From 163786f3e359fa9986aac4280fd48f0d8033082e Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 29 Nov 2019 19:59:14 +0300 Subject: [PATCH] LOT2: finalize int->mcIdType in MEDCoupling: DataArray, Meshes, Fields, Remapper --- src/MEDCoupling/MCType.hxx | 9 + src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 1220 ++++----- src/MEDCoupling/MEDCoupling1GTUMesh.hxx | 168 +- src/MEDCoupling/MEDCoupling1GTUMesh.txx | 10 +- src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 216 +- src/MEDCoupling/MEDCouplingAMRAttribute.hxx | 74 +- src/MEDCoupling/MEDCouplingCMesh.cxx | 87 +- src/MEDCoupling/MEDCouplingCMesh.hxx | 26 +- .../MEDCouplingCartesianAMRMesh.cxx | 533 ++-- .../MEDCouplingCartesianAMRMesh.hxx | 162 +- .../MEDCouplingCurveLinearMesh.cxx | 195 +- .../MEDCouplingCurveLinearMesh.hxx | 34 +- src/MEDCoupling/MEDCouplingDefinitionTime.cxx | 4 +- src/MEDCoupling/MEDCouplingField.cxx | 40 +- src/MEDCoupling/MEDCouplingField.hxx | 26 +- .../MEDCouplingFieldDiscretization.cxx | 890 +++---- .../MEDCouplingFieldDiscretization.hxx | 278 +- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 125 +- src/MEDCoupling/MEDCouplingFieldDouble.hxx | 15 +- src/MEDCoupling/MEDCouplingFieldFloat.cxx | 1 + src/MEDCoupling/MEDCouplingFieldInt.cxx | 1 + src/MEDCoupling/MEDCouplingFieldT.hxx | 22 +- src/MEDCoupling/MEDCouplingFieldT.txx | 74 +- src/MEDCoupling/MEDCouplingFieldTemplate.cxx | 18 +- src/MEDCoupling/MEDCouplingFieldTemplate.hxx | 8 +- .../MEDCouplingGaussLocalization.cxx | 24 +- .../MEDCouplingGaussLocalization.hxx | 6 +- src/MEDCoupling/MEDCouplingIMesh.cxx | 360 +-- src/MEDCoupling/MEDCouplingIMesh.hxx | 50 +- .../MEDCouplingMappedExtrudedMesh.cxx | 292 +- .../MEDCouplingMappedExtrudedMesh.hxx | 80 +- src/MEDCoupling/MEDCouplingMatrix.cxx | 27 +- src/MEDCoupling/MEDCouplingMatrix.hxx | 28 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 65 +- src/MEDCoupling/MEDCouplingMemArray.hxx | 27 +- src/MEDCoupling/MEDCouplingMemArray.txx | 50 +- src/MEDCoupling/MEDCouplingMemArrayChar.cxx | 78 +- src/MEDCoupling/MEDCouplingMemArrayFloat.cxx | 4 +- src/MEDCoupling/MEDCouplingMesh.cxx | 48 +- src/MEDCoupling/MEDCouplingMesh.hxx | 68 +- src/MEDCoupling/MEDCouplingMultiFields.cxx | 70 +- src/MEDCoupling/MEDCouplingMultiFields.hxx | 5 +- .../MEDCouplingNormalizedCartesianMesh.hxx | 6 +- .../MEDCouplingNormalizedCartesianMesh.txx | 4 +- .../MEDCouplingNormalizedUnstructuredMesh.hxx | 2 +- .../MEDCouplingNormalizedUnstructuredMesh.txx | 2 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 236 +- src/MEDCoupling/MEDCouplingPointSet.hxx | 104 +- src/MEDCoupling/MEDCouplingRemapper.cxx | 196 +- src/MEDCoupling/MEDCouplingRemapper.hxx | 30 +- src/MEDCoupling/MEDCouplingSkyLineArray.cxx | 274 +- src/MEDCoupling/MEDCouplingSkyLineArray.hxx | 52 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 754 +++--- src/MEDCoupling/MEDCouplingStructuredMesh.hxx | 138 +- .../MEDCouplingTimeDiscretization.cxx | 106 +- .../MEDCouplingTimeDiscretization.hxx | 70 +- .../MEDCouplingTimeDiscretization.txx | 8 +- src/MEDCoupling/MEDCouplingTraits.hxx | 6 - src/MEDCoupling/MEDCouplingUMesh.cxx | 2373 +++++++++-------- src/MEDCoupling/MEDCouplingUMesh.hxx | 414 +-- src/MEDCoupling/MEDCouplingUMesh.txx | 10 +- src/MEDCoupling/MEDCouplingUMesh_internal.cxx | 766 +++--- src/MEDCoupling/MEDCouplingUMesh_internal.hxx | 144 +- .../MEDCouplingUMesh_intersection.cxx | 1044 ++++---- src/MEDCoupling/MEDCouplingVoronoi.cxx | 140 +- 65 files changed, 6164 insertions(+), 6233 deletions(-) diff --git a/src/MEDCoupling/MCType.hxx b/src/MEDCoupling/MCType.hxx index 82a66c9cb..32a82b709 100644 --- a/src/MEDCoupling/MCType.hxx +++ b/src/MEDCoupling/MCType.hxx @@ -32,13 +32,22 @@ namespace MEDCoupling using mcIdType = ::mcIdType; using Int64 = std::int64_t; using Int32 = std::int32_t; + + class DataArrayInt32; + class DataArrayInt32Iterator; + class DataArrayInt32Tuple; + class DataArrayInt64; + class DataArrayInt64Tuple; + #ifndef MEDCOUPLING_USE_64BIT_IDS #define DataArrayIdType DataArrayInt32 +#define DataArrayIdTypeTuple DataArrayInt32Tuple #else #define DataArrayIdType DataArrayInt64 +#define DataArrayIdTypeTuple DataArrayInt64Tuple #endif diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 0f8504d96..80eb49f99 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -94,9 +94,9 @@ int MEDCoupling1GTUMesh::getMeshDimension() const * \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 ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); if(type==getCellModelEnum()) ret->alloc(getNumberOfCells(),1); else @@ -108,7 +108,7 @@ DataArrayInt *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCe /*! * 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; } @@ -119,7 +119,7 @@ std::size_t MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::Normali * \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 MEDCoupling1GTUMesh::getAllGeoTypes( * 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 MEDCoupling1GTUMesh::getDistributionOfTypes() const +std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const { - std::vector ret(3); - ret[0]=(int)getCellModelEnum(); ret[1]=ToIdType(getNumberOfCells()); ret[2]=-1; + std::vector ret(3); + ret[0]=ToIdType(getCellModelEnum()); ret[1]=getNumberOfCells(); ret[2]=-1; return ret; } @@ -178,28 +178,28 @@ std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const * - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]]
*/ -void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const +void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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(profile); idsInPflPerType[0]->incrRef(); + idsInPflPerType[0]=const_cast(profile); idsInPflPerType[0]->incrRef(); idsPerType.clear(); return ; } code[2]=0; profile->checkAllIdsInRange(0,nbOfCells); idsPerType.resize(1); - idsPerType[0]=const_cast(profile); idsPerType[0]->incrRef(); - idsInPflPerType[0]=DataArrayInt::Range(0,nbTuples,1); + idsPerType[0]=const_cast(profile); idsPerType[0]->incrRef(); + idsInPflPerType[0]=DataArrayIdType::Range(0,nbTuples,1); } /*! @@ -208,12 +208,12 @@ void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std:: * * \sa MEDCouplingUMesh::checkTypeConsistencyAndContig */ -DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const +DataArrayIdType *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& 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()); @@ -231,15 +231,15 @@ DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vect 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(pfl); + return const_cast(pfl); } void MEDCoupling1GTUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const @@ -328,7 +328,7 @@ MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureFieldOnNode(bool isAbs) c /*! * to improve perf ! */ -int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const +mcIdType MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const { MCAuto m(buildUnstructured()); return m->getCellContainingPoint(pos,eps); @@ -337,7 +337,7 @@ int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) c /*! * to improve perf ! */ -void MEDCoupling1GTUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const +void MEDCoupling1GTUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { MCAuto m(buildUnstructured()); return m->getCellsContainingPoint(pos,eps,elts); @@ -351,25 +351,25 @@ MEDCouplingFieldDouble *MEDCoupling1GTUMesh::buildOrthogonalField() const return ret.retn(); } -DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const +DataArrayIdType *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const { MCAuto 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 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 m=buildUnstructured(); return m->buildFacePartOfMySelfNode(start,end,fullyIn); } -DataArrayInt *MEDCoupling1GTUMesh::findBoundaryNodes() const +DataArrayIdType *MEDCoupling1GTUMesh::findBoundaryNodes() const { MCAuto m=buildUnstructured(); return m->findBoundaryNodes(); @@ -381,15 +381,15 @@ MEDCouplingPointSet *MEDCoupling1GTUMesh::buildBoundaryMesh(bool keepCoords) con 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 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) @@ -423,7 +423,7 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v int meshDim(firstPart->getMeshDimension()); MCAuto 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)) @@ -432,22 +432,22 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v 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 conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto 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(*it)); const MEDCoupling1DGTUMesh *pd(dynamic_cast(*it)); if(ps && !pd) { - int nNodesPerCell(ps->getNumberOfNodesPerCell()); + mcIdType nNodesPerCell(ps->getNumberOfNodesPerCell()); for(int i=0;igetNodalConnectivityIndex()->begin()); + const mcIdType *ciinPtr(pd->getNodalConnectivityIndex()->begin()); for(int i=0;ideepCopy(); } @@ -517,15 +517,15 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const MEDCouplingUMesh *m) std::set 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 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 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;igetNumberOfCells(); + mcIdType nbOfNodesPerCell(ret->getNumberOfNodesPerCell()); + MCAuto 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 ret(clone(false)); - MCAuto c(_conn->deepCopy()); + MCAuto c(_conn->deepCopy()); ret->setNodalConnectivity(c); return ret.retn(); } @@ -584,7 +584,7 @@ void MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom(const MEDCouplingPointSet void MEDCoupling1SGTUMesh::updateTime() const { MEDCoupling1GTUMesh::updateTime(); - const DataArrayInt *c(_conn); + const DataArrayIdType *c(_conn); if(c) updateTimeWith(*c); } @@ -597,7 +597,7 @@ std::size_t MEDCoupling1SGTUMesh::getHeapMemorySizeWithoutChildren() const std::vector MEDCoupling1SGTUMesh::getDirectChildrenWithNull() const { std::vector ret(MEDCoupling1GTUMesh::getDirectChildrenWithNull()); - ret.push_back((const DataArrayInt *)_conn); + ret.push_back((const DataArrayIdType *)_conn); return ret; } @@ -619,7 +619,7 @@ bool MEDCoupling1SGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } 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) @@ -629,7 +629,7 @@ bool MEDCoupling1SGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } if(!c1->isEqualIfNotWhy(*c2,reason)) { - reason.insert(0,"Nodal connectivity DataArrayInt differ : "); + reason.insert(0,"Nodal connectivity DataArrayIdType differ : "); return false; } return true; @@ -644,7 +644,7 @@ bool MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o 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) @@ -656,7 +656,7 @@ bool MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o void MEDCoupling1SGTUMesh::checkConsistencyOfConnectivity() const { - const DataArrayInt *c1(_conn); + const DataArrayIdType *c1(_conn); if(c1) { if(c1->getNumberOfComponents()!=1) @@ -678,18 +678,18 @@ void MEDCoupling1SGTUMesh::checkConsistencyLight() const 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;ibegin()); + for(mcIdType i=0;i=nbOfNodes) @@ -700,10 +700,10 @@ void MEDCoupling1SGTUMesh::checkConsistency(double eps) const } } -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 !"; @@ -712,55 +712,55 @@ std::size_t MEDCoupling1SGTUMesh::getNumberOfCells() const 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 ret=DataArrayInt::New(); + MCAuto 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 ret=DataArrayInt::New(); + MCAuto 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 ret=DataArrayInt::New(); - mcIdType nbCells=ToIdType(getNumberOfCells()); + MCAuto 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;igetPointer()); + mcIdType nbNodesPerCell(getNumberOfNodesPerCell()); + const mcIdType *conn(_conn->begin()); + for(mcIdType i=0;i s(conn,conn+nbNodesPerCell); - *retPtr=(int)s.size(); + std::set s(conn,conn+nbNodesPerCell); + *retPtr=ToIdType(s.size()); } return ret.retn(); } -void MEDCoupling1SGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCoupling1SGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - int sz=getNumberOfNodesPerCell(); + mcIdType sz=getNumberOfNodesPerCell(); conn.resize(sz); if(cellIdbegin()+cellId*sz,_conn->begin()+(cellId+1)*sz,conn.begin()); @@ -804,7 +804,7 @@ std::string MEDCoupling1SGTUMesh::simpleRepr() const else ret << msg0 << "\n"; ret << "Number of cells : "; - if((const DataArrayInt *)_conn) + if((const DataArrayIdType *)_conn) { if(_conn->isAllocated()) { @@ -833,19 +833,19 @@ std::string MEDCoupling1SGTUMesh::advancedRepr() const 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;ibegin(); + for(mcIdType i=0;i(ret," ")); + std::copy(connPtr,connPtr+sz,std::ostream_iterator(ret," ")); ret << "\n"; } } @@ -864,18 +864,18 @@ DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() cons { MCAuto 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;ibegin(); + mcIdType sz=getNumberOfNodesPerCell(); + double coeff=1./FromIdType(sz); + for(mcIdType i=0;i=0 && *nodal()); else @@ -888,26 +888,26 @@ DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() cons return ret.retn(); } -void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check) +void MEDCoupling1SGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check) { - mcIdType nbCells=ToIdType(getNumberOfCells()); - MCAuto o2n=DataArrayInt::New(); + mcIdType nbCells=getNumberOfCells(); + MCAuto o2n=DataArrayIdType::New(); o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1); if(check) o2n=o2n->checkAndPreparePermutation(); // - const int *conn=_conn->begin(); - MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); - const int *n2oPtr=n2o->begin(); - MCAuto newConn=DataArrayInt::New(); + const mcIdType *conn=_conn->begin(); + MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); + const mcIdType *n2oPtr=n2o->begin(); + MCAuto 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;igetPointer(); + for(mcIdType i=0;i 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 cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); + mcIdType tmp=-1; + mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; std::vector fastFinder(sz,false); - for(const int *work=begin;work!=end;work++) + for(const mcIdType *work=begin;work!=end;work++) if(*work>=0 && *workbegin(); - int nbNodesPerCell=getNumberOfNodesPerCell(); - for(int i=0;ibegin(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); + for(mcIdType i=0;i=0) { ref++; @@ -964,18 +964,18 @@ MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const { MCAuto 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 c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1); - int *cPtr=c->getPointer(); - for(int i=0;ibegin(); + mcIdType nbCells=getNumberOfCells(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); + mcIdType geoType=ToIdType(getCellModelEnum()); + MCAuto c=DataArrayIdType::New(); c->alloc(nbCells*(nbNodesPerCell+1),1); + mcIdType *cPtr=c->getPointer(); + for(mcIdType i=0;i cI=DataArrayInt::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1); + MCAuto cI=DataArrayIdType::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1); ret->setConnectivity(c,cI,true); try { ret->copyTinyInfoFrom(this); } @@ -983,7 +983,7 @@ MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const return ret.retn(); } -DataArrayInt *MEDCoupling1SGTUMesh::simplexize(int policy) +DataArrayIdType *MEDCoupling1SGTUMesh::simplexize(int policy) { switch(policy) { @@ -991,9 +991,9 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexize(int 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)"); @@ -1005,8 +1005,8 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexize(int policy) 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 @@ -1014,21 +1014,21 @@ struct MEDCouplingAccVisit /*! * 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 fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); - int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true)); - MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); - int *retPtr(ret->getPointer()); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(sz,1); + mcIdType *retPtr(ret->getPointer()); + for(mcIdType i=0;igetNumberOfNodes(). 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. @@ -1048,18 +1048,18 @@ DataArrayInt *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const * \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 ret(DataArrayInt::New()); + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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;ibegin(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); + for(mcIdType i=0;i=0 && *connapplyLin(1,offset); @@ -1089,23 +1089,23 @@ void MEDCoupling1SGTUMesh::renumberNodesWithOffsetInConn(int 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& newNodeNumbersO2N) +void MEDCoupling1SGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) { - this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); + this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(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& newNodeNumbersO2N) +void MEDCoupling1SGTUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) { - this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); + this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); } /*! @@ -1118,7 +1118,7 @@ void MEDCoupling1SGTUMesh::renumberNodesInConn(const std::map& newNodeN * 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()); @@ -1149,15 +1149,15 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshes(std::vector > bb(sz); std::vector< const MEDCoupling1SGTUMesh * > aa(sz); - mcIdType spaceDim=-3; - for(std::size_t i=0;igetCoords(); 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::const_iterator it=a.begin(); if(!(*it)) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords : null instance in the first element of input vector !"); - std::vector ncs(a.size()); + std::vector ncs(a.size()); (*it)->getNumberOfCells();//to check that all is OK const DataArrayDouble *coords=(*it)->getCoords(); const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel()); @@ -1197,7 +1197,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(std::ve } MCAuto ret(new MEDCoupling1SGTUMesh("merge",*cm)); ret->setCoords(coords); - ret->_conn=DataArrayInt::Aggregate(ncs); + ret->_conn=DataArrayIdType::Aggregate(ncs); return ret.retn(); } @@ -1209,30 +1209,30 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector::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 aps(a.size()); std::copy(a.begin(),a.end(),aps.begin()); MCAuto pts=MergeNodesArray(aps); MCAuto ret(new MEDCoupling1SGTUMesh("merge",*cm)); ret->setCoords(pts); - MCAuto c=DataArrayInt::New(); + MCAuto 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(),offset)); + mcIdType curConnLgth=(*it)->getNodalConnectivityLength(); + const mcIdType *curC=(*it)->_conn->begin(); + cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus(),offset)); offset+=(*it)->getNumberOfNodes(); } // @@ -1240,17 +1240,17 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector 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 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 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 ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - const int *inConn=_conn->getConstPointer(); - int sz=getNumberOfNodesPerCell(); - MCAuto connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1); - int *connPtr=connRet->getPointer(); - int curId=start; - for(int i=0;igetConstPointer(); + mcIdType sz=getNumberOfNodesPerCell(); + MCAuto connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1); + mcIdType *connPtr=connRet->getPointer(); + mcIdType curId=start; + for(mcIdType i=0;i=0 && curId& 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& nodeIdsInUse) co } } -MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const +MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const { MCAuto ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); - MCAuto tmp1; - const DataArrayInt *nodalConn(_conn); + MCAuto tmp1; + const DataArrayIdType *nodalConn(_conn); if(!nodalConn) { - tmp1=DataArrayInt::New(); tmp1->alloc(0,1); + tmp1=DataArrayIdType::New(); tmp1->alloc(0,1); } else tmp1=_conn; @@ -1328,16 +1328,16 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDi 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 newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); - MCAuto 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 newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1); + MCAuto 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 newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); - MCAuto 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 newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1); + MCAuto 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 newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1); - MCAuto 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 newConn=DataArrayIdType::New(); newConn->alloc(5*4*nbOfCells,1); + MCAuto 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 newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1); - MCAuto 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 newConn=DataArrayIdType::New(); newConn->alloc(6*4*nbOfCells,1); + MCAuto ret=DataArrayIdType::New(); ret->alloc(6*nbOfCells,1); + const mcIdType *c(_conn->begin()); + mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); + for(mcIdType i=0;igetNumberOfComponents() << "." << 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()) { @@ -1433,19 +1433,19 @@ void MEDCoupling1SGTUMesh::reprQuickOverview(std::ostream& stream) const 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& tinyInfo) const +bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector& tinyInfo) const { throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEmptyMesh : not implemented yet !"); } -void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -1458,21 +1458,21 @@ void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& std::vector 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 tinyInfo2,tinyInfo3; + std::vector 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()); @@ -1480,35 +1480,35 @@ void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD.push_back(time); } -void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - std::vector tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]); - std::vector tinyInfo1(tinyInfo.begin()+7+tinyInfo[5],tinyInfo.begin()+7+tinyInfo[5]+tinyInfo[6]); + std::vector tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]); + std::vector 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& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); @@ -1516,15 +1516,15 @@ void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, 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(tinyInfo[1]),FromIdType(tinyInfo[2])); + mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]); // _coords=DataArrayDouble::New(); - std::vector tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2); + std::vector tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2); _coords->resizeForUnserialization(tinyInfo2); std::copy(a2->begin(),a2->end(),_coords->getPointer()); - _conn=DataArrayInt::New(); - std::vector tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3); + _conn=DataArrayIdType::New(); + std::vector tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3); _conn->resizeForUnserialization(tinyInfo3); std::copy(a1->begin(),a1->end(),_conn->getPointer()); std::vector littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); @@ -1549,7 +1549,7 @@ void MEDCoupling1SGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, do const MEDCoupling1SGTUMesh *otherC=dynamic_cast(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) @@ -1575,18 +1575,18 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords(const MED 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;eltIdbegin(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfEltsInRevNodal=0; + mcIdType nbOfNodesPerCell=getNumberOfNodesPerCell(); + for(mcIdType eltId=0;eltId()); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); 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(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*conn],revNodalPtr+revNodalIndxPtr[*conn+1],std::bind2nd(std::equal_to(),-1))=eltId; } } } @@ -1619,7 +1619,7 @@ void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, D /*! * 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(); @@ -1628,12 +1628,12 @@ void MEDCoupling1SGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn) } /*! - * \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(ret); + const DataArrayIdType *ret(_conn); + return const_cast(ret); } /*! @@ -1643,11 +1643,11 @@ DataArrayInt *MEDCoupling1SGTUMesh::getNodalConnectivity() const * * \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(); } @@ -1661,13 +1661,13 @@ void MEDCoupling1SGTUMesh::allocateCells(int nbOfCells) * 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 @@ -1717,12 +1717,12 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4() const 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 ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4)); - MCAuto c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1); - int *cPtr(c->getPointer()); - for(int i=0;i c(DataArrayIdType::New()); c->alloc(nbHexa8*6*4,1); + mcIdType *cPtr(c->getPointer()); + for(mcIdType i=0;igetNumberOfNodes() * \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 cm(MEDCouplingCMesh::New()); @@ -1771,7 +1771,7 @@ MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayInt *& cellPerm, /// @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 @@ -1784,11 +1784,11 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS 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)); @@ -1796,7 +1796,7 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS 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++) @@ -1820,11 +1820,11 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS for(int i=0;i<6;i++) { cm.fillSonCellNodalConnectivity(i,myConn,allFacesTmp+4*i); - std::set s(allFacesTmp+4*i,allFacesTmp+4*i+4); + std::set s(allFacesTmp+4*i,allFacesTmp+4*i+4); bool found(false); for(int j=0;j<6 && !found;j++) { - std::set s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4); + std::set s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4); if(s==s1) { neighTmp[i]=myNeighbours[j]; @@ -1845,44 +1845,44 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS * 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 quads(explodeEachHexa8To6Quad4());//checks that only hexa8 - mcIdType nbHexa8=ToIdType(getNumberOfCells()); - int *cQuads(quads->getNodalConnectivity()->getPointer()); - MCAuto neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1); - int *ptNeigh(neighOfQuads->getPointer()); + mcIdType nbHexa8=getNumberOfCells(); + mcIdType *cQuads(quads->getNodalConnectivity()->getPointer()); + MCAuto 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 quadsTmp(quads->buildUnstructured()); - MCAuto ccSafe,cciSafe; - DataArrayInt *cc(0),*cci(0); + MCAuto 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 ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); std::vector fetched(nbHexa8,false); std::vector::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 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 s; s.insert(cellId);//s contains already organized. while(!s.empty()) { - std::set sNext; - for(std::set::const_iterator it0=s.begin();it0!=s.end();it0++) + std::set sNext; + for(std::set::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]]) @@ -1902,10 +1902,10 @@ DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther() } 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]; } @@ -1933,28 +1933,28 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh3D : only TETRA4 supported !"); checkFullyDefined(); MCAuto thisu(buildUnstructured()); - MCAuto revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); + MCAuto revNodArr(DataArrayIdType::New()),revNodIArr(DataArrayIdType::New()); thisu->getReverseNodalConnectivity(revNodArr,revNodIArr); - const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); - MCAuto d1Arr(DataArrayInt::New()),di1Arr(DataArrayInt::New()),rd1Arr(DataArrayInt::New()),rdi1Arr(DataArrayInt::New()); + const mcIdType *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); + MCAuto d1Arr(DataArrayIdType::New()),di1Arr(DataArrayIdType::New()),rd1Arr(DataArrayIdType::New()),rdi1Arr(DataArrayIdType::New()); MCAuto edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr)); - const int *d1(d1Arr->begin()); - MCAuto d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); + const mcIdType *d1(d1Arr->begin()); + MCAuto d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New()); MCAuto 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 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 v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr; MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0; std::string name("DualOf_"); name+=getName(); MCAuto ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr); - MCAuto 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 cArr(DataArrayIdType::New()),ciArr(DataArrayIdType::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); + for(mcIdType i=0;ipushBackSilent(-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; @@ -1982,10 +1982,10 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const { 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; @@ -2010,35 +2010,35 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh2D : only TRI3 supported !"); checkFullyDefined(); MCAuto thisu(buildUnstructured()); - MCAuto revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); + MCAuto revNodArr(DataArrayIdType::New()),revNodIArr(DataArrayIdType::New()); thisu->getReverseNodalConnectivity(revNodArr,revNodIArr); - const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); - MCAuto d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); + const mcIdType *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); + MCAuto d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New()); MCAuto 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 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 v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr; MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; std::string name("DualOf_"); name+=getName(); MCAuto ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr); - MCAuto 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 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 > polyg; + std::vector< std::vector > polyg; for(int j=0;j locV(3); + std::vector 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); @@ -2046,10 +2046,10 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const { 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 locV2(2); + std::vector locV2(2); int zeLocEdgeIdRel(DUAL_TRI_1[2*nodePosInCurCell+kk]); if(zeLocEdgeIdRel>0) { locV2[0]=d2[3*curCellId+zeLocEdgeIdRel-3]+nbOfNodes; locV2[1]=i; } @@ -2061,7 +2061,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const } } } - std::vector zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg)); + std::vector zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg)); cArr->insertAtTheEnd(zePolyg.begin(),zePolyg.end()); ciArr->setIJ(i+1,0,cArr->getNumberOfTuples()); } @@ -2081,22 +2081,22 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const */ 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 ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); - for(int i=0;i::max(); bbox[2*i+1]=-std::numeric_limits::max(); } const double *coordsPtr(_coords->getConstPointer()); - const int *conn(_conn->getConstPointer()); - for(int i=0;igetConstPointer()); + for(mcIdType i=0;i=0 && nodeId ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); - mcIdType nbCells=ToIdType(getNumberOfCells()); + mcIdType nbCells=getNumberOfCells(); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); INTERP_KERNEL::AutoCppPtr dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension())); @@ -2145,9 +2145,9 @@ void MEDCoupling1SGTUMesh::invertOrientationOfAllCells() { checkConsistencyOfConnectivity(); INTERP_KERNEL::AutoCppPtr oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum())); - mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes()),nbCells=ToIdType(getNumberOfCells()); - int *conn(_conn->getPointer()); - for(int i=0;igetNumberOfNodes()),nbCells=getNumberOfCells(); + mcIdType *conn(_conn->getPointer()); + for(mcIdType i=0;ioperate(conn+i*nbOfNodesPerCell,conn+(i+1)*nbOfNodesPerCell); updateTime(); } @@ -2184,7 +2184,7 @@ MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bo { if(recDeepCpy) { - const DataArrayInt *c(other._conn); + const DataArrayIdType *c(other._conn); if(c) _conn=c->deepCopy(); c=other._conn_indx; @@ -2209,7 +2209,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCopyConnectivityOnly() const { checkConsistencyLight(); MCAuto ret(clone(false)); - MCAuto c(_conn->deepCopy()),ci(_conn_indx->deepCopy()); + MCAuto c(_conn->deepCopy()),ci(_conn_indx->deepCopy()); ret->setNodalConnectivity(c,ci); return ret.retn(); } @@ -2217,7 +2217,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCopyConnectivityOnly() const void MEDCoupling1DGTUMesh::updateTime() const { MEDCoupling1GTUMesh::updateTime(); - const DataArrayInt *c(_conn); + const DataArrayIdType *c(_conn); if(c) updateTimeWith(*c); c=_conn_indx; @@ -2233,8 +2233,8 @@ std::size_t MEDCoupling1DGTUMesh::getHeapMemorySizeWithoutChildren() const std::vector MEDCoupling1DGTUMesh::getDirectChildrenWithNull() const { std::vector 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; } @@ -2256,7 +2256,7 @@ bool MEDCoupling1DGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } 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) @@ -2266,7 +2266,7 @@ bool MEDCoupling1DGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } 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; @@ -2279,7 +2279,7 @@ bool MEDCoupling1DGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } 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; @@ -2294,7 +2294,7 @@ bool MEDCoupling1DGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o 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) @@ -2328,7 +2328,7 @@ void MEDCoupling1DGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, do const MEDCoupling1DGTUMesh *otherC=dynamic_cast(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) @@ -2356,7 +2356,7 @@ void MEDCoupling1DGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, do void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const { - const DataArrayInt *c1(_conn); + const DataArrayIdType *c1(_conn); if(c1) { if(c1->getNumberOfComponents()!=1) @@ -2379,7 +2379,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const 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 << ") !"; @@ -2398,7 +2398,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const } else throw INTERP_KERNEL::Exception("Nodal connectivity index array not defined !"); - int szOfC1Exp=_conn_indx->back(); + mcIdType szOfC1Exp=_conn_indx->back(); if(sz2getNumberOfTuples() << " !"; @@ -2420,14 +2420,14 @@ void MEDCoupling1DGTUMesh::checkConsistencyLight() const 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;ibegin()); + for(mcIdType i=0;i=nbOfNodes) @@ -2438,7 +2438,7 @@ void MEDCoupling1DGTUMesh::checkConsistency(double eps) const } } -std::size_t MEDCoupling1DGTUMesh::getNumberOfCells() const +mcIdType MEDCoupling1DGTUMesh::getNumberOfCells() const { checkConsistencyOfConnectivity();//do not remove return _conn_indx->getNumberOfTuples()-1; @@ -2452,7 +2452,7 @@ std::size_t MEDCoupling1DGTUMesh::getNumberOfCells() const * * \return a newly allocated array */ -DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const +DataArrayIdType *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const { checkConsistencyLight(); _conn_indx->checkMonotonic(true); @@ -2460,12 +2460,12 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const return _conn_indx->deltaShiftIndex(); // for polyhedrons mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); - const int *ci=_conn_indx->begin(),*c=_conn->begin(); - for(int i=0;igetPointer(); + const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin(); + for(mcIdType i=0;icheckMonotonic(true); @@ -2483,17 +2483,17 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const return _conn_indx->deltaShiftIndex(); if(getCellModelEnum()==INTERP_KERNEL::NORM_QPOLYG) { - MCAuto ret=_conn_indx->deltaShiftIndex(); + MCAuto ret=_conn_indx->deltaShiftIndex(); ret->applyDivideBy(2); return ret.retn(); } // for polyhedrons mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); - const int *ci=_conn_indx->begin(),*c=_conn->begin(); - for(int i=0;igetPointer(); + const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin(); + for(mcIdType i=0;icheckMonotonic(true); mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; - MCAuto ret=DataArrayInt::New(); + MCAuto 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 s(c+ci[0],c+ci[1]); - *retPtr=(int)s.size(); + std::set s(c+ci[0],c+ci[1]); + *retPtr=ToIdType(s.size()); } } else { - for(int i=0;i s(c+ci[0],c+ci[1]); s.erase(-1); - *retPtr=(int)s.size(); + std::set 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& conn) const +void MEDCoupling1DGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - std::size_t nbOfCells(getNumberOfCells());//performs checks + mcIdType nbOfCells(getNumberOfCells());//performs checks if(cellIdgetIJ(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); @@ -2552,13 +2552,13 @@ void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector } } -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 && cellIdbegin()); - 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 @@ -2626,9 +2626,9 @@ std::string MEDCoupling1DGTUMesh::advancedRepr() const } if(!isOK) return ret.str(); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); - const int *ci=_conn_indx->begin(),*c=_conn->begin(); - for(int i=0;ibegin(),*c=_conn->begin(); + for(mcIdType i=0;i(ret," ")); @@ -2641,21 +2641,21 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons { MCAuto 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= to avoid division by 0. { - for(int j=nodali[0];j=0 && *nodal()); @@ -2664,7 +2664,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons 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(),1./(nodali[1]-nodali[0]))); + std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./double(nodali[1]-nodali[0]))); } } else @@ -2676,13 +2676,13 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons } else { - for(int i=0;i= to avoid division by 0. { int nbOfNod=0; - for(int j=nodali[0];j=0 && *nodal o2n=DataArrayInt::New(); + mcIdType nbCells=getNumberOfCells(); + MCAuto 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 newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + const mcIdType *o2nPtr=o2n->getPointer(); + const mcIdType *conn=_conn->begin(),*conni=_conn_indx->begin(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto 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;igetPointer(),*newCI=newConnI->getPointer(); + for(mcIdType i=0;i=0) newCI[newPos]=sz; else @@ -2744,9 +2744,9 @@ void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) } newConnI->computeOffsetsFull(); newCI=newConnI->getPointer(); // - for(int i=0;i 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 c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1); - MCAuto 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 c=DataArrayIdType::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1); + MCAuto cI=DataArrayIdType::New(); cI->alloc(nbCells+1); + mcIdType *cPtr=c->getPointer(),*ciPtr=cI->getPointer(); ciPtr[0]=0; - for(int i=0;i=0) { *cPtr++=geoType; @@ -2797,10 +2797,10 @@ MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const /*! * 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 ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); ret->iota(0); return ret.retn(); @@ -2849,26 +2849,26 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords(const MED 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 ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - DataArrayInt *c=0,*ci=0; - DataArrayInt::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci); - MCAuto cSafe(c),ciSafe(ci); + DataArrayIdType *c=0,*ci=0; + DataArrayIdType::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci); + MCAuto 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 ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - DataArrayInt *c=0,*ci=0; - DataArrayInt::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci); - MCAuto cSafe(c),ciSafe(ci); + DataArrayIdType *c=0,*ci=0; + DataArrayIdType::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci); + MCAuto cSafe(c),ciSafe(ci); ret->setNodalConnectivity(c,ci); return ret.retn(); } @@ -2876,8 +2876,8 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(int void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector& 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& nodeIdsInUse) co } } -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;eltIdbegin(),*conni=_conn_indx->begin(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfEltsInRevNodal=0; + for(mcIdType eltId=0;eltId=0) { - for(int j=0;j=0 && nodeId()); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); 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(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[nodeId],revNodalPtr+revNodalIndxPtr[nodeId+1],std::bind2nd(std::equal_to(),-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& tinyInfo) const +bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector& tinyInfo) const { throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEmptyMesh : not implemented yet !"); } -void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -2970,11 +2970,11 @@ void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& std::vector 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()); @@ -2982,14 +2982,14 @@ void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfo.push_back(getCellModelEnum()); tinyInfo.push_back(it); tinyInfo.push_back(order); - std::vector tinyInfo2,tinyInfo3,tinyInfo4; + std::vector 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()); @@ -2998,46 +2998,46 @@ void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD.push_back(time); } -void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - std::vector tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]); - std::vector tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]); - std::vector tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]); - MCAuto p1(DataArrayInt::New()); p1->resizeForUnserialization(tinyInfo1); - MCAuto p2(DataArrayInt::New()); p2->resizeForUnserialization(tinyInfo12); - std::vector v(2); v[0]=p1; v[1]=p2; - p2=DataArrayInt::Aggregate(v); + std::vector tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]); + std::vector tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]); + std::vector tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]); + MCAuto p1(DataArrayIdType::New()); p1->resizeForUnserialization(tinyInfo1); + MCAuto p2(DataArrayIdType::New()); p2->resizeForUnserialization(tinyInfo12); + std::vector 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& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); @@ -3045,19 +3045,19 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, 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(tinyInfo[1]),FromIdType(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 tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3); + std::vector tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3); _coords->resizeForUnserialization(tinyInfo2); std::copy(a2->begin(),a2->end(),_coords->getPointer()); - _conn=DataArrayInt::New(); - std::vector tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4); + _conn=DataArrayIdType::New(); + std::vector 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 tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5); + _conn_indx=DataArrayIdType::New(); + std::vector 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 littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); @@ -3073,7 +3073,7 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, * 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. @@ -3082,16 +3082,16 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, * \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 fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); - int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true)); - MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); - int *retPtr(ret->getPointer()); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(sz,1); + mcIdType *retPtr(ret->getPointer()); + for(mcIdType i=0;igetNumberOfNodes(). 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. @@ -3111,22 +3111,22 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const * \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 ret=DataArrayInt::New(); + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight + MCAuto 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;ibegin(),*conni(_conn_indx->begin()); + for(mcIdType i=0;i=0 && nodeIdgetNumberOfTuples()); - int *pt(_conn->getPointer()); + mcIdType *pt(_conn->getPointer()); for(mcIdType i=0;i& newNodeNumbersO2N) +void MEDCoupling1DGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) { - this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); + this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(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& newNodeNumbersO2N) +void MEDCoupling1DGTUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) { - this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); + this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); } /*! @@ -3195,13 +3195,13 @@ void MEDCoupling1DGTUMesh::renumberNodesInConn(const std::map& newNodeN * 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;igetPointer()); + for(mcIdType i=0;i=0 && *pt 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 cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); + mcIdType tmp=-1; + mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; std::vector fastFinder(sz,false); - for(const int *work=begin;work!=end;work++) + for(const mcIdType *work=begin;work!=end;work++) if(*work>=0 && *workbegin(),*conni=_conn_indx->begin(); - for(int i=0;ibegin(),*conni=_conn_indx->begin(); + for(mcIdType i=0;i=0) { - for(int j=0;j=0) { ref++; @@ -3266,13 +3266,13 @@ void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const 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(); } @@ -3286,14 +3286,14 @@ void MEDCoupling1DGTUMesh::allocateCells(int nbOfCells) * 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)); @@ -3308,7 +3308,7 @@ void MEDCoupling1DGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const in 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(); @@ -3320,21 +3320,21 @@ void MEDCoupling1DGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn, DataArr } /*! - * \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(ret); + const DataArrayIdType *ret(_conn); + return const_cast(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(ret); + const DataArrayIdType *ret(_conn_indx); + return const_cast(ret); } /*! @@ -3353,9 +3353,9 @@ DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const { MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); - DataArrayInt *nc=0,*nci=0; + DataArrayIdType *nc=0,*nci=0; isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci); - MCAuto ncs(nc),ncis(nci); + MCAuto ncs(nc),ncis(nci); ret->_conn=ncs; ret->_conn_indx=ncis; ret->setCoords(getCoords()); return ret.retn(); @@ -3382,18 +3382,18 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool * * \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(c0); nodalConnIndx=const_cast(c1); + const DataArrayIdType *c0(_conn),*c1(_conn_indx); + nodalConn=const_cast(c0); nodalConnIndx=const_cast(c1); nodalConn->incrRef(); nodalConnIndx->incrRef(); return true; } - int bg=_conn_indx->front(),end=_conn_indx->back(); - MCAuto nc(_conn->selectByTupleIdSafeSlice(bg,end,1)); - MCAuto nci(_conn_indx->deepCopy()); + mcIdType bg=_conn_indx->front(),end=_conn_indx->back(); + MCAuto nc(_conn->selectByTupleIdSafeSlice(bg,end,1)); + MCAuto nci(_conn_indx->deepCopy()); nci->applyLin(1,-bg); nodalConn=nc.retn(); nodalConnIndx=nci.retn(); return false; @@ -3410,7 +3410,7 @@ bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalC 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) @@ -3437,15 +3437,15 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(std::vector > bb(sz); std::vector< const MEDCoupling1DGTUMesh * > aa(sz); - mcIdType spaceDim=-3; - for(std::size_t i=0;igetCoords(); 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 > objs(a.size()); - std::vector ncs(a.size()),ncis(a.size()); + std::vector 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()); @@ -3489,8 +3489,8 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(std::ve } MCAuto 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(); } @@ -3502,15 +3502,15 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector > objs(a.size()); - std::vector ncs(a.size()),ncis(a.size()); + std::vector ncs(a.size()),ncis(a.size()); std::vector::const_iterator it=a.begin(); - std::vector nbNodesPerElt(a.size()); + std::vector 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++) @@ -3529,18 +3529,18 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector 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 ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); - MCAuto tmp1,tmp2; - const DataArrayInt *nodalConn(_conn),*nodalConnI(_conn_indx); + MCAuto 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; @@ -3548,7 +3548,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDi // 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; @@ -3577,23 +3577,23 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDi DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const { checkFullyDefined(); - int spaceDim(getSpaceDimension()),nbOfCells(ToIdType(getNumberOfCells())),nbOfNodes(getNumberOfNodes()); + mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); - for(int i=0;i::max(); bbox[2*i+1]=-std::numeric_limits::max(); } const double *coordsPtr(_coords->getConstPointer()); - const int *conn(_conn->getConstPointer()),*connI(_conn_indx->getConstPointer()); - for(int i=0;igetConstPointer()),*connI(_conn_indx->getConstPointer()); + for(mcIdType i=0;i=0 && nodeId MEDCoupling1DGTUMesh::BuildAPolygonFromParts(const std::vector< std::vector >& parts) +std::vector MEDCoupling1DGTUMesh::BuildAPolygonFromParts(const std::vector< std::vector >& parts) { - std::vector ret; + std::vector 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 b(sz,true); b[0]=false; while(nbh oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum())); - mcIdType nbCells=ToIdType(getNumberOfCells()); - const int *connI(_conn_indx->begin()); - int *conn(_conn->getPointer()); - for(int i=0;ibegin()); + mcIdType *conn(_conn->getPointer()); + for(mcIdType i=0;ioperate(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& nodalConns, const std::vector& offsetInNodeIdsPerElt) +DataArrayIdType *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std::vector& nodalConns, const std::vector& offsetInNodeIdsPerElt) { std::size_t sz1(nodalConns.size()),sz2(offsetInNodeIdsPerElt.size()); if(sz1!=sz2) @@ -3684,7 +3684,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std: if(sz1==0) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : empty vectors in input !"); mcIdType nbOfTuples=0; - for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++) + for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++) { if(!(*it)) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of null pointer in input vector !"); @@ -3694,15 +3694,15 @@ DataArrayInt *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std: throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of array with not exactly one component !"); nbOfTuples+=(*it)->getNumberOfTuples(); } - MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); - int *pt=ret->getPointer(); - int i=0; - for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++) + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1); + mcIdType *pt=ret->getPointer(); + mcIdType i=0; + for(std::vector::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;jbegin(); + mcIdType offset=offsetInNodeIdsPerElt[i]; + for(mcIdType j=0;j 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 ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); - mcIdType nbCells=ToIdType(m->getNumberOfCells()); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); + mcIdType nbCells=m->getNumberOfCells(); + MCAuto 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;igetPointer()),*ci(connI->getPointer()); *ci=0; + const mcIdType *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin()); + for(mcIdType i=0;i getAllGeoTypes() const; - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& 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& elts) const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& 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); @@ -109,60 +109,60 @@ namespace MEDCoupling 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& 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& 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& 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& 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& newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& 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& 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& newNodeNumbersO2N); + MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& 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& a); MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(std::vector& 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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); private: MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); @@ -171,10 +171,10 @@ namespace MEDCoupling private: void checkNonDynamicGeoType() const; static MEDCoupling1SGTUMesh *Merge1SGTUMeshesLL(std::vector& a); - DataArrayInt *simplexizePol0(); - DataArrayInt *simplexizePol1(); - DataArrayInt *simplexizePlanarFace5(); - DataArrayInt *simplexizePlanarFace6(); + DataArrayIdType *simplexizePol0(); + DataArrayIdType *simplexizePol1(); + DataArrayIdType *simplexizePlanarFace5(); + DataArrayIdType *simplexizePlanarFace6(); MEDCoupling1DGTUMesh *computeDualMesh3D() const; MEDCoupling1DGTUMesh *computeDualMesh2D() const; template @@ -208,61 +208,61 @@ namespace MEDCoupling 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& 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& 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& 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& 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& newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& 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& 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& newNodeNumbersO2N); + MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& 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& a); MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(std::vector& a); - MEDCOUPLING_EXPORT static DataArrayInt *AggregateNodalConnAndShiftNodeIds(const std::vector& nodalConns, const std::vector& offsetInNodeIdsPerElt); - MEDCOUPLING_EXPORT static std::vector BuildAPolygonFromParts(const std::vector< std::vector >& parts); - MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const; + MEDCOUPLING_EXPORT static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(const std::vector& nodalConns, const std::vector& offsetInNodeIdsPerElt); + MEDCOUPLING_EXPORT static std::vector BuildAPolygonFromParts(const std::vector< std::vector >& parts); + MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const; public://serialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); private: MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.txx b/src/MEDCoupling/MEDCoupling1GTUMesh.txx index c7c3024f7..efd0db6b5 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.txx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.txx @@ -27,10 +27,10 @@ template 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()) @@ -52,8 +52,8 @@ void MEDCoupling::MEDCoupling1DGTUMesh::renumberNodesInConnT(const MAPCLS& newNo getNumberOfCells();//only to check that all is well defined. // mcIdType nbOfTuples(_conn->getNumberOfTuples()); - int *pt(_conn->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;i=0) diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx index d550f2ac5..3b123d347 100755 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -43,7 +43,7 @@ DataArrayDoubleCollection *DataArrayDoubleCollection::deepCopy() const 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=(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 !"); @@ -204,7 +204,7 @@ void DataArrayDoubleCollection::SynchronizeFineToCoarse(int ghostLev, const MEDC } } -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 !"); @@ -218,7 +218,7 @@ void DataArrayDoubleCollection::SynchronizeCoarseToFine(int ghostLev, const MEDC } } -void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector& children, const std::vector& fieldsOnFine) +void DataArrayDoubleCollection::SynchronizeFineEachOther(mcIdType patchId, mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector& children, const std::vector& fieldsOnFine) { if(!fatherOfFineMesh) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : father is NULL !"); @@ -229,7 +229,7 @@ void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostL return ; std::size_t nbOfCall(fieldsOnFine[0]->_arrs.size()); for(std::size_t i=0;igetPatchIdFromChildMesh(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_arrs.size()) @@ -246,7 +246,7 @@ void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostL /*! * 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 !"); @@ -262,7 +262,7 @@ void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(int ghostLev, } } -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 !"); @@ -273,7 +273,7 @@ void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghost 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(this)); std::size_t sz(_arrs.size()); @@ -283,7 +283,7 @@ void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(int ghostLev, const 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(this)); std::size_t sz(_arrs.size()); @@ -389,11 +389,11 @@ MEDCouplingGridCollection *MEDCouplingGridCollection::deepCopy(const MEDCoupling return new MEDCouplingGridCollection(*this,newGf,oldGf); } -void MEDCouplingGridCollection::alloc(int ghostLev) +void MEDCouplingGridCollection::alloc(mcIdType ghostLev) { for(std::vector< std::pair > >::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); @@ -446,9 +446,9 @@ std::vector MEDCouplingGridCollection::getNatures() const 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_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++) { if((*it).first==m) @@ -460,16 +460,16 @@ bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen 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; } @@ -479,29 +479,29 @@ DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos) * 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 > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { - std::vector deltaThis,deltaOther; - std::vector< std::pair > rgThis((*it).first->positionRelativeToGodFather(deltaThis)); - std::vector thisSt((*it).first->getImageMesh()->getCellGridStructure()); - std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus(),2*ghostLev)); + std::vector deltaThis,deltaOther; + std::vector< std::pair > rgThis((*it).first->positionRelativeToGodFather(deltaThis)); + std::vector thisSt((*it).first->getImageMesh()->getCellGridStructure()); + std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus(),2*ghostLev)); for(std::vector< std::pair > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++) { - std::vector< std::pair > rgOther((*it2).first->positionRelativeToGodFather(deltaOther)); + std::vector< std::pair > rgOther((*it2).first->positionRelativeToGodFather(deltaOther)); if(MEDCouplingStructuredMesh::AreRangesIntersect(rgThis,rgOther)) { - std::vector< std::pair > isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther)); - std::vector< std::pair > pThis,pOther; + std::vector< std::pair > isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther)); + std::vector< std::pair > pThis,pOther; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgThis,isect,pThis,true); MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgOther,isect,pOther,true); - std::vector otherSt((*it2).first->getImageMesh()->getCellGridStructure()); + std::vector 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(),2*ghostLev)); - int sz((*it2).second->size()); - for(int i=0;i(),2*ghostLev)); + mcIdType sz((*it2).second->size()); + for(mcIdType i=0;iat(i)); DataArrayDouble *thisArr((*it).second->at(i)); @@ -513,7 +513,7 @@ void MEDCouplingGridCollection::copyOverlappedZoneFrom(int ghostLev, const MEDCo } } -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 !"); @@ -529,7 +529,7 @@ void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDC 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(coarseDaCol));//coarse values in DataArrayDouble will be altered DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,(*it).second,coarseModified); @@ -540,7 +540,7 @@ void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDC } } -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 !"); @@ -556,7 +556,7 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDC 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(fineDaCol));//fine values in DataArrayDouble will be altered DataArrayDoubleCollection::SynchronizeCoarseToFine(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified); @@ -572,11 +572,11 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDC * * \sa synchronizeFineEachOtherExt */ -void MEDCouplingGridCollection::synchronizeFineEachOther(int ghostLev, const std::vector< std::pair >& ps) const +void MEDCouplingGridCollection::synchronizeFineEachOther(mcIdType ghostLev, const std::vector< std::pair >& ps) const { for(std::vector< std::pair >::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)) @@ -592,11 +592,11 @@ void MEDCouplingGridCollection::synchronizeFineEachOther(int ghostLev, const std * * \sa synchronizeFineEachOther */ -void MEDCouplingGridCollection::synchronizeFineEachOtherExt(int ghostLev, const std::vector< std::pair >& ps) const +void MEDCouplingGridCollection::synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair >& ps) const { for(std::vector< std::pair >::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)) @@ -610,7 +610,7 @@ void MEDCouplingGridCollection::synchronizeFineEachOtherExt(int ghostLev, const /*! * The pairs returned share the same direct father. The number of returned elements must be even. */ -std::vector< std::pair > MEDCouplingGridCollection::findNeighbors(int ghostLev) const +std::vector< std::pair > MEDCouplingGridCollection::findNeighbors(mcIdType ghostLev) const { std::vector< std::pair > ret; std::map > m; @@ -624,10 +624,10 @@ std::vector< std::pair::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++) { - int patchId((*it0).first->getPatchIdFromChildMesh(*it1)); - std::vector neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); + mcIdType patchId((*it0).first->getPatchIdFromChildMesh(*it1)); + std::vector neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); const MEDCouplingCartesianAMRPatch *pRef((*it0).first->getPatch(patchId)); - for(std::vector::const_iterator it2=neighs.begin();it2!=neighs.end();it2++) + for(std::vector::const_iterator it2=neighs.begin();it2!=neighs.end();it2++) { const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(*it2)); ret.push_back(std::pair(pRef,pLoc)); @@ -639,7 +639,7 @@ std::vector< std::pairgetPatchIdFromChildMesh(fineMesh)); + mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); const DataArrayDoubleCollection *fineDaCol((*it).second); DataArrayDoubleCollection *fineModified(const_cast(fineDaCol));//fine values in DataArrayDouble will be altered DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified); @@ -696,7 +696,7 @@ MEDCouplingGridCollection::MEDCouplingGridCollection(const MEDCouplingGridCollec std::size_t sz(other._map_of_dadc.size()); for(std::size_t i=0;i pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf)); + std::vector 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) @@ -783,12 +783,12 @@ MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(const MEDCouplingDataFo /*! * 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 >& fieldNames, int ghostLev) +MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev) { return new MEDCouplingAMRAttribute(gf,fieldNames,ghostLev); } -MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, int ghostLev) +MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, mcIdType ghostLev) { std::size_t sz(fieldNames.size()); std::vector< std::pair > fieldNames2(sz); @@ -842,10 +842,10 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCpyWithoutGodFather() cons * 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()); } /*! @@ -859,7 +859,7 @@ std::vector MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCoup { for(std::vector< MCAuto >::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)); @@ -876,7 +876,7 @@ const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianA { for(std::vector< MCAuto >::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)); @@ -890,7 +890,7 @@ DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMesh { for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { - int tmp(-1); + mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) { DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); @@ -912,7 +912,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutO std::size_t lev(0); for(std::vector< MCAuto >::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)); @@ -942,7 +942,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCo const DataArrayDouble *arr(0); for(std::vector< MCAuto >::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)); @@ -972,7 +972,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(ME const DataArrayDouble *arr(0); for(std::vector< MCAuto >::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)); @@ -983,12 +983,12 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(ME throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !"); // MCAuto im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); - std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); + std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); MCAuto arr2(DataArrayDouble::New()); arr2->alloc(mesh->getImageMesh()->getNumberOfCells(),arr->getNumberOfComponents()); - std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); + std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev); - std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); + std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors); arr2->copyStringInfoFrom(*arr); // @@ -1017,17 +1017,17 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons const MEDCouplingIMesh *gfm(gf->getImageMesh()); std::vector orig(gfm->getOrigin()); std::vector spacing(gfm->getDXYZ()); - int dim((int)orig.size()); + mcIdType dim(ToIdType(orig.size())); std::copy(orig.begin(),orig.end(),std::ostream_iterator(ofs," ")); ofs << "\" grid_description=\""; - for(int i=0;i\n"; // - int maxLev(gf->getMaxNumberOfLevelsRelativeToThis()),kk(0); - for(int i=0;igetMaxNumberOfLevelsRelativeToThis()),kk(0); + for(mcIdType i=0;i patches(gf->retrieveGridsAt(i)); std::size_t sz(patches.size()); @@ -1041,8 +1041,8 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons ofs << "\">\n"; if(i!=maxLev-1) { - std::vector factors(patches[0]->getMesh()->getFactors()); - for(int k=0;k factors(patches[0]->getMesh()->getFactors()); + for(mcIdType k=0;kgetMesh()); if(patchCast) { - const std::vector< std::pair >& bltr(patchCast->getBLTRRangeRelativeToGF()); - for(int pp=0;pp >& bltr(patchCast->getBLTRRangeRelativeToGF()); + for(mcIdType pp=0;ppgetMesh()->getImageMesh()); - std::vector cgs(im->getCellGridStructure()); - for(int pp=0;pp cgs(im->getCellGridStructure()); + for(mcIdType pp=0;pppresenceOf((*it)->getMesh(),tmp)) { const DataArrayDoubleCollection& ddc(_levs[i]->getFieldsAt(tmp)); @@ -1080,12 +1080,12 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons for(std::size_t pp=0;pp im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); - std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); + std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); arrs2Safe[pp]=DataArrayDouble::New(); arrs2Safe[pp]->alloc(mesh->getImageMesh()->getNumberOfCells(),arrs[pp]->getNumberOfComponents()); - std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); + std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev); - std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); + std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); MEDCouplingIMesh::SpreadCoarseToFine(arrs[pp],cgsWG,arrs2Safe[pp],cgs2,fakeFactors); arrs2Safe[pp]->copyStringInfoFrom(*arrs[pp]); // @@ -1134,7 +1134,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::projectTo(MEDCouplingCartesian MCAuto 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 @@ -1144,7 +1144,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::projectTo(MEDCouplingCartesian DataArrayDoubleCollection& colTarget(ret->_levs[0]->getFieldsAt(0)); colTarget.copyFrom(col); // then go deeper and deeper - for(int i=1;isynchronizeCoarseToFineByOneLevel(i-1); MEDCouplingGridCollection *targetCol(ret->_levs[i]); @@ -1174,7 +1174,7 @@ void MEDCouplingAMRAttribute::synchronizeFineToCoarse() while(sz>1) { sz--; - synchronizeFineToCoarseByOneLevel((int)sz); + synchronizeFineToCoarseByOneLevel(ToIdType(sz)); } } @@ -1188,16 +1188,16 @@ void MEDCouplingAMRAttribute::synchronizeFineToCoarse() * \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(fromLevtoLev;i--) + for(mcIdType i=fromLev;i>toLev;i--) synchronizeFineToCoarseByOneLevel(i); } @@ -1213,7 +1213,7 @@ void MEDCouplingAMRAttribute::synchronizeCoarseToFine() std::size_t sz(_levs.size()); // for(std::size_t i=0;i=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;isynchronizeFineEachOtherExt(_ghost_lev,_cross_lev_neighbors[i]); @@ -1296,7 +1296,7 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf(const ME { 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 >& itemsToFilter(_neighbors[level+1]); @@ -1316,9 +1316,9 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf(const ME * 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) @@ -1338,9 +1338,9 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(int leve * 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]); @@ -1408,12 +1408,12 @@ void MEDCouplingAMRAttribute::updateTime() const {//tony } -MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev) +MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& 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 patches(gf->retrieveGridsAt(i)); std::size_t sz(patches.size()); @@ -1477,7 +1477,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& for(std::size_t j=0;j pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); + std::vector pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); neigh3[j].first=_gf->getPatchAtPosition(pp1); neigh3[j].second=_gf->getPatchAtPosition(pp2); } @@ -1487,7 +1487,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& for(std::size_t i=0;i pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); + std::vector 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); } @@ -1501,7 +1501,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& for(std::size_t j=0;j pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); + std::vector pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); neigh3[j].first=_gf->getPatchAtPosition(pp1); neigh3[j].second=_gf->getPatchAtPosition(pp2); } @@ -1515,7 +1515,7 @@ const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttached const MEDCouplingGridCollection *elt(*it); if(elt) { - int tmp(-1); + mcIdType tmp(-1); if(elt->presenceOf(m,tmp)) { return elt->getFieldsAt(tmp); @@ -1525,18 +1525,18 @@ const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttached 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]); diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx index 4e818db7e..22497d538 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx @@ -33,7 +33,7 @@ namespace MEDCoupling public: static DataArrayDoubleCollection *New(const std::vector< std::pair >& 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 >& compNames); @@ -43,16 +43,16 @@ namespace MEDCoupling std::vector 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& children, const std::vector& 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& children, const std::vector& 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 >& fieldNames); DataArrayDoubleCollection(const DataArrayDoubleCollection& other); @@ -72,22 +72,22 @@ namespace MEDCoupling public: static MEDCouplingGridCollection *New(const std::vector& ms, const std::vector< std::pair >& 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 >& compNames); void spillNatures(const std::vector& nfs); std::vector< std::pair > > getInfoOnComponents() const; std::vector 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 >& ps) const; - void synchronizeFineEachOtherExt(int ghostLev, const std::vector< std::pair >& ps) const; - std::vector< std::pair > 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 >& ps) const; + void synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair >& ps) const; + std::vector< std::pair > 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& recurseArrs) const; private: MEDCouplingGridCollection(const std::vector& ms, const std::vector< std::pair >& fieldNames); @@ -108,13 +108,13 @@ namespace MEDCoupling 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: @@ -131,13 +131,13 @@ namespace MEDCoupling class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel { public: - MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev); - MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, int ghostLev); + MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev); + MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, mcIdType ghostLev); MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector >& compNames); MEDCOUPLING_EXPORT void spillNatures(const std::vector& 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 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); @@ -149,13 +149,13 @@ namespace MEDCoupling 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(); @@ -165,13 +165,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void updateTime() const; private: - MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev); + MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& 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 > _levs; std::vector< std::vector< std::pair > > _neighbors; std::vector< std::pair > _mixed_lev_neighbors; diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 3e7f605af..100e21341 100755 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -107,10 +107,10 @@ const DataArrayDouble *MEDCouplingCMesh::getDirectAccessOfCoordsArrIfInStructure MEDCouplingCurveLinearMesh *MEDCouplingCMesh::buildCurveLinear() const { checkConsistencyLight(); - int dim(getSpaceDimension()); + std::size_t dim(getSpaceDimension()); MCAuto ret(MEDCouplingCurveLinearMesh::New()); ret->MEDCouplingStructuredMesh::operator=(*this); - INTERP_KERNEL::AutoPtr ngs(new int[dim]); + INTERP_KERNEL::AutoPtr ngs(new mcIdType[dim]); getNodeGridStructure(ngs); ret->setNodeGridStructure(ngs,ngs+dim); MCAuto coo(getCoordinatesAndOwner()); @@ -213,7 +213,7 @@ bool MEDCouplingCMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other } 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 !"); @@ -224,7 +224,7 @@ void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int ce * 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 !"); @@ -288,16 +288,16 @@ void MEDCouplingCMesh::checkConsistency(double eps) const _z_array->checkMonotonic(true, eps); } -void MEDCouplingCMesh::getNodeGridStructure(int *res) const +void MEDCouplingCMesh::getNodeGridStructure(mcIdType *res) const { - std::vector ret(getNodeGridStructure()); + std::vector ret(getNodeGridStructure()); std::copy(ret.begin(),ret.end(),res); } -std::vector MEDCouplingCMesh::getNodeGridStructure() const +std::vector 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 ret; + std::vector ret; bool isOK(true); if(_x_array) { @@ -328,11 +328,11 @@ std::vector MEDCouplingCMesh::getNodeGridStructure() const return ret; } -MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const +MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair >& 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()); @@ -355,13 +355,13 @@ int MEDCouplingCMesh::getSpaceDimension() const return (int)getNodeGridStructure().size(); } -void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingCMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& 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;jdecrRef(); field->setMesh(const_cast(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;igetConstPointer(); - for(int icell=0;icellgetConstPointer(); - 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(),ref)); - int w2=(int)std::distance(d,w); + mcIdType w2=ToIdType(std::distance(d,w)); if(w2& elts) const +void MEDCouplingCMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - int ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } @@ -665,7 +665,7 @@ void MEDCouplingCMesh::translate(const double *vector) /*! * 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. */ @@ -703,20 +703,21 @@ MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh *other) DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const { MCAuto 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;jgetConstPointer(); ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0)); } - int tmp2[3]; - for(int i=0;ialloc(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 tabsPtr[3]; for(int j=0;jgetNbOfElems())-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()); std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),tabsPtr[j].begin(),std::bind2nd(std::multiplies(),0.5)); } - int tmp2[3]; + mcIdType tmp2[3]; for(int i=0;i& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -786,7 +787,7 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny 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]) { @@ -801,22 +802,22 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny tinyInfoD.push_back(time); } -void MEDCouplingCMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingCMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& 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]) @@ -830,7 +831,7 @@ void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const a2Ptr=std::copy(thisArr[i]->getConstPointer(),thisArr[i]->getConstPointer()+thisArr[i]->getNumberOfTuples(),a2Ptr); } -void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { setName(littleStrings[0]); @@ -849,7 +850,7 @@ void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, con data+=tinyInfo[i]; } } - setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[3]),FromIdType(tinyInfo[4])); } void MEDCouplingCMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const @@ -892,7 +893,7 @@ void MEDCouplingCMesh::reprQuickOverview(std::ostream& stream) 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; diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index e97618ed6..ae68dffb8 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -45,13 +45,13 @@ namespace MEDCoupling 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& coo) const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT const DataArrayDouble *getCoordsAt(int i) const; @@ -64,8 +64,8 @@ namespace MEDCoupling 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& elts) const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& 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); @@ -73,16 +73,16 @@ namespace MEDCoupling 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 getNodeGridStructure() const; - MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; + MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const; + MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; + MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; //serialisation-unserialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx index 743948d7a..ef0ed1bfc 100755 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -33,17 +33,17 @@ using namespace MEDCoupling; /// @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(); } @@ -90,9 +90,9 @@ std::vector MEDCouplingCartesianAMRPatchGen::getDirectC * \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 >& bottomLeftTopRight):MEDCouplingCartesianAMRPatchGen(mesh),_bl_tr(bottomLeftTopRight) +MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& 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 !"); } @@ -102,12 +102,12 @@ MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRPatch::deepCopy(MEDCoupling return new MEDCouplingCartesianAMRPatch(*this,father); } -void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) +void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) { return getMeshSafe()->addPatch(bottomLeftTopRight,factors); } -int MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const +mcIdType MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const { return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(_bl_tr); } @@ -126,14 +126,14 @@ int MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const * * \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 >& thisp(getBLTRRange()); - const std::vector< std::pair >& otherp(other->getBLTRRange()); + const std::vector< std::pair >& thisp(getBLTRRange()); + const std::vector< std::pair >& otherp(other->getBLTRRange()); return IsInMyNeighborhood(ghostLev==0?0:1,thisp,otherp);//make hypothesis that nb this->_mesh->getFather->getFactors() is >= ghostLev } @@ -152,19 +152,19 @@ bool MEDCouplingCartesianAMRPatch::isInMyNeighborhood(const MEDCouplingCartesian * * \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 offset(ComputeOffsetFromTwoToOne(com,lev,this,other)); - const std::vector< std::pair >& thisp(getBLTRRange()); - std::vector< std::pair > otherp(other->getBLTRRange()); + std::vector offset(ComputeOffsetFromTwoToOne(com,lev,this,other)); + const std::vector< std::pair >& thisp(getBLTRRange()); + std::vector< std::pair > otherp(other->getBLTRRange()); otherp=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp,offset); return IsInMyNeighborhood(ghostLev,thisp,otherp); } @@ -184,24 +184,24 @@ bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt(const MEDCouplingCartes * * \sa isInMyNeighborhoodExt */ -bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const +bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const { - std::vector< std::pair > thispp,otherpp; - std::vector factors; + std::vector< std::pair > thispp,otherpp; + std::vector 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 > MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF() const +std::vector< std::pair > MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF() const { - std::vector< std::pair > ret(_bl_tr); + std::vector< std::pair > 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 factors(fath->getFactors()); + std::vector factors(fath->getFactors()); std::size_t sz(ret.size()); for(std::size_t ii=0;ii > MEDCouplingCartesianAMRPatch::getBLTRRangeRela 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 >& tmp(p->getBLTRRange()); - const std::vector& factors2(fath->getFactors()); - std::transform(factors.begin(),factors.end(),factors2.begin(),factors.begin(),std::multiplies()); + const std::vector< std::pair >& tmp(p->getBLTRRange()); + const std::vector& factors2(fath->getFactors()); + std::transform(factors.begin(),factors.end(),factors2.begin(),factors.begin(),std::multiplies()); for(std::size_t ii=0;ii > MEDCouplingCartesianAMRPatch::getBLTRRangeRela return ret; } -std::vector MEDCouplingCartesianAMRPatch::computeCellGridSt() const +std::vector MEDCouplingCartesianAMRPatch::computeCellGridSt() const { const MEDCouplingCartesianAMRMeshGen *m(getMesh()); if(!m) @@ -237,22 +237,22 @@ std::vector MEDCouplingCartesianAMRPatch::computeCellGridSt() const const MEDCouplingCartesianAMRMeshGen *father(m->getFather()); if(!father) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::computeCellGridSt : no father help by underlying mesh !"); - const std::vector< std::pair >& bltr(getBLTRRange()); - const std::vector& factors(father->getFactors()); - std::vector ret(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(bltr)); - std::transform(ret.begin(),ret.end(),factors.begin(),ret.begin(),std::multiplies()); + const std::vector< std::pair >& bltr(getBLTRRange()); + const std::vector& factors(father->getFactors()); + std::vector ret(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(bltr)); + std::transform(ret.begin(),ret.end(),factors.begin(),ret.begin(),std::multiplies()); return ret; } -bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(int ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2) +bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& 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& thispp(p1[i]); - const std::pair& otherpp(p2[i]); + const std::pair& thispp(p1[i]); + const std::pair& otherpp(p2[i]); if(thispp.second > > MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2) +std::vector< std::vector< std::pair > > 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 !"); @@ -310,7 +310,7 @@ std::vector< std::vector< std::pair >& ret) +void MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& ret) { if(!p1 || !p2) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf : the input pointers must be not NULL !"); @@ -334,10 +334,10 @@ void MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(int ghostLev, con * * \saUpdateNeighborsOfOneWithTwoExt */ -void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(int ghostLev, const std::vector& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) +void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(mcIdType ghostLev, const std::vector& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) { - const std::vector< std::pair >& p1BLTR(p1->getBLTRRange()); - const std::vector< std::pair >& p2BLTR(p2->getBLTRRange()); + const std::vector< std::pair >& p1BLTR(p1->getBLTRRange()); + const std::vector< std::pair >& p2BLTR(p2->getBLTRRange()); UpdateNeighborsOfOneWithTwoInternal(ghostLev,factors,p1BLTR,p2BLTR,dataOnP1,dataOnP2); } @@ -346,13 +346,13 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(int ghostLev, con * * \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 >& p1BLTR(p1->getBLTRRange());//p1BLTR=[(10,12),(5,8)] - std::vector< std::pair > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)] - int lev(0); + const std::vector< std::pair >& p1BLTR(p1->getBLTRRange());//p1BLTR=[(10,12),(5,8)] + std::vector< std::pair > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)] + mcIdType lev(0); const MEDCouplingCartesianAMRMeshGen *ca(FindCommonAncestor(p1,p2,lev)); - std::vector offset(ComputeOffsetFromTwoToOne(ca,lev,p1,p2));//[12,4] + std::vector 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); } @@ -360,23 +360,23 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(int ghostLev, /*! * \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 > p1pp,p2pp; - std::vector factors; + std::vector< std::pair > p1pp,p2pp; + std::vector factors; ComputeZonesOfTwoRelativeToOneDiffLev(ghostLev,p1,p2,p1pp,p2pp,factors); // - std::vector dimsP2NotRefined(p2->computeCellGridSt()); - std::vector dimsP2Refined(dimsP2NotRefined); - std::transform(dimsP2NotRefined.begin(),dimsP2NotRefined.end(),factors.begin(),dimsP2Refined.begin(),std::multiplies()); - std::vector< std::pair > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); - std::vector dimsP2RefinedGhost(dimsP2Refined.size()); - std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus(),2*ghostLev)); + std::vector dimsP2NotRefined(p2->computeCellGridSt()); + std::vector dimsP2Refined(dimsP2NotRefined); + std::transform(dimsP2NotRefined.begin(),dimsP2NotRefined.end(),factors.begin(),dimsP2Refined.begin(),std::multiplies()); + std::vector< std::pair > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); + std::vector dimsP2RefinedGhost(dimsP2Refined.size()); + std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus(),2*ghostLev)); MCAuto 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(),1./((double)fact))); } // @@ -388,7 +388,7 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(int ghost * 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 >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2) +void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2) { std::vector ancestorsOfThis; const MEDCouplingCartesianAMRMeshGen *work(p1->getMesh()),*work2(0); @@ -424,24 +424,24 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(int gho 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 offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp)); + std::vector 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 > tmp0; + std::vector< std::pair > 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& factors(curAncestor->getFactors()); - std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies()); - int tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i])); + const std::vector& factors(curAncestor->getFactors()); + std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies()); + mcIdType tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i])); p1Zone=curAncestor->getPatch(tmpId)->getBLTRRange(); } } @@ -449,11 +449,11 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(int gho std::size_t MEDCouplingCartesianAMRPatch::getHeapMemorySizeWithoutChildren() const { std::size_t ret(sizeof(MEDCouplingCartesianAMRPatch)); - ret+=_bl_tr.capacity()*sizeof(std::pair); + ret+=_bl_tr.capacity()*sizeof(std::pair); 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; @@ -469,33 +469,33 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAn return f1; } -std::vector MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, int lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2) +std::vector 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 ret(dim,0); + for(mcIdType i=0;i_mesh),*f2(p2->_mesh); const MEDCouplingCartesianAMRPatch *p1h(0),*p2h(0); - for(int j=0;jgetFather()),*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 > p2c(p2h->getBLTRRange()); - for(int k=0;k > p2c(p2h->getBLTRRange()); + for(mcIdType k=0;kgetBLTRRange()[k].first; ret[k]*=f1->getFactors()[k]; @@ -504,25 +504,25 @@ std::vector MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const M return ret; } -void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(int ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) +void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) {//p1=[(1,4),(2,4)] p2=[(4,5),(3,4)] - int dim((int)factors.size()); - std::vector dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(p1));//[3,2] - std::transform(dimsCoarse.begin(),dimsCoarse.end(),factors.begin(),dimsCoarse.begin(),std::multiplies());//[12,8] - std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind2nd(std::plus(),2*ghostLev));//[14,10] - std::vector< std::pair > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)] - std::vector fakeFactors(dim,1); + mcIdType dim(ToIdType(factors.size())); + std::vector dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(p1));//[3,2] + std::transform(dimsCoarse.begin(),dimsCoarse.end(),factors.begin(),dimsCoarse.begin(),std::multiplies());//[12,8] + std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind2nd(std::plus(),2*ghostLev));//[14,10] + std::vector< std::pair > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)] + std::vector fakeFactors(dim,1); // - std::vector< std::pair > tmp0,tmp1,tmp2; + std::vector< std::pair > 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 > interstRange(MEDCouplingStructuredMesh::IntersectRanges(tmp0,rangeCoarse));//interstRange=[(13,14),(5,9)] + std::vector< std::pair > 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 > dimsFine(p2); + std::vector< std::pair > dimsFine(p2); ApplyFactorsOnCompactFrmt(dimsFine,factors); ApplyAllGhostOnCompactFrmt(dimsFine,ghostLev); // @@ -538,7 +538,7 @@ MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(const MEDCouplingCart * \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 >& partBeforeFact, const std::vector& factors) +void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors) { std::size_t sz(factors.size()); if(sz!=partBeforeFact.size()) @@ -556,7 +556,7 @@ void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::p * \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 >& partBeforeFact, int ghostSize) +void MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt : ghost size must be >= 0 !"); @@ -593,9 +593,9 @@ int MEDCouplingCartesianAMRMeshGen::getSpaceDimension() const return _mesh->getSpaceDimension(); } -void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& newFactors) +void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& 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()) { @@ -610,9 +610,9 @@ void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& newFacto declareAsNew(); } -int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const +mcIdType MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const { - int ret(1); + mcIdType ret(1); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) ret=std::max(ret,(*it)->getMaxNumberOfLevelsRelativeToThis()+1); return ret; @@ -623,9 +623,9 @@ int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const * 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(); } /*! @@ -635,19 +635,19 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const * * \sa getNumberOfCellsAtCurrentLevel */ -int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const { MCAuto 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 >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret+=(*it)->getNumberOfCellsRecursiveWithOverlap(); @@ -662,9 +662,9 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const * * \sa buildUnstructured */ -int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const { - mcIdType ret=ToIdType(_mesh->getNumberOfCells()); + mcIdType ret=_mesh->getNumberOfCells(); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret-=(*it)->getNumberOfOverlapedCellsForFather(); @@ -679,11 +679,11 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() co * * \sa getPatchAtPosition */ -std::vector MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const +std::vector MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const { if(!ref) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo : input pointer is NULL !"); - std::vector ret; + std::vector ret; getPositionRelativeToInternal(ref,ret); std::reverse(ret.begin(),ret.end()); return ret; @@ -692,27 +692,27 @@ std::vector MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MED /*! * \sa getPositionRelativeTo, getMeshAtPosition */ -const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector& pos) const +const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector& 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 pos2(pos.begin()+1,pos.end()); + std::vector pos2(pos.begin()+1,pos.end()); return elt->getMesh()->getPatchAtPosition(pos2); } -const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector& pos) const +const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector& 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) { @@ -722,7 +722,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtP } if(!elt || !elt->getMesh()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !"); - std::vector pos2(pos.begin()+1,pos.end()); + std::vector pos2(pos.begin()+1,pos.end()); return elt->getMesh()->getMeshAtPosition(pos2); } @@ -731,7 +731,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtP * * \return std::vector - objects in vector are to be managed (decrRef) by the caller. */ -std::vector MEDCouplingCartesianAMRMeshGen::retrieveGridsAt(int absoluteLev) const +std::vector MEDCouplingCartesianAMRMeshGen::retrieveGridsAt(mcIdType absoluteLev) const { if(absoluteLev<0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::retrieveGridsAt : absolute level must be >=0 !"); @@ -743,7 +743,7 @@ std::vector MEDCouplingCartesianAMRMeshGen::r * 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 >& bottomLeftTopRight, const std::vector& factors) +void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) { checkFactorsAndIfNotSetAssign(factors); MCAuto mesh(static_cast(_mesh->buildStructuredSubPart(bottomLeftTopRight))); @@ -760,38 +760,38 @@ class InternalPatch : public RefCountObjectOnly { 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& getCriterion() { return _crit; } const std::vector& getConstCriterion() const { return _crit; } - void setPart(const std::vector< std::pair >& part) { _part=part; } - std::vector< std::pair >& getPart() { return _part; } - const std::vector< std::pair >& getConstPart() const { return _part; } + void setPart(const std::vector< std::pair >& part) { _part=part; } + std::vector< std::pair >& getPart() { return _part; } + const std::vector< std::pair >& getConstPart() const { return _part; } bool presenceOfTrue() const { return _nb_of_true>0; } - std::vector computeCGS() const { return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(_part); } - std::vector< std::vector > 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 computeCGS() const { return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(_part); } + std::vector< std::vector > 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 extractPart(const std::vector< std::pair >&partInGlobal) const; + MCAuto extractPart(const std::vector< std::pair >&partInGlobal) const; MCAuto deepCopy() const; protected: ~InternalPatch() { } private: - mutable int _nb_of_true; + mutable mcIdType _nb_of_true; std::vector _crit; //! _part is global - std::vector< std::pair > _part; + std::vector< std::pair > _part; }; -void InternalPatch::zipToFitOnCriterion(int minPatchLgth) +void InternalPatch::zipToFitOnCriterion(mcIdType minPatchLgth) { - std::vector cgs(computeCGS()); + std::vector cgs(computeCGS()); std::vector newCrit; - std::vector< std::pair > newPart,newPart2; - int newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart)); + std::vector< std::pair > 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 !"); @@ -800,14 +800,14 @@ void InternalPatch::zipToFitOnCriterion(int minPatchLgth) 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::extractPart(const std::vector< std::pair >&partInGlobal) const +MCAuto InternalPatch::extractPart(const std::vector< std::pair >&partInGlobal) const { MCAuto ret(new InternalPatch); - std::vector cgs(computeCGS()); - std::vector< std::pair > newPart; + std::vector cgs(computeCGS()); + std::vector< std::pair > newPart; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(_part,partInGlobal,newPart); MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(cgs,_crit,newPart,ret->getCriterion()); ret->setPart(partInGlobal); @@ -822,19 +822,19 @@ MCAuto InternalPatch::deepCopy() const 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 ratio(largestLength-minimumPatchLength,std::numeric_limits::max()); - int index_min = -1; + mcIdType index_min = -1; double minSemiEfficiencyRatio(std::numeric_limits::max()); double efficiencyPerAxis[2]; - for(int i=minimumPatchLength-1;i > rectH(patchToBeSplit->getConstPart()); + std::vector< std::pair > rectH(patchToBeSplit->getConstPart()); if(h==0) rectH[axisId].second=patchToBeSplit->getConstPart()[axisId].first+i; else @@ -857,26 +857,26 @@ void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const Intern 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 > signatures(patchToBeSplit->computeSignature()); - for(int id=0;idgetDimension()); + std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); + for(mcIdType id=0;id& signature(signatures[id]); - std::vector hole; + const std::vector& signature(signatures[id]); + std::vector hole; std::vector distance; - int len((int)signature.size()); - for(int i=minimumPatchLength-1;i >& part(patchToBeSplit->getConstPart()); - int sign,minimumPatchLength(bso.getMinimumPatchLength()); - const int dim(patchToBeSplit->getDimension()); - - std::vector zeroCrossDims(dim,-1); - std::vector zeroCrossVals(dim,-1); - std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); - for (int id=0;id >& part(patchToBeSplit->getConstPart()); + mcIdType sign,minimumPatchLength(bso.getMinimumPatchLength()); + const mcIdType dim(patchToBeSplit->getDimension()); + + std::vector zeroCrossDims(dim,-1); + std::vector zeroCrossVals(dim,-1); + std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); + for (mcIdType id=0;id& signature(signatures[id]); + const std::vector& signature(signatures[id]); - std::vector derivate_second_order,gradient_absolute,zero_cross,edge,max_cross_list ; + std::vector derivate_second_order,gradient_absolute,zero_cross,edge,max_cross_list ; std::vector distance ; for(std::size_t i=1;i 0 ) { - int max_cross=*max_element(edge.begin(),edge.end()) ; - for (unsigned int i=0;i(signature.size())/2.0); - for (unsigned int i=0;i(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 ; @@ -963,12 +963,12 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna 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 @@ -978,12 +978,12 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna 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(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()) { @@ -1013,11 +1013,11 @@ MCAuto DealWithNoCut(const InternalPatch *patch) return ret; } -void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, int cutPlace, std::vector >& listOfPatches) +void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, mcIdType cutPlace, std::vector >& listOfPatches) { MCAuto leftPart,rightPart; - std::vector< std::pair > rect(patchToBeSplit->getConstPart()); - std::vector< std::pair > leftRect(rect),rightRect(rect); + std::vector< std::pair > rect(patchToBeSplit->getConstPart()); + std::vector< std::pair > leftRect(rect),rightRect(rect); leftRect[axisId].second=cutPlace+1; rightRect[axisId].first=cutPlace+1; leftPart=patchToBeSplit->extractPart(leftRect); @@ -1035,12 +1035,12 @@ void MEDCouplingCartesianAMRMeshGen::removeAllPatches() 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 > patches(sz-1); - for(int i=0;i(_patches[patchId]->getMesh()))->detachFromFather(); @@ -1048,9 +1048,9 @@ void MEDCouplingCartesianAMRMeshGen::removePatch(int patchId) declareAsNew(); } -int MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const { - return (int)_patches.size(); + return ToIdType(_patches.size()); } /*! @@ -1070,13 +1070,13 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const * for more information. * */ -void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector& criterion, const std::vector& factors) +void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector& criterion, const std::vector& 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 cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > listOfPatches,listOfPatchesOK; // MCAuto p(new InternalPatch); @@ -1089,7 +1089,8 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER for(std::vector< MCAuto >::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())) { @@ -1117,7 +1118,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER * 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& factors) +void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors) { if(!criterion || !criterion->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the criterion DataArrayByte instance must be allocated and not NULL !"); @@ -1126,7 +1127,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER declareAsNew(); } -void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps) +void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps) { if(!criterion) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : null criterion pointer !"); @@ -1134,9 +1135,9 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER 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 >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++) { if((*it)->getMesh()==mesh) @@ -1154,7 +1155,7 @@ std::vector< const MEDCouplingCartesianAMRPatch *> MEDCouplingCartesianAMRMeshGe return ret; } -const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(int patchId) const +const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(mcIdType patchId) const { checkPatchId(patchId); return _patches[patchId]; @@ -1164,7 +1165,7 @@ const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(int * 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); @@ -1183,7 +1184,7 @@ bool MEDCouplingCartesianAMRMeshGen::isPatchInNeighborhoodOf(int patchId1, int p * \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 !"); @@ -1205,7 +1206,7 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch(int patc * * \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 !"); @@ -1213,7 +1214,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(int patchId, const Dat 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(),1./((double)fact))); } } @@ -1229,7 +1230,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(int patchId, const Dat * * \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 !"); @@ -1237,7 +1238,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(int patchId, cons 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(),1./((double)fact))); } } @@ -1251,7 +1252,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(int patchId, cons * \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 !"); @@ -1271,10 +1272,10 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZone(int pat * * \sa fillCellFieldOnPatchOnlyGhostAdv */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, const std::vector& arrsOnPatches, bool isConservative) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector& 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()); @@ -1291,25 +1292,25 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(int patchId, c * * \sa getPatchIdsInTheNeighborhoodOf */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector& arrsOnPatches) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, const std::vector& 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(arrsOnPatches[patchId])); - std::vector ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); - for(std::vector::const_iterator it=ids.begin();it!=ids.end();it++) + std::vector ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); + for(std::vector::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); } @@ -1326,7 +1327,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZoneWith(int * \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 !"); @@ -1334,7 +1335,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(int patchId, c 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); } } @@ -1353,7 +1354,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(int patchId, c * \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 !"); @@ -1361,7 +1362,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(int patch 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); } } @@ -1372,13 +1373,13 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(int patch * * \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 ret(DataArrayInt::New()); ret->alloc(0,1); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); + for(mcIdType i=0;i part(_mesh->buildUnstructured()); std::vector bs(_mesh->getNumberOfCells(),false); - std::vector cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) @@ -1399,7 +1400,7 @@ MEDCouplingUMesh *MEDCouplingCartesianAMRMeshGen::buildUnstructured() const MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs); msSafe[ii+1]=(*it)->getMesh()->buildUnstructured(); } - MCAuto eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); + MCAuto eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs)); msSafe[0]=static_cast(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false)); std::vector< const MEDCouplingUMesh * > ms(msSafe.size()); for(std::size_t i=0;i& recurseArrs) const +MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, const std::vector& recurseArrs) const { if(recurseArrs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost : array is empty ! Should never happen !"); // std::vector bs(_mesh->getNumberOfCells(),false); - std::vector cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) @@ -1466,7 +1467,7 @@ MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseW std::vector tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs)); msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs); } - MCAuto eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); + MCAuto eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs)); // MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS)); MCAuto arr2(extractGhostFrom(ghostSz,recurseArrs[0])); @@ -1489,11 +1490,11 @@ MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseW * 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 st(_mesh->getCellGridStructure()); - std::vector< std::pair > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st)); - std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus(),2*ghostSz)); + std::vector st(_mesh->getCellGridStructure()); + std::vector< std::pair > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st)); + std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus(),2*ghostSz)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(p,ghostSz); MCAuto ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p)); return ret.retn(); @@ -1504,12 +1505,12 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(int ghostSz, c * * \sa fillCellFieldOnPatchOnlyGhostAdv */ -std::vector MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const +std::vector MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const { - std::vector ret; - int nbp(getNumberOfPatches()); + std::vector ret; + mcIdType nbp(getNumberOfPatches()); // - for(int i=0;igetName() << "\"," << getSpaceDimension() << ",["; - std::vector ngs(getImageMesh()->getNodeGridStructure()); + std::vector ngs(getImageMesh()->getNodeGridStructure()); std::vector orig(getImageMesh()->getOrigin()),dxyz(getImageMesh()->getDXYZ()); - std::copy(ngs.begin(),ngs.end(),std::ostream_iterator(oss,",")); + std::copy(ngs.begin(),ngs.end(),std::ostream_iterator(oss,",")); oss << "],["; std::copy(orig.begin(),orig.end(),std::ostream_iterator(oss,",")); oss << "],["; @@ -1553,7 +1554,7 @@ MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const MEDCoupling } } -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); @@ -1567,9 +1568,9 @@ MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh _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 << ") !"; @@ -1577,9 +1578,9 @@ void MEDCouplingCartesianAMRMeshGen::checkPatchId(int patchId) const } } -void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::vector& factors) +void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::vector& 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()) { @@ -1592,7 +1593,7 @@ void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::ve } } -void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vector< MCAuto >& grids) const +void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(mcIdType lev, std::vector< MCAuto >& grids) const { if(lev==0) { @@ -1623,13 +1624,13 @@ void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vecto } } -int MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(int ghostLev, const std::vector& factors) +mcIdType MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(mcIdType ghostLev, const std::vector& 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 @@ -1647,11 +1648,11 @@ int MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(int ghostLev, const s */ std::vector MEDCouplingCartesianAMRMeshGen::extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const { - int maxLev(getMaxNumberOfLevelsRelativeToThis()); + mcIdType maxLev(getMaxNumberOfLevelsRelativeToThis()); std::vector ret; std::vector meshes(1,this); std::size_t kk(0); - for(int i=0;i meshesTmp; for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++) @@ -1682,7 +1683,7 @@ void MEDCouplingCartesianAMRMeshGen::dumpPatchesOf(const std::string& varName, s if(patch) { std::ostringstream oss2; oss2 << varName << ".addPatch(["; - const std::vector< std::pair >& bltr(patch->getBLTRRange()); + const std::vector< std::pair >& bltr(patch->getBLTRRange()); std::size_t sz(bltr.size()); for(std::size_t i=0;i(oss2,",")); + std::copy(_factors.begin(),_factors.end(),std::ostream_iterator(oss2,",")); oss2 << "])\n"; oss << oss2.str(); std::ostringstream oss3; oss3 << varName << "[" << j++ << "]"; @@ -1750,7 +1751,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshSub::getGodFath /*! * 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 !"); @@ -1763,34 +1764,34 @@ void MEDCouplingCartesianAMRMeshSub::detachFromFather() declareAsNew(); } -std::vector< std::pair > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector& st) const +std::vector< std::pair > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector& st) const { st=_father->getFactors(); std::size_t dim(st.size()); - std::vector prev(st); - int id(_father->getPatchIdFromChildMesh(this)); + std::vector prev(st); + mcIdType id(_father->getPatchIdFromChildMesh(this)); const MEDCouplingCartesianAMRPatch *p(_father->getPatch(id)); - std::vector< std::pair > ret(p->getBLTRRange()); - std::vector delta(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(ret)),start(dim); - std::transform(delta.begin(),delta.end(),prev.begin(),delta.begin(),std::multiplies()); + std::vector< std::pair > ret(p->getBLTRRange()); + std::vector delta(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(ret)),start(dim); + std::transform(delta.begin(),delta.end(),prev.begin(),delta.begin(),std::multiplies()); for(std::size_t i=0;i()); + std::transform(start.begin(),start.end(),prev.begin(),start.begin(),std::multiplies()); const MEDCouplingCartesianAMRMeshGen *it(_father); while(!dynamic_cast(it)) { const MEDCouplingCartesianAMRMeshSub *itc(static_cast(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 >& start2(p2->getBLTRRange()); - std::vector tmp(dim); + const std::vector< std::pair >& start2(p2->getBLTRRange()); + std::vector tmp(dim); for(std::size_t i=0;i_father->getFactors(); - std::transform(st.begin(),st.end(),prev.begin(),st.begin(),std::multiplies()); - std::transform(st.begin(),st.end(),tmp.begin(),tmp.begin(),std::multiplies()); - std::transform(start.begin(),start.end(),tmp.begin(),start.begin(),std::plus()); + std::transform(st.begin(),st.end(),prev.begin(),st.begin(),std::multiplies()); + std::transform(st.begin(),st.end(),tmp.begin(),tmp.begin(),std::multiplies()); + std::transform(start.begin(),start.end(),tmp.begin(),start.begin(),std::plus()); it=itc->_father; } for(std::size_t i=0;i > MEDCouplingCartesianAMRMeshSub::positionRelati return ret; } -int MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const +mcIdType MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const { if(this==ref) return 0; @@ -1823,18 +1824,18 @@ MEDCouplingCartesianAMRMeshSub *MEDCouplingCartesianAMRMeshSub::deepCopy(MEDCoup /*! * \sa getPositionRelativeTo */ -void MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const +void MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& 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); @@ -1856,7 +1857,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMesh::getGodFather( return this; } -int MEDCouplingCartesianAMRMesh::getAbsoluteLevel() const +mcIdType MEDCouplingCartesianAMRMesh::getAbsoluteLevel() const { return 0; } @@ -1865,20 +1866,20 @@ void MEDCouplingCartesianAMRMesh::detachFromFather() {//not a bug - do nothing } -std::vector< std::pair > MEDCouplingCartesianAMRMesh::positionRelativeToGodFather(std::vector& st) const +std::vector< std::pair > MEDCouplingCartesianAMRMesh::positionRelativeToGodFather(std::vector& 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 MEDCouplingCartesianAMRMesh::retrieveGridsAt(int absoluteLev) const +std::vector MEDCouplingCartesianAMRMesh::retrieveGridsAt(mcIdType absoluteLev) const { std::vector< MCAuto > rets; retrieveGridsAtInternal(absoluteLev,rets); @@ -1909,7 +1910,7 @@ MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::deepCopy(MEDCouplingCa * * \sa createPatchesFromCriterion */ -void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps) +void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps) { std::size_t nbOfLevs(bso.size()); if(nbOfLevs!=factors.size()) @@ -1924,7 +1925,7 @@ void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector if(!bso[i]) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML : presence of a NULL BoxSplittingOptions in input vector !"); // - std::vector elts(retrieveGridsAt((int)(i))); + std::vector elts(retrieveGridsAt(ToIdType((i)))); std::size_t sz(elts.size()); std::vector< MCAuto > elts2(sz); std::vector< MCAuto > elts3(sz); @@ -1949,7 +1950,7 @@ void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector } } -void MEDCouplingCartesianAMRMesh::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const +void MEDCouplingCartesianAMRMesh::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const { } @@ -1958,7 +1959,7 @@ MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const MEDCouplingCartes { } -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) { } diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx index ad4e74aa9..cfe7aa4ab 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx @@ -34,7 +34,7 @@ namespace MEDCoupling { class MEDCouplingIMesh; class MEDCouplingUMesh; - class DataArrayInt; + class DataArrayIdType; class DataArrayByte; class DataArrayDouble; class MEDCoupling1SGTUMesh; @@ -51,9 +51,9 @@ namespace MEDCoupling { 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); @@ -72,41 +72,41 @@ namespace MEDCoupling class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen { public: - MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight); + MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight); MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; // direct forward to _mesh - MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); + MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& 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 >& getBLTRRange() const { return _bl_tr; } - MEDCOUPLING_EXPORT std::vector< std::pair > getBLTRRangeRelativeToGF() const; - MEDCOUPLING_EXPORT std::vector computeCellGridSt() const; - MEDCOUPLING_EXPORT static bool IsInMyNeighborhood(int ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2); + MEDCOUPLING_EXPORT const std::vector< std::pair >& getBLTRRange() const { return _bl_tr; } + MEDCOUPLING_EXPORT std::vector< std::pair > getBLTRRangeRelativeToGF() const; + MEDCOUPLING_EXPORT std::vector computeCellGridSt() const; + MEDCOUPLING_EXPORT static bool IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2); // - static std::vector< std::vector< std::pair > > FindNeighborsOfSubPatchesOfSameLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); - static void FindNeighborsOfSubPatchesOf(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& ret); - static void UpdateNeighborsOfOneWithTwo(int ghostLev, const std::vector& 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 > > FindNeighborsOfSubPatchesOfSameLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); + static void FindNeighborsOfSubPatchesOf(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& ret); + static void UpdateNeighborsOfOneWithTwo(mcIdType ghostLev, const std::vector& 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 >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2); + static void ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2); private: std::size_t getHeapMemorySizeWithoutChildren() const; - static const MEDCouplingCartesianAMRMeshGen *FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, int& lev); - static std::vector ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, int lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); - static void UpdateNeighborsOfOneWithTwoInternal(int ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); + static const MEDCouplingCartesianAMRMeshGen *FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, mcIdType& lev); + static std::vector ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); + static void UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); public: - static void ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors); - static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, int ghostSize); + static void ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors); + static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& 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 > _bl_tr; + std::vector< std::pair > _bl_tr; }; /*! @@ -135,72 +135,72 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRMeshGen *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const = 0; MEDCOUPLING_EXPORT int getSpaceDimension() const; - MEDCOUPLING_EXPORT const std::vector& getFactors() const { return _factors; } - MEDCOUPLING_EXPORT void setFactors(const std::vector& 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& getFactors() const { return _factors; } + MEDCOUPLING_EXPORT void setFactors(const std::vector& 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 > positionRelativeToGodFather(std::vector& st) const = 0; - MEDCOUPLING_EXPORT virtual int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const = 0; - MEDCOUPLING_EXPORT std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const; - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const; - MEDCOUPLING_EXPORT virtual std::vector retrieveGridsAt(int absoluteLev) const; - MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); + MEDCOUPLING_EXPORT virtual std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const = 0; + MEDCOUPLING_EXPORT std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const; + MEDCOUPLING_EXPORT virtual std::vector retrieveGridsAt(mcIdType absoluteLev) const; + MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& 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& criterion, const std::vector& factors); - MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); - MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& 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& criterion, const std::vector& factors); + MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); + MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& 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& arrsOnPatches, bool isConservative=true) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector& arrsOnPatches, bool isConservative=true) const; // fine to fine - MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector& 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& 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& recurseArrs) const; - MEDCOUPLING_EXPORT DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT std::vector getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, const std::vector& recurseArrs) const; + MEDCOUPLING_EXPORT DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT std::vector 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& factors); - void retrieveGridsAtInternal(int lev, std::vector< MCAuto >& grids) const; - static int GetGhostLevelInFineRef(int ghostLev, const std::vector& factors); + void checkPatchId(mcIdType patchId) const; + void checkFactorsAndIfNotSetAssign(const std::vector& factors); + void retrieveGridsAtInternal(mcIdType lev, std::vector< MCAuto >& grids) const; + static mcIdType GetGhostLevelInFineRef(mcIdType ghostLev, const std::vector& factors); std::vector extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const; void dumpPatchesOf(const std::string& varName, std::ostream& oss) const; public: - virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const = 0; + virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const = 0; protected: MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; @@ -208,7 +208,7 @@ namespace MEDCoupling protected: MCAuto _mesh; std::vector< MCAuto > _patches; - std::vector _factors; + std::vector _factors; }; class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen @@ -217,14 +217,14 @@ namespace MEDCoupling 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 > positionRelativeToGodFather(std::vector& st) const; - MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& 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& ret) const; + void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; protected: MEDCouplingCartesianAMRMeshGen *_father; }; @@ -232,22 +232,22 @@ namespace MEDCoupling 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 > positionRelativeToGodFather(std::vector& st) const; - MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; - MEDCOUPLING_EXPORT std::vector retrieveGridsAt(int absoluteLev) const; + MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const; + MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + MEDCOUPLING_EXPORT std::vector retrieveGridsAt(mcIdType absoluteLev) const; MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; - MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps); + MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps); private: - void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; + void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& 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 getDirectChildrenWithNull() const; diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index de19c7da4..8b1ad4a07 100755 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -83,7 +83,7 @@ void MEDCouplingCurveLinearMesh::updateTime() 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; } @@ -159,7 +159,7 @@ bool MEDCouplingCurveLinearMesh::isEqualWithoutConsideringStr(const MEDCouplingM } 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 !"); @@ -170,7 +170,7 @@ void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *oth * 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 !"); @@ -178,10 +178,11 @@ void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCoupli 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::const_iterator it=_structure.begin();it!=_structure.end();it++,i++) + for(std::vector::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()); } @@ -193,7 +194,7 @@ void MEDCouplingCurveLinearMesh::checkConsistencyLight() const 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()); @@ -205,19 +206,19 @@ void MEDCouplingCurveLinearMesh::checkConsistency(double eps) const 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); } @@ -232,10 +233,10 @@ int MEDCouplingCurveLinearMesh::getSpaceDimension() const { 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& coo) const +void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { if(!((const DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !"); @@ -296,7 +297,7 @@ void MEDCouplingCurveLinearMesh::setCoords(const DataArrayDouble *coords) } } -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) @@ -311,25 +312,25 @@ void MEDCouplingCurveLinearMesh::setNodeGridStructure(const int *gridStructBg, c } } -std::vector MEDCouplingCurveLinearMesh::getNodeGridStructure() const +std::vector MEDCouplingCurveLinearMesh::getNodeGridStructure() const { return _structure; } -MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const +MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { checkConsistencyLight(); int dim(getSpaceDimension()); - std::vector dims(getMeshDimension()); - if(dim!=(int)cellPart.size()) + std::vector 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 > nodePartFormat(cellPart); - for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) + std::vector< std::pair > nodePartFormat(cellPart); + for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) (*it).second++; - MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); + MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); MCAuto ret(dynamic_cast(deepCopy())); const DataArrayDouble *coo(ret->getCoords()); if(coo) @@ -380,7 +381,7 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const { - int nbnodes=getNumberOfNodes(); + mcIdType nbnodes=getNumberOfNodes(); int spaceDim=getSpaceDimension(); MCAuto arr=DataArrayDouble::New(); field->setArray(arr); if(nbnodes==0) @@ -406,7 +407,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCoupling */ 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 !"); @@ -414,13 +415,13 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCoupling 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(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim); + *pt=INTERP_KERNEL::computeVolSurfOfCell2(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim); } if(isAbs) arr->abs(); @@ -432,7 +433,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCoupling */ 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 !"); @@ -440,17 +441,17 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCoupling 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(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3); + *pt=INTERP_KERNEL::computeVolSurfOfCell2(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3); } if(isAbs) arr->abs(); @@ -470,10 +471,10 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::buildOrthogonalField() const 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;isetArray(array); array->decrRef(); @@ -491,31 +492,31 @@ 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 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()) @@ -539,7 +540,7 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double 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); @@ -569,8 +570,8 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double { 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); @@ -634,9 +635,9 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double } } -void MEDCouplingCurveLinearMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const +void MEDCouplingCurveLinearMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - int ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } @@ -664,9 +665,9 @@ void MEDCouplingCurveLinearMesh::translate(const double *vector) 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; ideclareAsNew(); @@ -682,7 +683,7 @@ void MEDCouplingCurveLinearMesh::scale(const double *point, double factor) double *coords=_coords->getPointer(); mcIdType nbNodes(_coords->getNumberOfTuples()); std::size_t dim(_coords->getNumberOfComponents()); - for(int i=0;i()); std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies(),factor)); @@ -711,7 +712,7 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeCellCenterOfMass() const MCAuto 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) @@ -738,22 +739,22 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeIsoBarycenterOfNodesPerCell( */ 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(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill); + INTERP_KERNEL::computeBarycenter2(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill); ptToFill+=3; } } @@ -764,19 +765,19 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble * */ 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(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill); + INTERP_KERNEL::computeBarycenter2(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } } @@ -792,12 +793,12 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble * std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind2nd(std::multiplies(),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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -815,10 +816,10 @@ void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector::const_iterator itt=_structure.begin();itt!=_structure.end();itt++) + tinyInfo.push_back(ToIdType(_structure.size())); + for(std::vector::const_iterator itt=_structure.begin();itt!=_structure.end();itt++) tinyInfo.push_back(*itt); - std::vector tinyInfo2; + std::vector tinyInfo2; if((const DataArrayDouble *)_coords) _coords->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); @@ -826,45 +827,45 @@ void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingCurveLinearMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { a1->alloc(tinyInfo[2],1); - std::vector tinyInfo2(tinyInfo.begin()+3+tinyInfo[2],tinyInfo.end()); + std::vector 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::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::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& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCouplingCurveLinearMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& 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(tinyInfo[0]),FromIdType(tinyInfo[1])); + mcIdType sz=tinyInfo[2]; _structure.resize(sz); - for(int i=0;isz+3) + if(ToIdType(tinyInfo.size())>sz+3) { _coords=DataArrayDouble::New(); - std::vector tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end()); + std::vector tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end()); _coords->resizeForUnserialization(tinyInfo2); std::copy(a2->begin(),a2->end(),_coords->getPointer()); std::vector littleStrings2(littleStrings.begin()+3,littleStrings.end()); @@ -875,11 +876,11 @@ void MEDCouplingCurveLinearMesh::unserialization(const std::vector& tiny 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\n"; ofs << " \n"; ofs << " \n" << pointData << std::endl; @@ -903,8 +904,8 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const { stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\"."; stream << " Nodal structure : ["; - mcIdType s_size=ToIdType(_structure.size()); - for(mcIdType i=0;igetNumberOfComponents()); - int nbOfCompoExp(-1); + std::size_t nbOfCompoExp(-1); try { nbOfCompoExp=getSpaceDimension(); @@ -926,7 +927,7 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const 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); diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx index 05d29452a..c99730e36 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx @@ -42,31 +42,31 @@ namespace MEDCoupling 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& coo) const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& 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 getNodeGridStructure() const; - MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; + MEDCOUPLING_EXPORT void setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd); + MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; + MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& 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& elts) const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& 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); @@ -74,14 +74,14 @@ namespace MEDCoupling 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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; @@ -100,7 +100,7 @@ namespace MEDCoupling std::string getVTKDataSetType() const; private: MCAuto _coords; - std::vector _structure; + std::vector _structure; }; } diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx index 23d4204b4..d6dc441a7 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx @@ -446,11 +446,11 @@ MEDCouplingDefinitionTime::MEDCouplingDefinitionTime(const std::vector& refCoo, +void MEDCouplingField::setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) { if(!_mesh) @@ -379,13 +379,13 @@ MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId) /*! * 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 !"); @@ -395,11 +395,11 @@ int MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedC /*! * Returns ids of Gauss localization objects corresponding to a given cell type. * \param [in] type - the cell type of interest. - * \return std::set - ids of the Gauss localization object. + * \return std::set - 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 MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const +std::set MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdsOfOneType method !"); @@ -409,11 +409,11 @@ std::set MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL:: /*! * 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 !"); @@ -423,12 +423,12 @@ int MEDCouplingField::getNbOfGaussLocalization() const /*! * 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 !"); @@ -445,7 +445,7 @@ int MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const * \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& cellIds) const +void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const { cellIds.clear(); if(!((const MEDCouplingFieldDiscretization *)_type)) @@ -506,7 +506,7 @@ MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy) * \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 @@ -515,7 +515,7 @@ MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy) * \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 !"); @@ -532,7 +532,7 @@ MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int * * \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 !"); @@ -541,9 +541,9 @@ MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(int begin, int end, int /*! * 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 !"); @@ -553,11 +553,11 @@ DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *st /*! * 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 !"); @@ -580,11 +580,11 @@ void MEDCouplingField::setDiscretization(MEDCouplingFieldDiscretization *newDisc /*! * 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 !"); @@ -623,7 +623,7 @@ void MEDCouplingField::copyTinyStringsFrom(const MEDCouplingField *other) * \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& code, const std::vector& idsPerType) const +mcIdType MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const { const MEDCouplingFieldDiscretization *t(_type); if(!t) diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index 942d5c6cc..54d8252c0 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -35,7 +35,7 @@ namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; class DataArrayDouble; class MEDCouplingMesh; class MEDCouplingFieldDouble; @@ -61,32 +61,32 @@ namespace MEDCoupling 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& refCoo, const std::vector& gsCoo, const std::vector& wg); - MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector& refCoo, + MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); MEDCOUPLING_EXPORT void clearGaussLocalizations(); MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId); - MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT std::set 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& cellIds) const; + MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT std::set 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& 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 getDirectChildrenWithNull() const; // for MED file RW - MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; protected: MEDCOUPLING_EXPORT MEDCouplingField(TypeOfField type); diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index 9810f0584..d0b3bd4c0 100755 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -50,7 +50,7 @@ const char MEDCouplingFieldDiscretizationP1::REPR[]="P1"; 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"; @@ -197,7 +197,7 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::deepCopy() const /*! * 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(); } @@ -205,7 +205,7 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const /*! * 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(); } @@ -236,12 +236,12 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D { MCAuto 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 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 da=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto 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; } @@ -330,7 +330,7 @@ void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayInt *& ar /*! * Empty : Not a bug */ -void MEDCouplingFieldDiscretization::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingFieldDiscretization::getTinySerializationIntInformation(std::vector& tinyInfo) const { } @@ -341,7 +341,7 @@ void MEDCouplingFieldDiscretization::getTinySerializationDbleInformation(std::ve { } -void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr) +void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr) { arr=0; } @@ -349,7 +349,7 @@ void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector< /*! * Empty : Not a bug */ -void MEDCouplingFieldDiscretization::checkForUnserialization(const std::vector& tinyInfo, const DataArrayInt *arr) +void MEDCouplingFieldDiscretization::checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr) { } @@ -364,11 +364,11 @@ void MEDCouplingFieldDiscretization::finishUnserialization(const std::vector& refCoo, +void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh *m, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); @@ -390,57 +390,57 @@ void MEDCouplingFieldDiscretization::clearGaussLocalizations() 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 MEDCouplingFieldDiscretization::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const +std::set 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& cellIds) const +void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& 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 arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(newNbOfTuples); double *ptToFill=arr->getPointer(); std::fill(ptToFill,ptToFill+nbOfComp*newNbOfTuples,std::numeric_limits::max()); INTERP_KERNEL::AutoPtr tmp=new double[nbOfComp]; - for(int i=0;i=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(),std::numeric_limits::max())) @@ -463,16 +463,16 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons } } -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 arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(new2OldSz); double *ptToFill=arr->getPointer(); - for(int i=0;igetNumberOfCells()); + return mesh->getNumberOfCells(); } /*! @@ -547,19 +547,19 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfTuples(const MEDCouplingMesh *m * 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& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& 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=nbOfSplit) @@ -567,8 +567,8 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(con 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()); @@ -579,39 +579,39 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(con 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& 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::const_iterator it=arrays.begin();it!=arrays.end();it++) { if(*it) (*it)->renumberInPlace(array); } if(check) - free(const_cast(array)); + free(const_cast(array)); } DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const @@ -621,15 +621,15 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(c 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 tmp=DataArrayInt::New(); - tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayIdType::New(); + tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); - MCAuto tmp2(tmp->deepCopy()); + MCAuto tmp2(tmp->deepCopy()); cellRestriction=tmp.retn(); trueTupleRestriction=tmp2.retn(); } @@ -647,7 +647,7 @@ void MEDCouplingFieldDiscretizationP0::checkCoherencyBetween(const MEDCouplingMe { 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(); @@ -667,34 +667,34 @@ void MEDCouplingFieldDiscretizationP0::getValueOn(const DataArrayDouble *arr, co { 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(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 eltsArr,eltsIndexArr; + MCAuto 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 ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); - for(int i=0;i=1) arr->getTuple(elts[eltsIndex[i]],ptToFill); else @@ -710,16 +710,16 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArr /*! * 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"); } @@ -732,10 +732,10 @@ void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingM * \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 ret=DataArrayInt::New(); - ret->alloc((int)std::distance(startCellIds,endCellIds),1); + MCAuto ret=DataArrayIdType::New(); + ret->alloc(std::distance(startCellIds,endCellIds),1); std::copy(startCellIds,endCellIds,ret->getPointer()); return ret.retn(); } @@ -747,13 +747,13 @@ DataArrayInt *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellI * * \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 ret=mesh->buildPart(start,end); - MCAuto diSafe=DataArrayInt::New(); - diSafe->alloc((int)std::distance(start,end),1); + MCAuto diSafe=DataArrayIdType::New(); + diSafe->alloc(std::distance(start,end),1); std::copy(start,end,diSafe->getPointer()); di=diSafe.retn(); return ret.retn(); @@ -769,7 +769,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCou * * \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 !"); @@ -783,7 +783,7 @@ MCAuto MEDCouplingFieldDiscretizationP0::aggrega return EasyAggregate(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 !"); @@ -796,19 +796,19 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuples(const MEDCouplingMe * 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& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& 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=nbOfSplit) @@ -816,8 +816,8 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCod 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()); @@ -828,7 +828,7 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCod 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 !"); @@ -839,16 +839,16 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCoupli * Nothing to do here. */ void MEDCouplingFieldDiscretizationOnNodes::renumberArraysForCell(const MEDCouplingMesh *, const std::vector& 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; @@ -861,17 +861,17 @@ DataArrayDouble *MEDCouplingFieldDiscretizationOnNodes::getLocalizationOfDiscVal 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 ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd); + MCAuto ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd); const MEDCouplingUMesh *meshc=dynamic_cast(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 meshPart=static_cast(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true)); - MCAuto ret2=meshPart->computeFetchedNodeIds(); + MCAuto ret2=meshPart->computeFetchedNodeIds(); cellRestriction=ret1.retn(); trueTupleRestriction=ret2.retn(); } @@ -880,7 +880,7 @@ void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCoupl { 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(); @@ -894,14 +894,14 @@ void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCoupl * @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 ret=mesh->buildPartAndReduceNodes(start,end,diTmp); - MCAuto diTmpSafe(diTmp); - MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); + MCAuto diTmpSafe(diTmp); + MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); di=di2.retn(); return ret.retn(); } @@ -916,16 +916,16 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const M * * \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 ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp); if(diTmp) { - MCAuto diTmpSafe(diTmp); - MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); + MCAuto diTmpSafe(diTmp); + MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); di=di2.retn(); } return ret.retn(); @@ -939,7 +939,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(co * \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 !"); @@ -948,7 +948,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFrom 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"); } @@ -956,23 +956,23 @@ void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnNodes(double epsOnVa /*! * 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(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); } @@ -1032,7 +1032,7 @@ void MEDCouplingFieldDiscretizationP1::getValueOn(const DataArrayDouble *arr, co { 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); @@ -1045,14 +1045,14 @@ void MEDCouplingFieldDiscretizationP1::getValueOn(const DataArrayDouble *arr, co * 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 conn; + std::vector conn; std::vector coo; mesh->getNodeIdsOfCell(cellId,conn); - for(std::vector::const_iterator iter=conn.begin();iter!=conn.end();iter++) + for(std::vector::const_iterator iter=conn.begin();iter!=conn.end();iter++) mesh->getCoordinatesOfNode(*iter,coo); int spaceDim=mesh->getSpaceDimension(); std::size_t nbOfNodes=conn.size(); @@ -1073,19 +1073,19 @@ void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mes } } -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 eltsArr,eltsIndexArr; + MCAuto 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 ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); - for(int i=0;i=1) getValueInCell(mesh,elts[eltsIndex[i]],arr,loc+i*spaceDim,ptToFill+i*nbOfComponents); else @@ -1119,11 +1119,11 @@ MEDCouplingFieldDiscretizationPerCell::~MEDCouplingFieldDiscretizationPerCell() } /*! - * 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) @@ -1133,16 +1133,16 @@ MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(con } } -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(); @@ -1173,7 +1173,7 @@ void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCoupl 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 !"); } @@ -1197,7 +1197,7 @@ bool MEDCouplingFieldDiscretizationPerCell::isEqualIfNotWhy(const MEDCouplingFie 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; } @@ -1217,19 +1217,19 @@ bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const M * 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(array)); + free(const_cast(array)); } void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh) @@ -1238,10 +1238,10 @@ void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const M 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); } } @@ -1250,7 +1250,7 @@ void MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells() const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : no discretization defined !"); - MCAuto test=_discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE); + MCAuto test( _discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE)); if(test->getNumberOfTuples()!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : presence of orphan cells !"); } @@ -1265,25 +1265,25 @@ void MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells() const * * If no descretization is set in 'this' and exception will be thrown. */ -std::vector MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType(std::vector& locIds) const +std::vector MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType(std::vector& 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(adids); + _discr_per_cell=const_cast(adids); if(_discr_per_cell) _discr_per_cell->incrRef(); declareAsNew(); @@ -1294,11 +1294,11 @@ MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss() { } -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) { } @@ -1364,12 +1364,12 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clone() con 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); } @@ -1382,7 +1382,7 @@ std::string MEDCouplingFieldDiscretizationGauss::getStringRepr() const if(_discr_per_cell->isAllocated()) { oss << "Discretization per cell : "; - std::copy(_discr_per_cell->begin(),_discr_per_cell->end(),std::ostream_iterator(oss,", ")); + std::copy(_discr_per_cell->begin(),_discr_per_cell->end(),std::ostream_iterator(oss,", ")); oss << std::endl; } } @@ -1417,21 +1417,21 @@ const char *MEDCouplingFieldDiscretizationGauss::getRepr() const * 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& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& 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=nbOfSplit) @@ -1439,8 +1439,8 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode( 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()); @@ -1456,15 +1456,15 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode( 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 && *wgetNumberOfCells()); + 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 ret=DataArrayInt::New(); + mcIdType nbOfTuples=mesh->getNumberOfCells(); + MCAuto 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& 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;irenumberInPlace(array2); delete [] array2; if(check) - free(const_cast(array)); + free(const_cast(array)); } DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const @@ -1552,20 +1552,20 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValue throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !"); checkNoOrphanCells(); MCAuto umesh=mesh->buildUnstructured();//in general do nothing - int nbOfTuples=getNumberOfTuples(mesh); + mcIdType nbOfTuples=getNumberOfTuples(mesh); MCAuto ret=DataArrayDouble::New(); int spaceDim=mesh->getSpaceDimension(); ret->alloc(nbOfTuples,spaceDim); - std::vector< int > locIds; - std::vector parts=splitIntoSingleGaussDicrPerCellType(locIds); - std::vector< MCAuto > parts2(parts.size()); + std::vector< mcIdType > locIds; + std::vector parts=splitIntoSingleGaussDicrPerCellType(locIds); + std::vector< MCAuto > parts2(parts.size()); std::copy(parts.begin(),parts.end(),parts2.begin()); - MCAuto offsets=buildNbOfGaussPointPerCellField(); + MCAuto 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& 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 tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayIdType::New(); tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); tmp->sort(true); tmp=tmp->buildUnique(); - MCAuto nbOfNodesPerCell=buildNbOfGaussPointPerCellField(); + MCAuto nbOfNodesPerCell=buildNbOfGaussPointPerCellField(); nbOfNodesPerCell->computeOffsetsFull(); nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); } @@ -1606,13 +1606,13 @@ void MEDCouplingFieldDiscretizationGauss::checkCompatibilityWithNature(NatureOfF { } -void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std::vector& 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 @@ -1627,19 +1627,19 @@ void MEDCouplingFieldDiscretizationGauss::getTinySerializationDbleInformation(st (*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& tinyInfo, DataArrayInt *& arr) +void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::vector& 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 @@ -1648,16 +1648,16 @@ void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::ve commonUnserialization(tinyInfo); } -void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector& tinyInfo, const DataArrayInt *arr) +void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector& 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(arr); + _discr_per_cell=const_cast(arr); _discr_per_cell->incrRef(); } else @@ -1675,9 +1675,9 @@ void MEDCouplingFieldDiscretizationGauss::finishUnserialization(const std::vecto 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); } @@ -1688,10 +1688,10 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da); for(std::vector::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;igetNumberOfCells(); + const mcIdType *dc=_discr_per_cell->getConstPointer(); + for(mcIdType i=0;i=nbOfDesc) { @@ -1733,28 +1733,28 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con 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 offset=getOffsetArr(mesh); + MCAuto offset=getOffsetArr(mesh); MCAuto 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 locIds; - std::vector ids=splitIntoSingleGaussDicrPerCellType(locIds); - std::vector< MCAuto > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin()); + const mcIdType *offsetPtr=offset->getConstPointer(); + mcIdType maxGaussLoc=ToIdType(_loc.size()); + std::vector locIds; + std::vector ids=splitIntoSingleGaussDicrPerCellType(locIds); + std::vector< MCAuto > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin()); for(std::size_t i=0;i=0 && locId 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(),1./sum)); - for(const int *cellId=curIds->begin();cellId!=curIds->end();cellId++) - for(int j=0;jbegin();cellId!=curIds->end();cellId++) + for(mcIdType j=0;j diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); + MCAuto diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); MCAuto ret=mesh->buildPart(start,end); di=diSafe.retn(); return ret.retn(); @@ -1802,7 +1802,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshData(const MED * * \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); @@ -1813,15 +1813,15 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(cons 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;ibegin(); + mcIdType nbMaxOfLocId=ToIdType(_loc.size()); + for(mcIdType i=0;i=0 && *w nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer - std::size_t nbOfCells(mesh->getNumberOfCells()); - if(_discr_per_cell->getNumberOfTuples()!=ToIdType(nbOfCells)) + MCAuto 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 sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); + MCAuto 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 !"); } @@ -1880,7 +1880,7 @@ MCAuto MEDCouplingFieldDiscretizationGauss::aggr if(fds.empty()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : input array is empty"); std::vector loc;//store the localizations for the output GaussDiscretization object - std::vector< MCAuto > discPerCells(fds.size()); + std::vector< MCAuto > discPerCells(fds.size()); std::size_t i(0); for(auto it=fds.begin();it!=fds.end();++it,++i) { @@ -1889,7 +1889,7 @@ MCAuto MEDCouplingFieldDiscretizationGauss::aggr throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : same field discretization expected for all input discretizations !"); // std::vector loc2(itc->_loc); - std::vector newLocId(loc2.size()); + std::vector newLocId(loc2.size()); for(std::size_t j=0;j MEDCouplingFieldDiscretizationGauss::aggr { 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 dpc2(dpc->deepCopy()); + MCAuto dpc2(dpc->deepCopy()); dpc2->transformWithIndArr(newLocId.data(),newLocId.data()+newLocId.size()); discPerCells[i]=dpc2; } - MCAuto dpc3(DataArrayInt::Aggregate(ToConstVect(discPerCells))); + MCAuto dpc3(DataArrayIdType::Aggregate(ToConstVect(discPerCells))); MCAuto ret(new MEDCouplingFieldDiscretizationGauss(dpc3,loc)); return DynamicCast(ret); } @@ -1925,25 +1925,25 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType(const MEDCo 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;igetPointer(); + mcIdType nbCells=mesh->getNumberOfCells(); + for(mcIdType i=0;igetTypeOfCell(i)==type) ptr[i]=id; zipGaussLocalizations(); } -void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector& refCoo, +void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) { if(!mesh) @@ -1953,9 +1953,9 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDC 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) { @@ -1964,7 +1964,7 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDC } } // - for(const int *w2=begin;w2!=end;w2++) + for(const mcIdType *w2=begin;w2!=end;w2++) ptr[*w2]=id; // _loc.push_back(elt); @@ -1981,18 +1981,18 @@ void MEDCouplingFieldDiscretizationGauss::clearGaussLocalizations() _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 !"); @@ -2000,30 +2000,30 @@ void MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector(int newSz) _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 ret=getGaussLocalizationIdsOfOneType(type); + std::set ret=getGaussLocalizationIdsOfOneType(type); if(ret.empty()) throw INTERP_KERNEL::Exception("No gauss discretization found for the specified type !"); if(ret.size()>1) @@ -2031,46 +2031,46 @@ int MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_ return *ret.begin(); } -std::set MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const +std::set MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("No Gauss localization still set !"); - std::set ret; - int id=0; + std::set ret; + mcIdType id=0; for(std::vector::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& cellIds) const +void MEDCouplingFieldDiscretizationGauss::getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& 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;igetConstPointer(); + for(mcIdType i=0;i=(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; } @@ -2081,17 +2081,17 @@ int MEDCouplingFieldDiscretizationGauss::getOffsetOfCell(int cellId) const * 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 ret=DataArrayInt::New(); - const int *w=_discr_per_cell->begin(); + MCAuto 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;igetPointer(); + mcIdType nbMaxOfLocId=ToIdType(_loc.size()); + for(mcIdType i=0;i=0 && *wbegin(); + const mcIdType *start=_discr_per_cell->begin(); mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); - INTERP_KERNEL::AutoPtr 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 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;igetPointer(); - 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 tmpLoc; - for(int i=0;i<(int)_loc.size();i++) + for(mcIdType i=0;i& tinyInfo) +void MEDCouplingFieldDiscretizationGauss::commonUnserialization(const std::vector& 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 tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta); + std::vector tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta); MEDCouplingGaussLocalization elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp); _loc.push_back(elt); } @@ -2212,14 +2212,14 @@ bool MEDCouplingFieldDiscretizationGaussNE::isEqualIfNotWhy(const MEDCouplingFie * 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& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& 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=nbOfSplit) @@ -2238,24 +2238,24 @@ int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCod 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;igetTypeOfCell(i); @@ -2267,23 +2267,23 @@ int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMe 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;igetTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); @@ -2295,30 +2295,30 @@ DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCoupl } void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& 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;igetTypeOfCell((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;igetTypeOfCell(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;krenumberInPlace(array2); delete [] array2; if(check) - free(const_cast(array)); + free(const_cast(array)); } DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const @@ -2336,16 +2336,16 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscVal throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !"); MCAuto ret=DataArrayDouble::New(); MCAuto 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=0) retPtr=std::copy(coords+(*w)*spaceDim,coords+((*w)+1)*spaceDim,retPtr); return ret.retn(); @@ -2363,7 +2363,7 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh // MCAuto vol=mesh->getMeasureField(isWAbs); std::set types=mesh->getAllGeoTypes(); - MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); nbOfNodesPerCell->computeOffsetsFull(); const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin(); for(std::set::const_iterator it=types.begin();it!=types.end();it++) @@ -2373,11 +2373,11 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); - MCAuto ids=mesh->giveCellsWithType(*it); - MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); - const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); + MCAuto ids=mesh->giveCellsWithType(*it); + MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); + const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); - for(int i=0;i tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayIdType::New(); tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); tmp->sort(true); tmp=tmp->buildUnique(); - MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); nbOfNodesPerCell->computeOffsetsFull(); nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); } @@ -2644,12 +2644,12 @@ void MEDCouplingFieldDiscretizationGaussNE::checkCompatibilityWithNature(NatureO { } -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;igetTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); @@ -2678,8 +2678,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c ret->setMesh(mesh); // std::set types=mesh->getAllGeoTypes(); - MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); - int nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + mcIdType nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0); nbOfNodesPerCell->computeOffsetsFull(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbTuples,1); ret->setArray(arr); @@ -2691,11 +2691,11 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); - MCAuto ids=mesh->giveCellsWithType(*it); - MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); - const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); + MCAuto ids=mesh->giveCellsWithType(*it); + MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); + const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); - for(int i=0;i diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); + MCAuto diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); MCAuto ret=mesh->buildPart(start,end); di=diSafe.retn(); return ret.retn(); @@ -2738,22 +2738,22 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData(const M * * \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;igetTypeOfCell(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 nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); nbOfNodesPerCell->computeOffsetsFull(); - MCAuto sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); + MCAuto 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 !"); } @@ -2799,7 +2799,7 @@ MCAuto MEDCouplingFieldDiscretizationGaussNE::ag return EasyAggregate(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 !"); } @@ -2871,17 +2871,17 @@ void MEDCouplingFieldDiscretizationKriging::getValueOn(const DataArrayDouble *ar 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 m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols)); MCAuto ret(DataArrayDouble::New()); @@ -2905,9 +2905,9 @@ MCAuto MEDCouplingFieldDiscretizationKriging::ag * * \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 matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); // MCAuto coords=getLocalizationOfDiscValues(mesh); @@ -2924,12 +2924,12 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO matrix3->alloc(nbOfTargetPoints*nbRows,1); double *work=matrix3->getPointer(); const double *workCst(matrix2->begin()),*workCst2(loc); - for(int i=0;i ret(DataArrayDouble::New()); @@ -2938,7 +2938,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO MCAuto ret2(DataArrayDouble::New()); ret2->alloc(nbOfTargetPoints*nbOfPts,1); workCst=ret->begin(); work=ret2->getPointer(); - for(int i=0;i matrixWithDrift(computeMatrix(mesh,isDrift,matSz)); MCAuto matrixInv(DataArrayDouble::New()); @@ -2966,7 +2966,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeInverseMatrix(con * \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 !"); @@ -2990,9 +2990,9 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDC * 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 matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); MCAuto KnewiK(DataArrayDouble::New()); KnewiK->alloc(nbRows*1,1); @@ -3008,7 +3008,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficie * \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) { @@ -3032,18 +3032,18 @@ void MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix(int spaceDimens } } -void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH3(int nbOfElems, double *matrixPtr) +void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH3(mcIdType nbOfElems, double *matrixPtr) { - for(int i=0;iisAllocated() || matr->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input dense matrix ! Must be allocated not NULL and with exactly one component !"); @@ -3068,13 +3068,13 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftRect(const D 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 ret(DataArrayDouble::New()); ret->alloc(nbOfPts*(nbOfCols+delta)); double *retPtr(ret->getPointer()); const double *mPtr(matr->begin()),*aPtr(arr->begin()); - for(int i=0;iisAllocated() || arr->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec : input array must be not NULL allocated and with one component !"); @@ -3111,7 +3111,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const * \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; diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx index 51736bc19..da7a4ca3d 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx @@ -35,7 +35,7 @@ namespace MEDCoupling { class DataArray; - class DataArrayInt; + class DataArrayIdType; class MEDCouplingMesh; class DataArrayDouble; class MEDCouplingFieldDouble; @@ -57,61 +57,61 @@ namespace MEDCoupling 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& code, const std::vector& 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& code, const std::vector& 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& 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 aggregate(std::vector& fds) const = 0; - MEDCOUPLING_EXPORT virtual void getSerializationIntArray(DataArrayInt *& arr) const; - MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT virtual void getSerializationIntArray(DataArrayIdType *& arr) const; + MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector& tinyInfo); - MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr); - MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfo, const DataArrayInt *arr); + MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr); + MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr); MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); - MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector& refCoo, + MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& 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 getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT virtual void getCellIdsHavingGaussLocalization(int locId, std::vector& 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 getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT virtual void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& 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 static MCAuto EasyAggregate(std::vector& fds); protected: @@ -127,28 +127,28 @@ namespace MEDCoupling 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& code, const std::vector& 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& code, const std::vector& 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& 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 aggregate(std::vector& 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[]; @@ -158,24 +158,24 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationOnNodes : public MEDCouplingFieldDiscretization { public: - MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& 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& code, const std::vector& 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& 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 @@ -189,14 +189,14 @@ namespace MEDCoupling 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 aggregate(std::vector& 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; }; /*! @@ -206,15 +206,15 @@ namespace MEDCoupling 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 splitIntoSingleGaussDicrPerCellType(std::vector< int >& locIds) const; + MEDCOUPLING_EXPORT std::vector 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; @@ -222,12 +222,12 @@ namespace MEDCoupling 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 @@ -238,64 +238,64 @@ namespace MEDCoupling 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& code, const std::vector& 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& code, const std::vector& 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& 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& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfo); - MEDCOUPLING_EXPORT void getSerializationIntArray(DataArrayInt *& arr) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr); - MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& 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& tinyInfo, DataArrayIdType *& arr); + MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& 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 aggregate(std::vector& fds) const override; MEDCOUPLING_EXPORT void setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); - MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector& refCoo, + MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& 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 getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector& 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 getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& 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& 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& loc):MEDCouplingFieldDiscretizationPerCell(dpc),_loc(loc) { } void zipGaussLocalizations(); - int getOffsetOfCell(int cellId) const; - void checkLocalizationId(int locId) const; - void commonUnserialization(const std::vector& tinyInfo); + mcIdType getOffsetOfCell(mcIdType cellId) const; + void checkLocalizationId(mcIdType locId) const; + void commonUnserialization(const std::vector& tinyInfo); public: static const char REPR[]; static const TypeOfField TYPE; @@ -315,29 +315,29 @@ namespace MEDCoupling 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& code, const std::vector& 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& code, const std::vector& 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& 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 aggregate(std::vector& 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); @@ -416,20 +416,20 @@ namespace MEDCoupling 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 aggregate(std::vector& 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; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 64a49f171..e2113c3e3 100755 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -226,7 +226,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const const double *srcPt(arrs[j]->begin()); for(mcIdType i=0;i nodeIds; + std::vector nodeIds; m->getNodeIdsOfCell(i,nodeIds); std::fill(pt,pt+nbCompo,0.); std::size_t nbNodesInCell(nodeIds.size()); @@ -268,9 +268,9 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const MCAuto nsp(new MEDCouplingFieldDiscretizationP1); ret->setDiscretization(nsp); const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call - MCAuto rn(DataArrayInt::New()),rni(DataArrayInt::New()); + MCAuto rn(DataArrayIdType::New()),rni(DataArrayIdType::New()); m->getReverseNodalConnectivity(rn,rni); - MCAuto rni2(rni->deltaShiftIndex()); + MCAuto rni2(rni->deltaShiftIndex()); MCAuto rni3(rni2->convertToDblArr()); rni2=0; std::vector arrs(getArrays()); std::size_t sz(arrs.size()); @@ -388,14 +388,14 @@ bool MEDCouplingFieldDouble::areCompatibleForMeld(const MEDCouplingFieldDouble * * \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(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("Invalid mesh to apply renumberNodes on it !"); - int nbOfNodes=meshC->getNumberOfNodes(); + mcIdType nbOfNodes=meshC->getNumberOfNodes(); MCAuto 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); @@ -423,7 +423,7 @@ void MEDCouplingFieldDouble::renumberNodes(const int *old2NewBg, double eps) * \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 !"); @@ -441,13 +441,13 @@ void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, int * 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 !"); @@ -547,7 +547,7 @@ double MEDCouplingFieldDouble::getMaxValue() const if(*iter) { isExistingArr=true; - int loc; + mcIdType loc; ret=std::max(ret,(*iter)->getMaxValue(loc)); } } @@ -559,30 +559,30 @@ double MEDCouplingFieldDouble::getMaxValue() const /*! * 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 arrays; timeDiscr()->getArrays(arrays); double ret(-std::numeric_limits::max()); bool isExistingArr=false; tupleIds=0; - MCAuto ret1; + MCAuto ret1; for(std::vector::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 tmpSafe(tmp); - if(!((const DataArrayInt *)ret1)) + MCAuto tmpSafe(tmp); + if(!((const DataArrayIdType *)ret1)) ret1=tmpSafe; } } @@ -611,7 +611,7 @@ double MEDCouplingFieldDouble::getMinValue() const if(*iter) { isExistingArr=true; - int loc; + mcIdType loc; ret=std::min(ret,(*iter)->getMinValue(loc)); } } @@ -623,30 +623,30 @@ double MEDCouplingFieldDouble::getMinValue() const /*! * 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 arrays; timeDiscr()->getArrays(arrays); double ret(-std::numeric_limits::max()); bool isExistingArr=false; tupleIds=0; - MCAuto ret1; + MCAuto ret1; for(std::vector::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 tmpSafe(tmp); - if(!((const DataArrayInt *)ret1)) + MCAuto tmpSafe(tmp); + if(!((const DataArrayIdType *)ret1)) ret1=tmpSafe; } } @@ -1034,7 +1034,7 @@ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, dou std::vector 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]); } @@ -1077,7 +1077,7 @@ MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value) 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; } @@ -1288,7 +1288,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, double val) 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); } @@ -1513,7 +1513,7 @@ mcIdType MEDCouplingFieldDouble::getNumberOfTuples() const * 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 !"); @@ -1561,7 +1561,7 @@ std::vector MEDCouplingFieldDouble::getDirectChildrenWi * \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 !"); @@ -1627,9 +1627,9 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, { 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 cellCor2(cellCor),nodeCor2(nodeCor); + MCAuto cellCor2(cellCor),nodeCor2(nodeCor); if(cellCor) renumberCellsWithoutMesh(cellCor->getConstPointer(),false); if(nodeCor) @@ -1708,8 +1708,8 @@ bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodes !"); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); bool ret; - int ret2; - MCAuto arr=meshC2->mergeNodes(eps,ret,ret2); + mcIdType ret2; + MCAuto arr=meshC2->mergeNodes(eps,ret,ret2); if(!ret)//no nodes have been merged. return ret; std::vector arrays; @@ -1747,8 +1747,8 @@ bool MEDCouplingFieldDouble::mergeNodesCenter(double eps, double epsOnVals) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodesCenter !"); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); bool ret; - int ret2; - MCAuto arr=meshC2->mergeNodesCenter(eps,ret,ret2); + mcIdType ret2; + MCAuto arr=meshC2->mergeNodesCenter(eps,ret,ret2); if(!ret)//no nodes have been merged. return ret; std::vector arrays; @@ -1783,8 +1783,8 @@ bool MEDCouplingFieldDouble::zipCoords(double epsOnVals) if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipCoords !"); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); - int oldNbOfNodes=meshC2->getNumberOfNodes(); - MCAuto arr=meshC2->zipCoordsTraducer(); + mcIdType oldNbOfNodes=meshC2->getNumberOfNodes(); + MCAuto arr=meshC2->zipCoordsTraducer(); if(meshC2->getNumberOfNodes()!=oldNbOfNodes) { std::vector arrays; @@ -1824,8 +1824,8 @@ bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals) if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !"); MCAuto meshC2((MEDCouplingUMesh *)meshC->deepCopy()); - std::size_t oldNbOfCells(meshC2->getNumberOfCells()); - MCAuto arr=meshC2->zipConnectivityTraducer(compType); + mcIdType oldNbOfCells(meshC2->getNumberOfCells()); + MCAuto arr=meshC2->zipConnectivityTraducer(compType); if(meshC2->getNumberOfCells()!=oldNbOfCells) { std::vector arrays; @@ -1855,11 +1855,11 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::extractSlice3D(const double *ori const MCAuto umesh(mesh->buildUnstructured()); MCAuto ret(clone(false)); ret->setMesh(umesh); - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; MCAuto mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds); - MCAuto cellIds2=cellIds; + MCAuto cellIds2=cellIds; ret->setMesh(mesh2); - MCAuto tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); + MCAuto tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); std::vector arrays; timeDiscr()->getArrays(arrays); int i=0; @@ -1900,7 +1900,7 @@ bool MEDCouplingFieldDouble::simplexize(int policy) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !"); std::size_t oldNbOfCells=_mesh->getNumberOfCells(); MCAuto meshC2(_mesh->deepCopy()); - MCAuto arr=meshC2->simplexize(policy); + MCAuto arr=meshC2->simplexize(policy); std::size_t newNbOfCells=meshC2->getNumberOfCells(); if(oldNbOfCells==newNbOfCells) return false; @@ -1922,7 +1922,7 @@ MCAuto MEDCouplingFieldDouble::voronoize(double eps) con checkConsistencyLight(); const MEDCouplingMesh *mesh(getMesh()); INTERP_KERNEL::AutoCppPtr 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)) @@ -1950,8 +1950,8 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi MCAuto umesh(mesh->buildUnstructured()); umesh=umesh->clone(false); umesh->convertQuadraticCellsToLinear(); - MCAuto o2n(umesh->zipCoordsTraducer()); - MCAuto n2o(o2n->invertArrayO2N2N2O(umesh->getNumberOfNodes())); + MCAuto o2n(umesh->zipCoordsTraducer()); + MCAuto n2o(o2n->invertArrayO2N2N2O(umesh->getNumberOfNodes())); MCAuto arr(getArray()->selectByTupleIdSafe(n2o->begin(),n2o->end())); MCAuto ret(MEDCouplingFieldDouble::New(ON_NODES)); ret->setArray(arr); @@ -1988,17 +1988,17 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi if(!disc2) throw INTERP_KERNEL::Exception("convertQuadraticCellsToLinear : Not a ON_GAUSS_PT field"); std::set gt2(umesh->getAllGeoTypes()); - std::vector< MCAuto > cellIdsV; + std::vector< MCAuto > cellIdsV; std::vector< MCAuto > meshesV; std::vector< MEDCouplingGaussLocalization > glV; bool isZipReq(false); for(std::set::const_iterator it=gt.begin();it!=gt.end();it++) { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it)); - MCAuto cellIds(umesh->giveCellsWithType(*it)); + MCAuto cellIds(umesh->giveCellsWithType(*it)); cellIdsV.push_back(cellIds); MCAuto 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()) { @@ -2019,8 +2019,8 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi { std::vector< const MEDCouplingUMesh * > meshesPtr(VecAutoToVecOfCstPt(meshesV)); umesh=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshesPtr); - std::vector< const DataArrayInt * > zeCellIds(VecAutoToVecOfCstPt(cellIdsV)); - MCAuto zeIds(DataArrayInt::Aggregate(zeCellIds)); + std::vector< const DataArrayIdType * > zeCellIds(VecAutoToVecOfCstPt(cellIdsV)); + MCAuto zeIds(DataArrayIdType::Aggregate(zeCellIds)); umesh->renumberCells(zeIds->begin()); umesh->setName(mesh->getName()); } @@ -2312,14 +2312,6 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std ret->setMesh(getMesh()); return ret.retn(); } -MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector& compoIds) const -{ - // The method has to be removed as duplicate after SWIG update - std::vector ids (compoIds.size()); - cast_to_remove (compoIds, ids); - return keepSelectedComponents(ids); -} - /*! * Copy all components in a specified order from another field. @@ -2336,11 +2328,6 @@ void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble { timeDiscr()->setSelectedComponents(f->timeDiscr(),compoIds); } -void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector& 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. @@ -2414,7 +2401,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vectorareCompatibleForMerge(*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 MEDCouplingFieldDouble::voronoizeGen(const Voroni 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(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 > cells(nbCells); - for(int i=0;igetGaussLocalization(i)); if(gl.getDimension()!=vor->getDimension()) @@ -2947,14 +2934,14 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni MCAuto coo3(MEDCouplingUMesh::Build0DMeshFromCoords(coo2)); // MCAuto vorCellsForCurDisc(vor->doIt(mesh,coo2,eps)); - std::vector ids; + std::vector ids; MCAuto ptsInReal; disc2->getCellIdsHavingGaussLocalization(i,ids); { MCAuto 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 elt(vorCellsForCurDisc->clone(false)); diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index 016a33842..6d4b572a5 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -41,9 +41,9 @@ namespace MEDCoupling 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; @@ -51,13 +51,13 @@ namespace MEDCoupling 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; @@ -91,7 +91,7 @@ namespace MEDCoupling 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 getDirectChildrenWithNull() const; @@ -118,7 +118,6 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble *maxPerTuple() const; MEDCOUPLING_EXPORT void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.); MEDCOUPLING_EXPORT MEDCouplingFieldDouble *keepSelectedComponents(const std::vector& compoIds) const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *keepSelectedComponents(const std::vector& compoIds) const; MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector& compoIds); MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector& compoIds); MEDCOUPLING_EXPORT void sortPerTuple(bool asc); diff --git a/src/MEDCoupling/MEDCouplingFieldFloat.cxx b/src/MEDCoupling/MEDCouplingFieldFloat.cxx index 8fbc9ef69..7fbbce57f 100644 --- a/src/MEDCoupling/MEDCouplingFieldFloat.cxx +++ b/src/MEDCoupling/MEDCouplingFieldFloat.cxx @@ -23,6 +23,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" +#include "MEDCouplingMemArray.txx" using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingFieldInt.cxx b/src/MEDCoupling/MEDCouplingFieldInt.cxx index 42aa53538..66637f2e3 100644 --- a/src/MEDCoupling/MEDCouplingFieldInt.cxx +++ b/src/MEDCoupling/MEDCouplingFieldInt.cxx @@ -23,6 +23,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" +#include "MEDCouplingMemArray.txx" using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingFieldT.hxx b/src/MEDCoupling/MEDCouplingFieldT.hxx index b1635504b..f9b22d3de 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.hxx +++ b/src/MEDCoupling/MEDCouplingFieldT.hxx @@ -46,9 +46,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual typename Traits::FieldType *clone(bool recDeepCpy) const = 0; MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT typename Traits::FieldType *cloneWithMesh(bool recDeepCpy) const; - MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const DataArrayInt *part) const; - MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const int *partBg, const int *partEnd) const; - MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPartRange(int begin, int end, int step) const; + MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const DataArrayIdType *part) const; + MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const; + MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPartRange(mcIdType begin, mcIdType end, mcIdType step) const; MEDCOUPLING_EXPORT void setArray(typename Traits::ArrayType *array) { _time_discr->setArray(array,this); } MEDCOUPLING_EXPORT void setEndArray(typename Traits::ArrayType *array) { _time_discr->setEndArray(array,this); } MEDCOUPLING_EXPORT const typename Traits::ArrayType *getArray() const { return _time_discr->getArray(); } @@ -74,7 +74,7 @@ namespace MEDCoupling 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 *other, double meshPrec, T valsPrec) const; MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldT *other, double meshPrec, T valsPrec, std::string& reason) const; MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldT *other, double meshPrec, T valsPrec) const; @@ -88,16 +88,16 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool areCompatibleForDiv(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingFieldT *other); MEDCOUPLING_EXPORT void copyAllTinyAttrFrom(const MEDCouplingFieldT *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& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const DataArrayInt *dataInt, const std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const DataArrayIdType *dataInt, const std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) const; MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretizationTemplate *timeDiscrSafe() const; protected: MEDCouplingTimeDiscretizationTemplate *timeDiscrSafe(); diff --git a/src/MEDCoupling/MEDCouplingFieldT.txx b/src/MEDCoupling/MEDCouplingFieldT.txx index 91c3d15de..c59c5c069 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.txx +++ b/src/MEDCoupling/MEDCouplingFieldT.txx @@ -228,7 +228,7 @@ namespace MEDCoupling * \endif */ template - void MEDCouplingFieldT::renumberCells(const int *old2NewBg, bool check) + void MEDCouplingFieldT::renumberCells(const mcIdType *old2NewBg, bool check) { renumberCellsWithoutMesh(old2NewBg,check); MCAuto m(_mesh->deepCopy()); @@ -259,7 +259,7 @@ namespace MEDCoupling * \throw If mesh nature does not allow renumbering (e.g. structured mesh). */ template - void MEDCouplingFieldT::renumberCellsWithoutMesh(const int *old2NewBg, bool check) + void MEDCouplingFieldT::renumberCellsWithoutMesh(const mcIdType *old2NewBg, bool check) { if(!_mesh) throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !"); @@ -474,13 +474,13 @@ namespace MEDCoupling * \sa MEDCoupling::MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *) const, MEDCouplingFieldDouble::buildSubPartRange */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const int *partBg, const int *partEnd) const + typename Traits::FieldType *MEDCouplingFieldT::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 m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect); - MCAuto arrSelect2(arrSelect); + MCAuto arrSelect2(arrSelect); MCAuto< typename Traits::FieldType > ret(clone(false));//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) @@ -490,8 +490,8 @@ namespace MEDCoupling timeDiscrSafe()->getArrays(arrays); std::vector::ArrayType *> arrs; std::vector< MCAuto< typename Traits::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::ArrayType *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { typename Traits::ArrayType *arr(0); @@ -534,7 +534,7 @@ namespace MEDCoupling * \sa MEDCouplingFieldDouble::buildSubPartRange */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const DataArrayInt *part) const + typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const DataArrayIdType *part) const { if(part==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : not empty array must be passed to this method !"); @@ -548,14 +548,14 @@ namespace MEDCoupling * \sa MEDCouplingFieldDouble::buildSubPart */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPartRange(int begin, int end, int step) const + typename Traits::FieldType *MEDCouplingFieldT::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 m(_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect)); - MCAuto arrSelect2(arrSelect); + MCAuto arrSelect2(arrSelect); MCAuto< typename Traits::FieldType > ret(clone(false));//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) @@ -572,8 +572,8 @@ namespace MEDCoupling { 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 @@ -619,19 +619,19 @@ namespace MEDCoupling * @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny. */ template - void MEDCouplingFieldT::getTinySerializationIntInformation(std::vector& tinyInfo) const + void MEDCouplingFieldT::getTinySerializationIntInformation(std::vector& 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 tinyInfo2; + std::vector tinyInfo2; _type->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - tinyInfo.push_back((int)tinyInfo2.size()); + tinyInfo.push_back(ToIdType(tinyInfo2.size())); } /*! @@ -660,18 +660,18 @@ namespace MEDCoupling * \sa checkForUnserialization */ template - void MEDCouplingFieldT::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) + void MEDCouplingFieldT::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); dataInt=0; - std::vector tinyInfoITmp(tinyInfoI); - int sz=tinyInfoITmp.back(); + std::vector tinyInfoITmp(tinyInfoI); + mcIdType sz=tinyInfoITmp.back(); tinyInfoITmp.pop_back(); - std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); - std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); + std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); + std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); timeDiscrSafe()->resizeForUnserialization(tinyInfoI2,arrays); - std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); + std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); _type->resizeForUnserialization(tinyInfoITmp3,dataInt); } @@ -681,29 +681,29 @@ namespace MEDCoupling * \sa resizeForUnserialization */ template - void MEDCouplingFieldT::checkForUnserialization(const std::vector& tinyInfoI, const DataArrayInt *dataInt, const std::vector::ArrayType *>& arrays) + void MEDCouplingFieldT::checkForUnserialization(const std::vector& tinyInfoI, const DataArrayIdType *dataInt, const std::vector::ArrayType *>& arrays) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); - std::vector tinyInfoITmp(tinyInfoI); - int sz=tinyInfoITmp.back(); + std::vector tinyInfoITmp(tinyInfoI); + mcIdType sz=tinyInfoITmp.back(); tinyInfoITmp.pop_back(); - std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); - std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); + std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); + std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); timeDiscrSafe()->checkForUnserialization(tinyInfoI2,arrays); - std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); + std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); _type->checkForUnserialization(tinyInfoITmp3,dataInt); } template - void MEDCouplingFieldT::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) + void MEDCouplingFieldT::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !"); - std::vector tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end()); + std::vector tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end()); // std::vector 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 tmp1(tmp.begin(),tmp.end()-sz); std::vector tmp2(tmp.end()-sz,tmp.end()); @@ -711,7 +711,7 @@ namespace MEDCoupling 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]); @@ -722,7 +722,7 @@ namespace MEDCoupling * The values returned must be consulted only in readonly mode. */ template - void MEDCouplingFieldT::serialize(DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) const + void MEDCouplingFieldT::serialize(DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !"); diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 423593f40..55b23cf0d 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -140,17 +140,17 @@ std::string MEDCouplingFieldTemplate::advancedRepr() const return simpleRepr(); } -void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector& 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 tinyInfo2; + tinyInfo.push_back(ToIdType(_type->getEnum())); + tinyInfo.push_back(ToIdType(_nature)); + std::vector 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& tinyInfo) const @@ -168,16 +168,16 @@ void MEDCouplingFieldTemplate::getTinySerializationStrInformation(std::vector& tinyInfoI, DataArrayInt *&dataInt) +void MEDCouplingFieldTemplate::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt) { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); dataInt=0; - std::vector tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end()); + std::vector tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end()); _type->resizeForUnserialization(tinyInfoITmp,dataInt); } -void MEDCouplingFieldTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingFieldTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !"); @@ -187,7 +187,7 @@ void MEDCouplingFieldTemplate::finishUnserialization(const std::vector& tin _desc=tinyInfoS[1]; } -void MEDCouplingFieldTemplate::serialize(DataArrayInt *&dataInt) const +void MEDCouplingFieldTemplate::serialize(DataArrayIdType *&dataInt) const { _type->getSerializationIntArray(dataInt); } diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx index c5c0986f5..082dcc36a 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx @@ -56,12 +56,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT MCAuto clone(bool recDeepCpy) const; // - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, DataArrayInt *&dataInt); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&dataInt) const; // MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; private: diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index bb9b404a6..5572831ac 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -71,7 +71,7 @@ void MEDCouplingGaussLocalization::checkConsistencyLight() const 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()); @@ -160,9 +160,9 @@ double MEDCouplingGaussLocalization::getWeight(int gaussPtIdInCell, double newVa * 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& tinyInfo) const +void MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std::vector& tinyInfo) const { - tinyInfo.push_back((int)_type); + tinyInfo.push_back(ToIdType(_type)); tinyInfo.push_back(getNumberOfPtsInRefCell()); tinyInfo.push_back(getNumberOfGaussPt()); } @@ -212,9 +212,9 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach 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()); @@ -222,13 +222,13 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach MCAuto 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& wg(getWeights()); INTERP_KERNEL::GaussCoords calculator; calculator.addGaussInfo(typ,dim, ptsInRefCoo->begin(),nbPts,&_ref_coord[0],getNumberOfPtsInRefCell()); // - for(int i=0;i MEDCouplingGaussLocalization::buildRefCell() const { MCAuto 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 ret(MEDCoupling1SGTUMesh::New("",getType())); ret->setCoords(coo); - MCAuto conn(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()); conn->alloc(cm.getNumberOfNodes(),1); conn->iota(); ret->setNodalConnectivity(conn); @@ -299,17 +299,17 @@ void MEDCouplingGaussLocalization::setWeights(const std::vector& w) /*! * The format of 'tinyData' parameter is the same than pushed in method MEDCouplingGaussLocalization::pushTinySerializationIntInfo. */ -MEDCouplingGaussLocalization MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(int dim, const std::vector& tinyData) +MEDCouplingGaussLocalization MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(mcIdType dim, const std::vector& tinyData) { std::vector 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) diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx index 6cd859599..b88702df6 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx @@ -48,7 +48,7 @@ namespace MEDCoupling 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& tinyInfo) const; + MEDCOUPLING_EXPORT void pushTinySerializationIntInfo(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void pushTinySerializationDblInfo(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT const double *fillWithValues(const double *vals); // @@ -68,10 +68,10 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void setGaussCoords(const std::vector& gsCoo); MEDCOUPLING_EXPORT void setWeights(const std::vector& w); // - MEDCOUPLING_EXPORT static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(int dim, const std::vector& tinyData); + MEDCOUPLING_EXPORT static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(mcIdType dim, const std::vector& tinyData); MEDCOUPLING_EXPORT static bool AreAlmostEqual(const std::vector& v1, const std::vector& 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 _ref_coord; diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx index fa3eb3f34..00d77cfa5 100755 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -53,7 +53,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::New() 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 ret(new MEDCouplingIMesh); @@ -88,17 +88,17 @@ const DataArrayDouble *MEDCouplingIMesh::getDirectAccessOfCoordsArrIfInStructure * \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(ghostLev)*_dxyz[i]; dxyz[i]=_dxyz[i]; structure[i]=_structure[i]+2*ghostLev; } @@ -107,26 +107,26 @@ MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const 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 MEDCouplingIMesh::getNodeStruct() const +std::vector MEDCouplingIMesh::getNodeStruct() const { checkSpaceDimension(); - return std::vector(_structure,_structure+_space_dim); + return std::vector(_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); @@ -142,7 +142,7 @@ std::vector MEDCouplingIMesh::getOrigin() const 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); @@ -214,12 +214,12 @@ MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const * 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& factors) +void MEDCouplingIMesh::refineWithFactor(const std::vector& 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 structure(_structure,_structure+3); + std::vector structure(_structure,_structure+3); std::vector dxyz(_dxyz,_dxyz+3); for(int i=0;i<_space_dim;i++) { @@ -228,7 +228,7 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) 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]; @@ -248,14 +248,14 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const { checkConsistencyLight(); - int spaceDim(getSpaceDimension()),nodeSt[3]; + mcIdType spaceDim(getSpaceDimension()),nodeSt[3]; double dxyz[3]; for(int i=0;i=2) { nodeSt[i]=2; - dxyz[i]=(_structure[i]-1)*_dxyz[i]; + dxyz[i]=double(_structure[i]-1)*_dxyz[i]; } else { @@ -281,7 +281,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const * * \sa CondenseFineToCoarseGhost,SpreadCoarseToFine */ -void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA) +void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& 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 !"); @@ -309,7 +309,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co } 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())); + mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies())); if(nbTuplesFine!=fact*nbOfTuplesInFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!"; @@ -319,16 +319,16 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co double *outPtr(coarseDA->getPointer()); const double *inPtr(fineDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector 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()); @@ -340,15 +340,15 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co } 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()); @@ -363,19 +363,19 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co } 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()); @@ -409,7 +409,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co * * \sa CondenseFineToCoarse,SpreadCoarseToFineGhost */ -void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, int ghostSize) +void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : ghost level has to be >= 0 !"); @@ -417,7 +417,7 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS 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 coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); std::size_t nbCompo(fineDA->getNumberOfComponents()); @@ -431,9 +431,9 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { @@ -444,17 +444,17 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS double *outPtr(coarseDA->getPointer()); const double *inPtr(fineDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector 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()); @@ -466,18 +466,18 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS } 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()); @@ -493,24 +493,24 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS } 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()); @@ -542,7 +542,7 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS * \param [in] facts The refinement coefficient per axis. * \sa SpreadCoarseToFineGhost, CondenseFineToCoarse */ -void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts) +void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& 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 !"); @@ -563,7 +563,7 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const 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())); + mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies())); if(nbTuplesFine!=fact*nbOfTuplesInFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!"; @@ -573,31 +573,31 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const double *outPtr(fineDA->getPointer()); const double *inPtr(coarseDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector 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& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : ghost level has to be >= 0 !"); @@ -654,7 +654,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, 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 coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); std::size_t nbCompo=fineDA->getNumberOfComponents(); @@ -668,9 +668,9 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { @@ -685,41 +685,41 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, { case 1: { - std::vector 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 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 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 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& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : ghost level has to be >= 0 !"); @@ -747,7 +747,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse 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 coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); std::size_t nbCompo=fineDA->getNumberOfComponents(); @@ -761,9 +761,9 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { @@ -774,17 +774,17 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse double *outPtr(fineDA->getPointer()); const double *inPtr(coarseDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector 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=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType i=0;i=0 thanks to the fact that ghostSize>=1 ! - for(int i=0;i=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType i=0;i MEDCouplingIMesh::getNodeGridStructure() const +std::vector MEDCouplingIMesh::getNodeGridStructure() const { checkSpaceDimension(); - std::vector ret(_structure,_structure+_space_dim); + std::vector ret(_structure,_structure+_space_dim); return ret; } -MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const +MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair >& 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 ret(dynamic_cast(deepCopy())); for(int i=0;i=_structure[i]) { std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : At dimension #" << i << " the start node id is " << startNode << " it should be in [0," << _structure[i] << ") !"; @@ -998,7 +998,7 @@ MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::v 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(startNode)*_dxyz[i]; retStruct[i]=myDelta; } ret->setNodeStruct(retStruct,retStruct+dim); @@ -1015,15 +1015,15 @@ int MEDCouplingIMesh::getSpaceDimension() const return _space_dim; } -void MEDCouplingIMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingIMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& 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(tmp2[j])); } std::string MEDCouplingIMesh::simpleRepr() const @@ -1059,7 +1059,7 @@ void MEDCouplingIMesh::getBoundingBox(double *bbox) const for(int idim=0; idim1) coeff=_structure[idim]-1; - bbox[2*idim+1]=_origin[idim]+_dxyz[idim]*coeff; + bbox[2*idim+1]=_origin[idim]+_dxyz[idim]*FromIdType(coeff); } } @@ -1109,14 +1109,14 @@ MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureFieldOnNode(bool isAbs) cons //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=0 && tmp& elts) const +void MEDCouplingIMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - int ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } @@ -1187,17 +1187,18 @@ DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const { checkConsistencyLight(); MCAuto 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(tmp2[j])+_origin[j]; } return ret.retn(); } @@ -1214,18 +1215,19 @@ DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const { checkConsistencyLight(); MCAuto 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(),0.5)); std::transform(_origin,_origin+spaceDim,shiftOrigin,shiftOrigin,std::plus()); getSplitCellValues(tmp); ret->setInfoOnComponents(buildInfoOnComponents()); - for(int i=0;i(tmp2[j])+shiftOrigin[j]; } return ret.retn(); } @@ -1235,12 +1237,12 @@ DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const 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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingIMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time(getTime(it,order)); @@ -1260,29 +1262,29 @@ void MEDCouplingIMesh::getTinySerializationInformation(std::vector& tiny tinyInfoD.insert(tinyInfoD.end(),_origin,_origin+3); } -void MEDCouplingIMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingIMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& 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& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCouplingIMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& 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(tinyInfo[0]),FromIdType(tinyInfo[1])); + _space_dim=FromIdType(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]; @@ -1319,12 +1321,12 @@ void MEDCouplingIMesh::reprQuickOverview(std::ostream& stream) const 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; @@ -1412,95 +1414,95 @@ int MEDCouplingIMesh::FindIntRoot(int val, int order) } } -void MEDCouplingIMesh::SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { double *outPtrWork(outPtr); - std::vector 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 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= ghostlev - for(int i=0;i= ghostlev + for(mcIdType i=0;i& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { double *outPtr2(outPtr); - std::vector 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 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= 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 getNodeStruct() const; + MEDCOUPLING_EXPORT void setNodeStruct(const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop); + MEDCOUPLING_EXPORT std::vector getNodeStruct() const; MEDCOUPLING_EXPORT void setOrigin(const double *originStart, const double *originStop); MEDCOUPLING_EXPORT std::vector getOrigin() const; MEDCOUPLING_EXPORT void setDXYZ(const double *dxyzStart, const double *dxyzStop); @@ -46,18 +46,18 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string getAxisUnit() const; MEDCOUPLING_EXPORT double getMeasureOfAnyCell() const; MEDCOUPLING_EXPORT MEDCouplingCMesh *convertToCartesian() const; - MEDCOUPLING_EXPORT void refineWithFactor(const std::vector& factors); + MEDCOUPLING_EXPORT void refineWithFactor(const std::vector& factors); MEDCOUPLING_EXPORT MEDCouplingIMesh *asSingleCell() const; - MEDCOUPLING_EXPORT static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA); - MEDCOUPLING_EXPORT static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, int ghostSize); - MEDCOUPLING_EXPORT static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts); - MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); - MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); + MEDCOUPLING_EXPORT static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA); + MEDCOUPLING_EXPORT static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, mcIdType ghostSize); + MEDCOUPLING_EXPORT static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts); + MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize); + MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& 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 getDirectChildrenWithNull() const; @@ -66,21 +66,21 @@ namespace MEDCoupling 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& coo) const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& 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& elts) const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& 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); @@ -88,16 +88,16 @@ namespace MEDCoupling 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 getNodeGridStructure() const; - MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; + MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const; + MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; + MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; //serialisation-unserialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; @@ -112,8 +112,8 @@ namespace MEDCoupling 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& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); - static void SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); + static void SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize); + static void SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize); private: int _space_dim; double _origin[3]; diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index 54c2385ce..429ec16c6 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -46,7 +46,7 @@ using namespace MEDCoupling; * 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); } @@ -98,7 +98,7 @@ void MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom(const MEDCouplingMesh *o _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(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId) { if(_mesh2D.isNotNull()) @@ -146,12 +146,12 @@ MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingMa } } -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(); } @@ -235,27 +235,27 @@ bool MEDCouplingMappedExtrudedMesh::isEqualWithoutConsideringStr(const MEDCoupli } 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(); } @@ -268,65 +268,65 @@ std::set MEDCouplingMappedExtrudedMesh::getAl 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 ret(DataArrayInt::New()); + MCAuto ret(DataArrayIdType::New()); if(revExtTyp==INTERP_KERNEL::NORM_ERROR) { ret->alloc(0,1); return ret.retn(); } - MCAuto tmp(_mesh2D->giveCellsWithType(revExtTyp)); - mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells()); - mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); + MCAuto 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;ibegin(),tmp->end(),pt,std::bind2nd(std::plus(),i*nbOfCells2D)); - MCAuto ret2(ret->renumberR(_mesh3D_ids->begin())); + std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus(),i*nbOfCells2D)); + MCAuto ret2(ret->renumberR(_mesh3D_ids->begin())); ret2->sort(); return ret2.retn(); } -DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const { - MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); - mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells()); - mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); - MCAuto ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); - int *pt(ret3D->getPointer()); + MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); + mcIdType nbOfLevs=_mesh1D->getNumberOfCells(); + mcIdType nbOfCells2D=_mesh2D->getNumberOfCells(); + MCAuto ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); + mcIdType *pt(ret3D->getPointer()); for(int i=0;ibegin(),ret2D->end(),pt); ret3D->applyLin(2,0,0); return ret3D->renumberR(_mesh3D_ids->begin()); } -DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const { - MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); - mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells()); - mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); - MCAuto ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); - int *pt(ret3D->getPointer()); + MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); + mcIdType nbOfLevs=_mesh1D->getNumberOfCells(); + mcIdType nbOfCells2D=_mesh2D->getNumberOfCells(); + MCAuto ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); + mcIdType *pt(ret3D->getPointer()); for(int i=0;ibegin(),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;igetNumberOfCells()); + for(mcIdType i=0;igetTypeOfCell(i)); if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type) @@ -335,26 +335,26 @@ std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNE return ret*_mesh1D->getNumberOfCells(); } -void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); - int nbOfNodes2D(_mesh2D->getNumberOfNodes()); - int locId(ToIdType(cellId)%nbOfCells2D); - int lev(ToIdType(cellId)/nbOfCells2D); - std::vector tmp,tmp2; + mcIdType nbOfCells2D(_mesh2D->getNumberOfCells()); + mcIdType nbOfNodes2D(_mesh2D->getNumberOfNodes()); + mcIdType locId(cellId%nbOfCells2D); + mcIdType lev(cellId/nbOfCells2D); + std::vector tmp,tmp2; _mesh2D->getNodeIdsOfCell(locId,tmp); tmp2=tmp; - std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus(),nbOfNodes2D*lev)); - std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus(),nbOfNodes2D*(lev+1))); + std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus(),nbOfNodes2D*lev)); + std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus(),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& coo) const +void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& 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 tmp,tmp2; _mesh2D->getCoordinatesOfNode(locId,tmp); tmp2=tmp; @@ -415,17 +415,17 @@ void MEDCouplingMappedExtrudedMesh::getBoundingBox(double *bbox) const 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::max()); std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits::max())); - for(int i=0;i(std::min)); std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast(std::max)); } std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus()); - 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]; @@ -440,7 +440,7 @@ void MEDCouplingMappedExtrudedMesh::updateTime() const 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"); } @@ -454,7 +454,7 @@ MEDCouplingUMesh *MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh() const MCAuto mesh2DZC(_mesh2D->deepCopyConnectivityOnly()); mesh2DZC->zipCoords(); MCAuto 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(); @@ -476,17 +476,17 @@ MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureField(bool) con MCAuto 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 ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); ret->setMesh(this); ret->synchronizeTimeWithMesh(); MCAuto da(DataArrayDouble::New()); da->alloc(nbOf3DCells,1); double *retPtr(da->getPointer()); - for(int i=0;isetArray(da); ret->setName(name); @@ -504,12 +504,12 @@ MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::buildOrthogonalField() co 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& elts) const +void MEDCouplingMappedExtrudedMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellsContainingPoint : not implemented yet !"); } @@ -530,35 +530,35 @@ void MEDCouplingMappedExtrudedMesh::computeExtrusion(const MEDCouplingUMesh *mes 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;igetNodalConnectivity()->begin()); + const mcIdType *conn2DIndx(subMesh->getNodalConnectivityIndex()->begin()); + for(mcIdType i=1;i conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); + std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); std::sort(conn.begin(),conn.end()); if(computeMesh1D) computeBaryCenterOfFace(conn,i-1); @@ -580,7 +580,7 @@ void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, } if(computeMesh1D) { - std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); + std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); std::sort(conn.begin(),conn.end()); computeBaryCenterOfFace(conn,nbOf1DLev-1); current2DCell=findOppositeFaceOf(current2DCell,current3DCell,conn, @@ -592,22 +592,22 @@ void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, } } -int MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector& connSorted, - const int *desc3D, const int *descIndx3D, - const int *conn2D, const int *conn2DIndx) +mcIdType MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(mcIdType current2DCell, mcIdType current3DCell, const std::vector& 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 conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]); + std::vector conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]); std::sort(conn2.begin(),conn2.end()); - std::list intersect; + std::list intersect; std::set_intersection(connSorted.begin(),connSorted.end(),conn2.begin(),conn2.end(), - std::insert_iterator< std::list >(intersect,intersect.begin())); + std::insert_iterator< std::list >(intersect,intersect.begin())); if(intersect.empty()) return *candidate2D; } @@ -617,33 +617,33 @@ int MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(int current2DCell, int cur throw INTERP_KERNEL::Exception(ost.str().c_str()); } -void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId) +void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vector& 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::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) + for(std::vector::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus()); - std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(double)(1./(int)nodalConnec.size()))); + std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(1./(double)nodalConnec.size()))); } -int MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr) +mcIdType MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr) { - std::vector::const_iterator iter=nodalConnec.begin(); - std::set s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); + std::vector::const_iterator iter=nodalConnec.begin(); + std::set s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); iter++; for(;iter!=nodalConnec.end();iter++) { - std::set s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); - std::set s3; - std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set >(s3,s3.end())); + std::set s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); + std::set s3; + std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set >(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(ostr," ")); + std::copy(nodalConnec.begin(),nodalConnec.end(),std::ostream_iterator(ostr," ")); ostr << " is not part of mesh"; throw INTERP_KERNEL::Exception(ostr.str().c_str()); } @@ -670,7 +670,7 @@ void MEDCouplingMappedExtrudedMesh::Project1DMeshes(const MEDCouplingUMesh *m1, m2r=m2->clone(true); m1r->changeSpaceDimension(1); m2r->changeSpaceDimension(1); - std::vector c; + std::vector c; std::vector ref,ref2; m1->getNodeIdsOfCell(0,c); m1->getCoordinatesOfNode(c[0],ref); @@ -700,34 +700,34 @@ void MEDCouplingMappedExtrudedMesh::scale(const double *point, double factor) _mesh1D->scale(point,factor); } -std::vector MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const +std::vector MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } -DataArrayInt *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } -void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const +void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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 !"); } @@ -744,18 +744,18 @@ DataArrayDouble *MEDCouplingMappedExtrudedMesh::getCoordinatesAndOwner() const const DataArrayDouble *arr1D(_mesh1D->getCoords()); MCAuto 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;ibegin()+3*i,arr1D->begin()+3*(i+1),vec); std::transform(arr1D->begin()+3*(i-1),arr1D->begin()+3*i,vec,vec,std::minus()); - for(int j=0;j()); } return ret.retn(); @@ -771,7 +771,7 @@ DataArrayDouble *MEDCouplingMappedExtrudedMesh::computeIsoBarycenterOfNodesPerCe 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 m(buildUnstructured()); m->getReverseNodalConnectivity(revNodal,revNodalIndx); @@ -780,11 +780,11 @@ void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *re 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;ialloc(nbOf1DLev+1,3); _mesh1D->setCoords(myCoords); myCoords->decrRef(); - MCAuto desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descIndx(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescIndx(DataArrayIdType::New()); MCAuto subMesh(mesh3D->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)); - MCAuto revNodal2D(DataArrayInt::New()),revNodalIndx2D(DataArrayInt::New()); + MCAuto 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;igetNumberOfCells(); + for(mcIdType i=0;i nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); + mcIdType idInSubMesh; + std::vector nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); try { idInSubMesh=FindCorrespCellByNodalConn(nodalConnec,revNodal2DPtr,revNodalIndx2DPtr); @@ -824,13 +824,13 @@ void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh * } } -void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { - std::vector tinyInfo1; + std::vector tinyInfo1; std::vector ls1; std::vector ls3; _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1); - std::vector tinyInfo2; + std::vector tinyInfo2; std::vector ls2; std::vector ls4; _mesh1D->getTinySerializationInformation(ls4,tinyInfo2,ls2); @@ -840,29 +840,29 @@ void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector< 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& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { std::size_t sz=tinyInfo.size(); - int sz1=tinyInfo[sz-2]; - std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); + mcIdType sz1=tinyInfo[sz-2]; + std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); + std::vector 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 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(); // @@ -871,15 +871,15 @@ void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vectorserialize(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); @@ -893,18 +893,18 @@ void MEDCouplingMappedExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble a2_2->decrRef(); } -void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& 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 ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); - DataArrayInt *a1tmp=DataArrayInt::New(); + std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); + std::vector 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 ls1,ls2; @@ -921,7 +921,7 @@ void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& t 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()); @@ -929,8 +929,8 @@ void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& t _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()); } diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx index ec5d5da9e..c2fcadd14 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx @@ -28,7 +28,7 @@ namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; class DataArrayDouble; class MEDCouplingUMesh; class MEDCouplingCMesh; @@ -37,15 +37,15 @@ namespace MEDCoupling 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 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; @@ -54,77 +54,77 @@ namespace MEDCoupling 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 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& conn) const; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& 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& conn) const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& 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& elts) const; - MEDCOUPLING_EXPORT static int FindCorrespCellByNodalConn(const std::vector& 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& elts) const; + MEDCOUPLING_EXPORT static mcIdType FindCorrespCellByNodalConn(const std::vector& 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 getDistributionOfTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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 getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& 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& connSorted, - const int *desc3D, const int *descIndx3D, - const int *conn2D, const int *conn2DIndx); - void computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId); + mcIdType findOppositeFaceOf(mcIdType current2DCell, mcIdType current3DCell, const std::vector& connSorted, + const mcIdType *desc3D, const mcIdType *descIndx3D, + const mcIdType *conn2D, const mcIdType *conn2DIndx); + void computeBaryCenterOfFace(const std::vector& nodalConnec, mcIdType lev1DId); ~MEDCouplingMappedExtrudedMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; std::string getVTKDataSetType() const; diff --git a/src/MEDCoupling/MEDCouplingMatrix.cxx b/src/MEDCoupling/MEDCouplingMatrix.cxx index 1045e260c..35b6e1e75 100755 --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -26,12 +26,12 @@ 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); } @@ -77,9 +77,9 @@ void DenseMatrix::updateTime() const * * \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) @@ -108,7 +108,7 @@ void DenseMatrix::reBuild(DataArrayDouble *array, int nbRows, int nbCols) * \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 !"); @@ -225,7 +225,7 @@ DenseMatrix *DenseMatrix::Multiply(const DenseMatrix *a1, const DenseMatrix *a2) 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 data(DataArrayDouble::New()); data->alloc(nbr*nbc,1); MCAuto 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()); @@ -246,21 +246,21 @@ DenseMatrix::~DenseMatrix() { } -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 !"); @@ -270,7 +270,7 @@ int DenseMatrix::getNumberOfRowsExt(int nbRows) const 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 !"); @@ -290,7 +290,7 @@ void DenseMatrix::checkValidData() const 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 !"); @@ -298,8 +298,7 @@ void DenseMatrix::CheckArraySizes(DataArrayDouble *array, int nbRows, int nbCols 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 !"); } diff --git a/src/MEDCoupling/MEDCouplingMatrix.hxx b/src/MEDCoupling/MEDCouplingMatrix.hxx index c62272be1..e999bf290 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.hxx +++ b/src/MEDCoupling/MEDCouplingMatrix.hxx @@ -38,19 +38,19 @@ namespace MEDCoupling 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 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; @@ -68,17 +68,17 @@ namespace MEDCoupling 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 _data; }; } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 6100a6f41..50f19056d 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -83,7 +83,7 @@ void DataArrayDouble::findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, } 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()); } @@ -103,7 +103,7 @@ void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts commonNodes; for(std::vector::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()); } } @@ -191,14 +191,6 @@ void DataArray::copyStringInfoFrom(const DataArray& other) _info_on_compo=other._info_on_compo; } -void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) -{ - // The method has to be removed as duplicate after SWIG update - std::vector ids (compoIds.size()); - cast_to_remove(compoIds, ids); - copyPartOfStringInfoFrom(other, ids); -} - void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) { std::size_t nbOfCompoOth=other.getNumberOfComponents(); @@ -213,14 +205,6 @@ void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vect setInfoOnComponent(i,other.getInfoOnComponent(compoIds[i])); } -void DataArray::copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other) -{ - // The method has to be removed as duplicate after SWIG update - std::vector ids (compoIds.size()); - cast_to_remove (compoIds, ids); - copyPartOfStringInfoFrom2(ids, other); -} - void DataArray::copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other) { if(compoIds.size()!=other.getNumberOfComponents()) @@ -346,18 +330,18 @@ void DataArray::setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgT std::vector DataArray::getVarsOnComponent() const { - mcIdType nbOfCompo=(mcIdType)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); std::vector ret(nbOfCompo); - for(mcIdType i=0;i DataArray::getUnitsOnComponent() const { - mcIdType nbOfCompo=(mcIdType)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); std::vector ret(nbOfCompo); - for(mcIdType i=0;i(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; @@ -1290,13 +1274,6 @@ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std: for(std::size_t j=0;j& compoIds) -{ - // The method has to be removed as duplicate after SWIG update - std::vector 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. @@ -1305,7 +1282,7 @@ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std: 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 !"); @@ -1533,7 +1510,7 @@ double DataArrayDouble::getAverageValue() const 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(nbOfTuples); } /*! @@ -1726,7 +1703,7 @@ DataArrayDouble *DataArrayDouble::accumulatePerChunck(const mcIdType *bgOfIndex, 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--; @@ -1736,7 +1713,7 @@ DataArrayDouble *DataArrayDouble::accumulatePerChunck(const mcIdType *bgOfIndex, 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=w[0]) @@ -2366,7 +2343,7 @@ DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayIdType* &compo { 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(); @@ -2560,7 +2537,7 @@ void DataArrayDouble::applyPow(double val) checkAllocated(); double *ptr=getPointer(); std::size_t nbOfElems=getNbOfElems(); - mcIdType val2=(mcIdType)val; + int val2=(int)val; bool isInt=((double)val2)==val; if(!isInt) { @@ -2703,7 +2680,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe expr.parse(); std::set 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(oss," ")); @@ -2786,7 +2763,7 @@ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) expr.parse(); std::set 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(oss," ")); @@ -2914,7 +2891,7 @@ DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(std::size_t nbOfComp, cons std::vector stck; for(std::size_t iComp=0;iCompgetPointer()+iComp; diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 2f19607b1..c27d9673a 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -144,9 +144,7 @@ namespace MEDCoupling 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& compoIds); - MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); - MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector& 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; @@ -170,7 +168,7 @@ namespace MEDCoupling 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; @@ -179,7 +177,6 @@ namespace MEDCoupling 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 >& ranges) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector& compoIds) const = 0; MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector& 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; @@ -192,7 +189,7 @@ namespace MEDCoupling 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); @@ -238,7 +235,7 @@ namespace MEDCoupling 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(); } @@ -314,7 +311,6 @@ namespace MEDCoupling typename Traits::ArrayType *mySelectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const; typename Traits::ArrayType *mySelectByTupleId(const DataArrayIdType& di) const; typename Traits::ArrayType *mySelectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const; - typename Traits::ArrayType *myKeepSelectedComponents(const std::vector& compoIds) const; typename Traits::ArrayType *myKeepSelectedComponents(const std::vector& compoIds) const; typename Traits::ArrayType *mySelectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const; typename Traits::ArrayType *mySelectByTupleRanges(const std::vector >& ranges) const; @@ -397,7 +393,6 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); } MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::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::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } @@ -439,7 +434,6 @@ namespace MEDCoupling 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::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const; @@ -449,7 +443,6 @@ namespace MEDCoupling 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& compoIds); - MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds); MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator(); MEDCOUPLING_EXPORT void checkNoNullValues() const; MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) const; @@ -586,7 +579,6 @@ namespace MEDCoupling MEDCOUPLING_EXPORT T checkUniformAndGuess() const; MEDCOUPLING_EXPORT bool hasUniqueValues() const; MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayType *a, const std::vector& compoIds); - MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayType *a, const std::vector& 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; @@ -708,11 +700,10 @@ namespace MEDCoupling 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::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::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& 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 >& ranges) const { return this->mySelectByTupleRanges(ranges); } public: MEDCOUPLING_EXPORT DataArrayInt32Iterator *iterator(); private: @@ -720,7 +711,7 @@ namespace MEDCoupling DataArrayInt32() { } }; - class DataArrayInt64 : public DataArrayDiscrete + class DataArrayInt64 : public DataArrayDiscreteSigned { friend class DataArrayDiscrete; public: @@ -731,7 +722,6 @@ namespace MEDCoupling 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::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } public: @@ -776,7 +766,6 @@ namespace MEDCoupling 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::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } MEDCOUPLING_EXPORT bool isUniform(char val) const; MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other); diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index 421498694..303dbe245 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -617,7 +617,7 @@ namespace MEDCoupling 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 @@ -647,8 +647,8 @@ namespace MEDCoupling if (step == 0) return -1; - if(step>0 && begin<=value && value=value && value>end) + if((step>0 && begin<=value && value=value && value>end)) { mcIdType id = ToIdType((value-begin)/step); if (begin + step * id == value) @@ -1300,7 +1300,7 @@ namespace MEDCoupling MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::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()); @@ -1452,14 +1452,6 @@ namespace MEDCoupling return ret.retn(); } - template - typename Traits::ArrayType *DataArrayTemplate::myKeepSelectedComponents(const std::vector& compoIds) const - { - // The method has to be removed as duplicate after SWIG update - std::vector 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 @@ -1597,7 +1589,7 @@ namespace MEDCoupling 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); @@ -1718,7 +1710,7 @@ namespace MEDCoupling 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) { @@ -1850,7 +1842,7 @@ namespace MEDCoupling 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"); @@ -1871,7 +1863,7 @@ namespace MEDCoupling if(assignTech) { for(const mcIdType *w=bgTuples;w!=endTuples;w++) - for(std::size_t j=0;jgetNbOfElems()==newNbOfTuples*newNbOfComp) + if(a->getNbOfElems()==ToIdType(newNbOfTuples*newNbOfComp)) { if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -2331,7 +2323,7 @@ namespace MEDCoupling 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; } @@ -2412,7 +2404,7 @@ namespace MEDCoupling 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; } @@ -4333,7 +4325,7 @@ struct NotInRange T a(sttoopp-1-strt),tmp(strt); if(a%(nbTuples-1)!=0) return false; - stteepp=a/(nbTuples-1); + stteepp=a/(FromIdType(nbTuples)-1); for(mcIdType i=0;i(nbTuples)-1)); for(mcIdType i=0;i - void DataArrayDiscrete::setSelectedComponents(const DataArrayType *a, const std::vector& compoIds) - { - // The method has to be removed as duplicate after SWIG update - std::vector ids (compoIds.size()); - cast_to_remove(compoIds, ids); - setSelectedComponents (a, ids); - } /*! * Creates a new DataArrayInt containing IDs (indices) of tuples holding value \b not @@ -6303,7 +6287,7 @@ struct NotInRange 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(nbOfSlices)); mcIdType pos(0); const T *w(this->begin()); std::vector< std::pair > ret(nbOfSlices); @@ -7569,7 +7553,7 @@ namespace MEDCouplingImpl { 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(_cnt); _cnt++; } private: T *_pt; MEDCoupling::mcIdType _cnt; @@ -7580,7 +7564,7 @@ namespace MEDCouplingImpl { 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(_cnt); _cnt++; } private: T *_pt; MEDCoupling::mcIdType _cnt; diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx index fb0cf3d0e..1c083670d 100755 --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -35,11 +35,11 @@ template class MEDCoupling::DataArrayTemplate; /*! * 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(); @@ -47,7 +47,7 @@ int DataArrayChar::getHashCode() const 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;ialloc(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; @@ -180,7 +180,7 @@ void DataArrayChar::meldWith(const DataArrayChar *other) char *w=newArr; const char *inp1=getConstPointer(); const char *inp2=other->getConstPointer(); - for(int i=0;igetNumberOfComponents() != 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 ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); mcIdType nbOfTuples=getNumberOfTuples(); - for(int i=0;ipushBackSilent(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 @@ -224,15 +224,15 @@ DataArrayInt *DataArrayChar::findIdsEqual(char val) const * \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 ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); mcIdType nbOfTuples=getNumberOfTuples(); - for(int i=0;ipushBackSilent(i); return ret.retn(); @@ -244,7 +244,7 @@ DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const * 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& vals) const +mcIdType DataArrayChar::findIdSequence(const std::vector& vals) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -269,7 +269,7 @@ int DataArrayChar::findIdSequence(const std::vector& vals) const * \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& tupl) const +mcIdType DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); std::size_t nbOfCompo=getNumberOfComponents(); @@ -339,7 +339,7 @@ bool DataArrayChar::presenceOfValue(const std::vector& vals) const * 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) @@ -358,11 +358,11 @@ int DataArrayChar::findIdFirstEqual(char value) const * If not any tuple contains one of the values contained in 'vals' false is returned. * \sa DataArrayChar::presenceOfValue */ -int DataArrayChar::findIdFirstEqual(const std::vector& vals) const +mcIdType DataArrayChar::findIdFirstEqual(const std::vector& 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 vals2(vals.begin(),vals.end()); const char *cptr=getConstPointer(); mcIdType nbOfTuples=getNumberOfTuples(); @@ -381,15 +381,15 @@ int DataArrayChar::findIdFirstEqual(const std::vector& vals) const * \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 ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto ret=DataArrayIdType::New(); ret->alloc(0,1); mcIdType nbOfTuples=getNumberOfTuples(); - for(int i=0;i=vmin && *cptrpushBackSilent(i); return ret.retn(); @@ -444,7 +444,7 @@ DataArrayChar *DataArrayChar::Aggregate(const std::vector std::vector::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 !"); @@ -526,13 +526,13 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr ret->alloc(nbOfTuples,totalNbOfComp); char *retPtr=ret->getPointer(); for(mcIdType i=0;isetInfoOnComponent(k,a[i]->getInfoOnComponent(j)); return ret; @@ -626,7 +626,7 @@ void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const const char *data=begin(); mcIdType nbOfTuples=getNumberOfTuples(); std::size_t nbCompo=getNumberOfComponents(); - for(int i=0;i(stream," "));//it is not a bug int here not char because it is not ASCII here contrary to DataArrayAsciiChar @@ -690,7 +690,7 @@ void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxN std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; - for(int i=0;i1) { @@ -738,7 +738,7 @@ std::vector DataArrayByte::toVectorOfBool() const mcIdType nbt(getNumberOfTuples()); std::vector ret(nbt,false); const char *pt(begin()); - for(int i=0;i& vst, char 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(stream)); @@ -1042,7 +1042,7 @@ void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; - for(int i=0;i=1) { mcIdType nbOfTuples=getNumberOfTuples(); @@ -86,7 +86,7 @@ void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t max oss2.precision(7); std::string oss2Str(oss2.str()); bool isFinished=true; - for(int i=0;i1) { diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index 299bd38f2..195a6f308 100755 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -146,7 +146,7 @@ bool MEDCouplingMesh::isEqual(const MEDCouplingMesh *other, double prec) const * 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; @@ -195,28 +195,28 @@ void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levO * \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 crest; - std::set p(partBg,partEnd); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); - for(int i=0;i crest; + std::set p(partBg,partEnd); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i conn; + std::vector conn; getNodeIdsOfCell(i,conn); bool cont=true; - for(std::vector::const_iterator iter=conn.begin();iter!=conn.end() && cont;iter++) + for(std::vector::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; } @@ -259,9 +259,9 @@ bool MEDCouplingMesh::areCompatibleForMerge(const MEDCouplingMesh *other) const * * \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(this)); ret->incrRef(); @@ -269,7 +269,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellId } else { - MCAuto cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds); return buildPart(cellIds->begin(),cellIds->end()); } } @@ -279,9 +279,9 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellId * * \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 cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds); return buildPartAndReduceNodes(cellIds->begin(),cellIds->end(),arr); } @@ -572,12 +572,12 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingMesh::GetCorrespondingPolyType(INTE * \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()); } /*! @@ -647,15 +647,15 @@ const char *MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NormalizedCel * \ref py_mcumesh_getCellsContainingPoints "Here is a Python example". * \endif */ -void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& 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 ret; + std::vector ret; getCellsContainingPoint(work,eps,ret); elts->insertAtTheEnd(ret.begin(),ret.end()); eltsIndexPtr[i+1]=elts->getNumberOfTuples(); @@ -669,7 +669,7 @@ void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints * * \sa MEDCouplingMesh::getCellsContainingPoints, MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss */ -void MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const { this->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex); } diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index d89292301..02e3bfc27 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -47,7 +47,7 @@ namespace MEDCoupling } MEDCouplingMeshType; // -- WARNING this enum must be synchronized with MEDCouplingCommon.i file ! -- - class DataArrayInt; + class DataArrayIdType; class DataArrayByte; class DataArrayDouble; class MEDCouplingUMesh; @@ -77,46 +77,46 @@ namespace MEDCoupling 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 getAllGeoTypes() const = 0; - MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; - MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(int nodeId, std::vector& coo) const = 0; + MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const; + MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(mcIdType nodeId, std::vector& 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 getDistributionOfTypes() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const = 0; - MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const = 0; + MEDCOUPLING_EXPORT virtual std::vector getDistributionOfTypes() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const = 0; + MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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& elts) const = 0; - MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; - MEDCOUPLING_EXPORT virtual void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& 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& elts) const = 0; + MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; + MEDCOUPLING_EXPORT virtual void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& 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; @@ -125,29 +125,29 @@ namespace MEDCoupling 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& 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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const = 0; - MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const = 0; - MEDCOUPLING_EXPORT virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0; - MEDCOUPLING_EXPORT virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const = 0; + MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const = 0; + MEDCOUPLING_EXPORT virtual void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const = 0; + MEDCOUPLING_EXPORT virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& 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; diff --git a/src/MEDCoupling/MEDCouplingMultiFields.cxx b/src/MEDCoupling/MEDCouplingMultiFields.cxx index 8322da12f..bb7213e4f 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.cxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.cxx @@ -151,7 +151,7 @@ bool MEDCouplingMultiFields::isEqualWithoutConsideringStr(const MEDCouplingMulti 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]; } @@ -170,7 +170,7 @@ int MEDCouplingMultiFields::getNumberOfFields() const 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()); @@ -354,7 +354,7 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& oth tmp2[j]=0; } _fs[i]->setArrays(tmp2); - std::vector tinyInfo; + std::vector tinyInfo; std::vector tinyInfo2; other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tinyInfo); other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tinyInfo2); @@ -367,7 +367,7 @@ MEDCouplingMultiFields::MEDCouplingMultiFields() { } -void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const +void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const { std::vector refs; std::vector ms=getDifferentMeshes(refs); @@ -376,70 +376,70 @@ void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& t std::vector 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 doubleDaInd(sz); std::vector timeDiscrInt; tinyInfo.resize(sz2+5*sz+3); - tinyInfo[0]=(int)sz; + tinyInfo[0]=sz; tinyInfo[1]=sz2; - for(std::size_t i=0;i tmp; - std::vector tmp2; + std::vector 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;igetTimeDiscretization(); + for(mcIdType i=0;igetTimeDiscretization()); int k=0; - for(std::size_t i=0;i::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& tinyInfoI, const std::vector& tinyInfoD, +void MEDCouplingMultiFields::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& ft, const std::vector& ms, const std::vector& 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;isetMesh(ms[meshId]); } // dealing with fieldtemplate->fielddouble - int k=0; - int offI=0; - int offD=0; - for(int i=0;i tmp(sz3); - for(int j=0;j& tinyI } _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 tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI); + std::vector tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI); std::vector tdInfoD(tinyInfoD.begin()+offD,tinyInfoD.begin()+offD+lgthD); _fs[i]->getTimeDiscretizationUnderGround()->finishUnserialization2(tdInfoI,tdInfoD); // diff --git a/src/MEDCoupling/MEDCouplingMultiFields.hxx b/src/MEDCoupling/MEDCouplingMultiFields.hxx index e7a82b402..9fe1d9a13 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.hxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.hxx @@ -24,6 +24,7 @@ #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MCAuto.hxx" +#include "MCType.hxx" #include "InterpKernelException.hxx" @@ -61,8 +62,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const; - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const; + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& ft, const std::vector& ms, const std::vector& das); MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const; diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx index 759e36d9d..8b076f1d6 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx @@ -34,7 +34,7 @@ class MEDCouplingNormalizedCartesianMesh 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); @@ -42,8 +42,8 @@ public: //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: diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx index 2dfc27791..7fe1ef125 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx @@ -39,13 +39,13 @@ MEDCouplingNormalizedCartesianMesh::~MEDCouplingNormalizedCartesianMes } template -std::size_t MEDCouplingNormalizedCartesianMesh::getNumberOfElements() const +mcIdType MEDCouplingNormalizedCartesianMesh::getNumberOfElements() const { return _mesh->getNumberOfCells(); } template -std::size_t MEDCouplingNormalizedCartesianMesh::nbCellsAlongAxis(int axis) const +mcIdType MEDCouplingNormalizedCartesianMesh::nbCellsAlongAxis(int axis) const { return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1; } diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx index bdf3a7e3d..d97062f5d 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx @@ -41,7 +41,7 @@ public: 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; diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index c8b059097..c9485e669 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx @@ -69,7 +69,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh -int MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodesOfElement(mcIdType eltId) const +mcIdType MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodesOfElement(mcIdType eltId) const { return _mesh->getNumberOfNodesInCell(eltId); } diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 951358aaf..007621fb2 100755 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -52,7 +52,7 @@ MEDCouplingPointSet::~MEDCouplingPointSet() _coords->decrRef(); } -int MEDCouplingPointSet::getNumberOfNodes() const +mcIdType MEDCouplingPointSet::getNumberOfNodes() const { if(_coords) return _coords->getNumberOfTuples(); @@ -63,7 +63,7 @@ int MEDCouplingPointSet::getNumberOfNodes() const 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 !"); } @@ -228,15 +228,15 @@ bool MEDCouplingPointSet::areCoordsEqualWithoutConsideringStr(const MEDCouplingP * \ref py_mcpointset_getcoordinatesofnode "Here is a Python example". * \endif */ -void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingPointSet::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCoordinatesOfNode : no coordinates array set !"); - int nbNodes=getNumberOfNodes(); + mcIdType nbNodes=getNumberOfNodes(); if(nodeId>=0 && nodeIdgetConstPointer(); - int spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1)); } else @@ -256,17 +256,17 @@ void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector& * 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 ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); + mcIdType oldNbOfNodes=getNumberOfNodes(); + MCAuto ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); areNodesMerged=(oldNbOfNodes!=newNbOfNodes); comm->decrRef(); commI->decrRef(); @@ -299,7 +299,7 @@ DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision, * \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 !"); @@ -313,7 +313,7 @@ void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArra * 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. @@ -323,11 +323,11 @@ void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArra * \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 cITmp(cI); + MCAuto cITmp(cI); return c; } @@ -358,11 +358,11 @@ DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double * \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 points=DataArrayDouble::New(); points->useArray(pos,false,DeallocType::CPP_DEALLOC,nbOfPoints,spaceDim); _coords->computeTupleIdsNearTuples(points,eps,c,cI); @@ -373,12 +373,12 @@ void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints * @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); } /*! @@ -398,7 +398,7 @@ DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const * \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 !"); @@ -426,24 +426,24 @@ void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNo * \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 div(newNbOfNodes); - int spaceDim=getSpaceDimension(); + std::vector 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()); div[newNodeNumbers[i]]++; } - for(int i=0;i(),1./(double)div[i])); setCoords(newCoords); newCoords->decrRef(); @@ -480,7 +480,7 @@ void MEDCouplingPointSet::getBoundingBox(double *bbox) const void MEDCouplingPointSet::zipCoords() { checkFullyDefined(); - DataArrayInt *traducer=zipCoordsTraducer(); + DataArrayIdType *traducer=zipCoordsTraducer(); traducer->decrRef(); } @@ -543,7 +543,7 @@ void MEDCouplingPointSet::recenterForMaxPrecision(double eps) */ 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) @@ -573,10 +573,10 @@ void MEDCouplingPointSet::translate(const double *vector) 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; ideclareAsNew(); updateTime(); @@ -603,9 +603,9 @@ void MEDCouplingPointSet::scale(const double *point, double factor) 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()); std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies(),factor)); @@ -671,7 +671,7 @@ void MEDCouplingPointSet::tryToShareSameCoords(const MEDCouplingPointSet& other, * \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 !"); @@ -695,7 +695,7 @@ void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg * \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& nodes) const +void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector& nodes) const { if(getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : Invalid spacedim to be applied on this ! Must be equal to 3 !"); @@ -703,13 +703,13 @@ void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, 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::min()) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : vector pointer specified has norm equal to 0. !"); const double *work=_coords->getConstPointer(); - for(int i=0;igetSpaceDimension() != 3 && \a this->getSpaceDimension() != 2 ). */ -void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const +void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& 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 vecn=new double[spaceDim]; - for(int i=0;igetConstPointer(); if(spaceDim==2) { - for(int i=0;i& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingPointSet::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -894,7 +894,7 @@ void MEDCouplingPointSet::getTinySerializationInformation(std::vector& t /*! * 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) { @@ -909,7 +909,7 @@ void MEDCouplingPointSet::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) con * Second step of serialization process. * @param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { if(tinyInfo[2]>=0 && tinyInfo[1]>=1) { @@ -926,7 +926,7 @@ void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyI * Second and final unserialization process. * @param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { if(tinyInfo[2]>=0 && tinyInfo[1]>=1) { @@ -935,16 +935,16 @@ void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, setDescription(littleStrings[1]); a2->setName(littleStrings[2]); setTimeUnit(littleStrings[3]); - for(int i=0;isetInfoOnComponent(i,littleStrings[i+4]); - setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[3]),FromIdType(tinyInfo[4])); } else { setName(littleStrings[0]); setDescription(littleStrings[1]); setTimeUnit(littleStrings[2]); - setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[3]),FromIdType(tinyInfo[4])); } } @@ -1023,7 +1023,7 @@ bool MEDCouplingPointSet::intersectsBoundingBox(const INTERP_KERNEL::DirectedBou 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); } @@ -1034,11 +1034,11 @@ void MEDCouplingPointSet::rotate3D(const double *center, const double *vect, dou * \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 !"); @@ -1056,7 +1056,7 @@ DataArrayInt *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MED * \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); } @@ -1069,12 +1069,12 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPart(const int *start, const int *end * \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 ret=buildPartOfMySelf(start,end,true); arr=ret->zipCoordsTraducer(); @@ -1092,7 +1092,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, * * \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) { @@ -1116,7 +1116,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCe * * \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 ret(buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true)); arr=ret->zipCoordsTraducer(); @@ -1129,7 +1129,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(int beginCell 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); } @@ -1140,7 +1140,7 @@ class DummyClsMCPS 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; }; @@ -1152,21 +1152,21 @@ public: * 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& res) const +void MEDCouplingPointSet::project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector& 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 cpy(res); - int nbNodes=(int)std::distance(startConn,endConn); - INTERP_KERNEL::PlanarIntersector::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::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& res, bool * 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 c1,c2; + std::vector c1,c2; getNodeIdsOfCell(cellId,c1); other->getNodeIdsOfCell(cellId,c2); std::size_t sz(c1.size()); @@ -1249,21 +1249,21 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& 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 newCoords=MergeNodesArray(&other,this); _coords->incrRef(); MCAuto oldCoords=_coords; setCoords(newCoords); bool areNodesMerged; - int newNbOfNodes; - MCAuto da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes); + mcIdType newNbOfNodes; + MCAuto 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(),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(),maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { setCoords(oldCoords); @@ -1274,7 +1274,7 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& 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 ret=buildPartOfMySelfKeepCoords(begin,end); if(!keepCoords) @@ -1282,7 +1282,7 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const int *begin, co 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 ret=buildPartOfMySelfKeepCoordsSlice(start,end,step); if(!keepCoords) @@ -1313,11 +1313,11 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(int start, int * \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 cellIdsKept2(cellIdsKept); + MCAuto cellIdsKept2(cellIdsKept); return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true); } @@ -1340,7 +1340,7 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin * \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. @@ -1352,15 +1352,15 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin * \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 commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); - int newNbOfCells=-1; - MCAuto ret=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(getNumberOfCells()),commonCells->begin(),commonCellsI->begin(), + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + mcIdType newNbOfCells=-1; + MCAuto ret=DataArrayIdType::ConvertIndexArrayToO2N(ToIdType(getNumberOfCells()),commonCells->begin(),commonCellsI->begin(), commonCellsI->end(),newNbOfCells); - MCAuto ret2=ret->invertArrayO2N2N2O(newNbOfCells); + MCAuto ret2=ret->invertArrayO2N2N2O(newNbOfCells); MCAuto self=buildPartOfMySelf(ret2->begin(),ret2->end(),true); shallowCopyConnectivityFrom(self); return ret.retn(); @@ -1374,7 +1374,7 @@ DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int sta bool MEDCouplingPointSet::areAllNodesFetched() const { checkFullyDefined(); - int nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); return std::find(fetchedNodes.begin(),fetchedNodes.end(),false)==fetchedNodes.end(); @@ -1411,7 +1411,7 @@ bool MEDCouplingPointSet::areAllNodesFetched() const * \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 !"); @@ -1420,18 +1420,18 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : other is not a PointSet mesh !"); MCAuto m=dynamic_cast(mergeMyselfWith(otherC)); bool areNodesMerged; - int newNbOfNodes; - int oldNbOfNodes=getNumberOfNodes(); - MCAuto da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes); + mcIdType newNbOfNodes; + mcIdType oldNbOfNodes=getNumberOfNodes(); + MCAuto 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(),oldNbOfNodes-1)); + const mcIdType *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),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 nodeCor2=da->subArray(oldNbOfNodes); + MCAuto nodeCor2=da->subArray(oldNbOfNodes); da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes); // da=m->zipConnectivityTraducer(cellCompPol); @@ -1441,7 +1441,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int mcIdType dan(da->getNumberOfTuples()); if (dan) { - MCAuto da1(DataArrayInt::New()),da2(DataArrayInt::New()); + MCAuto 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()); @@ -1449,7 +1449,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int if (!da1->isEqualWithoutConsideringStr(*da2)) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); } - MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,ToIdType(da->getNbOfElems()),1); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,ToIdType(da->getNbOfElems()),1); nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn(); cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } @@ -1477,7 +1477,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int * \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 !"); @@ -1487,14 +1487,14 @@ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh if(_coords!=otherC->_coords) throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : meshes do not share the same coordinates ! Use tryToShareSameCoordinates or call checkDeepEquivalWith !"); MCAuto m=mergeMyselfWithOnSameCoords(otherC); - MCAuto 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(),maxId)); + MCAuto 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(),maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !"); } - MCAuto cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1); cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } @@ -1523,7 +1523,7 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou * \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. @@ -1537,9 +1537,9 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou * \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; @@ -1551,7 +1551,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, cons * 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. @@ -1565,7 +1565,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, cons * \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); } @@ -1574,7 +1574,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *p * 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. @@ -1586,10 +1586,10 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *p * \ref py_mcumesh_zipCoordsTraducer "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() +DataArrayIdType *MEDCouplingPointSet::zipCoordsTraducer() { - int newNbOfNodes=-1; - MCAuto traducer=getNodeIdsInUse(newNbOfNodes); + mcIdType newNbOfNodes=-1; + MCAuto traducer=getNodeIdsInUse(newNbOfNodes); renumberNodes(traducer->getConstPointer(),newNbOfNodes); return traducer.retn(); } @@ -1601,7 +1601,7 @@ DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() * 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. @@ -1612,9 +1612,9 @@ DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() * \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 ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); + MCAuto ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); if(areNodesMerged) renumberNodes(ret->begin(),newNbOfNodes); return ret.retn(); @@ -1628,7 +1628,7 @@ DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMe * 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. @@ -1639,9 +1639,9 @@ DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMe * \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; diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 7d7d38e63..d76dc55c6 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -35,7 +35,7 @@ namespace INTERP_KERNEL namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; class DataArrayDouble; /*! @@ -56,7 +56,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector 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; } @@ -68,26 +68,26 @@ namespace MEDCoupling 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& nodeIdsInUse) const = 0; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& 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& 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; @@ -97,63 +97,63 @@ namespace MEDCoupling 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& nodes) const; - MEDCOUPLING_EXPORT void findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const; + MEDCOUPLING_EXPORT void findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector& nodes) const; + MEDCOUPLING_EXPORT void findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const; MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2); MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const std::vector& 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& newNodeNumbersO2N) = 0; - MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const std::map& 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& 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& newNodeNumbersO2N) = 0; + MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const std::map& 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& tinyInfo) const = 0; MEDCOUPLING_EXPORT virtual void invertOrientationOfAllCells() = 0; MEDCOUPLING_EXPORT virtual void checkFullyDefined() const = 0; - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& 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& res) const; + MEDCOUPLING_EXPORT void project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector& res) const; MEDCOUPLING_EXPORT static bool isButterfly2DCell(const std::vector& res, bool isQuad, double eps); protected: DataArrayDouble *_coords; diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index 2318f4890..bc18d38fe 100755 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -94,14 +94,14 @@ int MEDCouplingRemapper::prepareEx(const MEDCouplingFieldTemplate *src, const ME return prepareNotInterpKernelOnly(); } -void MEDCouplingRemapper::setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m) +void MEDCouplingRemapper::setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m) { MCAuto src,target; BuildFieldTemplatesFrom(srcMesh,targetMesh,method,src,target); setCrudeMatrixEx(src,target,m); } -void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m) +void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m) { restartUsing(src,target); if(ToIdType(m.size())!=target->getNumberOfTuplesExpected()) @@ -249,7 +249,7 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons 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 @@ -261,7 +261,7 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons 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); } /*! @@ -419,7 +419,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() 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); @@ -480,7 +480,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D1D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); @@ -500,7 +500,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D1D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); @@ -509,10 +509,10 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() 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 >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::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(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -525,7 +525,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); @@ -541,10 +541,10 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() 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 >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::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(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -564,10 +564,10 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() 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 >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::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(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -587,7 +587,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D3D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); @@ -596,10 +596,10 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() 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 >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::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(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -674,18 +674,18 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src2D); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(trg2D); INTERP_KERNEL::Interpolation2D interpolation2D(*this); - std::vector > matrix2D; - int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC); + std::vector > 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 > matrix1D; + std::vector > 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, @@ -714,7 +714,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUC() 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 > res; + std::vector > res; switch(srcMeshDim) { case 1: @@ -744,7 +744,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUC() 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(); @@ -869,7 +869,7 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() MCAuto trgLoc=_target_ft->getLocalizationOfDiscr(); const double *trgLocPtr=trgLoc->begin(); mcIdType trgSpaceDim=ToIdType(trgLoc->getNumberOfComponents()); - MCAuto srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh()); + MCAuto 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 !"; @@ -877,27 +877,27 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() oss << _src_ft->getMesh()->getSpaceDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const int *srcOffsetArrPtr=srcOffsetArr->begin(); + const mcIdType *srcOffsetArrPtr=srcOffsetArr->begin(); MCAuto srcLoc=_src_ft->getLocalizationOfDiscr(); const double *srcLocPtr=srcLoc->begin(); - MCAuto eltsArr,eltsIndexArr; + MCAuto 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 nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex()); - MCAuto ids0=nbOfSrcCellsShTrgPts->findIdsNotEqual(0); - for(const int *trgId=ids0->begin();trgId!=ids0->end();trgId++) + const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); + MCAuto nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex()); + MCAuto 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::max(); - int srcEntry=-1; - for(int srcId=srcOffsetArrPtr[srcCellId];srcIdgetNumberOfTuples()!=trgNbOfGaussPts) { - MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); + MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); MCAuto orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end()); - MCAuto srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg); - const int *srcIdPerTrgPtr=srcIdPerTrg->begin(); - for(const int *orphanTrgId=orphanTrgIds->begin();orphanTrgId!=orphanTrgIds->end();orphanTrgId++,srcIdPerTrgPtr++) + MCAuto 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(); @@ -1092,7 +1092,7 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF 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) @@ -1108,7 +1108,7 @@ void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldD 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: @@ -1133,8 +1133,8 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou denoPtr2[0]=std::accumulate(denoRPtr,denoRPtr+denoR->getNumberOfTuples(),0.); } int idx=0; - for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) + for(std::map::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]; @@ -1164,9 +1164,9 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou double *denoPtr2=deno->getArray()->getPointer(); denoPtr2[0]=std::accumulate(denoRPtr,denoRPtr+denoR->getNumberOfTuples(),0.); } - int idx=0; - for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + mcIdType idx=0; + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) + for(std::map::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]; @@ -1184,7 +1184,7 @@ void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNb { int idx=0; double *tmp=new double[inputNbOfCompo]; - for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) { if((*iter1).empty()) { @@ -1194,8 +1194,8 @@ void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNb } else std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,0.); - std::map::const_iterator iter3=_deno_multiply[idx].begin(); - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter3++) + std::map::const_iterator iter3=_deno_multiply[idx].begin(); + for(std::map::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(),(*iter2).second/(*iter3).second)); std::transform(tmp,tmp+inputNbOfCompo,resPointer+idx*inputNbOfCompo,resPointer+idx*inputNbOfCompo,std::plus()); @@ -1207,12 +1207,12 @@ void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNb void MEDCouplingRemapper::computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer) { std::vector 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 >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) { - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::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(),(*iter2).second/_deno_reverse_multiply[(*iter2).first][idx])); @@ -1226,81 +1226,81 @@ void MEDCouplingRemapper::computeReverseProduct(const double *inputPointer, int std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,dftValue); } -void MEDCouplingRemapper::ReverseMatrix(const std::vector >& matIn, int nbColsMatIn, std::vector >& matOut) +void MEDCouplingRemapper::ReverseMatrix(const std::vector >& matIn, mcIdType nbColsMatIn, std::vector >& matOut) { matOut.resize(nbColsMatIn); - int id=0; - for(std::vector >::const_iterator iter1=matIn.begin();iter1!=matIn.end();iter1++,id++) - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + mcIdType id=0; + for(std::vector >::const_iterator iter1=matIn.begin();iter1!=matIn.end();iter1++,id++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) matOut[(*iter2).first][id]=(*iter2).second; } -void MEDCouplingRemapper::ComputeRowSumAndColSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse) +void MEDCouplingRemapper::ComputeRowSumAndColSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse) { - std::map values; - int idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + std::map values; + mcIdType idx=0; + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { double sum=0.; - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { sum+=(*iter2).second; values[(*iter2).first]+=(*iter2).second; } - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) deno[idx][(*iter2).first]=sum; } idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) denoReverse[(*iter2).first][idx]=values[(*iter2).first]; } } -void MEDCouplingRemapper::ComputeColSumAndRowSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse) +void MEDCouplingRemapper::ComputeColSumAndRowSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse) { - std::map values; - int idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + std::map values; + mcIdType idx=0; + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { double sum=0.; - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { sum+=(*iter2).second; values[(*iter2).first]+=(*iter2).second; } - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) denoReverse[(*iter2).first][idx]=sum; } idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) deno[idx][(*iter2).first]=values[(*iter2).first]; } } -void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, - const std::vector< std::map >& m2D, - const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc, - const int *corrCellIdTrg) +void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, + const std::vector< std::map >& 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 >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++) + mcIdType id2R=0; + for(std::vector< std::map >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++) { - for(std::map::const_iterator iter2C=(*iter2R).begin();iter2C!=(*iter2R).end();iter2C++) + for(std::map::const_iterator iter2C=(*iter2R).begin();iter2C!=(*iter2R).end();iter2C++) { - int id1R=0; - for(std::vector< std::map >::const_iterator iter1R=m1D.begin();iter1R!=m1D.end();iter1R++,id1R++) + mcIdType id1R=0; + for(std::vector< std::map >::const_iterator iter1R=m1D.begin();iter1R!=m1D.end();iter1R++,id1R++) { - for(std::map::const_iterator iter1C=(*iter1R).begin();iter1C!=(*iter1R).end();iter1C++) + for(std::map::const_iterator iter1C=(*iter1R).begin();iter1C!=(*iter1R).end();iter1C++) { _matrix[corrCellIdTrg[id1R*nbOf2DCellsTrg+id2R]][corrCellIdSrc[(*iter1C).first*nbOf2DCellsSrc+(*iter2C).first]]=(*iter1C).second*((*iter2C).second); } @@ -1309,19 +1309,19 @@ void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std:: } } -void MEDCouplingRemapper::PrintMatrix(const std::vector >& m) +void MEDCouplingRemapper::PrintMatrix(const std::vector >& m) { - int id=0; - for(std::vector >::const_iterator iter1=m.begin();iter1!=m.end();iter1++,id++) + mcIdType id=0; + for(std::vector >::const_iterator iter1=m.begin();iter1!=m.end();iter1++,id++) { std::cout << "Target Cell # " << id << " : "; - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) std::cout << "(" << (*iter2).first << "," << (*iter2).second << "), "; std::cout << std::endl; } } -const std::vector >& MEDCouplingRemapper::getCrudeMatrix() const +const std::vector >& MEDCouplingRemapper::getCrudeMatrix() const { return _matrix; } @@ -1329,9 +1329,9 @@ const std::vector >& MEDCouplingRemapper::getCrudeMatrix() /*! * 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()); } /*! @@ -1349,12 +1349,12 @@ int MEDCouplingRemapper::getNumberOfColsOfMatrix() const int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs) { int ret=0; - std::vector > matrixNew(_matrix.size()); - int i=0; - for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++,i++) + std::vector > matrixNew(_matrix.size()); + mcIdType i=0; + for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++,i++) { - std::map& rowNew=matrixNew[i]; - for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + std::map& rowNew=matrixNew[i]; + for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) { if(fabs((*it2).second)>maxValAbs) rowNew[(*it2).first]=(*it2).second; @@ -1398,8 +1398,8 @@ int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrix(double scaleFactor) double MEDCouplingRemapper::getMaxValueInCrudeMatrix() const { double ret=0.; - for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++) - for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++) + for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) if(fabs((*it2).second)>ret) ret=fabs((*it2).second); return ret; diff --git a/src/MEDCoupling/MEDCouplingRemapper.hxx b/src/MEDCoupling/MEDCouplingRemapper.hxx index 393436141..5d840c98d 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.hxx +++ b/src/MEDCoupling/MEDCouplingRemapper.hxx @@ -57,8 +57,8 @@ namespace MEDCoupling 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 >& m); - MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& 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); @@ -74,9 +74,9 @@ namespace MEDCoupling MEDCOUPLINGREMAPPER_EXPORT int nullifiedTinyCoeffInCrudeMatrix(double scaleFactor); MEDCOUPLINGREMAPPER_EXPORT double getMaxValueInCrudeMatrix() const; public: - MEDCOUPLINGREMAPPER_EXPORT const std::vector >& getCrudeMatrix() const; - MEDCOUPLINGREMAPPER_EXPORT int getNumberOfColsOfMatrix() const; - MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT const std::vector >& getCrudeMatrix() const; + MEDCOUPLINGREMAPPER_EXPORT mcIdType getNumberOfColsOfMatrix() const; + MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector >& 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& src, MCAuto& target); private: @@ -103,16 +103,16 @@ namespace MEDCoupling 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 >& m1D, - const std::vector< std::map >& m2D, - const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc, - const int *corrCellIdTrg); - static void ReverseMatrix(const std::vector >& matIn, int nbColsMatIn, - std::vector >& matOut); - static void ComputeRowSumAndColSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse); - static void ComputeColSumAndRowSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse); + void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, + const std::vector< std::map >& m2D, + const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc, + const mcIdType *corrCellIdTrg); + static void ReverseMatrix(const std::vector >& matIn, mcIdType nbColsMatIn, + std::vector >& matOut); + static void ComputeRowSumAndColSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse); + static void ComputeColSumAndRowSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse); private: MCAuto _src_ft; MCAuto _target_ft; diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx index f554f509d..dcbb24a4c 100755 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx @@ -26,7 +26,7 @@ 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() ) { } @@ -39,8 +39,8 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New() return new MEDCouplingSkyLineArray(); } -MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector& index, - const std::vector& value ) +MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector& index, + const std::vector& value ) { MEDCouplingSkyLineArray * ret = new MEDCouplingSkyLineArray(); ret->_index->reserve( index.size() ); @@ -50,7 +50,7 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector& i return ret; } -MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( DataArrayInt* index, DataArrayInt* value ) +MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( DataArrayIdType* index, DataArrayIdType* value ) { MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray(); ret->set(index, value); @@ -70,19 +70,19 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const MEDCouplingSkyLineA * 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]; @@ -91,22 +91,22 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: connectivity containing other types than POLYHED!"); } - vector superIdx, idx, vals; - int cnt = 0, cnt2 = 0; + vector 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 @@ -131,30 +131,30 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons * 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& c, MCAuto& cI) const +void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto& c, MCAuto& 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 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 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) @@ -179,36 +179,36 @@ std::vector MEDCouplingSkyLineArray::getDirectChildrenW } -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(this)->_super_index; } -DataArrayInt* MEDCouplingSkyLineArray::getIndexArray() const +DataArrayIdType* MEDCouplingSkyLineArray::getIndexArray() const { return const_cast(this)->_index; } -DataArrayInt* MEDCouplingSkyLineArray::getValuesArray() const +DataArrayIdType* MEDCouplingSkyLineArray::getValuesArray() const { return const_cast(this)->_values; } @@ -223,9 +223,9 @@ void MEDCouplingSkyLineArray::checkSuperIndex(const std::string& func) const } } -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!"; @@ -233,9 +233,9 @@ void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int super } } -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!"; @@ -243,11 +243,11 @@ void MEDCouplingSkyLineArray::validIndex(const std::string& func, int idx) const } } -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!"; @@ -259,14 +259,14 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const { std::ostringstream oss; oss << "MEDCouplingSkyLineArray (" << this << ")" << std::endl; - MCAuto super_index = _super_index->deepCopy(); + MCAuto 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; @@ -275,7 +275,7 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const { 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; @@ -283,16 +283,16 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const 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 ) { @@ -315,12 +315,12 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const /** * 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 & pack) const +void MEDCouplingSkyLineArray::getSimplePackSafe(const mcIdType absolutePackId, std::vector & 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()); } @@ -328,11 +328,11 @@ void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::v /** * 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]; } @@ -344,12 +344,12 @@ const int * MEDCouplingSkyLineArray::getSimplePackSafePtr(const int absolutePack * \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 & superPackIndices, - const int *packBg, const int *packEnd, - std::vector& out) const +void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPackIndices, + const mcIdType *packBg, const mcIdType *packEnd, + std::vector& out) const { using namespace std; @@ -360,14 +360,14 @@ void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPackIndi 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::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::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)) @@ -384,41 +384,41 @@ void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPackIndi * \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); @@ -427,43 +427,43 @@ void MEDCouplingSkyLineArray::deleteSimplePack(const int idx) 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& packs) +void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayIdType* idx, const std::vector& 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> - std::deque< std::set > 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(vP+iP[ii], vP+iP[ii+1])); + // copy _index, _values into a deque> + std::deque< std::set > 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(vP+iP[ii], vP+iP[ii+1])); - // modify the deque> according to idx and packs - int ii(0); - for (const int *id = idx->begin(); id != idx->end(); id++) + // modify the deque> according to idx and packs + mcIdType ii(0); + for (const mcIdType *id = idx->begin(); id != idx->end(); id++) { - valuesByIdx[*id] = std::set(packs[ii]->begin(), packs[ii]->end()); + valuesByIdx[*id] = std::set(packs[ii]->begin(), packs[ii]->end()); ii++; } - // copy back the deque> into _index, _values - int valSz(0); + // copy back the deque> into _index, _values + mcIdType valSz(0); *iP = 0; - for (std::deque< std::set >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++) + for (std::deque< std::set >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++) { valSz += ToIdType((*values).size()); *(++iP) = valSz; @@ -478,21 +478,21 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayInt* idx, const } } -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 packsToDelete(idx->begin(), idx->end()); + std::set 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::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::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; @@ -503,17 +503,17 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) _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::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++) + mcIdType deleted = 0; + for(std::set::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]; @@ -524,7 +524,7 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) if (end_prec != 0) { std::copy(iP+end_prec, iP+nt, iP+start_prec); - for (int i=start_prec; ireAlloc(nt-deleted); @@ -533,20 +533,20 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) /**! * 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]]); @@ -556,11 +556,11 @@ void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packB _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])++; } @@ -568,22 +568,22 @@ void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packB * 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); @@ -593,7 +593,7 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packB 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; } @@ -601,23 +601,23 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packB * 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); @@ -627,6 +627,6 @@ void MEDCouplingSkyLineArray::replacePack(const int superIdx, const int idx, con 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; } diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx index 203b27ea9..f8afb84a1 100644 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx @@ -58,57 +58,57 @@ namespace MEDCoupling { public: static MEDCouplingSkyLineArray * New(); - static MEDCouplingSkyLineArray * New( const std::vector& index, const std::vector& value); - static MEDCouplingSkyLineArray * New( DataArrayInt* index, DataArrayInt* value ); + static MEDCouplingSkyLineArray * New( const std::vector& index, const std::vector& 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 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 & pack) const; - const int * getSimplePackSafePtr(const int absolutePackId, int & packSize) const; - void findPackIds(const std::vector & superPackIndices, const int *packBg, const int *packEnd, - std::vector& out) const; + void getSimplePackSafe(const mcIdType absolutePackId, std::vector & pack) const; + const mcIdType * getSimplePackSafePtr(const mcIdType absolutePackId, mcIdType & packSize) const; + void findPackIds(const std::vector & superPackIndices, const mcIdType *packBg, const mcIdType *packEnd, + std::vector& 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& packs); + void deleteSimplePacks(const DataArrayIdType* idx); + void replaceSimplePacks(const DataArrayIdType* idx, const std::vector& packs); - void convertToPolyhedronConn( MCAuto& c, MCAuto& cI) const; + void convertToPolyhedronConn( MCAuto& c, MCAuto& 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 _super_index; MCAuto _index; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index 0f5387686..69f68accd 100755 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -56,7 +56,7 @@ bool MEDCouplingStructuredMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, do 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()); } @@ -85,9 +85,9 @@ std::set MEDCouplingStructuredMesh::getAllGeo 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))); @@ -95,9 +95,9 @@ std::size_t MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::N 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 ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); if(getTypeOfCell(0)==type) { ret->alloc(getNumberOfCells(),1); @@ -108,23 +108,23 @@ DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::Normal return ret.retn(); } -DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const +DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const { std::size_t nbCells=getNumberOfCells(); - MCAuto ret=DataArrayInt::New(); + MCAuto 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 ret=DataArrayInt::New(); + MCAuto 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(); } @@ -133,21 +133,21 @@ DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const * 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& conn) const +void MEDCouplingStructuredMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& 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: @@ -173,9 +173,9 @@ void MEDCouplingStructuredMesh::getNodeIdsOfCell(std::size_t cellId, std::vector */ int MEDCouplingStructuredMesh::getMeshDimension() const { - std::vector ngs(getNodeGridStructure()); + std::vector ngs(getNodeGridStructure()); int ret(0),pos(0); - for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,pos++) + for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,pos++) { if(*it<=0) { @@ -195,11 +195,11 @@ int MEDCouplingStructuredMesh::getMeshDimension() const */ int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const { - std::vector nodeStr(getNodeGridStructure()); + std::vector nodeStr(getNodeGridStructure()); int spd1(0),pos(0); - for(std::vector::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++) + for(std::vector::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 !"; @@ -210,38 +210,38 @@ int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const return spd1; } -void MEDCouplingStructuredMesh::getSplitCellValues(int *res) const +void MEDCouplingStructuredMesh::getSplitCellValues(mcIdType *res) const { - std::vector strct(getCellGridStructure()); - std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); + std::vector strct(getCellGridStructure()); + std::vector 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 strct(getNodeGridStructure()); - std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); + std::vector strct(getNodeGridStructure()); + std::vector 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 cgs(getCellGridStructure()); + std::vector cgs(getCellGridStructure()); return GetNumberOfCellsOfSubLevelMesh(cgs,getMeshDimension()); } /*! * See MEDCouplingUMesh::getDistributionOfTypes for more information */ -std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const +std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const { //only one type of cell - std::vector ret(3); + std::vector 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; } @@ -252,12 +252,12 @@ std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const * * See MEDCouplingUMesh::checkTypeConsistencyAndContig for more information */ -DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const +DataArrayIdType *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& 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()); @@ -275,15 +275,15 @@ DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std 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(pfl); + return const_cast(pfl); } /*! @@ -310,16 +310,16 @@ DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std * - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]]
*/ -void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const +void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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)) { @@ -333,7 +333,7 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, 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); } /*! @@ -352,9 +352,9 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const 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 coords(getCoordinatesAndOwner()); - int ns[3]; + mcIdType ns[3]; getNodeGridStructure(ns); - MCAuto conn(Build1GTNodalConnectivity(ns,ns+spaceDim)); + MCAuto conn(Build1GTNodalConnectivity(ns,ns+spaceDim)); MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim))); ret->setNodalConnectivity(conn); ret->setCoords(coords); try @@ -375,9 +375,9 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTSubLevelMesh() const if(meshDim<1 || meshDim>3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTSubLevelMesh : meshdim must be in [2,3] !"); MCAuto coords(getCoordinatesAndOwner()); - int ns[3]; + mcIdType ns[3]; getNodeGridStructure(ns); - MCAuto conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim)); + MCAuto conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim)); MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim-1))); ret->setNodalConnectivity(conn); ret->setCoords(coords); return ret.retn(); @@ -409,26 +409,26 @@ MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const * \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 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 cgs(getCellGridStructure()); - std::vector< std::pair > cellPartFormat,nodePartFormat; + std::vector cgs(getCellGridStructure()); + std::vector< std::pair > cellPartFormat,nodePartFormat; if(IsPartStructured(start,end,cgs,cellPartFormat)) { MCAuto ret(buildStructuredSubPart(cellPartFormat)); nodePartFormat=cellPartFormat; - for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) + for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) (*it).second++; - MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); - MCAuto tmp2(DataArrayInt::New()); tmp2->alloc(getNumberOfNodes(),1); + MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); + MCAuto tmp2(DataArrayIdType::New()); tmp2->alloc(getNumberOfNodes(),1); tmp2->fillWithValue(-1); - MCAuto tmp3(DataArrayInt::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0); + MCAuto 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(); @@ -440,7 +440,7 @@ MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const int *s } } -DataArrayInt *MEDCouplingStructuredMesh::simplexize(int policy) +DataArrayIdType *MEDCouplingStructuredMesh::simplexize(int policy) { throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::simplexize : not available for Cartesian mesh !"); } @@ -459,19 +459,19 @@ MEDCouplingFieldDouble *MEDCouplingStructuredMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a MEDCouplingStructuredMesh with meshDim == 2 !"); MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME)); MCAuto array(DataArrayDouble::New()); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); array->alloc(nbOfCells,3); double *vals(array->getPointer()); - for(int i=0;isetArray(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 ngs(getNodeGridStructure()); + std::vector ngs(getNodeGridStructure()); int dim(getSpaceDimension()); switch(dim) { @@ -486,18 +486,18 @@ void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayInt *revNod } } -void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector& 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& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +void MEDCouplingStructuredMesh::GetReverseNodalConnectivity2(const std::vector& 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 ngs2(1); ngs2[0]=std::max(nbNodesX,nbNodesY); return GetReverseNodalConnectivity1(ngs2,revNodal,revNodalIndx); } + { std::vector 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& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vector& 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 ngs2(2); - int pos(0); + std::vector ngs2(2); + mcIdType pos(0); bool pass(false); for(int i=0;i<3;i++) { @@ -575,21 +575,21 @@ void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vectoralloc(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=1 && j>=1 && i>=1) *rn++=off00+i-1; if(k>=1 && j>=1 && i conn(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()); conn->alloc(1,1); conn->setIJ(0,0,0); return conn.retn(); } @@ -650,7 +650,7 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *no } } -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) @@ -666,46 +666,46 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh /*! * 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& st, int ghostLev) +DataArrayIdType *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector& st, mcIdType ghostLev) { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : ghost lev must be >= 0 !"); std::size_t dim(st.size()); - MCAuto ret(DataArrayInt::New()); + MCAuto ret(DataArrayIdType::New()); switch(dim) { case 1: { ret->alloc(2*ghostLev,1); - int *ptr(ret->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;i= 0 !"); - for(int i=0;i= 0 !"); ret->alloc(4*ghostLev,1); - int *ptr(ret->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;i= 0 !"); ret->alloc(8*ghostLev,1); - int *ptr(ret->getPointer()); - int zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev)); - for(int i=0;igetPointer()); + mcIdType zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev)); + for(mcIdType i=0;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; @@ -749,13 +749,13 @@ DataArrayInt *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat) { - int ret(1); + mcIdType ret(1); std::size_t ii(0); - for(std::vector< std::pair >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++) + for(std::vector< std::pair >::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 << " !"; @@ -766,9 +766,9 @@ int MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(const std:: return ret; } -int MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vector& st) +mcIdType MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vector& st) { - int ret(1); + mcIdType ret(1); bool isFetched(false); for(std::size_t i=0;i >& partCompactFormat, int& axisId, int& sizeOfRange) +void MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair >& 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& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf(mcIdType minPatchLgth, const std::vector& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& 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: { @@ -841,13 +841,13 @@ int MEDCouplingStructuredMesh::FindMinimalPartOf(int minPatchLgth, const std::ve default: throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : only dimension 1, 2 and 3 are supported actually !"); } - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat)); - int i(0); - for(std::vector< std::pair >::iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++) + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat)); + mcIdType i(0); + for(std::vector< std::pair >::iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++) { if(st[i] > MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit) +std::vector< std::vector > MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit) { - int dim((int)st.size()); - std::vector< std::vector > ret(dim); + std::size_t dim(st.size()); + std::vector< std::vector > ret(dim); switch(dim) { case 1: { - int nx(st[0]); + mcIdType nx(st[0]); ret[0].resize(nx); - std::vector& retX(ret[0]); - for(int i=0;i& retX(ret[0]); + for(mcIdType i=0;i& retX(ret[0]); - for(int i=0;i& retX(ret[0]); + for(mcIdType i=0;i& retY(ret[1]); - for(int j=0;j& retY(ret[1]); + for(mcIdType j=0;j > MEDCouplingStructuredMesh::ComputeSignaturePerAx } 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& retX(ret[0]); - for(int i=0;i& retX(ret[0]); + for(mcIdType i=0;i& retY(ret[1]); - for(int j=0;j& retY(ret[1]); + for(mcIdType j=0;j& retZ(ret[2]); - for(int k=0;k& retZ(ret[2]); + for(mcIdType k=0;k > MEDCouplingStructuredMesh::ComputeSignaturePerAx return ret; } -DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg) +DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const mcIdType *nodeStBg) { mcIdType nbOfCells=*nodeStBg-1; - MCAuto conn(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()); conn->alloc(2*nbOfCells,1); - int *cp=conn->getPointer(); + mcIdType *cp=conn->getPointer(); for(mcIdType i=0;i conn(DataArrayInt::New()); + MCAuto 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 conn(DataArrayInt::New()); + MCAuto 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 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 conn(DataArrayInt::New()); + std::vector 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 conn(DataArrayIdType::New()); conn->alloc(4*GetNumberOfCellsOfSubLevelMesh(ngs,3)); - int *cp(conn->getPointer()); + mcIdType *cp(conn->getPointer()); //X - for(int i=0;i& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf1D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& 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::max()),nxMax(-std::numeric_limits::max()); - int nx(st[0]),ret(0); - for(int i=0;i::max()),nxMax(-std::numeric_limits::max()); + mcIdType nx(st[0]),ret(0); + for(mcIdType i=0;i& st, c /*! * \sa MEDCouplingStructuredMesh::FindMinimalPartOf */ -int MEDCouplingStructuredMesh::FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& 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::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()); - int it(0),nx(st[0]),ny(st[1]); - int ret(0); - for(int i=0;i::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()); + mcIdType it(0),nx(st[0]),ny(st[1]); + mcIdType ret(0); + for(mcIdType i=0;i& st, c /*! * \sa MEDCouplingStructuredMesh::FindMinimalPartOf */ -int MEDCouplingStructuredMesh::FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& 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::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()),nzMin(std::numeric_limits::max()),nzMax(-std::numeric_limits::max()); - int it(0),nx(st[0]),ny(st[1]),nz(st[2]); - int ret(0); - for(int i=0;i::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()),nzMin(std::numeric_limits::max()),nzMax(-std::numeric_limits::max()); + mcIdType it(0),nx(st[0]),ny(st[1]),nz(st[2]); + mcIdType ret(0); + for(mcIdType i=0;i& st, c * 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 ngs(2); - int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1; - int off0(nodeStBg[0]); - MCAuto conn(DataArrayInt::New()); + std::vector ngs(2); + mcIdType n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1; + mcIdType off0(nodeStBg[0]); + MCAuto conn(DataArrayIdType::New()); conn->alloc(2*GetNumberOfCellsOfSubLevelMesh(ngs,2)); - int *cp(conn->getPointer()); + mcIdType *cp(conn->getPointer()); //X - for(int i=0;i()); + std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies()); return std::accumulate(tmp,tmp+meshDim,0); } @@ -1226,28 +1226,28 @@ int MEDCouplingStructuredMesh::getCellIdFromPos(int i, int j, int k) const * \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()); + std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies()); return std::accumulate(tmp,tmp+spaceDim,0); } -std::size_t MEDCouplingStructuredMesh::getNumberOfCells() const +mcIdType MEDCouplingStructuredMesh::getNumberOfCells() const { - std::vector ngs(getNodeGridStructure()); - std::size_t ret(1); + std::vector ngs(getNodeGridStructure()); + mcIdType ret(1); bool isCatched(false); std::size_t ii(0); - for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++) + for(std::vector::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 !"; @@ -1262,11 +1262,11 @@ std::size_t MEDCouplingStructuredMesh::getNumberOfCells() const return isCatched?ret:0; } -int MEDCouplingStructuredMesh::getNumberOfNodes() const +mcIdType MEDCouplingStructuredMesh::getNumberOfNodes() const { - std::vector ngs(getNodeGridStructure()); - int ret(1); - for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++) + std::vector ngs(getNodeGridStructure()); + mcIdType ret(1); + for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++) ret*=*it; return ret; } @@ -1278,18 +1278,18 @@ int MEDCouplingStructuredMesh::getNumberOfNodes() const * \return - A vector of size this->getMeshDimension() * \throw if \a cellId not in [ 0, this->getNumberOfCells() ) */ -std::vector MEDCouplingStructuredMesh::getLocationFromCellId(int cellId) const +std::vector MEDCouplingStructuredMesh::getLocationFromCellId(mcIdType cellId) const { int meshDim(getMeshDimension()); - std::vector ret(meshDim); - std::vector struc(getCellGridStructure()); - int nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); + std::vector ret(meshDim); + std::vector struc(getCellGridStructure()); + mcIdType nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); 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 spt(GetSplitVectFromStruct(struc)); + std::vector spt(GetSplitVectFromStruct(struc)); GetPosFromId(cellId,meshDim,&spt[0],&ret[0]); return ret; } @@ -1301,37 +1301,37 @@ std::vector MEDCouplingStructuredMesh::getLocationFromCellId(int cellId) co * \return - A vector of size this->getSpaceDimension() * \throw if \a cellId not in [ 0, this->getNumberOfNodes() ) */ -std::vector MEDCouplingStructuredMesh::getLocationFromNodeId(int nodeId) const +std::vector MEDCouplingStructuredMesh::getLocationFromNodeId(mcIdType nodeId) const { int spaceDim(getSpaceDimension()); - std::vector ret(spaceDim); - std::vector struc(getNodeGridStructure()); - int nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); + std::vector ret(spaceDim); + std::vector struc(getNodeGridStructure()); + mcIdType nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); 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 spt(GetSplitVectFromStruct(struc)); + std::vector 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 MEDCouplingStructuredMesh::getCellGridStructure() const +std::vector MEDCouplingStructuredMesh::getCellGridStructure() const { - std::vector ret(getNodeGridStructure()); - std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus(),-1)); + std::vector ret(getNodeGridStructure()); + std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus(),-1)); return ret; } @@ -1340,7 +1340,7 @@ std::vector MEDCouplingStructuredMesh::getCellGridStructure() const */ double MEDCouplingStructuredMesh::computeSquareness() const { - std::vector cgs(getCellGridStructure()); + std::vector cgs(getCellGridStructure()); if(cgs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : empty mesh !"); std::size_t dim(cgs.size()); @@ -1348,7 +1348,7 @@ double MEDCouplingStructuredMesh::computeSquareness() const 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 MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector& strct) +std::vector MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector& strct) { - int spaceDim((int)strct.size()); - std::vector res(spaceDim); - for(int l=0;l res(spaceDim); + for(std::size_t l=0;l MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::ve * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt */ -bool MEDCouplingStructuredMesh::IsPartStructured(const int *startIds, const int *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat) +bool MEDCouplingStructuredMesh::IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector& st, std::vector< std::pair >& 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 tmp2(dim),tmp(dim),tmp3(dim),tmp4(dim); tmp2[0]=1; + std::vector tmp2(dim),tmp(dim),tmp3(dim),tmp4(dim); tmp2[0]=1; for(int i=1;i=st[i]) @@ -1419,20 +1419,20 @@ bool MEDCouplingStructuredMesh::IsPartStructured(const int *startIds, const int 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 MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat) +std::vector MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat) { - std::vector ret(partCompactFormat.size()); + std::vector ret(partCompactFormat.size()); for(std::size_t i=0;ipartCompactFormat[i].second) @@ -1496,10 +1496,10 @@ std::vector MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const s * \throw if there is an axis in \a dims that is < 0. * \sa GetDimensionsFromCompactFrmt, ChangeReferenceFromGlobalOfCompactFrmt, ChangeReferenceToGlobalOfCompactFrmt */ -std::vector< std::pair > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector& dims) +std::vector< std::pair > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector& dims) { std::size_t sz(dims.size()); - std::vector< std::pair > ret(sz); + std::vector< std::pair > ret(sz); for(std::size_t i=0;i > MEDCouplingStructuredMesh::GetCompactFrmtFromD * * \sa AreRangesIntersect */ -std::vector< std::pair > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) +std::vector< std::pair > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& 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 > ret(sz); + std::vector< std::pair > ret(sz); for(std::size_t i=0;ir1[i].second) @@ -1553,7 +1553,7 @@ std::vector< std::pair > MEDCouplingStructuredMesh::IntersectRanges(con * * \sa IntersectRanges */ -bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) +bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) { std::size_t sz(r1.size()); if(sz!=r2.size()) @@ -1579,7 +1579,7 @@ bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair< } /*! - * 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. * @@ -1589,24 +1589,24 @@ bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair< * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, ExtractFieldOfBoolFrom */ -void MEDCouplingStructuredMesh::SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn) +void MEDCouplingStructuredMesh::SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& 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 dims(GetDimensionsFromCompactFrmt(partCompactFormat)); + std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); switch(st.size()) { case 3: { - for(int i=0;i& st, cons } case 2: { - for(int j=0;j& st, cons * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfDoubleFrom */ -void MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut) +void MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& 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 dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); + std::vector 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& s } case 2: { - for(int j=0;j& s * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfBoolFrom */ -DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat) +DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat) { if(!fieldOfDbl || !fieldOfDbl->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input array of double is NULL or not allocated!"); @@ -1711,8 +1711,8 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: 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 dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); + std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); + mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); std::size_t nbComp(fieldOfDbl->getNumberOfComponents()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp); ret->copyStringInfoFrom(*fieldOfDbl); @@ -1722,13 +1722,13 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: { case 3: { - for(int i=0;i& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other) +void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other) {//to be optimized - std::vector facts(st.size(),1); + std::vector facts(st.size(),1); MEDCouplingIMesh::CondenseFineToCoarse(st,other,partCompactFormat,facts,fieldOfDbl); } @@ -1778,7 +1778,7 @@ void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector * * \sa ChangeReferenceToGlobalOfCompactFrmt, BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfBoolFrom, ExtractFieldOfDoubleFrom */ -void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check) +void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check) { std::size_t dim(bigInAbs.size()); if(dim!=partOfBigInAbs.size()) @@ -1817,7 +1817,7 @@ void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std * * \sa ChangeReferenceFromGlobalOfCompactFrmt */ -void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check) +void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check) { std::size_t dim(bigInAbs.size()); if(dim!=partOfBigRelativeToBig.size()) @@ -1856,12 +1856,12 @@ void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std:: * * \sa FindTranslationFrom */ -std::vector< std::pair > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation) +std::vector< std::pair > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& 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 > ret(sz); + std::vector< std::pair > ret(sz); for(std::size_t i=0;i > MEDCouplingStructuredMesh::TranslateCompactFrm /*! * \sa TranslateCompactFrmt */ -std::vector MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo) +std::vector MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& 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 MEDCouplingStructuredMesh::FindTranslationFrom(const std::vecto * 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& st, const std::vector< std::pair >& partCompactFormat) +DataArrayIdType *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat) { if(st.size()!=partCompactFormat.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::BuildExplicitIdsFrom : input arrays must have the same size !"); - int nbOfItems(1); - std::vector dims(st.size()); + mcIdType nbOfItems(1); + std::vector dims(st.size()); for(std::size_t i=0;ist[i]) @@ -1910,20 +1910,20 @@ DataArrayInt *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector< dims[i]=partCompactFormat[i].second-partCompactFormat[i].first; nbOfItems*=dims[i]; } - MCAuto ret(DataArrayInt::New()); + MCAuto 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& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da) +void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const std::vector< std::pair >& 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 dims(st.size()); + std::vector dims(st.size()); for(std::size_t i=0;ist[i]) @@ -1978,7 +1978,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const 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) { @@ -1990,15 +1990,15 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const { case 3: { - for(int i=0;i(),factor)); } } @@ -2007,12 +2007,12 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const } case 2: { - for(int j=0;j(),factor)); } } @@ -2020,9 +2020,9 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const } case 1: { - for(int k=0;k(),factor)); } break; @@ -2043,10 +2043,10 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const * * \sa MultiplyPartOf, PutInGhostFormat */ -void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, int ghostSize, double factor, DataArrayDouble *da) +void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, mcIdType ghostSize, double factor, DataArrayDouble *da) { - std::vector stWG; - std::vector< std::pair > partWG; + std::vector stWG; + std::vector< std::pair > partWG; PutInGhostFormat(ghostSize,st,part,stWG,partWG); MultiplyPartOf(stWG,partWG,factor,da); } @@ -2062,7 +2062,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector& st * * \sa MultiplyPartOf, PutInGhostFormat */ -void MEDCouplingStructuredMesh::PutInGhostFormat(int ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost) +void MEDCouplingStructuredMesh::PutInGhostFormat(mcIdType ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : ghost size must be >= 0 !"); @@ -2073,7 +2073,7 @@ void MEDCouplingStructuredMesh::PutInGhostFormat(int ghostSize, const std::vecto 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(),2*ghostSize)); + std::transform(st.begin(),st.end(),stWithGhost.begin(),std::bind2nd(std::plus(),2*ghostSize)); partWithGhost=part; ApplyGhostOnCompactFrmt(partWithGhost,ghostSize); } @@ -2082,7 +2082,7 @@ void MEDCouplingStructuredMesh::PutInGhostFormat(int ghostSize, const std::vecto * \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 >& partBeforeFact, int ghostSize) +void MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt : ghost size must be >= 0 !"); @@ -2094,12 +2094,12 @@ void MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(std::vector< std::pair& cgs, int mdim) +mcIdType MEDCouplingStructuredMesh::GetNumberOfCellsOfSubLevelMesh(const std::vector& cgs, int mdim) { - int ret(0); + mcIdType ret(0); for(int i=0;i 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 getLocationFromCellId(int cellId) const; - MEDCOUPLING_EXPORT std::vector 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& 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 getLocationFromCellId(mcIdType cellId) const; + MEDCOUPLING_EXPORT std::vector 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& 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 getDistributionOfTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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 getNodeGridStructure() const = 0; - MEDCOUPLING_EXPORT std::vector 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 getNodeGridStructure() const = 0; + MEDCOUPLING_EXPORT std::vector getCellGridStructure() const; MEDCOUPLING_EXPORT double computeSquareness() const; - MEDCOUPLING_EXPORT virtual MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const = 0; - MEDCOUPLING_EXPORT static std::vector GetSplitVectFromStruct(const std::vector& strct); - MEDCOUPLING_EXPORT static bool IsPartStructured(const int *startIds, const int *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static std::vector GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static std::vector< std::pair > GetCompactFrmtFromDimensions(const std::vector& dims); - MEDCOUPLING_EXPORT static std::vector< std::pair > IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); - MEDCOUPLING_EXPORT static bool AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); - MEDCOUPLING_EXPORT static void SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn); - MEDCOUPLING_EXPORT static void ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut); - MEDCOUPLING_EXPORT static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other); - MEDCOUPLING_EXPORT static void ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check=true); - MEDCOUPLING_EXPORT static void ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check=true); - MEDCOUPLING_EXPORT static std::vector< std::pair > TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation); - MEDCOUPLING_EXPORT static std::vector FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo); - MEDCOUPLING_EXPORT static DataArrayInt *BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static void MultiplyPartOf(const std::vector& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da); - MEDCOUPLING_EXPORT static void MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, int ghostSize, double factor, DataArrayDouble *da); - MEDCOUPLING_EXPORT static void PutInGhostFormat(int ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost); - MEDCOUPLING_EXPORT static void ApplyGhostOnCompactFrmt(std::vector< std::pair >& 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& st, int ghostLev); - MEDCOUPLING_EXPORT static int DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static int DeduceNumberOfGivenStructure(const std::vector& st); - MEDCOUPLING_EXPORT static void FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat, int& axisId, int& sizeOfRange); - MEDCOUPLING_EXPORT static int FindMinimalPartOf(int minPatchLgth, const std::vector& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static std::vector< std::vector > ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit); + MEDCOUPLING_EXPORT virtual MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const = 0; + MEDCOUPLING_EXPORT static std::vector GetSplitVectFromStruct(const std::vector& strct); + MEDCOUPLING_EXPORT static bool IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector< std::pair > GetCompactFrmtFromDimensions(const std::vector& dims); + MEDCOUPLING_EXPORT static std::vector< std::pair > IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); + MEDCOUPLING_EXPORT static bool AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); + MEDCOUPLING_EXPORT static void SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn); + MEDCOUPLING_EXPORT static void ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut); + MEDCOUPLING_EXPORT static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other); + MEDCOUPLING_EXPORT static void ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check=true); + MEDCOUPLING_EXPORT static void ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check=true); + MEDCOUPLING_EXPORT static std::vector< std::pair > TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation); + MEDCOUPLING_EXPORT static std::vector FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo); + MEDCOUPLING_EXPORT static DataArrayIdType *BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static void MultiplyPartOf(const std::vector& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da); + MEDCOUPLING_EXPORT static void MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, mcIdType ghostSize, double factor, DataArrayDouble *da); + MEDCOUPLING_EXPORT static void PutInGhostFormat(mcIdType ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost); + MEDCOUPLING_EXPORT static void ApplyGhostOnCompactFrmt(std::vector< std::pair >& 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& st, mcIdType ghostLev); + MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenStructure(const std::vector& st); + MEDCOUPLING_EXPORT static void FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat, int& axisId, mcIdType& sizeOfRange); + MEDCOUPLING_EXPORT static mcIdType FindMinimalPartOf(mcIdType minPatchLgth, const std::vector& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector< std::vector > ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit); private: - static int GetNumberOfCellsOfSubLevelMesh(const std::vector& cgs, int mdim); - static void GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); - static void GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); - static void GetReverseNodalConnectivity3(const std::vector& 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& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); - static int FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); - static int FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType GetNumberOfCellsOfSubLevelMesh(const std::vector& cgs, int mdim); + static void GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static void GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static void GetReverseNodalConnectivity3(const std::vector& 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& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& 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); diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 98373fdd9..8e213bfd0 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -361,13 +361,6 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedCompon ret->setArrays(arrays3,0); return ret; } -MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector& compoIds) const -{ - // The method has to be removed as duplicate after SWIG update - std::vector ids (compoIds.size()); - cast_to_remove(compoIds, ids); - return keepSelectedComponents(ids); -} void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds) { @@ -384,13 +377,6 @@ void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeD throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondence are not defined symmetrically !"); } } -void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds) -{ - // The method has to be removed as duplicate after SWIG update - std::vector ids (compoIds.size()); - cast_to_remove (compoIds, ids); - setSelectedComponents (other, ids); -} void MEDCouplingTimeDiscretization::changeNbOfComponents(std::size_t newNbOfComp, double dftValue) { @@ -419,7 +405,7 @@ void MEDCouplingTimeDiscretization::sortPerTuple(bool asc) } } -void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value) +void MEDCouplingTimeDiscretization::setUniformValue(mcIdType nbOfTuple, int nbOfCompo, double value) { std::vector arrays; getArrays(arrays); @@ -444,7 +430,7 @@ void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value) +void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(mcIdType nbOfTuple, double value) { std::vector arrays; getArrays(arrays); @@ -1182,12 +1168,12 @@ void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order) 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); } @@ -1195,7 +1181,7 @@ void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int or /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.clear(); } @@ -1212,7 +1198,7 @@ void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector& tinyInfoI, const std::vector& tinyInfoD) +void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { _time_tolerance=tinyInfoD[0]; } @@ -1244,7 +1230,7 @@ void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh) setTimeUnit(tUnit); } -void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector& tinyInfo) const { MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo); tinyInfo.push_back(_tk.getIteration()); @@ -1257,18 +1243,18 @@ void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingWithTimeStep::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS); _tk.setTimeValue(tinyInfoD[1]); - _tk.setIteration(tinyInfoI[2]); - _tk.setOrder(tinyInfoI[3]); + _tk.setIteration(FromIdType(tinyInfoI[2])); + _tk.setOrder(FromIdType(tinyInfoI[3])); } /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.resize(2); tinyInfo[0]=_tk.getIteration(); @@ -1288,10 +1274,10 @@ void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector& tinyInfoI, const std::vector& tinyInfoD) +void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { - _tk.setIteration(tinyInfoI[0]); - _tk.setOrder(tinyInfoI[1]); + _tk.setIteration(FromIdType(tinyInfoI[0])); + _tk.setOrder(FromIdType(tinyInfoI[1])); _time_tolerance=tinyInfoD[0]; _tk.setTimeValue(tinyInfoD[1]); } @@ -1607,7 +1593,7 @@ void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector_end); } -void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector& tinyInfo) const { MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo); tinyInfo.push_back(_start.getIteration()); @@ -1659,21 +1645,21 @@ void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::ve tinyInfo.push_back(_end.getTimeValue()); } -void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& 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(tinyInfoI[2])); + _start.setOrder(FromIdType(tinyInfoI[3])); + _end.setIteration(FromIdType(tinyInfoI[4])); + _end.setOrder(FromIdType(tinyInfoI[5])); } /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.resize(4); tinyInfo[0]=_start.getIteration(); @@ -1696,12 +1682,12 @@ void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::v /*! * idem finishUnserialization except that it is for multi field fetch */ -void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) +void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { - _start.setIteration(tinyInfoI[0]); - _start.setOrder(tinyInfoI[1]); - _end.setIteration(tinyInfoI[2]); - _end.setOrder(tinyInfoI[3]); + _start.setIteration(FromIdType(tinyInfoI[0])); + _start.setOrder(FromIdType(tinyInfoI[1])); + _end.setIteration(FromIdType(tinyInfoI[2])); + _end.setOrder(FromIdType(tinyInfoI[3])); _time_tolerance=tinyInfoD[0]; _start.setTimeValue(tinyInfoD[1]); _end.setTimeValue(tinyInfoD[2]); @@ -1826,7 +1812,7 @@ bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCoupl 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) @@ -1837,7 +1823,7 @@ void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, doub 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) @@ -2243,7 +2229,7 @@ void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *own } } -void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector& tinyInfo) const { MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo); tinyInfo.push_back(_start.getIteration()); @@ -2278,7 +2264,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vectorgetInfoOnComponent(i)); } -void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays) +void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays) { arrays.resize(2); if(_array!=0) @@ -2303,7 +2289,7 @@ void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector& t arrays[1]=arr; } -void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays) +void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays) { static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size two !"; if(arrays.size()!=2) @@ -2329,21 +2315,21 @@ void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector& ti } } -void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& 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(tinyInfoI[2])); + _start.setOrder(FromIdType(tinyInfoI[3])); + _end.setIteration(FromIdType(tinyInfoI[4])); + _end.setOrder(FromIdType(tinyInfoI[5])); } /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.resize(4); tinyInfo[0]=_start.getIteration(); @@ -2366,12 +2352,12 @@ void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector& tinyInfoI, const std::vector& tinyInfoD) +void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { - _start.setIteration(tinyInfoI[0]); - _start.setOrder(tinyInfoI[1]); - _end.setIteration(tinyInfoI[2]); - _end.setOrder(tinyInfoI[3]); + _start.setIteration(FromIdType(tinyInfoI[0])); + _start.setOrder(FromIdType(tinyInfoI[1])); + _end.setIteration(FromIdType(tinyInfoI[2])); + _end.setOrder(FromIdType(tinyInfoI[3])); _time_tolerance=tinyInfoD[0]; _start.setTimeValue(tinyInfoD[1]); _end.setTimeValue(tinyInfoD[2]); @@ -2501,7 +2487,7 @@ void MEDCouplingLinearTime::getValueForTime(double time, const std::vector()); } -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) @@ -2519,7 +2505,7 @@ void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value std::transform(tmp.begin(),tmp.end(),value,value,std::plus()); } -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()) { diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx index a45f16ef9..3a1d7b33d 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx @@ -99,12 +99,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretizationTemplate(); - MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); protected: MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate(); MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate(const MEDCouplingTimeDiscretizationTemplate& other, bool deepCopy); @@ -167,17 +167,17 @@ namespace MEDCoupling 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& tinyInfo) const = 0; + MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector& tinyInfo) const = 0; MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector& tinyInfo) const = 0; - MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) = 0; + MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& 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& 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; @@ -191,13 +191,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *negate() const; MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *maxPerTuple() const; MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector& compoIds) const; - MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector& compoIds) const; MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds); - MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& 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); @@ -313,11 +311,11 @@ namespace MEDCoupling 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& 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& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); public: static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME; MEDCOUPLING_EXPORT static const char REPR[]; @@ -359,12 +357,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT void checkNoTimePresence() const; MEDCOUPLING_EXPORT void checkTimePresence(double time) const; @@ -380,8 +378,8 @@ namespace MEDCoupling 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& 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[]; @@ -398,12 +396,12 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval(); MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other); - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const; @@ -414,8 +412,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const; MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const; MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& 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; @@ -490,15 +488,15 @@ namespace MEDCoupling 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& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays); - MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays); + MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const; MEDCOUPLING_EXPORT void setArrays(const std::vector& arrays, TimeLabel *owner); protected: @@ -525,8 +523,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& 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& other) const; MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const; diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx index ced70b7ad..d17900a4d 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx @@ -225,7 +225,7 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::getTinySerializationIntInformation(std::vector& tinyInfo) const + void MEDCouplingTimeDiscretizationTemplate::getTinySerializationIntInformation(std::vector& tinyInfo) const { if(_array) { @@ -254,7 +254,7 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays) + void MEDCouplingTimeDiscretizationTemplate::resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays) { arrays.resize(1); if(_array!=0) @@ -270,7 +270,7 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays) + void MEDCouplingTimeDiscretizationTemplate::checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays) { static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !"; if(arrays.size()!=1) @@ -289,7 +289,7 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) + void MEDCouplingTimeDiscretizationTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { _time_tolerance=tinyInfoD[0]; std::size_t nbOfCompo=_array->getNumberOfComponents(); diff --git a/src/MEDCoupling/MEDCouplingTraits.hxx b/src/MEDCoupling/MEDCouplingTraits.hxx index 1976a38cf..d0d8f7446 100644 --- a/src/MEDCoupling/MEDCouplingTraits.hxx +++ b/src/MEDCoupling/MEDCouplingTraits.hxx @@ -27,12 +27,6 @@ namespace MEDCoupling { - inline void cast_to_remove (const std::vector& in, std::vector& out) - { - out.resize (in.size()); - std::copy (in.begin(), in.end(), out.begin()); - } - template struct MEDCOUPLING_EXPORT Traits { diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index fec373339..603f7c5f7 100755 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -57,7 +57,7 @@ double MEDCouplingUMesh::EPS_FOR_POLYH_ORIENTATION=1.e-14; /// @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() @@ -108,7 +108,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::deepCopyConnectivityOnly() const { checkConnectivityFullyDefined(); MCAuto ret=clone(false); - MCAuto c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy()); + MCAuto c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy()); ret->setConnectivity(c,ci); return ret.retn(); } @@ -176,7 +176,7 @@ void MEDCouplingUMesh::checkConsistencyLight() const MEDCouplingPointSet::checkConsistencyLight(); for(std::set::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); @@ -227,22 +227,22 @@ void MEDCouplingUMesh::checkConsistency(double eps) const 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;igetConstPointer(); + const mcIdType *ptrI=_nodal_connec_index->getConstPointer(); + for(mcIdType i=0;i=0) { if(nodeId>=nbOfNodes) @@ -313,7 +313,7 @@ void MEDCouplingUMesh::setMeshDimension(int meshDim) * \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 !"); @@ -325,10 +325,10 @@ void MEDCouplingUMesh::allocateCells(int nbOfCells) { _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(); @@ -346,22 +346,22 @@ void MEDCouplingUMesh::allocateCells(int nbOfCells) * \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); @@ -439,12 +439,12 @@ std::vector MEDCouplingUMesh::getAllGeoTypesS { std::vector 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;iuseArray(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=0)//for polyhedrons { nbOfEltsInRevNodal++; revNodalIndxPtr[(*iter)+1]++; } } - std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); - int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int)); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); + 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=0)//for polyhedrons - *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; } } @@ -665,7 +665,7 @@ void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataA * \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(desc,descIndx,revDesc,revDescIndx,MEDCouplingFastNbrer); } @@ -677,7 +677,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity(DataArrayInt *de * 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) @@ -691,7 +691,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::explode3DMeshTo1D(DataArrayInt *desc, DataAr * * \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()) @@ -756,7 +756,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::explodeMeshIntoMicroEdges(DataArrayInt *desc * \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(desc,descIndx,revDesc,revDescIndx,MEDCouplingOrientationSensitiveNbrer); } @@ -777,18 +777,18 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayInt *d * \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 desc=DataArrayInt::New(); - MCAuto descIndx=DataArrayInt::New(); - MCAuto revDesc=DataArrayInt::New(); - MCAuto revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayIdType::New(); + MCAuto descIndx=DataArrayIdType::New(); + MCAuto revDesc=DataArrayIdType::New(); + MCAuto revDescIndx=DataArrayIdType::New(); MCAuto 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& cellNeigh, MCAuto& cellNeighIndex) const +void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI, MCAuto& cellNeigh, MCAuto& cellNeighIndex) const { if(!nodeNeigh || !nodeNeighI) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : null pointer !"); @@ -797,13 +797,13 @@ void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayInt *n 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 s; - for(const int *it=c+ci[i]+1;it!=c+ci[i+1];it++) + std::set 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); @@ -832,27 +832,27 @@ void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayInt *n * 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 out0=DataArrayInt::New(); - MCAuto out1=DataArrayInt::New(); out1->alloc(nbCells+1,1); - int *out1Ptr=out1->getPointer(); + MCAuto out0=DataArrayIdType::New(); + MCAuto out1=DataArrayIdType::New(); out1->alloc(nbCells+1,1); + mcIdType *out1Ptr=out1->getPointer(); *out1Ptr++=0; out0->reserve(desc->getNumberOfTuples()); - for(int i=0;i s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]); + std::set s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]); s.erase(i); out0->insertAtTheEnd(s.begin(),s.end()); } @@ -865,11 +865,11 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons /*! * Explodes \a this into edges whatever its dimension. */ -MCAuto MEDCouplingUMesh::explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& revDescIndx) const +MCAuto MEDCouplingUMesh::explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& 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 mesh1D; switch(mdim) { @@ -908,11 +908,11 @@ MCAuto MEDCouplingUMesh::explodeIntoEdges(MCAuto * * \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 desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New()); + mcIdType mdim(getMeshDimension()),nbNodes(getNumberOfNodes()); + MCAuto desc(DataArrayIdType::New()),descIndx(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescIndx(DataArrayIdType::New()); MCConstAuto mesh1D; switch(mdim) { @@ -936,15 +936,15 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArr 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 ret0(DataArrayInt::New()); + MCAuto 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;igetPointer()); + const mcIdType *c1DPtr(mesh1D->getNodalConnectivity()->begin()),*rn(desc->begin()),*rni(descIndx->begin()); + for(mcIdType i=0;i &neighbors, MCAuto& neighborsIdx) const +void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto &neighbors, MCAuto& 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 > st0(nbOfNodes); - for(int eltId=0;eltId s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons - for(std::set::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 > st0(nbOfNodes); + for(mcIdType eltId=0;eltId s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons + for(std::set::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 >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++) + mcIdType *neighIdx(neighborsIdx->getPointer()); + for(std::vector< std::set >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++) { if ((*it).empty()) neighIdx[1]=neighIdx[0]; @@ -983,13 +983,13 @@ void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto &nei 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 >::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 >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++,nodeId++) { - std::set s(*it); s.erase(nodeId); + std::set s(*it); s.erase(nodeId); std::copy(s.begin(),s.end(),neigh+*neighIdx); } } @@ -1018,18 +1018,18 @@ void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto &nei * \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 && *itergetPointer()); - const int *connOld(_nodal_connec->getConstPointer()); - MCAuto 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 connNew(DataArrayIdType::New()),connNewI(DataArrayIdType::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0); std::vector toBeDone(nbOfCells,false); - for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++) + for(const mcIdType *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++) { if(*iter>=0 && *iterpushBackValsSilent(tmp,tmp+newLgth); - connNewI->pushBackSilent(connNewI->back()+(int)newLgth); + connNewI->pushBackSilent(connNewI->back()+ToIdType(newLgth)); delete [] tmp; } else @@ -1109,8 +1109,8 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i */ void MEDCouplingUMesh::convertAllToPoly() { - mcIdType nbOfCells=ToIdType(getNumberOfCells()); - std::vector cellIds(nbOfCells); + mcIdType nbOfCells=getNumberOfCells(); + std::vector cellIds(nbOfCells); for(mcIdType i=0;i newCi=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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 newC=DataArrayInt::New(); + MCAuto newC=DataArrayIdType::New(); newC->alloc(newci[nbOfCells],1); - int *newc=newC->getPointer(); - for(int i=0;igetPointer(); + for(mcIdType i=0;igetPointer(); - 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 tmp=new int[lgthOfCurCell-1]; - std::copy(conn+posOfCurCell+1,conn+posOfCurCell+lgthOfCurCell,(int *)tmp); + INTERP_KERNEL::AutoPtr 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 zipFullReprOfPolyh=INTERP_KERNEL::CellSimplify::getFullPolyh3DCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,nbOfFaces,lgthOfPolyhConn); + mcIdType nbOfFaces,lgthOfPolyhConn; + INTERP_KERNEL::AutoPtr 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; } @@ -1307,19 +1307,19 @@ void MEDCouplingUMesh::simplifyPolyhedra(double eps) MCAuto coords=getCoords()->deepCopy(); coords->recenterForMaxPrecision(eps); // - mcIdType nbOfCells=ToIdType(getNumberOfCells()); - const int *conn=_nodal_connec->getConstPointer(); - const int *index=_nodal_connec_index->getConstPointer(); - MCAuto connINew=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *index=_nodal_connec_index->getConstPointer(); + MCAuto connINew=DataArrayIdType::New(); connINew->alloc(nbOfCells+1,1); - int *connINewPtr=connINew->getPointer(); *connINewPtr++=0; - MCAuto connNew=DataArrayInt::New(); connNew->alloc(0,1); - MCAuto E_Fi(DataArrayInt::New()), E_F(DataArrayInt::New()), F_Ei(DataArrayInt::New()), F_E(DataArrayInt::New()); + mcIdType *connINewPtr=connINew->getPointer(); *connINewPtr++=0; + MCAuto connNew=DataArrayIdType::New(); connNew->alloc(0,1); + MCAuto E_Fi(DataArrayIdType::New()), E_F(DataArrayIdType::New()), F_Ei(DataArrayIdType::New()), F_E(DataArrayIdType::New()); MCAuto m_faces(buildDescendingConnectivity(E_F, E_Fi, F_E, F_Ei)); bool changed=false; - for(int i=0;ibegin(),_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 retS(maxElt,false); computeNodeIdsAlg(retS); - return DataArrayInt::BuildListOfSwitchedOn(retS); + return DataArrayIdType::BuildListOfSwitchedOn(retS); } /*! @@ -1357,10 +1357,10 @@ DataArrayInt *MEDCouplingUMesh::computeFetchedNodeIds() const void MEDCouplingUMesh::computeNodeIdsAlg(std::vector& 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;igetConstPointer()),*conn(_nodal_connec->getConstPointer()); + for(mcIdType i=0;i=0) { if(conn[j]& nodeIdsInUse) const 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 @@ -1389,7 +1389,7 @@ struct MEDCouplingAccVisit * 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. @@ -1403,19 +1403,19 @@ struct MEDCouplingAccVisit * \endif * \sa computeFetchedNodeIds, computeNodeIdsAlg() */ -DataArrayInt *MEDCouplingUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const +DataArrayIdType *MEDCouplingUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const { nbrOfNodesInUse=-1; - int nbOfNodes(getNumberOfNodes()); - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfNodes(getNumberOfNodes()); + MCAuto 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;igetConstPointer(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + for(mcIdType i=0;i=0) { if(conn[j] ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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;igetPointer(); + const mcIdType *conn=getNodalConnectivity()->getConstPointer(); + const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;i ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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 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 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(); @@ -1495,16 +1495,16 @@ DataArrayInt *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const * * \return a newly allocated array */ -DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const +DataArrayIdType *MEDCouplingUMesh::computeNbOfFacesPerCell() const { checkConnectivityFullyDefined(); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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;igetPointer(); + const mcIdType *conn=getNodalConnectivity()->getConstPointer(); + const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;igetNumberOfNodes() 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. @@ -1529,7 +1529,7 @@ DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const * \ref py_mcumesh_zipCoordsTraducer "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingUMesh::zipCoordsTraducer() +DataArrayIdType *MEDCouplingUMesh::zipCoordsTraducer() { return MEDCouplingPointSet::zipCoordsTraducer(); } @@ -1538,7 +1538,7 @@ DataArrayInt *MEDCouplingUMesh::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) { @@ -1559,7 +1559,7 @@ int MEDCouplingUMesh::AreCellsEqual(const int *conn, const int *connI, int cell1 /*! * 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; @@ -1569,9 +1569,9 @@ int MEDCouplingUMesh::AreCellsEqualPolicy0(const int *conn, const int *connI, in /*! * 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]]) @@ -1582,11 +1582,11 @@ int MEDCouplingUMesh::AreCellsEqualPolicy1(const int *conn, const int *connI, in { if(dim!=1) { - int sz1=2*(sz-1); - INTERP_KERNEL::AutoPtr 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 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 @@ -1602,14 +1602,14 @@ int MEDCouplingUMesh::AreCellsEqualPolicy1(const int *conn, const int *connI, in /*! * 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 s1(conn+connI[cell1]+1,conn+connI[cell1+1]); - std::set s2(conn+connI[cell2]+1,conn+connI[cell2+1]); + std::set s1(conn+connI[cell1]+1,conn+connI[cell1+1]); + std::set s2(conn+connI[cell2]+1,conn+connI[cell2+1]); return s1==s2?1:0; } } @@ -1619,12 +1619,12 @@ int MEDCouplingUMesh::AreCellsEqualPolicy2(const int *conn, const int *connI, in /*! * 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 s1(conn+connI[cell1]+1,conn+connI[cell1+1]); - std::set s2(conn+connI[cell2]+1,conn+connI[cell2+1]); + std::set s1(conn+connI[cell1]+1,conn+connI[cell1+1]); + std::set s2(conn+connI[cell2]+1,conn+connI[cell2+1]); return s1==s2?1:0; } return 0; @@ -1633,9 +1633,9 @@ int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const int *conn, const int *con /*! * 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]]) @@ -1646,17 +1646,17 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, in { if(dim!=1) { - int sz1=2*(sz-1); - INTERP_KERNEL::AutoPtr 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 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 it1((int *)tmp+sz1); - std::reverse_iterator it2((int *)tmp); + std::reverse_iterator it1((mcIdType *)tmp+sz1); + std::reverse_iterator it2((mcIdType *)tmp); if(std::search(it1,it2,conn+connI[cell2]+1,conn+connI[cell2+1])!=it2) return 2; else @@ -1671,8 +1671,8 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, in return 1; if(!cm.isQuadratic()) { - std::reverse_iterator it1(conn+connI[cell1+1]); - std::reverse_iterator it2(conn+connI[cell1]+1); + std::reverse_iterator it1(conn+connI[cell1+1]); + std::reverse_iterator it2(conn+connI[cell1]+1); if(std::equal(it1,it2,conn+connI[cell2]+1)) return 2; return 0; @@ -1710,33 +1710,33 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, in * \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 revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New(); + MCAuto 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 commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1); + MCAuto 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 isFetched(nbOfCells,false); if(startCellId==0) { - for(int i=0;i(),-1)); - std::vector v,v2; + const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to(),-1)); + std::vector 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++; } @@ -1744,17 +1744,17 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D if(*connOfNode>=0) { v=v2; - const int *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i); - std::vector::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::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; } } @@ -1763,12 +1763,12 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D } else { - for(int i=startCellId;i(),-1)); - std::vector v,v2; + const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to(),-1)); + std::vector v,v2; if(connOfNode!=connPtr+connIPtr[i+1]) { v2.insert(v2.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1]); @@ -1778,16 +1778,16 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D if(*connOfNode>=0) { v=v2; - std::vector::iterator it=std::set_intersection(v.begin(),v.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin()); + std::vector::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; } } @@ -1808,7 +1808,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D * \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. @@ -1822,10 +1822,10 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D * \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 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)) { @@ -1834,10 +1834,10 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com oss << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - MCAuto o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); + MCAuto 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)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 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 commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); - const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer(); - mcIdType otherNbCells=ToIdType(other->getNumberOfCells()); - MCAuto arr2=DataArrayInt::New(); + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + const mcIdType *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer(); + mcIdType otherNbCells=other->getNumberOfCells(); + MCAuto 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;i0?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); } @@ -1915,13 +1915,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::mergeMyselfWithOnSameCoords(const MEDCouplin * \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(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) @@ -1954,7 +1954,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(int start, int end, i * \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(MEDCouplingPointSet::buildPartOfMySelf(begin,end,keepCoords)); @@ -1981,7 +1981,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelf(const int *begin, const in * \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(); @@ -1993,19 +1993,19 @@ void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsE 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 arrOutAuto(arrOut),arrIOutAuto(arrIOut); + MCAuto 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(); @@ -2042,18 +2042,18 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const 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;igetConstPointer(); + const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer(); + mcIdType it=start; + for(mcIdType i=0;i=0 && it arrOutAuto(arrOut),arrIOutAuto(arrIOut); + MCAuto arrOutAuto(arrOut),arrIOutAuto(arrIOut); setConnectivity(arrOut,arrIOut,true); } } @@ -2105,10 +2105,10 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const * \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 desc,descIndx,revDesc,revDescIndx; - desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); + MCAuto desc,descIndx,revDesc,revDescIndx; + desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New(); MCAuto subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); desc=0; descIndx=0; revDesc=0; revDescIndx=0; return static_cast(subMesh->buildPartOfMySelfNode(begin,end,fullyIn)); @@ -2132,19 +2132,19 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *begin, */ 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 meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); revDesc->decrRef(); desc->decrRef(); descIndx->decrRef(); - mcIdType nbOfCells=ToIdType(meshDM1->getNumberOfCells()); - const int *revDescIndxC=revDescIndx->getConstPointer(); - std::vector boundaryCells; - for(int i=0;igetNumberOfCells(); + const mcIdType *revDescIndxC=revDescIndx->getConstPointer(); + std::vector boundaryCells; + for(mcIdType i=0;idecrRef(); @@ -2153,35 +2153,35 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const } /*! - * 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 desc=DataArrayInt::New(); - MCAuto descIndx=DataArrayInt::New(); - MCAuto revDesc=DataArrayInt::New(); - MCAuto revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayIdType::New(); + MCAuto descIndx=DataArrayIdType::New(); + MCAuto revDesc=DataArrayIdType::New(); + MCAuto revDescIndx=DataArrayIdType::New(); // buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef(); - desc=(DataArrayInt*)0; descIndx=(DataArrayInt*)0; + desc=(DataArrayIdType*)0; descIndx=(DataArrayIdType*)0; // - MCAuto tmp=revDescIndx->deltaShiftIndex(); - MCAuto faceIds=tmp->findIdsEqual(1); tmp=(DataArrayInt*)0; - const int *revDescPtr=revDesc->getConstPointer(); - const int *revDescIndxPtr=revDescIndx->getConstPointer(); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); + MCAuto tmp=revDescIndx->deltaShiftIndex(); + MCAuto faceIds=tmp->findIdsEqual(1); tmp=(DataArrayIdType*)0; + const mcIdType *revDescPtr=revDesc->getConstPointer(); + const mcIdType *revDescIndxPtr=revDescIndx->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); std::vector 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::const_iterator it=ret1.begin();it!=ret1.end();it++,sz++) if(*it) @@ -2208,7 +2208,7 @@ DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const * \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 !"); @@ -2216,21 +2216,21 @@ void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSa otherDimM1OnSameCoords.checkConnectivityFullyDefined(); if(getMeshDimension()-1!=otherDimM1OnSameCoords.getMeshDimension()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : invalid mesh dimension of input mesh regarding meshdimesion of this !"); - MCAuto fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); - MCAuto s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false); + MCAuto fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); + MCAuto s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false); MCAuto thisPart=static_cast(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true)); - MCAuto descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New(); + MCAuto descThisPart=DataArrayIdType::New(),descIThisPart=DataArrayIdType::New(),revDescThisPart=DataArrayIdType::New(),revDescIThisPart=DataArrayIdType::New(); MCAuto 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 idsOtherInConstiAuto(idsOtherInConsti); + MCAuto 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 s1; - for(const int *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++) + std::set s1; + for(const mcIdType *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++) s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]); - MCAuto s1arr_renum1=DataArrayInt::New(); s1arr_renum1->alloc((int)s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer()); + MCAuto 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(); @@ -2245,21 +2245,21 @@ void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSa */ MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const { - MCAuto desc=DataArrayInt::New(); - MCAuto descIndx=DataArrayInt::New(); - MCAuto revDesc=DataArrayInt::New(); - MCAuto revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayIdType::New(); + MCAuto descIndx=DataArrayIdType::New(); + MCAuto revDesc=DataArrayIdType::New(); + MCAuto revDescIndx=DataArrayIdType::New(); // MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); revDesc=0; desc=0; descIndx=0; - MCAuto revDescIndx2=revDescIndx->deltaShiftIndex(); - MCAuto part=revDescIndx2->findIdsEqual(1); + MCAuto revDescIndx2=revDescIndx->deltaShiftIndex(); + MCAuto part=revDescIndx2->findIdsEqual(1); return static_cast(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. @@ -2270,7 +2270,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const * \ref py_mcumesh_findBoundaryNodes "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingUMesh::findBoundaryNodes() const +DataArrayIdType *MEDCouplingUMesh::findBoundaryNodes() const { MCAuto skin=computeSkin(); return skin->computeFetchedNodeIds(); @@ -2293,14 +2293,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildUnstructured() const * 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 DAInt; + typedef MCAuto DAInt; typedef MCAuto MCUMesh; checkFullyDefined(); @@ -2311,7 +2311,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On 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); @@ -2324,7 +2324,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On MCUMesh meshM2Part = static_cast(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 @@ -2334,12 +2334,12 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On 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()) { @@ -2361,23 +2361,23 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On // MCUMesh m0Part2=static_cast(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); @@ -2385,11 +2385,11 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On 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) { @@ -2397,14 +2397,14 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On 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); @@ -2440,9 +2440,9 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On * \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); } @@ -2455,16 +2455,16 @@ void MEDCouplingUMesh::duplicateNodes(const int *nodeIdsToDuplicateBg, const int * * \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=0)//avoid polyhedron separator { node+=offset; @@ -2475,23 +2475,23 @@ void MEDCouplingUMesh::renumberNodesWithOffsetInConn(int 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& newNodeNumbersO2N) +void MEDCouplingUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) { - this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); + this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(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& newNodeNumbersO2N) +void MEDCouplingUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) { - this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); + this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); } /*! @@ -2509,16 +2509,16 @@ void MEDCouplingUMesh::renumberNodesInConn(const std::map& newNodeNumbe * \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;igetPointer(); + const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i=0)//avoid polyhedron separator { node=newNodeNumbersO2N[node]; @@ -2535,16 +2535,16 @@ void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbersO2N) * * \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=0)//avoid polyhedron separator { node+=delta; @@ -2570,23 +2570,23 @@ void MEDCouplingUMesh::shiftNodeNumbersInConn(int 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 m; - int val=offset; - for(const int *work=nodeIdsToDuplicateBg;work!=nodeIdsToDuplicateEnd;work++,val++) + std::map 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=0)//avoid polyhedron separator { - std::map::iterator it=m.find(node); + std::map::iterator it=m.find(node); if(it!=m.end()) node=(*it).second; } @@ -2611,34 +2611,34 @@ void MEDCouplingUMesh::duplicateNodesInConn(const int *nodeIdsToDuplicateBg, con * \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 o2n=DataArrayInt::New(); o2n->useArray(array,false,DeallocType::C_DEALLOC,nbCells,1); - MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); - const int *n2oPtr=n2o->begin(); - MCAuto newConn=DataArrayInt::New(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connI=_nodal_connec_index->getConstPointer(); + MCAuto o2n=DataArrayIdType::New(); o2n->useArray(array,false,DeallocType::C_DEALLOC,nbCells,1); + MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); + const mcIdType *n2oPtr=n2o->begin(); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(_nodal_connec->getNumberOfTuples(),_nodal_connec->getNumberOfComponents()); newConn->copyStringInfoFrom(*_nodal_connec); - MCAuto newConnI=DataArrayInt::New(); + MCAuto 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(array)); + free(const_cast(array)); } /*! @@ -2657,7 +2657,7 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) * \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. @@ -2668,9 +2668,9 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) * \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 elems=DataArrayInt::New(); elems->alloc(0,1); + MCAuto elems=DataArrayIdType::New(); elems->alloc(0,1); if(getMeshDimension()==-1) { elems->pushBackSilent(0); @@ -2678,11 +2678,11 @@ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double } int dim=getSpaceDimension(); INTERP_KERNEL::AutoPtr 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::max(); } - for (int inode=conn_index[ielem]+1; inode=0)//avoid polyhedron separator { for (int idim=0; idim elems=DataArrayInt::New(); elems->alloc(0,1); + MCAuto elems=DataArrayIdType::New(); elems->alloc(0,1); if(getMeshDimension()==-1) { elems->pushBackSilent(0); @@ -2729,11 +2729,11 @@ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::Direc } int dim=getSpaceDimension(); INTERP_KERNEL::AutoPtr 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::max(); } - for (int inode=conn_index[ielem]+1; inode=0)//avoid polyhedron separator { for (int idim=0; idimgetNumberOfCells() ). */ -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 @@ -2792,20 +2792,20 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(std::size_t ce * \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 ret=DataArrayInt::New(); + MCAuto 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;igetConstPointer(); + const mcIdType *pt=_nodal_connec->getConstPointer(); + for(mcIdType i=0;ipushBackSilent(i); @@ -2816,11 +2816,11 @@ DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellT /*! * 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;ibegin()),*pt(_nodal_connec->begin()); + mcIdType nbOfCells(getNumberOfCells()),ret(0); + for(mcIdType i=0;igetNumberOfCells() ). */ -void MEDCouplingUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCouplingUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& 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); } @@ -2939,17 +2939,17 @@ std::string MEDCouplingUMesh::reprConnectivityOfThis() const * 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 ret=MEDCouplingUMesh::New(getName(),mdim); - MCAuto tmp1,tmp2; + MCAuto 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 @@ -2959,7 +2959,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const } 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 @@ -2980,14 +2980,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const 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(),-1)); + return ToIdType(std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to(),-1))); } /*! @@ -3001,13 +3001,13 @@ int MEDCouplingUMesh::getNumberOfNodesInCell(int cellId) const * \throw If the nodal connectivity of cells is not defined. * \sa getAllGeoTypes() */ -std::set MEDCouplingUMesh::getTypesOfPart(const int *begin, const int *end) const +std::set MEDCouplingUMesh::getTypesOfPart(const mcIdType *begin, const mcIdType *end) const { checkFullyDefined(); std::set 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; } @@ -3023,10 +3023,10 @@ std::set MEDCouplingUMesh::getTypesOfPart(con * \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(); @@ -3066,10 +3066,10 @@ void MEDCouplingUMesh::computeTypes() /*! * 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; @@ -3097,21 +3097,21 @@ int MEDCouplingUMesh::getMeshDimension() const * 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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& 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 @@ -3121,7 +3121,7 @@ void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tiny /*! * First step of unserialization process. */ -bool MEDCouplingUMesh::isEmptyMesh(const std::vector& tinyInfo) const +bool MEDCouplingUMesh::isEmptyMesh(const std::vector& tinyInfo) const { return tinyInfo[6]<=0; } @@ -3133,7 +3133,7 @@ bool MEDCouplingUMesh::isEmptyMesh(const std::vector& tinyInfo) const * \param a2 * \param littleStrings */ -void MEDCouplingUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { MEDCouplingPointSet::resizeForUnserialization(tinyInfo,a1,a2,littleStrings); if(tinyInfo[5]!=-1) @@ -3143,16 +3143,16 @@ void MEDCouplingUMesh::resizeForUnserialization(const std::vector& tinyInfo /*! * 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); } @@ -3164,18 +3164,18 @@ void MEDCouplingUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const * Second and final unserialization process. * \param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { MEDCouplingPointSet::unserialization(tinyInfoD,tinyInfo,a1,a2,littleStrings); - setMeshDimension(tinyInfo[5]); + setMeshDimension(FromIdType(tinyInfo[5])); if(tinyInfo[7]!=-1) { // Connectivity - const int *recvBuffer=a1->getConstPointer(); - MCAuto myConnecIndex=DataArrayInt::New(); + const mcIdType *recvBuffer=a1->getConstPointer(); + MCAuto myConnecIndex=DataArrayIdType::New(); myConnecIndex->alloc(tinyInfo[6]+1,1); std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer()); - MCAuto myConnec=DataArrayInt::New(); + MCAuto 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); @@ -3200,7 +3200,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; name+=getName(); - mcIdType nbelem=ToIdType(getNumberOfCells()); + mcIdType nbelem=getNumberOfCells(); MCAuto field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); MCAuto array=DataArrayDouble::New(); @@ -3211,17 +3211,17 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const 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;ielgetConstPointer(); + const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType iel=0;iel(type,connec+ipt+1,connec_index[iel+1]-ipt-1,coords,dim_space); + area_vol[iel]=INTERP_KERNEL::computeVolSurfOfCell2(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(fabs)); @@ -3253,28 +3253,28 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const * \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 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(type,connec+ipt+1,connec_index[*iel+1]-ipt-1,coords,dim_space); + *area_vol++=INTERP_KERNEL::computeVolSurfOfCell2(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(fabs)); @@ -3306,10 +3306,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) cons MCAuto tmp=getMeasureField(isAbs); std::string name="MeasureOnNodeOfMesh_"; name+=getName(); - int nbNodes=getNumberOfNodes(); + mcIdType nbNodes=getNumberOfNodes(); MCAuto nnpc; { - MCAuto tmp(computeNbOfNodesPerCell()); + MCAuto tmp(computeNbOfNodesPerCell()); nnpc=tmp->convertToDblArr(); } std::for_each(nnpc->rwBegin(),nnpc->rwEnd(),[](double& v) { v=1./v; }); @@ -3320,13 +3320,13 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) cons double *valsToFill=array->getPointer(); std::fill(valsToFill,valsToFill+nbNodes,0.); const double *values=tmp->getArray()->getConstPointer(); - MCAuto da=DataArrayInt::New(); - MCAuto daInd=DataArrayInt::New(); + MCAuto da=DataArrayIdType::New(); + MCAuto daInd=DataArrayIdType::New(); getReverseNodalConnectivity(da,daInd); - const int *daPtr=da->getConstPointer(); - const int *daIPtr=daInd->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *daIPtr=daInd->getConstPointer(); + for(mcIdType i=0;isetMesh(this); ret->setArray(array); @@ -3356,12 +3356,12 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); MCAuto 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) { @@ -3369,9 +3369,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const { MCAuto loc=computeCellCenterOfMass(); const double *locPtr=loc->getConstPointer(); - for(int i=0;i(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(),1./n)); @@ -3381,16 +3381,16 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const { MCAuto isAbs=getMeasureField(false); const double *isAbsPtr=isAbs->getArray()->begin(); - for(int i=0;i0.?1.:-1.; } } } else//meshdimension==1 { double tmp[2]; - for(int i=0;i()); double n=INTERP_KERNEL::norm<2>(tmp); std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies(),1./n)); @@ -3429,7 +3429,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const * \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 ) !"); @@ -3437,10 +3437,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be MCAuto 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) { @@ -3448,9 +3448,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be { MCAuto 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(),1./n)); @@ -3465,9 +3465,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be 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 n=INTERP_KERNEL::norm<2>(tmp); std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies(),1./n)); @@ -3501,14 +3501,14 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildDirectionVectorField() const throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); MCAuto 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 conn; + std::vector conn; conn.reserve(2); - for(int i=0;i candidates=getCellIdsCrossingPlane(origin,vec,eps); + MCAuto 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 nodes; - DataArrayInt *cellIds1D=0; + std::vector nodes; + DataArrayIdType *cellIds1D=0; MCAuto subMesh=static_cast(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); - MCAuto desc1=DataArrayInt::New(),desc2=DataArrayInt::New(); - MCAuto descIndx1=DataArrayInt::New(),descIndx2=DataArrayInt::New(); - MCAuto revDesc1=DataArrayInt::New(),revDesc2=DataArrayInt::New(); - MCAuto revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New(); + MCAuto desc1=DataArrayIdType::New(),desc2=DataArrayIdType::New(); + MCAuto descIndx1=DataArrayIdType::New(),descIndx2=DataArrayIdType::New(); + MCAuto revDesc1=DataArrayIdType::New(),revDesc2=DataArrayIdType::New(); + MCAuto revDescIndx1=DataArrayIdType::New(),revDescIndx2=DataArrayIdType::New(); MCAuto mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3 revDesc2=0; revDescIndx2=0; MCAuto 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 cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // - std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) + std::vector 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 > cut3DSurf(mDesc2->getNumberOfCells()); + std::vector< std::pair > cut3DSurf(mDesc2->getNumberOfCells()); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(), mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(), desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); + MCAuto 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()) @@ -3588,14 +3588,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const dou /*! * 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 @@ -3609,54 +3609,54 @@ the result mesh. * \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 candidates(getCellIdsCrossingPlane(origin,vec,eps)); + MCAuto 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 nodes; - DataArrayInt *cellIds1D(0); + std::vector nodes; + DataArrayIdType *cellIds1D(0); MCAuto subMesh(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); - MCAuto desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()); MCAuto mDesc1(subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3 mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D); - MCAuto cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // - std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) + std::vector 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 > cut3DSurf(ncellsSub); + mcIdType ncellsSub=subMesh->getNumberOfCells(); + std::vector< std::pair > cut3DSurf(ncellsSub); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(), mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(), desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0); + MCAuto 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;igetNodalConnectivity()->getConstPointer(); + const mcIdType *nodalI=subMesh->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;ipushBackSilent((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;jpushBackSilent((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); } @@ -3680,52 +3680,52 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double if(getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane works only on mesh containing exactly one cell !"); // - std::vector nodes; + std::vector nodes; findNodesOnPlane(origin,vec,eps,nodes); - MCAuto 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 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 mDesc2(buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2));//meshDim==2 spaceDim==3 revDesc2=0; revDescIndx2=0; MCAuto 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 cellIds1DTmp(cellIds1D); - std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) + MCAuto cellIds1DTmp(cellIds1D); + std::vector 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 > cut3DSurf(mDesc2->getNumberOfCells()); + std::vector< std::pair > cut3DSurf(mDesc2->getNumberOfCells()); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->begin(),mDesc2->getNodalConnectivityIndex()->begin(), mDesc1->getNodalConnectivity()->begin(),mDesc1->getNodalConnectivityIndex()->begin(), desc1->begin(),descIndx1->begin(),cut3DSurf); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); connI->pushBackSilent(0); conn->alloc(0,1); { - MCAuto cellIds2(DataArrayInt::New()); cellIds2->alloc(0,1); + MCAuto 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 > res; + std::vector > 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;ipushBackSilent((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 ret(MEDCouplingUMesh::New("",2)); ret->setCoords(mDesc1->getCoords()); ret->setConnectivity(conn,connI,true); - mcIdType nbCellsRet(ToIdType(ret->getNumberOfCells())); + mcIdType nbCellsRet(ret->getNumberOfCells()); // MCAuto vec2(DataArrayDouble::New()); vec2->alloc(1,3); std::copy(vec,vec+3,vec2->getPointer()); MCAuto ortho(ret->buildOrthogonalField()); @@ -3741,13 +3741,13 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double 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 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 ret2(MEDCouplingUMesh::New("Clip3D",3)); ret2->setCoords(mDesc1->getCoords()); - MCAuto conn2(DataArrayInt::New()),conn2I(DataArrayInt::New()); + MCAuto conn2(DataArrayIdType::New()),conn2I(DataArrayIdType::New()); conn2I->pushBackSilent(0); conn2->alloc(0,1); - std::vector cell0(1,(int)INTERP_KERNEL::NORM_POLYHED); - std::vector cell1(1,(int)INTERP_KERNEL::NORM_POLYHED); + std::vector cell0(1,ToIdType(INTERP_KERNEL::NORM_POLYHED)); + std::vector cell1(1,ToIdType(INTERP_KERNEL::NORM_POLYHED)); if(dott->getIJ(0,0)>0) { cell0.insert(cell0.end(),cPtr+1,cPtr+ciPtr[1]); @@ -3758,7 +3758,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double 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;igetIJ(i,0)<0) { @@ -3793,7 +3793,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double * \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. @@ -3802,7 +3802,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double * \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) @@ -3813,7 +3813,7 @@ DataArrayInt *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, co 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 cellIds; + MCAuto cellIds; double bbox[6]; if(angle>eps) { @@ -3847,12 +3847,12 @@ bool MEDCouplingUMesh::isContiguous1D() const { 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;ibegin()),*conn(_nodal_connec->begin()); + mcIdType ref=conn[connI[0]+2]; + for(mcIdType i=1;i f=buildDirectionVectorField(); const double *fPtr=f->getArray()->getConstPointer(); double tmp[3]; - for(std::size_t i=0;igetConstPointer(); - for(int i=0;i()); std::transform(tmp,tmp+3,v,tmp,std::multiplies()); @@ -3921,7 +3921,7 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps, * 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) @@ -3929,12 +3929,12 @@ double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd 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 pts=DataArrayDouble::New(); pts->useArray(ptBg,false,DeallocType::C_DEALLOC,1,spaceDim); MCAuto ret0=distanceToPoints(pts,ret1); - MCAuto ret1Safe(ret1); + MCAuto ret1Safe(ret1); cellId=*ret1Safe->begin(); return *ret0->begin(); } @@ -3960,7 +3960,7 @@ double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd * \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 !"); @@ -3970,20 +3970,20 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, 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 ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1); - MCAuto 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 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 bboxArr(getBoundingBoxForBBTree()); const double *bbox(bboxArr->begin()); switch(spaceDim) @@ -3991,10 +3991,10 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, case 3: { BBTreeDst<3> myTree(bbox,0,0,nbCells); - for(int i=0;i::max(); - std::vector elems; + std::vector elems; myTree.getMinDistanceOfMax(ptsPtr,x); myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems); DistanceToPoint3DSurfAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr); @@ -4004,10 +4004,10 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, case 2: { BBTreeDst<2> myTree(bbox,0,0,nbCells); - for(int i=0;i::max(); - std::vector elems; + std::vector elems; myTree.getMinDistanceOfMax(ptsPtr,x); myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems); DistanceToPoint2DCurveAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr); @@ -4035,14 +4035,14 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, * 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 elts; + std::vector elts; getCellsContainingPoint(pos,eps,elts); if(elts.empty()) return -1; @@ -4068,16 +4068,16 @@ int MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) cons * \ref py_mcumesh_getCellsContainingPoint "Here is a Python example". * \endif */ -void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const +void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - MCAuto eltsUg,eltsIndexUg; + MCAuto 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& elts, MCAuto& eltsIndex, - std::function sensibilityTo2DQuadraticLinearCellsFunc) const +void MEDCouplingUMesh::getCellsContainingPointsZeAlg(const double *pos, mcIdType nbOfPoints, double eps, + MCAuto& elts, MCAuto& eltsIndex, + std::function sensibilityTo2DQuadraticLinearCellsFunc) const { int spaceDim(getSpaceDimension()),mDim(getMeshDimension()); if(spaceDim==3) @@ -4143,8 +4143,8 @@ void MEDCouplingUMesh::getCellsContainingPointsZeAlg(const double *pos, int nbOf * \ref py_mcumesh_getCellsContainingPoints "Here is a Python example". * \endif */ -void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, - MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, + MCAuto& elts, MCAuto& 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); @@ -4157,9 +4157,9 @@ void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoint * * \sa MEDCouplingUMesh::getCellsContainingPoints, MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss */ -void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& 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); } @@ -4173,7 +4173,7 @@ void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const * \throw If \a this->getMeshDimension() != 2. * \throw If \a this->getSpaceDimension() != 2 && \a this->getSpaceDimension() != 3. */ -void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) const +void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) const { const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!"; if(getMeshDimension()!=2) @@ -4181,14 +4181,14 @@ void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) 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 cell2DinS2; - for(int i=0;i& cells, double eps) * \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 nodalConnecIndexOut=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto nodalConnecIndexOut=DataArrayIdType::New(); nodalConnecIndexOut->alloc(nbOfCells+1,1); - MCAuto nodalConnecOut(DataArrayInt::New()); - int *workIndexOut=nodalConnecIndexOut->getPointer(); + MCAuto 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 types; - MCAuto isChanged(DataArrayInt::New()); + MCAuto isChanged(DataArrayIdType::New()); isChanged->alloc(0,1); - for(int i=0;igetNumberOfTuples(); if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut)) @@ -4279,7 +4279,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMesh(const MEDCouplingUMesh *me 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 newCoords; switch(policy) { @@ -4313,8 +4313,8 @@ bool MEDCouplingUMesh::isFullyQuadratic() const { checkFullyDefined(); bool ret=true; - mcIdType nbOfCells=ToIdType(getNumberOfCells()); - for(int i=0;ibegin(); - for(int i=0;ibegin(); + for(mcIdType i=0;i newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); - const int *icptr(_nodal_connec->begin()); + MCAuto 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 types; checkFullyDefined(); - MCAuto ret,connSafe,connISafe; + MCAuto ret,connSafe,connISafe; MCAuto coordsSafe; int meshDim=getMeshDimension(); switch(conversionType) @@ -4531,8 +4531,8 @@ void MEDCouplingUMesh::tessellate2D(double eps) * * \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 !"); @@ -4541,9 +4541,9 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, 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 out0s(out0),outi0s(outi0); + //MCAuto out0s(out0),outi0s(outi0); //out0s=out0s->buildUnique(); out0s->sort(true); } #endif @@ -4564,7 +4564,7 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, * - 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. * @@ -4575,7 +4575,7 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, * \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) { @@ -4583,9 +4583,9 @@ DataArrayInt *MEDCouplingUMesh::simplexize(int 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)"); @@ -4612,10 +4612,10 @@ bool MEDCouplingUMesh::areOnlySimplexCells() const 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;ibegin(); + const mcIdType *connI=_nodal_connec_index->begin(); + for(mcIdType i=0;igetPointer(); - int *index=_nodal_connec_index->getPointer(); - int posOfCurCell=0; - int newPos=0; - int lgthOfCurCell; - for(int i=0;igetPointer(); + mcIdType *index=_nodal_connec_index->getPointer(); + mcIdType posOfCurCell=0; + mcIdType newPos=0; + mcIdType lgthOfCurCell; + for(mcIdType i=0;i ret(DataArrayInt::New()); ret->alloc(0,1); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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;igetPointer(); + mcIdType *index=_nodal_connec_index->getPointer(); + mcIdType posOfCurCell=0; + mcIdType newPos=0; + mcIdType lgthOfCurCell, nbDelCells(0); + for(mcIdType i=0;ibegin()),*conni(getNodalConnectivityIndex()->begin()); + const mcIdType *conn(getNodalConnectivity()->begin()),*conni(getNodalConnectivityIndex()->begin()); { for(std::size_t i=0;i do nothing return false; - MCAuto 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 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& cells) const +void MEDCouplingUMesh::are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector& 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;igetPointer()); - 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;igetPointer()); - 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& cells) const +void MEDCouplingUMesh::arePolyhedronsNotCorrectlyOriented(std::vector& 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;igetPointer(); - 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 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::const_iterator gt=gts.begin();gt!=gts.end();gt++) { INTERP_KERNEL::AutoCppPtr oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(*gt)); - MCAuto cwt(giveCellsWithType(*gt)); - for(const int *it=cwt->begin();it!=cwt->end();it++) + MCAuto cwt(giveCellsWithType(*gt)); + for(const mcIdType *it=cwt->begin();it!=cwt->end();it++) oi->operate(conn+conni[*it]+1,conn+conni[*it+1]); } updateTime(); @@ -4990,7 +4990,7 @@ void MEDCouplingUMesh::invertOrientationOfAllCells() * 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. @@ -5004,7 +5004,7 @@ void MEDCouplingUMesh::invertOrientationOfAllCells() * \endif * \sa MEDCouplingUMesh::findAndCorrectBadOriented3DCells */ -DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() +DataArrayIdType *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() { const char msg[]="check3DCellsWellOriented detection works only for 3D cells !"; if(getMeshDimension()!=3) @@ -5013,12 +5013,12 @@ DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() 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 cells(DataArrayInt::New()); cells->alloc(0,1); - for(int i=0;i cells(DataArrayIdType::New()); cells->alloc(0,1); + for(mcIdType i=0;igetPointer(); - 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 ret=DataArrayInt::New(); ret->alloc(0,1); - for(int i=0;i ret=DataArrayIdType::New(); ret->alloc(0,1); + for(mcIdType i=0;ibegin(); - 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(conn+1,connI[1]-connI[0]-1,coordsPtr,vec); + INTERP_KERNEL::areaVectorOfPolygon(conn+1,connI[1]-connI[0]-1,coordsPtr,vec); std::copy(coordsPtr+3*conn[1],coordsPtr+3*conn[1]+3,pos); } @@ -5153,16 +5153,16 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); MCAuto 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 ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); MCAuto 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 ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); MCAuto 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 ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); MCAuto 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;isetMesh(this); std::set types; ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index); - mcIdType spaceDim(getSpaceDimension()),nbCells(ToIdType(getNumberOfCells())); + int spaceDim(getSpaceDimension()); + mcIdType nbCells(getNumberOfCells()); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); for(std::set::const_iterator it=types.begin();it!=types.end();it++) { INTERP_KERNEL::AutoCppPtr dc(INTERP_KERNEL::CellModel::GetCellModel(*it).buildInstanceOfDiameterCalulator(spaceDim)); - MCAuto cellIds(giveCellsWithType(*it)); + MCAuto cellIds(giveCellsWithType(*it)); dc->computeForListOfCellIdsUMeshFrmt(cellIds->begin(),cellIds->end(),_nodal_connec_index->begin(),_nodal_connec->begin(),getCoords()->begin(),arr->getPointer()); } ret->setArray(arr); @@ -5478,24 +5479,24 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree(double arcDetEps) con DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const { checkFullyDefined(); - int spaceDim(getSpaceDimension()),nbOfNodes(getNumberOfNodes()); - mcIdType nbOfCells(ToIdType(getNumberOfCells())); + int spaceDim(getSpaceDimension()); + mcIdType nbOfCells(getNumberOfCells()), nbOfNodes(getNumberOfNodes()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); - for(int i=0;i::max(); bbox[2*i+1]=-std::numeric_limits::max(); } const double *coordsPtr(_coords->begin()); - const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); - for(int i=0;ibegin()),*connI(_nodal_connec_index->begin()); + for(mcIdType i=0;i=0 && nodeId 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;ibegin()),*connI(_nodal_connec_index->begin()); + for(mcIdType i=0;i nodes(sz); INTERP_KERNEL::QuadraticPolygon *pol(0); - for(int j=0;j 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;ibegin()),*connI(_nodal_connec_index->begin()); + for(mcIdType i=0;i nodes(sz); INTERP_KERNEL::Edge *edge(0); - for(int j=0;j MEDCouplingUMesh::getDistributionOfTypes() const +std::vector 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 ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here + std::vector ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here std::set types; for(std::size_t i=0;work!=connI+nbOfCells;i++) { @@ -5664,8 +5665,8 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const } 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; @@ -5686,9 +5687,9 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const * * 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& code, const std::vector& idsPerType) const +DataArrayIdType *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { if(code.empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code is empty, should not !"); @@ -5697,7 +5698,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !"); std::vector types; - int nb=0; + mcIdType nb=0; bool isNoPflUsed=true; for(std::size_t i=0;i ret=DataArrayInt::New(); + MCAuto 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::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=0 && idInIdsPerType<(int)idsPerType.size()) + mcIdType idInIdsPerType=code[3*kk+2]; + if(idInIdsPerType>=0 && idInIdsPerTypecheckAllocated(); 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& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const +void MEDCouplingUMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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 types; - std::vector typeRangeVals(1); - for(const int *i=connI;i!=connI+nbOfCells;) + std::vector 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()) @@ -5809,33 +5810,33 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec 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 tmp0=castArr; - MCAuto tmp1=rankInsideCast; - MCAuto tmp2=castsPresent; + MCAuto tmp0=castArr; + MCAuto tmp1=rankInsideCast; + MCAuto tmp2=castsPresent; // mcIdType nbOfCastsFinal=castsPresent->getNumberOfTuples(); code.resize(3*nbOfCastsFinal); - std::vector< MCAuto > idsInPflPerType2; - std::vector< MCAuto > idsPerType2; - for(int i=0;i > idsInPflPerType2; + std::vector< MCAuto > idsPerType2; + for(mcIdType i=0;igetIJ(i,0); - MCAuto tmp3=castArr->findIdsEqual(castId); + mcIdType castId=castsPresent->getIJ(i,0); + MCAuto 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 tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples()); + MCAuto 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 { @@ -5846,7 +5847,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec idsInPflPerType.resize(sz2); for(std::size_t i=0;iincrRef(); idsInPflPerType[i]=locDa; } @@ -5854,7 +5855,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec idsPerType.resize(sz); for(std::size_t i=0;iincrRef(); idsPerType[i]=locDa; } @@ -5866,7 +5867,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec * 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(); @@ -5874,20 +5875,20 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 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 tmp0=DataArrayInt::New(); - MCAuto tmp1=DataArrayInt::New(); + MCAuto tmp0=DataArrayIdType::New(); + MCAuto tmp1=DataArrayIdType::New(); MCAuto ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1); - MCAuto ret0=ret1->sortCellsInMEDFileFrmt(); + MCAuto ret0=ret1->sortCellsInMEDFileFrmt(); desc->transformWithIndArr(ret0->begin(),ret0->begin()+ret0->getNbOfElems()); MCAuto 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 << " !"; @@ -5907,14 +5908,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 * 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 ret=getRenumArrForMEDFileFrmt(); + MCAuto ret=getRenumArrForMEDFileFrmt(); renumberCells(ret->begin(),false); return ret.retn(); } @@ -5926,17 +5927,17 @@ DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt() 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 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; } @@ -5961,30 +5962,30 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesForMEDFileFrmt() const 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 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 @@ -5995,29 +5996,29 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No } /*! - * 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 tmpa=DataArrayInt::New(); - MCAuto tmpb=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + MCAuto tmpa=DataArrayIdType::New(); + MCAuto 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; } @@ -6040,7 +6041,7 @@ DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::Norma * * \sa MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec, MEDCouplingUMesh::sortCellsInMEDFileFrmt. */ -DataArrayInt *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const +DataArrayIdType *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const { return getRenumArrForConsecutiveCellTypesSpec(MEDMEM_ORDER,MEDMEM_ORDER+N_MEDMEM_ORDER); } @@ -6051,10 +6052,10 @@ DataArrayInt *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const * 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 tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType); + DataArrayIdType *nbPerType=0; + MCAuto tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType); nbPerType->decrRef(); return tmpa->buildPermArrPerLevel(); } @@ -6067,29 +6068,29 @@ DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INT * * \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 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::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++; } @@ -6105,19 +6106,19 @@ DataArrayInt *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes() std::vector 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 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((MEDCoupling1GTUMesh*)ret); if(retC) { - MCAuto c=convertNodalConnectivityToStaticGeoTypeMesh(); + MCAuto c=convertNodalConnectivityToStaticGeoTypeMesh(); retC->setNodalConnectivity(c); } else @@ -6155,15 +6156,15 @@ MEDCoupling1GTUMesh *MEDCouplingUMesh::convertIntoSingleGeoTypeMesh() const MEDCoupling1DGTUMesh *retD=dynamic_cast((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 cs(c),cis(ci); + MCAuto cs(c),cis(ci); retD->setNodalConnectivity(cs,cis); } return ret.retn(); } -DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() const +DataArrayIdType *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() const { checkConnectivityFullyDefined(); if(_types.size()!=1) @@ -6176,15 +6177,15 @@ DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() co 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 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 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;igetNumberOfTuples(); if(lgth c(DataArrayInt::New()),ci(DataArrayInt::New()); + MCAuto 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=1) { if((strt>=0 && strt=0 && stop<=lgth)) @@ -6245,16 +6246,16 @@ void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt * * \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& ms, - DataArrayInt *&szOfCellGrpOfSameType, - DataArrayInt *&idInMsOfCellGrpOfSameType) + DataArrayIdType *&szOfCellGrpOfSameType, + DataArrayIdType *&idInMsOfCellGrpOfSameType) { std::vector ms2; for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) @@ -6272,8 +6273,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons // std::vector m1ssmSingle; std::vector< MCAuto > m1ssmSingleAuto; - int fake=0,rk=0; - MCAuto ret1(DataArrayInt::New()),ret2(DataArrayInt::New()); + mcIdType fake=0,rk=0; + MCAuto ret1(DataArrayIdType::New()),ret2(DataArrayIdType::New()); ret1->alloc(0,1); ret2->alloc(0,1); for(std::vector::const_iterator it=ms2.begin();it!=ms2.end();it++,rk++) { @@ -6289,11 +6290,11 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons MEDCouplingUMesh *singleCell=static_cast((*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 m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle); - MCAuto renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); + MCAuto renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); std::vector m1ssmfinal(m1ssm.size()); for(mcIdType i=0;igetIJ(i,0)]=m1ssm[i]; @@ -6304,16 +6305,16 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons } /*! - * 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 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 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(); @@ -6323,28 +6324,28 @@ DataArrayInt *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellT * This method makes the assumption that da->getNumberOfTuples()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 types(getAllGeoTypes()); - int *tmp=new int[nbOfCells]; + mcIdType *tmp=new mcIdType[nbOfCells]; for(std::set::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;kgetPointer(); + const mcIdType *daPtr=da->begin(); + mcIdType nbOfElems=da->getNbOfElems(); + for(mcIdType k=0;k code=getDistributionOfTypes(); + std::vector 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=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 idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1); - int *idsPtr=idsTokeep->getPointer(); - int offset=0; + MCAuto 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(),offset)); + idsPtr=std::transform(idsPerGeoTypeBg,idsPerGeoTypeEnd,idsPtr,std::bind2nd(std::plus(),offset)); offset+=code[3*i+1]; } MCAuto ret=static_cast(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true)); @@ -6398,11 +6399,11 @@ MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::Normalized */ std::vector MEDCouplingUMesh::getQuadraticStatus() const { - mcIdType ncell=ToIdType(getNumberOfCells()); + mcIdType ncell=getNumberOfCells(); std::vector ret(ncell); - const int *cI=getNodalConnectivityIndex()->begin(); - const int *c=getNodalConnectivity()->begin(); - for(int i=0;ibegin(); + const mcIdType *c=getNodalConnectivity()->begin(); + for(mcIdType i=0;i 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(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill); + INTERP_KERNEL::computeBarycenter2(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } return ret.retn(); @@ -6494,20 +6495,20 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const checkFullyDefined(); MCAuto 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=0 && *conn()); @@ -6517,7 +6518,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const 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(),1./(double)nbOfNodesInCell)); else @@ -6528,9 +6529,9 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const } else { - std::set s(nodal+nodalI[i]+1,nodal+nodalI[i+1]); + std::set s(nodal+nodalI[i]+1,nodal+nodalI[i+1]); s.erase(-1); - for(std::set::const_iterator it=s.begin();it!=s.end();it++) + for(std::set::const_iterator it=s.begin();it!=s.end();it++) { if(*it>=0 && *it()); @@ -6571,21 +6572,21 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const * \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(type,nodal+nodalI[*w]+1,nodalI[*w+1]-nodalI[*w]-1,coor,spaceDim,ptToFill); + INTERP_KERNEL::computeBarycenter2(type,nodal+nodalI[*w]+1,nodalI[*w+1]-nodalI[*w]-1,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } delete [] tmp; @@ -6607,15 +6608,15 @@ DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const int *begin, c DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const { MCAuto 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=4) @@ -6630,7 +6631,7 @@ DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const 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()); - int nbOfNodesInCell(nodalI[1]-nodalI[0]-1); + mcIdType nbOfNodesInCell(nodalI[1]-nodalI[0]-1); std::transform(dd,dd+3,dd,std::bind2nd(std::multiplies(),1./(double)nbOfNodesInCell)); std::copy(dd,dd+3,matrix+4*2); INTERP_KERNEL::inverseMatrix(matrix,4,matrix2); @@ -6686,12 +6687,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) ret->setName("Mesh"); ret->setCoords(da); mcIdType nbOfTuples(da->getNumberOfTuples()); - MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); + MCAuto 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;igetCoords(); 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 !"); @@ -6839,8 +6840,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetCoords(); int meshDim=meshes.front()->getMeshDimension(); std::vector::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()) @@ -6848,24 +6849,24 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetMeshDimension()) throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, FuseUMeshesOnSameCoords impossible !"); meshLgth+=(*iter)->getNodalConnectivityArrayLen(); - meshIndexLgth+=ToIdType((*iter)->getNumberOfCells()); + meshIndexLgth+=(*iter)->getNumberOfCells(); } - MCAuto nodal=DataArrayInt::New(); + MCAuto nodal=DataArrayIdType::New(); nodal->alloc(meshLgth,1); - int *nodalPtr=nodal->getPointer(); - MCAuto nodalIndex=DataArrayInt::New(); + mcIdType *nodalPtr=nodal->getPointer(); + MCAuto 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(),offset)); + nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind2nd(std::plus(),offset)); else nodalIndexPtr=std::copy(index,index+nbOfCells+1,nodalIndexPtr); offset+=meshLgth2; @@ -6887,7 +6888,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr) +MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr) { //All checks are delegated to MergeUMeshesOnSameCoords MCAuto ret=MergeUMeshesOnSameCoords(meshes); - MCAuto o2n=ret->zipConnectivityTraducer(compType); + MCAuto 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;igetNumberOfCells()); + DataArrayIdType *tmp=DataArrayIdType::New(); + mcIdType curNbOfCells=meshes[i]->getNumberOfCells(); tmp->alloc(curNbOfCells,1); std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer()); offset+=curNbOfCells; @@ -6968,11 +6969,11 @@ void MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(const std::vector res=DataArrayDouble::Aggregate(coords); std::vector::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; @@ -7015,12 +7016,12 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vectorfindCommonTuples(eps,-1,comm,commI); - MCAuto tmp1(comm),tmp2(commI); + MCAuto tmp1(comm),tmp2(commI); mcIdType oldNbOfNodes=coo->getNumberOfTuples(); - int newNbOfNodes; - MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); + mcIdType newNbOfNodes; + MCAuto o2n=DataArrayIdType::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); if(oldNbOfNodes==newNbOfNodes) return ; MCAuto newCoords=coo->renumberAndReduce(o2n->begin(),newNbOfNodes); @@ -7035,7 +7036,7 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vector > edges; + std::vector > 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 p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); + std::pair 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(begin,(int)std::distance(begin,end),coords)>-EPS_FOR_POLYH_ORIENTATION; + return INTERP_KERNEL::calculateVolumeForPolyh2(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(begin,nbOfNodes,coords,vec0); + mcIdType nbOfNodes=ToIdType(sz/2); + INTERP_KERNEL::areaVectorOfPolygon(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 tmp=new int[sz]; + INTERP_KERNEL::AutoPtr 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(begin,4,coords,vec0); + INTERP_KERNEL::areaVectorOfPolygon(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.; } @@ -7163,74 +7164,74 @@ bool MEDCouplingUMesh::IsPyra5WellOriented(const int *begin, const int *end, con * \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 v=DataArrayDouble::New(); v->alloc(nbFaces,3); double *vPtr=v->getPointer(); MCAuto 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;igetPointer(), *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;ibegin(), 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(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 comm1Auto(comm1),commI1Auto(commI1); - const int *comm1Ptr=comm1->begin(); - const int *commI1Ptr=commI1->begin(); + MCAuto 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 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 comm2Auto(comm2),commI2Auto(commI2); - const int *comm2Ptr=comm2->begin(); - const int *commI2Ptr=commI2->begin(); + MCAuto comm2Auto(comm2),commI2Auto(commI2); + const mcIdType *comm2Ptr=comm2->begin(); + const mcIdType *commI2Ptr=commI2->begin(); mcIdType nbOfGrps2=commI2Auto->getNumberOfTuples()-1; - for(int j=0;jinsertAtTheEnd(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 ids2=comm2->selectByTupleIdSafeSlice(commI2Ptr[j],commI2Ptr[j+1],1); + mcIdType pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]]; + MCAuto 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 mm3=static_cast(faces->buildPartOfMySelf(ids2->begin(),ids2->end(),true)); - MCAuto idsNodeTmp=mm3->zipCoordsTraducer(); - MCAuto idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes()); - const int *idsNodePtr=idsNode->begin(); + MCAuto idsNodeTmp=mm3->zipCoordsTraducer(); + MCAuto 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]; @@ -7241,13 +7242,13 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble } mm3->changeSpaceDimension(2); MCAuto mm4=mm3->buildSpreadZonesWithPoly(); - const int *conn4=mm4->getNodalConnectivity()->begin(); - const int *connI4=mm4->getNodalConnectivityIndex()->begin(); - mcIdType nbOfCells=ToIdType(mm4->getNumberOfCells()); - for(int k=0;kgetNodalConnectivity()->begin(); + const mcIdType *connI4=mm4->getNodalConnectivityIndex()->begin(); + mcIdType nbOfCells=mm4->getNumberOfCells(); + for(mcIdType k=0;kpushBackSilent(idsNodePtr[*work]); res->pushBackSilent(-1); } @@ -7268,7 +7269,7 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble * \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) @@ -7314,15 +7315,15 @@ void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, c * 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 > edgesOK,edgesFinished; + std::list< std::pair > edgesOK,edgesFinished; std::size_t nbOfFaces=std::count(begin,end,-1)+1; std::vector 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 p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); } + for(std::size_t l=0;l p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); } // while(std::find(isPerm.begin(),isPerm.end(),false)!=isPerm.end()) { @@ -7337,8 +7338,8 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, c bool b; for(std::size_t j=0;j p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); - std::pair p2(p1.second,p1.first); + std::pair p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); + std::pair 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; } @@ -7349,13 +7350,13 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, c std::reverse(bgFace+1,endFace); for(std::size_t j=0;j p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); - std::pair p2(p1.second,p1.first); + std::pair p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); + std::pair 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 >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2); + std::list< std::pair >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2); if(it!=edgesOK.end()) { edgesOK.erase(it); @@ -7373,7 +7374,7 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, c } 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(begin,(int)std::distance(begin,end),coords)<-EPS_FOR_POLYH_ORIENTATION) + if(INTERP_KERNEL::calculateVolumeForPolyh2(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 skin(computeSkin()); - int oldNbOfNodes(skin->getNumberOfNodes()); - MCAuto o2n(skin->zipCoordsTraducer()); - int nbOfNodesExpected(skin->getNumberOfNodes()); - MCAuto n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); - mcIdType nbCells=ToIdType(skin->getNumberOfCells()); + mcIdType oldNbOfNodes(skin->getNumberOfNodes()); + MCAuto o2n(skin->zipCoordsTraducer()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); + MCAuto n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); + mcIdType nbCells=skin->getNumberOfCells(); if(nbCells==nbOfNodesExpected) return buildUnionOf2DMeshLinear(skin,n2o); else if(2*nbCells==nbOfNodesExpected) @@ -7416,20 +7417,20 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMesh() const * * \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 m=computeSkin(); - const int *conn=m->getNodalConnectivity()->begin(); - const int *connI=m->getNodalConnectivityIndex()->begin(); - mcIdType nbOfCells=ToIdType(m->getNumberOfCells()); - MCAuto 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 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;igetMeshDimension(); - 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 @@ -7476,25 +7477,25 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const //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 cell2cell_index(nbCells+1,0); - std::vector cell2cell; + std::vector cell2cell_index(nbCells+1,0); + std::vector cell2cell; cell2cell.reserve(3*nbCells); - for (int icell=0; icell counter; - for (int iconn=index_ptr[icell]+1; iconn counter; + for (mcIdType iconn=index_ptr[icell]+1; iconn::iterator iter=counter.find(icell2); + mcIdType icell2=revConn_ptr[iconnr]; + std::map::iterator iter=counter.find(icell2); if (iter!=counter.end()) (iter->second)++; else counter.insert(std::make_pair(icell2,1)); } } - for (std::map::const_iterator iter=counter.begin(); + for (std::map::const_iterator iter=counter.begin(); iter!=counter.end(); iter++) if (iter->second >= meshDim) { @@ -7505,7 +7506,7 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const indexr->decrRef(); revConn->decrRef(); cell2cell_index[0]=0; - for (int icell=0; icell\n"; @@ -7535,15 +7536,15 @@ void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData } ofs << " \n"; ofs << " \n"; - const int *cPtr=_nodal_connec->begin(); - const int *cIPtr=_nodal_connec_index->begin(); - MCAuto faceoffsets=DataArrayInt::New(); faceoffsets->alloc(nbOfCells,1); - MCAuto types=DataArrayInt::New(); types->alloc(nbOfCells,1); - MCAuto offsets=DataArrayInt::New(); offsets->alloc(nbOfCells,1); - MCAuto 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;ibegin(); + const mcIdType *cIPtr=_nodal_connec_index->begin(); + MCAuto faceoffsets=DataArrayIdType::New(); faceoffsets->alloc(nbOfCells,1); + MCAuto types=DataArrayIdType::New(); types->alloc(nbOfCells,1); + MCAuto offsets=DataArrayIdType::New(); offsets->alloc(nbOfCells,1); + MCAuto 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 c(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1]); c.erase(-1); - *w3=szConn+(int)c.size(); szConn+=(int)c.size(); + std::set 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); } } @@ -7568,18 +7569,18 @@ void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData {//presence of Polyhedra connectivity->reAlloc(szConn); faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData); - MCAuto faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1); + MCAuto faces=DataArrayIdType::New(); faces->alloc(szFaceOffsets,1); w1=faces->getPointer(); - for(int i=0;i _d(DataArrayInt::New()),_dI(DataArrayInt::New()); - MCAuto _rD(DataArrayInt::New()),_rDI(DataArrayInt::New()); + MCAuto _d(DataArrayIdType::New()),_dI(DataArrayIdType::New()); + MCAuto _rD(DataArrayIdType::New()),_rDI(DataArrayIdType::New()); MCAuto m_points(buildDescendingConnectivity(_d, _dI, _rD, _rDI)); - const int *d(_d->begin()), *dI(_dI->begin()); - const int *rD(_rD->begin()), *rDI(_rDI->begin()); - MCAuto _dsi(_rDI->deltaShiftIndex()); - const int * dsi(_dsi->begin()); - MCAuto dsii = _dsi->findIdsNotInRange(0,3); + const mcIdType *d(_d->begin()), *dI(_dI->begin()); + const mcIdType *rD(_rD->begin()), *rDI(_rDI->begin()); + MCAuto _dsi(_rDI->deltaShiftIndex()); + const mcIdType * dsi(_dsi->begin()); + MCAuto 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 result(DataArrayInt::New()); + mcIdType nc=getNumberOfCells(); + MCAuto result(DataArrayIdType::New()); result->alloc(nc,1); // set of edges not used so far - std::set edgeSet; - for (int i=0; i edgeSet; + for (mcIdType i=0; i linePiece; + std::list 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 @@ -7692,12 +7693,12 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const 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; } } @@ -7723,7 +7724,7 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const * \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. @@ -7731,7 +7732,7 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const * \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 !"); @@ -7758,7 +7759,7 @@ int MEDCouplingUMesh::split2DCells(const DataArrayInt *desc, const DataArrayInt * * \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) @@ -7766,8 +7767,8 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co 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++) { @@ -7777,14 +7778,14 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co refX=coords[2*startNode]; } } - std::vector tmpOut; tmpOut.reserve(sz); tmpOut.push_back(startNode); + std::vector 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) @@ -7819,8 +7820,8 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co tmpOut.push_back(nextNode); } } - std::vector tmp3(2*(sz-1)); - std::vector::iterator it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin()); + std::vector tmp3(2*(sz-1)); + std::vector::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()) { @@ -7834,7 +7835,7 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co } else { - nodalConnecOut->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON); + nodalConnecOut->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYGON)); nodalConnecOut->insertAtTheEnd(tmpOut.begin(),tmpOut.end()); return true; } @@ -7849,7 +7850,7 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co /*! * 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. @@ -7859,16 +7860,16 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co * \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. @@ -7881,7 +7882,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGradually(const DataArrayInt *a * \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) @@ -7889,7 +7890,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const int *se 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; } // @@ -7915,17 +7916,17 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const int spaceDim=getSpaceDimension(); if(mdim!=spaceDim) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension and spacedimension do not match !"); - std::vector partition=partitionBySpreadZone(); - std::vector< MCAuto > partitionAuto; partitionAuto.reserve(partition.size()); - std::copy(partition.begin(),partition.end(),std::back_insert_iterator > >(partitionAuto)); + std::vector partition=partitionBySpreadZone(); + std::vector< MCAuto > partitionAuto; partitionAuto.reserve(partition.size()); + std::copy(partition.begin(),partition.end(),std::back_insert_iterator > >(partitionAuto)); MCAuto ret=MEDCouplingUMesh::New(getName(),mdim); ret->setCoords(getCoords()); - ret->allocateCells((int)partition.size()); + ret->allocateCells(ToIdType(partition.size())); // - for(std::vector::const_iterator it=partition.begin();it!=partition.end();it++) + for(std::vector::const_iterator it=partition.begin();it!=partition.end();it++) { MCAuto tmp=static_cast(buildPartOfMySelf((*it)->begin(),(*it)->end(),true)); - MCAuto cell; + MCAuto cell; switch(mdim) { case 2: @@ -7950,15 +7951,15 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const * 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 MEDCouplingUMesh::partitionBySpreadZone() const +std::vector MEDCouplingUMesh::partitionBySpreadZone() const { - DataArrayInt *neigh=0,*neighI=0; + DataArrayIdType *neigh=0,*neighI=0; computeNeighborsOfCells(neigh,neighI); - MCAuto neighAuto(neigh),neighIAuto(neighI); + MCAuto neighAuto(neigh),neighIAuto(neighI); return PartitionBySpreadZone(neighAuto,neighIAuto); } -std::vector MEDCouplingUMesh::PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) +std::vector MEDCouplingUMesh::PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn) { if(!arrIn || !arrIndxIn) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !"); @@ -7966,40 +7967,40 @@ std::vector MEDCouplingUMesh::PartitionBySpreadZone(const DataAr 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 ret; + mcIdType nbOfCellsCur(nbOfTuples-1); + std::vector ret; if(nbOfCellsCur<=0) return ret; std::vector fetchedCells(nbOfCellsCur,false); - std::vector< MCAuto > ret2; - int seed=0; + std::vector< MCAuto > ret2; + mcIdType seed=0; while(seed >::iterator it=ret2.begin();it!=ret2.end();it++) + for(std::vector< MCAuto >::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& code) +DataArrayIdType *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector& code) { - MCAuto ret=DataArrayInt::New(); + MCAuto 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_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. @@ -8032,35 +8033,35 @@ DataArrayInt *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vec * \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 ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4)); - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfCells,1); - int *retPt(ret->getPointer()); - MCAuto newConn(DataArrayInt::New()); newConn->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfCells,1); + mcIdType *retPt(ret->getPointer()); + MCAuto newConn(DataArrayIdType::New()); newConn->alloc(0,1); MCAuto 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 a; std::vector b; + std::vector a; std::vector 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::iterator it=a.begin();it!=a.end();it++) + for(std::vector::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;jinsertAtTheEnd(aa,aa+4); @@ -8090,7 +8091,7 @@ MEDCouplingUMeshCellIterator::MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mes if(mesh) { mesh->incrRef(); - _nb_cell=ToIdType(mesh->getNumberOfCells()); + _nb_cell=mesh->getNumberOfCells(); } } @@ -8102,7 +8103,7 @@ MEDCouplingUMeshCellIterator::~MEDCouplingUMeshCellIterator() 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) { @@ -8139,7 +8140,7 @@ MEDCouplingUMeshCellByTypeEntry::~MEDCouplingUMeshCellByTypeEntry() _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) { @@ -8158,7 +8159,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMeshCellEntry::getType() const return _type; } -int MEDCouplingUMeshCellEntry::getNumberOfElems() const +mcIdType MEDCouplingUMeshCellEntry::getNumberOfElems() const { return _end-_bg; } @@ -8173,7 +8174,7 @@ MEDCouplingUMeshCellByTypeIterator::MEDCouplingUMeshCellByTypeIterator(MEDCoupli if(mesh) { mesh->incrRef(); - _nb_cell=ToIdType(mesh->getNumberOfCells()); + _nb_cell=mesh->getNumberOfCells(); } } @@ -8186,13 +8187,13 @@ MEDCouplingUMeshCellByTypeIterator::~MEDCouplingUMeshCellByTypeIterator() 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); } @@ -8225,7 +8226,7 @@ std::string MEDCouplingUMeshCell::repr() const { 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(oss," ")); + std::copy(_conn+1,_conn+_conn_lgth,std::ostream_iterator(oss," ")); return oss.str(); } else @@ -8240,7 +8241,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMeshCell::getType() const 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) diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 25fb72c8d..87a1c9a7d 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -58,125 +58,125 @@ namespace MEDCoupling 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 getAllGeoTypes() const; MEDCOUPLING_EXPORT std::vector getAllGeoTypesSorted() const; - MEDCOUPLING_EXPORT std::set 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& conn) const; + MEDCOUPLING_EXPORT std::set 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& 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& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& 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 partitionBySpreadZone() const; - MEDCOUPLING_EXPORT DataArrayInt *computeFetchedNodeIds() const; - MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const; + MEDCOUPLING_EXPORT std::vector partitionBySpreadZone() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const; + MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const; MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& 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 explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& 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& cellNeigh, MCAuto& 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 &neighbors, MCAuto& 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 explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& 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& cellNeigh, MCAuto& 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 &neighbors, MCAuto& 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& newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& 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& newNodeNumbersO2N); + MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N); + MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& 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 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& elts) const; - MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; - MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; - MEDCOUPLING_EXPORT void checkButterflyCells(std::vector& 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& elts) const; + MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; + MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; + MEDCOUPLING_EXPORT void checkButterflyCells(std::vector& 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; @@ -185,22 +185,22 @@ namespace MEDCoupling 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& cells) const; + MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectly2DCells(const double *vec, bool polyOnly); MEDCOUPLING_EXPORT void changeOrientationOfCells(); - MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& cells) const; + MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& 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; @@ -208,72 +208,72 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const; //utilities for MED File RW - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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 getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& 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 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& 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 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 Build1DMeshFromCoords(DataArrayDouble *da); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const std::vector& a); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const std::vector& meshes); - MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr); + MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr); MEDCOUPLING_EXPORT static void PutUMeshesOnSameAggregatedCoords(const std::vector& meshes); MEDCOUPLING_EXPORT static void MergeNodesOnUMeshesSharingSameCoords(const std::vector& 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 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 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 @@ -284,82 +284,82 @@ namespace MEDCoupling 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& 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& 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& 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& types) const; - DataArrayInt *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic2D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic3D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic3D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& 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& 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& types) const; + DataArrayIdType *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const; + DataArrayIdType *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const; template - void getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, - double eps, MCAuto& elts, MCAuto& eltsIndex, std::function sensibilityTo2DQuadraticLinearCellsFunc) const; - void getCellsContainingPointsZeAlg(const double *pos, int nbOfPoints, double eps, - MCAuto& elts, MCAuto& eltsIndex, - std::function sensibilityTo2DQuadraticLinearCellsFunc) const; + void getCellsContainingPointsAlg(const double *coords, const double *pos, mcIdType nbOfPoints, + double eps, MCAuto& elts, MCAuto& eltsIndex, std::function sensibilityTo2DQuadraticLinearCellsFunc) const; + void getCellsContainingPointsZeAlg(const double *pos, mcIdType nbOfPoints, double eps, + MCAuto& elts, MCAuto& eltsIndex, + std::function sensibilityTo2DQuadraticLinearCellsFunc) const; /// @cond INTERNAL static MEDCouplingUMesh *MergeUMeshesLL(const std::vector& 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 - 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& 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& ret); - static void Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps, std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& 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& 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& ret); + static void Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps, std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& mergedNodes); static void IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, - std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, - MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1, + std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, + MEDCouplingUMesh *& m1Desc, DataArrayIdType *&desc1, DataArrayIdType *&descIndx1, DataArrayIdType *&revDesc1, DataArrayIdType *&revDescIndx1, std::vector& addCoo, - MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2); - static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge); - static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1, const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, - const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector >& intesctEdges2, + MEDCouplingUMesh *& m2Desc, DataArrayIdType *&desc2, DataArrayIdType *&descIndx2, DataArrayIdType *&revDesc2, DataArrayIdType *&revDescIndx2); + static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge); + static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const mcIdType *desc1, const mcIdType *descIndx1, const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, + const MEDCouplingUMesh *m2, const mcIdType *desc2, const mcIdType *descIndx2, const std::vector >& intesctEdges2, const std::vector& addCoords, - std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2); - static void AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const int *nodal3DSurf, const int *nodalIndx3DSurf, - const int *nodal3DCurve, const int *nodalIndx3DCurve, - const int *desc, const int *descIndx, std::vector< std::pair >& cut3DSurf); - void assemblyForSplitFrom3DSurf(const std::vector< std::pair >& cut3DSurf, - const int *desc, const int *descIndx, DataArrayInt *nodalRes, DataArrayInt *nodalResIndx, DataArrayInt *cellIds) const; - void buildSubCellsFromCut(const std::vector< std::pair >& cut3DSurf, const int *desc, const int *descIndx, const double *coords, double eps, std::vector >& 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& forbiddenPoints, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords); - static void ComputeAllTypesInternal(std::set& 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 & pointIds, std::vector & hitSegs); - static void ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxConnE, int startNode, int endNode, - const std::vector& insidePoints, std::vector& modifiedFace); - void attractSeg3MidPtsAroundNodesUnderground(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd); - DataArrayInt *internalColinearize2D(double eps, bool stayConform); + std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2); + static void AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const mcIdType *nodal3DSurf, const mcIdType *nodalIndx3DSurf, + const mcIdType *nodal3DCurve, const mcIdType *nodalIndx3DCurve, + const mcIdType *desc, const mcIdType *descIndx, std::vector< std::pair >& cut3DSurf); + void assemblyForSplitFrom3DSurf(const std::vector< std::pair >& cut3DSurf, + const mcIdType *desc, const mcIdType *descIndx, DataArrayIdType *nodalRes, DataArrayIdType *nodalResIndx, DataArrayIdType *cellIds) const; + void buildSubCellsFromCut(const std::vector< std::pair >& cut3DSurf, const mcIdType *desc, const mcIdType *descIndx, const double *coords, double eps, std::vector >& 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& forbiddenPoints, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords); + static void ComputeAllTypesInternal(std::set& 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 & pointIds, std::vector & hitSegs); + static void ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdType * sIdxConnE, mcIdType startNode, mcIdType endNode, + const std::vector& insidePoints, std::vector& modifiedFace); + void attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd); + DataArrayIdType *internalColinearize2D(double eps, bool stayConform); template void renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N); public: - MEDCOUPLING_EXPORT static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector& code); + MEDCOUPLING_EXPORT static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector& 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; @@ -376,15 +376,15 @@ namespace MEDCoupling { 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; @@ -402,17 +402,17 @@ namespace MEDCoupling 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 @@ -424,8 +424,8 @@ namespace MEDCoupling private: MEDCouplingUMesh *_mesh; MEDCouplingUMeshCell *_cell; - int _cell_id; - int _nb_cell; + mcIdType _cell_id; + mcIdType _nb_cell; }; class MEDCouplingUMeshCell @@ -435,11 +435,11 @@ namespace MEDCoupling 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; }; } diff --git a/src/MEDCoupling/MEDCouplingUMesh.txx b/src/MEDCoupling/MEDCouplingUMesh.txx index 919372afb..b2cf017e6 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.txx +++ b/src/MEDCoupling/MEDCouplingUMesh.txx @@ -27,13 +27,13 @@ template 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=0)//avoid polyhedron separator { auto it(newNodeNumbersO2N.find(node)); diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx index a47ecc255..4b6b75a84 100755 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx @@ -74,10 +74,10 @@ void MEDCouplingUMesh::reprConnectivityOfThisLL(std::ostringstream& stream) cons { 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;igetConstPointer(); + const mcIdType *ci=_nodal_connec_index->getConstPointer(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4)); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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 newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto 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;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4)); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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 newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto 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;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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 newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto 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;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto 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 newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto 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;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i::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 desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()); MCAuto mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); revDesc1=0; revDescIndx1=0; mDesc->tessellate2D(eps); @@ -349,21 +349,21 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) if(epsa::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 addCoo; - std::vector newConn;//no direct DataArrayInt because interface with Geometric2D - MCAuto newConnI(DataArrayInt::New()); + std::vector newConn;//no direct DataArrayIdType because interface with Geometric2D + MCAuto 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 types; - for(int i=0;itesselate(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 { @@ -398,13 +398,13 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) 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 newConnArr=DataArrayInt::New(); - newConnArr->alloc((int)newConn.size(),1); + DataArrayIdType::SetArrayIn(newConnI,_nodal_connec_index); + MCAuto 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 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); @@ -420,34 +420,34 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) * \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;igetPointer(); + mcIdType newConnLgth=0; + for(mcIdType i=0;i0; - 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;j0; - 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; } @@ -466,29 +466,29 @@ void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeI connI[1]=newConnLgth; } // - MCAuto newConn=DataArrayInt::New(); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(newConnLgth,1); - int *work=newConn->getPointer(); - for(int i=0;igetPointer(); + for(mcIdType i=0;i0; - 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 it(nodeSubdived+nodeIndxSubdived[edgeId+1]); + mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; + std::reverse_iterator 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); @@ -505,23 +505,23 @@ void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeI * \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 cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); + MCAuto 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 fastFinder(sz,false); - for(const int *work=begin;work!=end;work++) + for(const mcIdType *work=begin;work!=end;work++) if(*work>=0 && *workgetConstPointer(); - const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;i=0) { ref++; @@ -545,29 +545,29 @@ void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int * 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& cut3DCurve) +void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector& 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 addCoo; - for(int i=0;ieps && 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; @@ -591,7 +591,7 @@ void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double } if(!addCoo.empty()) { - int newNbOfNodes=nnodes+((int)addCoo.size())/3; + mcIdType newNbOfNodes=nnodes+ToIdType(addCoo.size())/3; MCAuto coo2=DataArrayDouble::New(); coo2->alloc(newNbOfNodes,3); double *tmp=coo2->getPointer(); @@ -608,22 +608,22 @@ void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double */ 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 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 v; + std::vector v; std::vector c; double vec[3]; v.reserve(3); c.reserve(6); - for(int i=0;igetNodeIdsOfCell(i,v); @@ -631,7 +631,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCoupli 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()); - for(int j=0;j()); if(isQuad) { @@ -639,7 +639,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCoupli mesh1D->getCoordinatesOfNode(v[1],c); mesh1D->getCoordinatesOfNode(v[0],c); std::transform(c.begin(),c.begin()+spaceDim,c.begin()+spaceDim,vec,std::minus()); - for(int j=0;j()); } } @@ -670,12 +670,12 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con { 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 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); @@ -683,9 +683,9 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con MCAuto 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;igetNodalConnectivity()->getConstPointer(); + const mcIdType *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=1;igetNumberOfCells()); if(nbOf1DCells<2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !"); MCAuto 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); @@ -727,9 +727,9 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con MCAuto 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;igetNodalConnectivity()->getConstPointer(); + const mcIdType *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=1;ibegin()),*connI(_nodal_connec_index->begin()); - MCAuto newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); + const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); + MCAuto newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New()); newConnI->alloc(nbOf3DCells+1,1); - int *newConnIPtr(newConnI->getPointer()); + mcIdType *newConnIPtr(newConnI->getPointer()); *newConnIPtr++=0; - std::vector newc; - for(int j=0;j newc; + for(mcIdType j=0;jalloc((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(),newConnIPtr[iz*nbOf2DCells])); - const int *posOfTypeOfCell(newConnIPtr); - for(std::vector::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(),newConnIPtr[iz*nbOf2DCells])); + const mcIdType *posOfTypeOfCell(newConnIPtr); + for(std::vector::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) @@ -834,13 +834,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNode * 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& candidates, int compType, const int *conn, const int *connI, DataArrayInt *result) +bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidates, int compType, const mcIdType *conn, const mcIdType *connI, DataArrayIdType *result) { if(candidates.size()<1) return false; bool ret=false; - std::vector::const_iterator iter=candidates.begin(); - int start=(*iter++); + std::vector::const_iterator iter=candidates.begin(); + mcIdType start=(*iter++); for(;iter!=candidates.end();iter++) { int status=AreCellsEqual(conn,connI,start,*iter,compType); @@ -865,20 +865,20 @@ bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidates, i * 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 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 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 connRetArr=DataArrayInt::New(); + MCAuto connRetArr=DataArrayIdType::New(); connRetArr->useArray(connRet,true,DeallocType::C_DEALLOC,connIndexRet[nbOfElemsRet],1); - MCAuto connIndexRetArr=DataArrayInt::New(); - connIndexRetArr->useArray(connIndexRet,true,DeallocType::C_DEALLOC,(int)nbOfElemsRet+1,1); + MCAuto connIndexRetArr=DataArrayIdType::New(); + connIndexRetArr->useArray(connIndexRet,true,DeallocType::C_DEALLOC,nbOfElemsRet+1,1); ret->setConnectivity(connRetArr,connIndexRetArr,false); ret->_types=types; ret->copyTinyInfoFrom(this); @@ -911,20 +911,20 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin * 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 ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); - int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : "); - MCAuto 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 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=0 && work newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1); - int *newConnPtr=newConn->getPointer(); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(newConnIPtr[0],1); + mcIdType *newConnPtr=newConn->getPointer(); std::set types; work=start; - for(int i=0;i& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { MCAuto bary=computeCellCenterOfMass(); - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto 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 newConn=DataArrayIdType::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto 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;ipushBackSilent((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; @@ -1013,26 +1013,26 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *& return ret.retn(); } -DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto 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 types1D; DataArrayDouble *coordsTmp=0; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; MCAuto coordsTmpSafe(coordsTmp); - MCAuto 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 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;ipushBackSilent(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); @@ -1061,41 +1061,41 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDC /*! * 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& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto 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& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; // - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto ret=DataArrayIdType::New(); ret->alloc(0,1); // MCAuto 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 types1D; DataArrayDouble *coordsTmp=0; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; MCAuto coordsTmpSafe(coordsTmp); - MCAuto 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 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;ipushBackSilent(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; @@ -1126,45 +1126,45 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *& /*! * 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& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto 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& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc2(DataArrayInt::New()),desc2I(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc2(DataArrayIdType::New()),desc2I(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto m2D=buildDescendingConnectivityGen(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0; - MCAuto desc1(DataArrayInt::New()),desc1I(DataArrayInt::New()),tmp4(DataArrayInt::New()),tmp5(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),desc1I(DataArrayIdType::New()),tmp4(DataArrayIdType::New()),tmp5(DataArrayIdType::New()); MCAuto m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0; // - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto ret=DataArrayInt::New(),ret2=DataArrayInt::New(); ret->alloc(0,1); ret2->alloc(0,1); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto ret=DataArrayIdType::New(),ret2=DataArrayIdType::New(); ret->alloc(0,1); ret2->alloc(0,1); // MCAuto 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 types1D,types2D; DataArrayDouble *coordsTmp=0,*coordsTmp2=0; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayInt::New(); ret1D->alloc(0,1); - MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayIdType::New(); ret1D->alloc(0,1); + MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); MCAuto coordsTmpSafe(coordsTmp); - MCAuto ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayInt::New(); ret2D->alloc(0,1); + MCAuto ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayIdType::New(); ret2D->alloc(0,1); MCAuto coordsTmp2Safe(coordsTmp2); - MCAuto 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 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;ipushBackSilent(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); @@ -1200,48 +1200,48 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]); } } - MCAuto diffRet2D=ret2D->getDifferentValues(); - MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples()); + MCAuto diffRet2D=ret2D->getDifferentValues(); + MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples()); coordsTmp2Safe=coordsTmp2Safe->selectByTupleId(diffRet2D->begin(),diffRet2D->end()); MCAuto tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); std::vector 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 revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); + const mcIdType *n2oPtr(n2o->begin()); + MCAuto 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 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 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 conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3); + std::set 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 shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); + std::set shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); shar.erase(prevCell); if(shar.size()==1) { @@ -1260,37 +1260,37 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh 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 revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); + mcIdType nbOfTurn(nbOfNodesExpected/2); + const mcIdType *n2oPtr(n2o->begin()); + MCAuto 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 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 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 conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3); + std::set 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 shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); + std::set 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; @@ -1315,7 +1315,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vector::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()) @@ -1328,24 +1328,24 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vector pts=MergeNodesArray(aps); MCAuto ret=MEDCouplingUMesh::New("merge",meshDim); ret->setCoords(pts); - MCAuto c=DataArrayInt::New(); + MCAuto c=DataArrayIdType::New(); c->alloc(meshLgth,1); - int *cPtr=c->getPointer(); - MCAuto cI=DataArrayInt::New(); + mcIdType *cPtr=c->getPointer(); + MCAuto 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(),offset)); - for(int j=0;j_nodal_connec_index->begin(); + const mcIdType *curC=(*it)->_nodal_connec->begin(); + cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind2nd(std::plus(),offset)); + for(mcIdType j=0;j::max(); - for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) + for(const mcIdType *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) { switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]]) { @@ -1413,11 +1413,11 @@ void MEDCouplingUMesh::DistanceToPoint3DSurfAlg(const double *pt, const int *cel * \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::max(); - for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) + for(const mcIdType *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) { switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]]) { @@ -1435,7 +1435,7 @@ void MEDCouplingUMesh::DistanceToPoint2DCurveAlg(const double *pt, const int *ce } } } -DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vector& fetched, const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed) +DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vector& fetched, const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed) { nbOfDepthPeelingPerformed=0; if(!seedBg || !seedEnd || !arrIn || !arrIndxIn) @@ -1443,34 +1443,34 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vecto mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; std::vector 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 && *seedEltbegin(); - const int *arrIndxPtr=arrIndxIn->begin(); - int targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits::max(); - std::vector idsToFetch1(seedBg,seedEnd); - std::vector idsToFetch2; - std::vector *idsToFetch=&idsToFetch1; - std::vector *idsToFetchOther=&idsToFetch2; + const mcIdType *arrInPtr=arrIn->begin(); + const mcIdType *arrIndxPtr=arrIndxIn->begin(); + mcIdType targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits::max(); + std::vector idsToFetch1(seedBg,seedEnd); + std::vector idsToFetch2; + std::vector *idsToFetch=&idsToFetch1; + std::vector *idsToFetchOther=&idsToFetch2; while(!idsToFetch->empty() && nbOfDepthPeelingPerformed::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::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 ret=DataArrayInt::New(); ret->alloc(lgth,1); - int *retPtr=ret->getPointer(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(lgth,1); + mcIdType *retPtr=ret->getPointer(); for(std::vector::const_iterator it=fetched2.begin();it!=fetched2.end();it++,i++) if(*it) *retPtr++=i; @@ -1481,7 +1481,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vecto * 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) @@ -1505,12 +1505,12 @@ void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, co * \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& ret) +void MEDCouplingUMesh::AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector& 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: @@ -1521,38 +1521,38 @@ void MEDCouplingUMesh::AppendExtrudedCell(const int *connBg, const int *connEnd, } 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 @@ -1562,17 +1562,17 @@ void MEDCouplingUMesh::AppendExtrudedCell(const int *connBg, const int *connEnd, } case INTERP_KERNEL::NORM_POLYGON: { - std::back_insert_iterator< std::vector > ii(ret); + std::back_insert_iterator< std::vector > ii(ret); std::copy(connBg+1,connEnd,ii); *ii++=-1; - std::reverse_iterator rConnBg(connEnd); - std::reverse_iterator rConnEnd(connBg+1); - std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus(),deltaz)); + std::reverse_iterator rConnBg(connEnd); + std::reverse_iterator rConnEnd(connBg+1); + std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus(),deltaz)); std::size_t nbOfRadFaces=std::distance(connBg+1,connEnd); for(std::size_t i=0;i3DCurve * \param [out] cut3DSuf input/output param. */ -void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const int *nodal3DSurf, const int *nodalIndx3DSurf, - const int *nodal3DCurve, const int *nodalIndx3DCurve, - const int *desc, const int *descIndx, - std::vector< std::pair >& cut3DSurf) +void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const mcIdType *nodal3DSurf, const mcIdType *nodalIndx3DSurf, + const mcIdType *nodal3DCurve, const mcIdType *nodalIndx3DCurve, + const mcIdType *desc, const mcIdType *descIndx, + std::vector< std::pair >& cut3DSurf) { - std::set nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end()); - int nbOf3DSurfCell=(int)cut3DSurf.size(); - for(int i=0;i nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end()); + mcIdType nbOf3DSurfCell=ToIdType(cut3DSurf.size()); + for(mcIdType i=0;i res; - int offset=descIndx[i]; - int nbOfSeg=descIndx[i+1]-offset; - for(int j=0;j res; + mcIdType offset=descIndx[i]; + mcIdType nbOfSeg=descIndx[i+1]-offset; + for(mcIdType j=0;j-1) @@ -1634,8 +1634,8 @@ void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3D case 1: case 0: { - std::set 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 >(res)); + std::set 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 >(res)); if(res.size()==2) { cut3DSurf[i].first=res[0]; cut3DSurf[i].second=res[1]; @@ -1648,7 +1648,7 @@ void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3D } 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; } @@ -1669,25 +1669,25 @@ void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3D * \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 >& cut3DSurf, - const int *desc, const int *descIndx, - DataArrayInt *nodalRes, DataArrayInt *nodalResIndx, DataArrayInt *cellIds) const +void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair >& 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;ibegin()),*nodalIndx3D(_nodal_connec_index->begin()); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i > m; - int offset=descIndx[i]; - int nbOfFaces=descIndx[i+1]-offset; - int start=-1; - int end=-1; + std::map > m; + mcIdType offset=descIndx[i]; + mcIdType nbOfFaces=descIndx[i+1]-offset; + mcIdType start=-1; + mcIdType end=-1; for(int j=0;j& p=cut3DSurf[desc[offset+j]]; + const std::pair& p=cut3DSurf[desc[offset+j]]; if(p.first!=-1 && p.second!=-1) { if(p.first!=-2) @@ -1699,8 +1699,8 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair tmp=new int[sz]; + mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1; + INTERP_KERNEL::AutoPtr 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]; @@ -1714,18 +1714,18 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair conn(1,(int)INTERP_KERNEL::NORM_POLYGON); - int prev=end; + std::vector conn(1,ToIdType(INTERP_KERNEL::NORM_POLYGON)); + mcIdType prev=end; while(end!=start) { - std::map >::const_iterator it=m.find(start); - const std::set& s=(*it).second; - std::set s2; s2.insert(prev); - std::set s3; + std::map >::const_iterator it=m.find(start); + const std::set& s=(*it).second; + std::set s2; s2.insert(prev); + std::set 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; @@ -1744,15 +1744,15 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair& types, const DataArrayInt *nodalConnec, const DataArrayInt *nodalConnecIndex) +void MEDCouplingUMesh::ComputeAllTypesInternal(std::set& 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]); } } @@ -1770,7 +1770,7 @@ void MEDCouplingUMesh::ComputeAllTypesInternal(std::set edges; { - MCAuto a,b,c,d; + MCAuto a,b,c,d; edges=this->explodeIntoEdges(a,b,c,d); } return edges->attractSeg3MidPtsAroundNodesUnderground(ratio,nodeIdsBg,nodeIdsEnd); @@ -1791,7 +1791,7 @@ void MEDCouplingUMesh::attractSeg3MidPtsAroundNodes(double ratio, const int *nod /*! * \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()); @@ -1801,11 +1801,11 @@ void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, con for(auto work=nodeIdsBg;work!=nodeIdsEnd;work++) if(*work>=0 && *work cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); - const int *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin()); + MCAuto cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); + const mcIdType *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin()); for(std::size_t cellId=0;cellId -void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, - double eps, MCAuto& elts, MCAuto& eltsIndex, std::function sensibilityTo2DQuadraticLinearCellsFunc) const +void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, mcIdType nbOfPoints, + double eps, MCAuto& elts, MCAuto& eltsIndex, std::function 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 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 myTree(&bbox[0],0,0,nbOfCells,-eps); - for(int i=0;i myTree(&bbox[0],0,0,nbOfCells,-eps); + for(mcIdType i=0;i candidates; + std::vector candidates; myTree.getIntersectingElems(bb,candidates); - for(std::vector::const_iterator iter=candidates.begin();iter!=candidates.end();iter++) + for(std::vector::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. @@ -138,9 +138,9 @@ void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const d throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellsContainingPointsAlg : not implemented yet for POLYGON and QPOLYGON in spaceDim 3 !"); std::vector nodes(sz); INTERP_KERNEL::QuadraticPolygon *pol(0); - for(int j=0;j -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 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 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 ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA); ret->setCoords(getCoords()); ret->allocateCells(2*nbOfCells); descIndx->alloc(nbOfCells+1,1); - MCAuto revDesc2(DataArrayInt::New()); revDesc2->reserve(2*nbOfCells); - int *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0; - for(int eltId=0;eltId revDesc2(DataArrayIdType::New()); revDesc2->reserve(2*nbOfCells); + mcIdType *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0; + for(mcIdType eltId=0;eltId tmp=new int[posP1-pos]; + INTERP_KERNEL::AutoPtr tmp=new mcIdType[posP1-pos]; for(unsigned i=0;iinsertNextCell(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()); - MCAuto revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1); + mcIdType nbOfCellsM1=ret->getNumberOfCells(); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); + MCAuto 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;eltIdgetPointer(); + const mcIdType *connM1=ret->getNodalConnectivity()->getConstPointer(); + const mcIdType *connIndexM1=ret->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType eltId=0;eltId=0)//for polyhedrons - *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; } // - DataArrayInt *commonCells=0,*commonCellsI=0; + DataArrayIdType *commonCells=0,*commonCellsI=0; FindCommonCellsAlg(3,0,ret->getNodalConnectivity(),ret->getNodalConnectivityIndex(),revNodal,revNodalIndx,commonCells,commonCellsI); - MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); - const int *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer()); - int newNbOfCellsM1=-1; - MCAuto o2nM1=DataArrayInt::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(), + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + const mcIdType *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer()); + mcIdType newNbOfCellsM1=-1; + MCAuto o2nM1=DataArrayIdType::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(), commonCellsI->begin(),commonCellsI->end(),newNbOfCellsM1); std::vector 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 n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1); - const int *n2oM1Ptr=n2oM1->getConstPointer(); + const mcIdType *o2nM1Ptr=o2nM1->getConstPointer(); + MCAuto n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1); + const mcIdType *n2oM1Ptr=n2oM1->getConstPointer(); MCAuto ret2=static_cast(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;ireserve(newNbOfCellsM1); revDescIndx->alloc(newNbOfCellsM1+1,1); - int *revDescIndxPtr=revDescIndx->getPointer(); *revDescIndxPtr++=0; - const int *revDesc2Ptr=revDesc2->getConstPointer(); - for(int i=0;igetPointer(); *revDescIndxPtr++=0; + const mcIdType *revDesc2Ptr=revDesc2->getConstPointer(); + for(mcIdType i=0;ipushBackSilent(revDesc2Ptr[oldCellIdM1]); @@ -269,7 +269,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt } else { - for(int j=commonCellsIPtr[0];jpushBackSilent(revDesc2Ptr[commonCellsPtr[j]]); revDescIndxPtr[0]=revDescIndxPtr[-1]+commonCellsIPtr[1]-commonCellsIPtr[0]; commonCellsIPtr++; diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index 6f18e0051..cdac34c4a 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -50,13 +50,13 @@ using namespace MEDCoupling; /// @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); @@ -64,13 +64,13 @@ int InternalAddPoint(const INTERP_KERNEL::Edge *e, int id, const double *coo, in } } -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); @@ -79,11 +79,11 @@ int InternalAddPointOriented(const INTERP_KERNEL::Edge *e, int id, const double } -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& 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& 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) { @@ -98,9 +98,9 @@ void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int st } } -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& 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& middles) { - int tmpSrt(newConnOfCell->back()),tmpEnd(connBg[stp]); + mcIdType tmpSrt(newConnOfCell->back()),tmpEnd(connBg[stp]); newConnOfCell->pushBackSilent(tmpEnd); if(linOrArc) { @@ -115,7 +115,7 @@ void EnterTheResultOf2DCellMiddle(const INTERP_KERNEL::Edge *e, int start, int s } } -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& 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& middles) { // only the quadratic point to deal with: if(linOrArc) @@ -132,20 +132,20 @@ void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, } } -void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,int>& m, int forbVal0, int forbVal1, std::vector& isect) +void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector& isect) { MCAuto nTmp(n); nTmp->incrRef(); - std::map,int>::const_iterator it(m.find(nTmp)); + std::map,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,int>& m, int forbVal0, int forbVal1, std::vector& isect) +bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector& isect) { int sz(c.size()); if(sz<=1) @@ -166,7 +166,7 @@ bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map< namespace MEDCoupling { - INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const int *bg, const double *coords2D, std::map< MCAuto,int>& m) + INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const mcIdType *bg, const double *coords2D, std::map< MCAuto,mcIdType>& m) { INTERP_KERNEL::Edge *ret(0); MCAuto 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])); @@ -198,7 +198,7 @@ namespace MEDCoupling return ret; } - INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map& mapp2, const int *bg) + INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map& mapp2, const mcIdType *bg) { INTERP_KERNEL::Edge *ret=0; @@ -240,29 +240,29 @@ namespace MEDCoupling * 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& candidates, - std::map& mapp) + INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMesh(const MEDCouplingUMesh *mDesc, const std::vector& candidates, + std::map& mapp) { mapp.clear(); - std::map 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 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 s; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer(); + const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); + std::set s; + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) s.insert(c+cI[*it]+1,c+cI[(*it)+1]); - for(std::set::const_iterator it2=s.begin();it2!=s.end();it2++) + for(std::set::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::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(std::vector::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::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) + for(std::map::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) { if((*it2).second.second == INTERP_KERNEL::USAGE_LINEAR) mapp[(*it2).second.first]=(*it2).first; @@ -271,24 +271,24 @@ namespace MEDCoupling return ret; } - INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMeshWithTree(const MEDCouplingUMesh *mDesc, const std::vector& candidates, - std::map& mapp, - const BBTreePts<2,int> & nodeTree, - const std::map& mapRev) + INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMeshWithTree(const MEDCouplingUMesh *mDesc, const std::vector& candidates, + std::map& mapp, + const BBTreePts<2,mcIdType> & nodeTree, + const std::map& mapRev) { mapp.clear(); - std::map 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 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 s; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer(); + const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); + std::set s; + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) s.insert(c+cI[*it]+1,c+cI[(*it)+1]); - for(std::set::const_iterator it2=s.begin();it2!=s.end();it2++) + for(std::set::const_iterator it2=s.begin();it2!=s.end();it2++) { INTERP_KERNEL::Node *n; // Look for a potential node to merge - std::vector candNode; + std::vector 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!"); @@ -308,12 +308,12 @@ namespace MEDCoupling mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN); } INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(std::vector::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::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) + for(std::map::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) { if((*it2).second.second == INTERP_KERNEL::USAGE_LINEAR) mapp[(*it2).second.first]=(*it2).first; @@ -322,16 +322,16 @@ namespace MEDCoupling return ret; } - INTERP_KERNEL::Node *MEDCouplingUMeshBuildQPNode(int nodeId, const double *coo1, int offset1, const double *coo2, int offset2, const std::vector& addCoo) + INTERP_KERNEL::Node *MEDCouplingUMeshBuildQPNode(mcIdType nodeId, const double *coo1, mcIdType offset1, const double *coo2, mcIdType offset2, const std::vector& 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]); @@ -340,16 +340,16 @@ namespace MEDCoupling /** * 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& addCoo, - const int *desc1Bg, const int *desc1End, const std::vector >& intesctEdges1, - /*output*/std::map& mapp, std::map& mappRev) + void MEDCouplingUMeshBuildQPFromMesh3(const double *coo1, mcIdType offset1, const double *coo2, mcIdType offset2, const std::vector& addCoo, + const mcIdType *desc1Bg, const mcIdType *desc1End, const std::vector >& intesctEdges1, + /*output*/std::map& mapp, std::map& 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::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++) + mcIdType eltId1=std::abs(*desc1)-1; + for(std::vector::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++) { - std::map::const_iterator it=mappRev.find(*it1); + std::map::const_iterator it=mappRev.find(*it1); if(it==mappRev.end()) { INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it1,coo1,offset1,coo2,offset2,addCoo); @@ -368,28 +368,28 @@ namespace MEDCoupling * \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& forbiddenPoints, - DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords) +bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const mcIdType *connBg, const mcIdType *connEnd, mcIdType offset, + const std::map& 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 tmpConn(new int[sz]); - INTERP_KERNEL::AutoPtr tmpConn2(new int[sz]); + INTERP_KERNEL::AutoPtr tmpConn(new mcIdType[sz]); + INTERP_KERNEL::AutoPtr 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 middles; + std::vector middles; bool ret(false); for(;(nbOfTurn+nbOfHit),int> m; + std::map,mcIdType> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn,coords,m)); posEndElt = posBaseElt+1; @@ -399,9 +399,9 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg { for(unsigned i=1;idecrRef(); } @@ -469,14 +469,14 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg -bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEdge1, const std::vector& candidates, int start, int stop, int& retVal) +bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEdge1, const std::vector& candidates, mcIdType start, mcIdType stop, mcIdType& retVal) { if(candidates.empty()) return false; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) { - const std::vector& pool(intersectEdge1[*it]); - int tmp[2]; tmp[0]=start; tmp[1]=stop; + const std::vector& 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; @@ -508,37 +508,37 @@ bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEdge1, */ void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, - const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge) + const std::vector< std::vector >& subDiv, std::vector< std::vector >& 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& divs=subDiv[i]; - int nnode=cI[1]-cI[0]-1; - std::map mapp2; - std::map mapp22; - for(int j=0;j& divs=subDiv[i]; + mcIdType nnode=cI[1]-cI[0]-1; + std::map mapp2; + std::map mapp22; + for(mcIdType j=0;j::const_iterator it=mapp2.begin();it!=mapp2.end();it++) + for(std::map::const_iterator it=mapp2.begin();it!=mapp2.end();it++) ((*it).second.first)->decrRef(); std::vector addNodes(divs.size()); - std::map mapp3; + std::map mapp3; for(std::size_t j=0;j >& intersectEdge2, const DataArrayDouble *coords1, const std::vector& addCoo, const std::map& mergedNodes, const std::vector< std::vector >& colinear2, const std::vector< std::vector >& intersectEdge1, - MCAuto& idsInRetColinear, MCAuto& idsInMesh1DForIdsInRetColinear) +MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector >& intersectEdge2, const DataArrayDouble *coords1, const std::vector& addCoo, const std::map& mergedNodes, const std::vector< std::vector >& colinear2, const std::vector< std::vector >& intersectEdge1, + MCAuto& idsInRetColinear, MCAuto& 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 addCooQuad; - MCAuto 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 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,int> m; + std::map,mcIdType> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m)); - const std::vector& subEdges(intersectEdge2[i]); + const std::vector& subEdges(intersectEdge2[i]); mcIdType nbSubEdge=ToIdType(subEdges.size()/2); - for(int j=0;j n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)); MCAuto e2(e->buildEdgeLyingOnMe(n1,n2)); INTERP_KERNEL::Edge *e2Ptr(e2); - std::map::const_iterator itm; + std::map::const_iterator itm; if(dynamic_cast(e2Ptr)) { tmp[0]=INTERP_KERNEL::NORM_SEG3; @@ -592,7 +592,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: 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; @@ -610,7 +610,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: 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); @@ -622,8 +622,8 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: MCAuto ret(MEDCouplingUMesh::New(mesh1D->getName(),1)); ret->setConnectivity(cOut,ciOut,true); MCAuto arr3(DataArrayDouble::New()); - arr3->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,(int)addCoo.size()/2,2); - MCAuto 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 arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,DeallocType::C_DEALLOC,addCooQuad.size()/2,2); std::vector coordss(4); coordss[0]=coords1; coordss[1]=mesh1D->getCoords(); coordss[2]=arr3; coordss[3]=arr4; MCAuto arr(DataArrayDouble::Aggregate(coordss)); @@ -631,12 +631,12 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: return ret.retn(); } -MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const int *descBg, const int *descEnd, const std::vector< std::vector >& intersectEdge1) +MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& intersectEdge1) { - std::vector allEdges; - for(const int *it2(descBg);it2!=descEnd;it2++) + std::vector allEdges; + for(const mcIdType *it2(descBg);it2!=descEnd;it2++) { - const std::vector& edge1(intersectEdge1[std::abs(*it2)-1]); + const std::vector& edge1(intersectEdge1[std::abs(*it2)-1]); if(*it2>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); else @@ -649,31 +649,31 @@ MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(coords); ret->allocateCells(1); - std::vector connOut(nbOfEdgesOf2DCellSplit); + std::vector connOut(nbOfEdgesOf2DCellSplit); for(std::size_t kk=0;kkinsertNextCell(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 >& intersectEdge1) +MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, mcIdType cellIdInMesh2D, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& 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 tmpPtr(new int[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]); - std::vector allEdges,centers; + INTERP_KERNEL::AutoPtr tmpPtr(new mcIdType[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]); + std::vector allEdges,centers; const double *coordsPtr(coords->begin()); MCAuto 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& edge1(intersectEdge1[std::abs(*it2)-1]); + const std::vector& edge1(intersectEdge1[std::abs(*it2)-1]); if(*it2>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); else @@ -683,9 +683,9 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con else {//the current edge has been subsplit -> create corresponding centers. mcIdType nbOfCentersToAppend=ToIdType(edge1.size()/2); - std::map< MCAuto,int> m; + std::map< MCAuto,mcIdType> m; MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m)); - std::vector::const_iterator it3(allEdges.end()-edge1.size()); + std::vector::const_iterator it3(allEdges.end()-edge1.size()); for(mcIdType k=0;ksetCoords(addCoo); } ret->allocateCells(1); - std::vector connOut(nbOfEdgesOf2DCellSplit); + std::vector connOut(nbOfEdgesOf2DCellSplit); for(std::size_t kk=0;kkgetCoords()==coords[:mesh2D->getNumberOfNodes()] */ -MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, int cellIdInMesh2D, const int *descBg, const int *descEnd, const std::vector< std::vector >& intersectEdge1) +MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, mcIdType cellIdInMesh2D, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& intersectEdge1) { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(mesh2D->getTypeOfCell(cellIdInMesh2D))); if(!cm.isQuadratic()) @@ -734,7 +734,7 @@ MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCou return BuildRefined2DCellQuadratic(coords,mesh2D,cellIdInMesh2D,descBg,descEnd,intersectEdge1); } -void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, const std::vector< MCAuto >& edges) +void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, const std::vector< MCAuto >& edges) { bool isQuad(false); for(std::vector< MCAuto >::const_iterator it=edges.begin();it!=edges.end();it++) @@ -750,14 +750,14 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con const double *coo(mesh2D->getCoords()->begin()); std::size_t sz(conn.size()); std::vector addCoo; - std::vector conn2(conn); - int offset(mesh2D->getNumberOfNodes()); + std::vector conn2(conn); + mcIdType offset(mesh2D->getNumberOfNodes()); for(std::size_t i=0;igetMiddleOfPoints(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()); @@ -772,23 +772,23 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con * 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& edge1Bis, const std::vector< MCAuto >& edge1BisPtr, - std::vector< std::vector >& out0, std::vector< std::vector< MCAuto > >& out1) +void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector& edge1Bis, const std::vector< MCAuto >& edge1BisPtr, + std::vector< std::vector >& out0, std::vector< std::vector< MCAuto > >& 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 single output cell out0.resize(1); out1.resize(1); - std::vector& connOut(out0[0]); + std::vector& connOut(out0[0]); connOut.resize(nbOfEdgesOf2DCellSplit); std::vector< MCAuto >& edgesPtr(out1[0]); edgesPtr.resize(nbOfEdgesOf2DCellSplit); @@ -802,25 +802,25 @@ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vec { // [i,iEnd[ contains the out0.resize(2); out1.resize(2); - std::vector& connOutLeft(out0[0]); - std::vector& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1] + std::vector& connOutLeft(out0[0]); + std::vector& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1] std::vector< MCAuto >& eleft(out1[0]); std::vector< MCAuto >& eright(out1[1]); for(std::size_t k=ii;k > ees(iEnd); - for(int ik=0;ik,int> m; + std::map< MCAuto,mcIdType> m; MCAuto 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& edges, const std::vector< MCAuto >& edgesPtr); + CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); public: - std::vector _edges; + std::vector _edges; std::vector< MCAuto > _edges_ptr; }; -CellInfo::CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr) +CellInfo::CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr) { std::size_t nbe(edges.size()); - std::vector edges2(2*nbe); std::vector< MCAuto > edgesPtr2(2*nbe); + std::vector edges2(2*nbe); std::vector< MCAuto > edgesPtr2(2*nbe); for(std::size_t i=0;i& edges, const std::vector< MCAuto& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { } - EdgeInfo(int istart, int iend, int pos, const MCAuto& 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 >& newLeft, const std::vector< MCAuto >& newRight); - void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int offset, int neighbors[2]) const; + EdgeInfo(mcIdType istart, mcIdType iend, const MCAuto& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { } + EdgeInfo(mcIdType istart, mcIdType iend, mcIdType pos, const MCAuto& 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 >& newLeft, const std::vector< MCAuto >& newRight); + void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, mcIdType offset, mcIdType neighbors[2]) const; private: - int _istart; - int _iend; + mcIdType _istart; + mcIdType _iend; MCAuto _mesh; MCAuto _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 >& newLeft, const std::vector< MCAuto >& newRight) +void EdgeInfo::somethingHappendAt(mcIdType pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) { const MEDCouplingUMesh *mesh(_mesh); if(mesh) @@ -913,7 +913,7 @@ void EdgeInfo::somethingHappendAt(int pos, const std::vector< MCAuto 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; @@ -941,32 +941,32 @@ void EdgeInfo::feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int of class VectorOfCellInfo { public: - VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); + VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& 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& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs); - const std::vector& getConnOf(int pos) const { return get(pos)._edges; } - const std::vector< MCAuto >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; } + mcIdType getPositionOf(double eps, const MEDCouplingUMesh *mesh) const; + void setMeshAt(mcIdType pos, const MCAuto& mesh, mcIdType istart, mcIdType iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs); + const std::vector& getConnOf(mcIdType pos) const { return get(pos)._edges; } + const std::vector< MCAuto >& getEdgePtrOf(mcIdType pos) const { return get(pos)._edges_ptr; } MCAuto 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 >& newLeft, const std::vector< MCAuto >& newRight); - const CellInfo& get(int pos) const; - CellInfo& get(int pos); + mcIdType getZePosOfEdgeGivenItsGlobalId(mcIdType pos) const; + void updateEdgeInfo(mcIdType pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight); + const CellInfo& get(mcIdType pos) const; + CellInfo& get(mcIdType pos); private: - std::vector _pool; // for a newly created 2D cell, the list of edges (int) and edges ptr constiuing it + std::vector _pool; // for a newly created 2D cell, the list of edges ToIdType( and edges ptr constiuing it MCAuto _ze_mesh; // the aggregated mesh std::vector _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& edges, const std::vector< MCAuto >& edgesPtr):_pool(1) +VectorOfCellInfo::VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& 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 !"); @@ -979,21 +979,21 @@ int VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) co return zeMesh->getCellContainingPoint(barys->begin(),eps); } -void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto& mesh, int istart, int iend, - const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, +void VectorOfCellInfo::setMeshAt(mcIdType pos, const MCAuto& mesh, mcIdType istart, mcIdType iend, + const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& 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 pool(_pool.size()-1+sz); - for(std::size_t i=0;i _pool=pool; // if(sz==2) - updateEdgeInfo(ToIdType(pos),edgePtrs[0],edgePtrs[1]); + updateEdgeInfo(pos,edgePtrs[0],edgePtrs[1]); // if(isFast) { @@ -1013,13 +1013,13 @@ void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto std::vector< MCAuto > ms; if(pos>0) { - MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(0,ToIdType(pos),true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(0,pos,true))); ms.push_back(elt); } ms.push_back(mesh); if(pos<_ze_mesh->getNumberOfCells()-1) { - MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(ToIdType(pos)+1,ToIdType(_ze_mesh->getNumberOfCells()),true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true))); ms.push_back(elt); } std::vector< const MEDCouplingUMesh *> ms2(ms.size()); @@ -1028,16 +1028,16 @@ void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto _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::const_iterator it=_edge_info.begin();it!=_edge_info.end();it++,ret++) { if((*it).isInMyRange(pos)) @@ -1046,7 +1046,7 @@ int VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(int pos) const throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id !"); } -void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) +void VectorOfCellInfo::updateEdgeInfo(mcIdType pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) { get(pos);//to perform the sanity check; if(_edge_info.empty()) @@ -1056,16 +1056,16 @@ void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MCAuto=(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]; } @@ -1081,36 +1081,36 @@ CellInfo& VectorOfCellInfo::get(int 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& allEdges, const std::vector< MCAuto >& allEdgesPtr, int offset, - MCAuto& idsLeftRight) +MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector& allEdges, const std::vector< MCAuto >& allEdgesPtr, mcIdType offset, + MCAuto& 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 edge1Bis(nb*2); + std::vector edge1Bis(nb*2); std::vector< MCAuto > 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 renumb(DataArrayInt::New()); + MCAuto 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]; @@ -1132,9 +1132,9 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh // 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 partOfSplitMesh1D(static_cast(splitMesh1D->buildPartOfMySelfSlice(iStart,iEnd,1,true))); - int pos(pool.getPositionOf(eps,partOfSplitMesh1D)); + mcIdType pos(pool.getPositionOf(eps,partOfSplitMesh1D)); // MCAutoretTmp(MEDCouplingUMesh::New("",2)); retTmp->setCoords(splitMesh1D->getCoords()); retTmp->allocateCells(); - std::vector< std::vector > out0; + std::vector< std::vector > out0; std::vector< std::vector< MCAuto > > out1; BuildMesh2DCutInternal2(partOfSplitMesh1D,pool.getConnOf(pos),pool.getEdgePtrOf(pos),out0,out1); @@ -1163,7 +1163,7 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh // iStart=iEnd; } - for(int mm=0;mm >& intersectEdge1, int offset, - MCAuto& idsLeftRight) +MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, mcIdType cellIdInMesh2D, const MEDCouplingUMesh *mesh2DDesc, MEDCouplingUMesh *splitMesh1D, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& intersectEdge1, mcIdType offset, + MCAuto& idsLeftRight) { - const int *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin()); + const mcIdType *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin()); // - std::vector allEdges; + std::vector allEdges; std::vector< MCAuto > 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,int> m; + mcIdType edgeId(std::abs(*it)-1); + std::map< MCAuto,mcIdType> m; MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m)); - const std::vector& edge1(intersectEdge1[edgeId]); + const std::vector& edge1(intersectEdge1[edgeId]); if(*it>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); else @@ -1198,7 +1198,7 @@ MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, int cellIdInMesh2D, const MEDCo 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 @@ -1241,26 +1241,26 @@ bool AreEdgeEqual(const double *coo2D, const INTERP_KERNEL::CellModel& typ1, con * * \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 cur1D(static_cast(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 cur2D(static_cast(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 tmpPtr(new int[ci[1]-ci[0]]); + INTERP_KERNEL::AutoPtr tmpPtr(new mcIdType[ci[1]-ci[0]]); for(unsigned it2=0;it2 >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& mergedNodes) + std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& 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 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 myTree(bbox2,0,0,ToIdType(m2Desc->getNumberOfCells()),-eps); - BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps); + BBTree myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps); + BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps); - std::vector candidates1(1); - int offset1(m1Desc->getNumberOfNodes()); - int offset2(offset1+m2Desc->getNumberOfNodes()); - for(int i=0;i candidates1(1); + mcIdType offset1(m1Desc->getNumberOfNodes()); + mcIdType offset2(offset1+m2Desc->getNumberOfNodes()); + for(mcIdType i=0;i candidates2; // edges of mesh2 candidate for intersection + std::vector 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 map1,map2; - std::map revMap2; + std::map map1,map2; + std::map 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 @@ -1346,23 +1346,23 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M * 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 >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, - MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1, + std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, + MEDCouplingUMesh *& m1Desc, DataArrayIdType *&desc1, DataArrayIdType *&descIndx1, DataArrayIdType *&revDesc1, DataArrayIdType *&revDescIndx1, std::vector& 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 dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); - MCAuto 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 dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); + MCAuto dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2); m1Desc=m1->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1); m2Desc=m2->buildDescendingConnectivity2(desc2,descIndx2,revDesc2,revDescIndx2); MCAuto dd9(m1Desc),dd10(m2Desc); - std::map notUsedMap; + std::map 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(); @@ -1376,32 +1376,32 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c * @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 >& intesctEdges1, const std::vector< std::vector >& colinear2, - const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector >& intesctEdges2, +void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const mcIdType *desc1, const mcIdType *descIndx1, + const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, + const MEDCouplingUMesh *m2, const mcIdType *desc2, const mcIdType *descIndx2, const std::vector >& intesctEdges2, const std::vector& addCoords, - std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2) + std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& 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 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 myTree(bbox2,0,0,ToIdType(m2->getNumberOfCells()),eps); - mcIdType ncell1=ToIdType(m1->getNumberOfCells()); + BBTree myTree(bbox2,0,0,m2->getNumberOfCells(),eps); + mcIdType ncell1=m1->getNumberOfCells(); crI.push_back(0); - for(int i=0;i candidates2; + std::vector candidates2; myTree.getIntersectingElems(bbox1+i*2*SPACEDIM,candidates2); - std::map mapp; - std::map mappRev; + std::map mapp; + std::map 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); @@ -1417,12 +1417,12 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo for(it1.first();!it1.finished();it1.next()) edges1.insert(it1.current()->getPtr()); // - std::map > edgesIn2ForShare; // common edges + std::map > edgesIn2ForShare; // common edges std::vector 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::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++) + for(std::vector::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); @@ -1439,7 +1439,7 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo /// ii=0; // Now rebuild intersected cells from all this: - for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++) + for(std::vector::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); @@ -1460,21 +1460,21 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo throw INTERP_KERNEL::Exception(oss.str()); } } - for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) + for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) (*it).second->decrRef(); } } -void InsertNodeInConnIfNecessary(int nodeIdToInsert, std::vector& conn, const double *coords, double eps) +void InsertNodeInConnIfNecessary(mcIdType nodeIdToInsert, std::vector& conn, const double *coords, double eps) { - std::vector::iterator it(std::find(conn.begin(),conn.end(),nodeIdToInsert)); + std::vector::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::max()); for(std::size_t i=0;i(),1./normm)); @@ -1494,13 +1494,13 @@ void InsertNodeInConnIfNecessary(int nodeIdToInsert, std::vector& conn, con conn.insert(conn.begin()+(found+1)%sz,nodeIdToInsert); } -void SplitIntoToPart(const std::vector& conn, int pt0, int pt1, std::vector& part0, std::vector& part1) +void SplitIntoToPart(const std::vector& conn, mcIdType pt0, mcIdType pt1, std::vector& part0, std::vector& part1) { std::size_t sz(conn.size()); - std::vector *curPart(&part0); + std::vector *curPart(&part0); for(std::size_t i=0;i& conn, int pt0, int pt1, std::vector /*! * 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 >& cut3DSurf, - const int *desc, const int *descIndx, const double *coords, double eps, - std::vector >& res) const +void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pair >& cut3DSurf, + const mcIdType *desc, const mcIdType *descIndx, const double *coords, double eps, + std::vector >& 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& p=cut3DSurf[desc[offset+j]]; + const std::pair& 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 tmp(new int[sz]); + mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1; + INTERP_KERNEL::AutoPtr tmp(new mcIdType[sz]); INTERP_KERNEL::NormalizedCellType cmsId; unsigned nbOfNodesSon(cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId)); - std::vector elt((int *)tmp,(int *)tmp+nbOfNodesSon); + std::vector 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 elt1,elt2; + std::vector elt1,elt2; SplitIntoToPart(elt,p.first,p.second,elt1,elt2); res.push_back(elt1); res.push_back(elt2); @@ -1564,23 +1564,23 @@ void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pairgetNumberOfTuples()); - MCAuto 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 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;igetNumberOfTuples()); mcIdType nodesCnt(getNumberOfNodes()); - MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); + MCAuto c(DataArrayIdType::New()); c->alloc((std::size_t)lgthToReach); MCAuto 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;igetPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer()); + mcIdType prevPosOfCi(ciPtr[0]); + for(mcIdType i=0;i e(INTERP_KERNEL::QuadraticPolygon::BuildArcCircleEdge(ns)); - for(int k=0;k > intersectEdge1, colinear2, subDiv2; + std::vector< std::vector > 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 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 dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2); + MCAuto dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2); MCAuto dd5(m1Desc),dd6(m2Desc); // Step 2: re-order newly created nodes according to the ordering found in m2 - std::vector< std::vector > intersectEdge2; + std::vector< std::vector > intersectEdge2; BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2); subDiv2.clear(); dd5=0; dd6=0; // Step 3: - std::vector cr,crI; //no DataArrayInt because interface with Geometric2D - std::vector cNb1,cNb2; //no DataArrayInt because interface with Geometric2D + std::vector cr,crI; //no DataArrayIdType because interface with Geometric2D + std::vector 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 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 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 coordss(4); coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa; coordss[3]=addCoordsQuadraticDa; MCAuto coo(DataArrayDouble::Aggregate(coordss)); MCAuto ret(MEDCouplingUMesh::New("Intersect2D",2)); - MCAuto conn(DataArrayInt::New()); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); - MCAuto connI(DataArrayInt::New()); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); - MCAuto c1(DataArrayInt::New()); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); - MCAuto c2(DataArrayInt::New()); c2->alloc((int)cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); + MCAuto conn(DataArrayIdType::New()); conn->alloc(cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); + MCAuto connI(DataArrayIdType::New()); connI->alloc(crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); + MCAuto c1(DataArrayIdType::New()); c1->alloc(cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); + MCAuto 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(); @@ -1768,7 +1768,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 * * \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 !"); @@ -1778,22 +1778,22 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, 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 > intersectEdge1, colinear2, subDiv2; + std::vector< std::vector > intersectEdge1, colinear2, subDiv2; std::vector 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 dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); + DataArrayIdType *desc1(DataArrayIdType::New()),*descIndx1(DataArrayIdType::New()),*revDesc1(DataArrayIdType::New()),*revDescIndx1(DataArrayIdType::New()); + MCAuto dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); MCAuto m1Desc(mesh2D->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); - std::map mergedNodes; + std::map mergedNodes; Intersect1DMeshes(m1Desc,mesh1D,eps,intersectEdge1,colinear2,subDiv2,addCoo,mergedNodes); // use mergeNodes to fix intersectEdge1 - for(std::vector< std::vector >::iterator it0=intersectEdge1.begin();it0!=intersectEdge1.end();it0++) + for(std::vector< std::vector >::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::const_iterator it1; + mcIdType eltStart((*it0)[0]),eltEnd((*it0)[2*n-1]); + std::map::const_iterator it1; it1=mergedNodes.find(eltStart); if(it1!=mergedNodes.end()) (*it0)[0]=(*it1).second; @@ -1803,28 +1803,28 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, } // MCAuto 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 > intersectEdge2; + std::vector< std::vector > intersectEdge2; BuildIntersectEdges(m1Desc,mesh1D,addCoo,subDiv2,intersectEdge2); subDiv2.clear(); // Step 3: compute splitMesh1D - MCAuto idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear; - MCAuto ret2(DataArrayInt::New()); ret2->alloc(0,1); + MCAuto idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear; + MCAuto ret2(DataArrayIdType::New()); ret2->alloc(0,1); MCAuto ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1, idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear)); - MCAuto ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); - MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ToIdType(ret1->getNumberOfCells()))); + MCAuto ret3(DataArrayIdType::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); + MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); // deal with cells in mesh2D that are not cut but only some of their edges are - MCAuto idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy()); + MCAuto idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy()); idsInDesc2DToBeRefined->abs(); idsInDesc2DToBeRefined->applyLin(1,-1); idsInDesc2DToBeRefined=idsInDesc2DToBeRefined->buildUnique(); - MCAuto 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 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 outi0s(outi0); + DataArrayIdType *out0(0),*outi0(0); + DataArrayIdType::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0); + MCAuto outi0s(outi0); out0s=out0; out0s=out0s->buildUnique(); out0s->sort(true); @@ -1832,17 +1832,17 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, // MCAuto ret1NonCol(static_cast(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end()))); MCAuto baryRet1(ret1NonCol->computeCellCenterOfMass()); - MCAuto elts,eltsIndex; + MCAuto elts,eltsIndex; mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex); - MCAuto eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1); + MCAuto eltsIndex2(DataArrayIdType::New()); eltsIndex2->alloc(0,1); if (eltsIndex->getNumberOfTuples() > 1) eltsIndex2 = eltsIndex->deltaShiftIndex(); - MCAuto eltsIndex3(eltsIndex2->findIdsEqual(1)); - if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ToIdType(ret1NonCol->getNumberOfCells())) + MCAuto eltsIndex3(eltsIndex2->findIdsEqual(1)); + if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells()) throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !"); - MCAuto cellsToBeModified(elts->buildUnique()); - MCAuto untouchedCells(cellsToBeModified->buildComplement(ToIdType(mesh2D->getNumberOfCells()))); - if((DataArrayInt *)out0s) + MCAuto cellsToBeModified(elts->buildUnique()); + MCAuto 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 > outMesh2DSplit; // OK all is ready to insert in ret2 mesh @@ -1852,26 +1852,26 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, 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 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 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 partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); - partOfRet3->fillWithValue(std::numeric_limits::max()); partOfRet3->rearrange(2); - int kk(0),*ret3ptr(partOfRet3->getPointer()); - for(const int *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++) + MCAuto partOfRet3(DataArrayIdType::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); + partOfRet3->fillWithValue(std::numeric_limits::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]) @@ -1899,17 +1899,17 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, } } cellsToBeModified=cellsToBeModified->buildUniqueNotSorted(); - for(const int *it=cellsToBeModified->begin();it!=cellsToBeModified->end();it++) + for(const mcIdType *it=cellsToBeModified->begin();it!=cellsToBeModified->end();it++) { - MCAuto idsNonColPerCell(elts->findIdsEqual(*it)); + MCAuto idsNonColPerCell(elts->findIdsEqual(*it)); idsNonColPerCell->transformWithIndArr(eltsIndex3->begin(),eltsIndex3->end()); - MCAuto idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end())); + MCAuto idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end())); MCAuto partOfMesh1CuttingCur2DCell(static_cast(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end()))); - MCAuto partOfRet3; + MCAuto partOfRet3; MCAuto 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;igetNumberOfCells();i++) + for(mcIdType i=0;igetNumberOfCells();i++) ret2->pushBackSilent(*it); } // @@ -1920,16 +1920,16 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, // ret1->getCoords()->setInfoOnComponents(compNames); MCAuto ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp)); - // To finish - filter ret3 - std::numeric_limits::max() -> -1 - negate values must be resolved. + // To finish - filter ret3 - std::numeric_limits::max() -> -1 - negate values must be resolved. ret3->rearrange(1); - MCAuto edgesToDealWith(ret3->findIdsStrictlyNegative()); - for(const int *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++) + MCAuto edgesToDealWith(ret3->findIdsStrictlyNegative()); + for(const mcIdType *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++) { - int old2DCellId(-ret3->getIJ(*it,0)-1); - MCAuto candidates(ret2->findIdsEqual(old2DCellId)); + mcIdType old2DCellId(-ret3->getIJ(*it,0)-1); + MCAuto 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::max(),-1); + ret3->changeValue(std::numeric_limits::max(),-1); ret3->rearrange(2); // splitMesh1D=ret1.retn(); @@ -1953,7 +1953,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, * 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. @@ -1961,30 +1961,30 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, * \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 desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()); MCAuto 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 bboxArr(mDesc->getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()),*coords(getCoords()->begin()); - mcIdType nCell=ToIdType(getNumberOfCells()),nDescCell=ToIdType(mDesc->getNumberOfCells()); - std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); + mcIdType nCell=getNumberOfCells(),nDescCell=mDesc->getNumberOfCells(); + std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); std::vector addCoo; - BBTree myTree(bbox,0,0,nDescCell,-eps); + BBTree myTree(bbox,0,0,nDescCell,-eps); INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); - for(int i=0;i candidates; + std::vector candidates; myTree.getIntersectingElems(bbox+i*2*SPACEDIM,candidates); - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(std::vector::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,int> m; + std::map,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; @@ -1998,24 +1998,24 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) } } // splitting done. sort intersect point in intersectEdge. - std::vector< std::vector > middle(nDescCell); - int nbOf2DCellsToBeSplit(0); + std::vector< std::vector > middle(nDescCell); + mcIdType nbOf2DCellsToBeSplit(0); bool middleNeedsToBeUsed(false); std::vector cells2DToTreat(nDescCell,false); - for(int i=0;i& isect(intersectEdge[i]); - int sz((int)isect.size()); + std::vector& isect(intersectEdge[i]); + std::size_t sz(isect.size()); if(sz>1) { - std::map,int> m; + std::map,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]]) @@ -2024,22 +2024,22 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) nbOf2DCellsToBeSplit++; } // try to reuse at most eventual 'middle' of SEG3 - std::vector& mid(middle[i]); + std::vector& mid(middle[i]); mid.resize(sz+1,-1); if((INTERP_KERNEL::NormalizedCellType)c[ci[i]]==INTERP_KERNEL::NORM_SEG3) { middleNeedsToBeUsed=true; - const std::vector& candidates(overlapEdge[i]); - std::vector trueCandidates; - for(std::vector::const_iterator itc=candidates.begin();itc!=candidates.end();itc++) + const std::vector& candidates(overlapEdge[i]); + std::vector trueCandidates; + for(std::vector::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::const_iterator itc=trueCandidates.begin();itc!=trueCandidates.end();itc++) + for(std::vector::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; } } @@ -2049,29 +2049,29 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) } } } - MCAuto ret(DataArrayInt::New()),notRet(DataArrayInt::New()); ret->alloc(nbOf2DCellsToBeSplit,1); + MCAuto ret(DataArrayIdType::New()),notRet(DataArrayIdType::New()); ret->alloc(nbOf2DCellsToBeSplit,1); if(nbOf2DCellsToBeSplit==0) return ret.retn(); // - int *retPtr(ret->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;i 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 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 modif(static_cast(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 tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); + MCAuto tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); } return ret.retn(); } @@ -2089,7 +2089,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) * * 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. @@ -2097,7 +2097,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) * * \sa MEDCouplingUMesh::conformize2D, MEDCouplingUMesh::mergeNodes, MEDCouplingUMesh::convexEnvelop2D. */ -DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) +DataArrayIdType *MEDCouplingUMesh::colinearize2D(double eps) { return internalColinearize2D(eps, false); } @@ -2109,7 +2109,7 @@ DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) * * \sa MEDCouplingUMesh::colinearize2D */ -DataArrayInt *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps) +DataArrayIdType *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps) { return internalColinearize2D(eps, true); } @@ -2118,35 +2118,35 @@ DataArrayInt *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps) /*! * \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 ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto 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 newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); - std::map 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 newc(DataArrayIdType::New()),newci(DataArrayIdType::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); + std::map 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 desc1(DataArrayInt::New()),descI1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescI1(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),descI1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescI1(DataArrayIdType::New()); MCAuto mDesc1D(buildDescendingConnectivity(desc1,descI1,revDesc1,revDescI1)); - MCAuto desc2(DataArrayInt::New()),descI2(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescI2(DataArrayInt::New()); + MCAuto desc2(DataArrayIdType::New()),descI2(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescI2(DataArrayIdType::New()); MCAuto mDesc0D(mDesc1D->buildDescendingConnectivity(desc2,descI2,revDesc2,revDescI2)); - MCAuto dsi(revDescI2->deltaShiftIndex()); - MCAuto ids(dsi->findIdsGreaterThan(2)); - const int * cPtr(mDesc0D->getNodalConnectivity()->begin()); + MCAuto dsi(revDescI2->deltaShiftIndex()); + MCAuto 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 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;igetPointer()); + for(mcIdType i=0;ipushBackSilent(i); @@ -2173,19 +2173,19 @@ DataArrayInt *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConfo * 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 & pointIds, std::vector & 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 & pointIds, std::vector & hitSegs) { using namespace std; const int SPACEDIM=3; - typedef pair PairDI; + typedef pair 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)); } @@ -2195,10 +2195,10 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i pointIds.reserve(xx.size()); // Keep what is inside [startNode, endNode]: - int go = 0; + mcIdType go = 0; for (vector::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; @@ -2211,7 +2211,7 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i break; } -// vector pointIds2(pointIds.size()+2); +// vector pointIds2(pointIds.size()+2); // copy(pointIds.begin(), pointIds.end(), pointIds2.data()+1); // pointIds2[0] = startNode; // pointIds2[pointIds2.size()-1] = endNode; @@ -2220,12 +2220,12 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i 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::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start); + mcIdType start = c[cI[*it]+1], end = c[cI[*it]+2]; + vector::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start); if (itStart == pointIds.end()) continue; - vector::const_iterator itEnd = find(pointIds.begin(), pointIds.end(), end); + vector::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. @@ -2234,23 +2234,23 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i 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& insidePoints, std::vector& modifiedFace) +void MEDCouplingUMesh::ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdType * sIdxConnE, mcIdType startNode, mcIdType endNode, + const std::vector& insidePoints, std::vector& 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::iterator shortEnd = modifiedFace.begin()+dst; - vector::iterator startPos = find(modifiedFace.begin(), shortEnd , startNode); + vector::iterator shortEnd = modifiedFace.begin()+dst; + vector::iterator startPos = find(modifiedFace.begin(), shortEnd , startNode); if (startPos == shortEnd) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!"); - vector::iterator endPos = find(modifiedFace.begin(),shortEnd, endNode); + vector::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 @@ -2272,7 +2272,7 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxC * 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. @@ -2280,7 +2280,7 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxC * \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; @@ -2293,23 +2293,23 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto connSla(MEDCouplingSkyLineArray::BuildFromPolyhedronConn(getNodalConnectivity(), getNodalConnectivityIndex())); const double * coo(_coords->begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); { /************************* * STEP 1 -- faces *************************/ - MCAuto descDNU(DataArrayInt::New()),descIDNU(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescI(DataArrayInt::New()); + MCAuto descDNU(DataArrayIdType::New()),descIDNU(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescI(DataArrayIdType::New()); MCAuto 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 connSlaDesc(MEDCouplingSkyLineArray::New(mDesc->getNodalConnectivityIndex(), mDesc->getNodalConnectivity())); // Build BBTree MCAuto bboxArr(mDesc->getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()); getCoords()->begin(); - mcIdType nDescCell=ToIdType(mDesc->getNumberOfCells()); - BBTree myTree(bbox,0,0,nDescCell,-eps); + mcIdType nDescCell=mDesc->getNumberOfCells(); + BBTree myTree(bbox,0,0,nDescCell,-eps); // Surfaces - handle biggest first MCAuto surfF = mDesc->getMeasureField(true); DataArrayDouble * surfs = surfF->getArray(); @@ -2319,26 +2319,26 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) const double * normalsP = normals->getConstPointer(); // Sort faces by decreasing surface: - vector< pair > S; + vector< pair > S; for(mcIdType i=0;i < surfs->getNumberOfTuples();i++) { - pair p = make_pair(surfs->begin()[i], i); + pair p = make_pair(surfs->begin()[i], i); S.push_back(p); } sort(S.rbegin(),S.rend()); // reverse sort vector hit(nDescCell); fill(hit.begin(), hit.end(), false); - vector hitPoly; // the final result: which 3D cells have been modified. + vector hitPoly; // the final result: which 3D cells have been modified. - for( vector >::const_iterator it = S.begin(); it != S.end(); it++) + for( vector >::const_iterator it = S.begin(); it != S.end(); it++) { - int faceIdx = (*it).second; + mcIdType faceIdx = (*it).second; if (hit[faceIdx]) continue; - vector candidates, cands2; + vector candidates, cands2; myTree.getIntersectingElems(bbox+faceIdx*2*SPACEDIM,candidates); // Keep only candidates whose normal matches the normal of current face - for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) + for(vector::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) @@ -2366,7 +2366,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto baryPart = mPartCand->computeCellCenterOfMass(); vector compo; compo.push_back(2); MCAuto baryPartZ = baryPart->keepSelectedComponents(compo); - MCAuto idsGoodPlane = baryPartZ->findIdsInRange(-eps, +eps); + MCAuto idsGoodPlane = baryPartZ->findIdsInRange(-eps, +eps); if (!idsGoodPlane->getNumberOfTuples()) continue; @@ -2375,15 +2375,15 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) compo[0] = 0; compo.push_back(1); MCAuto baryPartXY = baryPart->keepSelectedComponents(compo); mPartRef->changeSpaceDimension(2,0.0); - MCAuto cc(DataArrayInt::New()), ccI(DataArrayInt::New()); + MCAuto cc(DataArrayIdType::New()), ccI(DataArrayIdType::New()); mPartRef->getCellsContainingPoints(baryPartXY->begin(), baryPartXY->getNumberOfTuples(), eps, cc, ccI); if (!cc->getNumberOfTuples()) continue; - MCAuto dsi = ccI->deltaShiftIndex(); + MCAuto dsi = ccI->deltaShiftIndex(); { - MCAuto tmp = dsi->findIdsInRange(0, 2); + MCAuto tmp = dsi->findIdsInRange(0, 2); if (tmp->getNumberOfTuples() != dsi->getNumberOfTuples()) { ostringstream oss; @@ -2392,16 +2392,16 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) } } - MCAuto ids = dsi->findIdsEqual(1); + MCAuto 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]; } @@ -2413,18 +2413,18 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) } // For all polyhedrons using this face, replace connectivity: - vector polyIndices, packsIds, facePack; - for (int ii=revDescIP[faceIdx]; ii < revDescIP[faceIdx+1]; ii++) + vector 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::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2, ++jj) + mcIdType jj=0; + for (vector::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 @@ -2435,22 +2435,22 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) 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::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2) + for (vector::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 cAuto; cAuto.takeRef(_nodal_connec); - MCAuto cIAuto; cIAuto.takeRef(_nodal_connec_index); + MCAuto cAuto; cAuto.takeRef(_nodal_connec); + MCAuto cIAuto; cIAuto.takeRef(_nodal_connec_index); connSla->convertToPolyhedronConn(cAuto, cIAuto); { @@ -2460,36 +2460,36 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Now we have a face-conform mesh. // Recompute descending - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescI(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescI(DataArrayIdType::New()); // Rebuild desc connectivity with orientation this time!! MCAuto 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 ciDeepC(mDesc->getNodalConnectivityIndex()->deepCopy()); - MCAuto 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 ciDeepC(mDesc->getNodalConnectivityIndex()->deepCopy()); + MCAuto cDeepC(mDesc->getNodalConnectivity()->deepCopy()); MCAuto connSlaDesc(MEDCouplingSkyLineArray::New(ciDeepC, cDeepC)); - MCAuto desc2(DataArrayInt::New()),descI2(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescI2(DataArrayInt::New()); + MCAuto desc2(DataArrayIdType::New()),descI2(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescI2(DataArrayIdType::New()); MCAuto 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 bboxArr(mDesc2->getBoundingBoxForBBTree(eps)); const double *bbox2(bboxArr->begin()); - mcIdType nDesc2Cell=ToIdType(mDesc2->getNumberOfCells()); - BBTree myTree2(bbox2,0,0,nDesc2Cell,-eps); + mcIdType nDesc2Cell=mDesc2->getNumberOfCells(); + BBTree myTree2(bbox2,0,0,nDesc2Cell,-eps); // Edges - handle longest first MCAuto lenF = mDesc2->getMeasureField(true); DataArrayDouble * lens = lenF->getArray(); // Sort edges by decreasing length: - vector > S; + vector > S; for(mcIdType i=0;i < lens->getNumberOfTuples();i++) { - pair p = make_pair(lens->getIJ(i, 0), i); + pair p = make_pair(lens->getIJ(i, 0), i); S.push_back(p); } sort(S.rbegin(),S.rend()); // reverse sort @@ -2497,24 +2497,24 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) vector hit(nDesc2Cell); fill(hit.begin(), hit.end(), false); - for( vector >::const_iterator it = S.begin(); it != S.end(); it++) + for( vector >::const_iterator it = S.begin(); it != S.end(); it++) { - int eIdx = (*it).second; + mcIdType eIdx = (*it).second; if (hit[eIdx]) continue; - vector candidates, cands2; + vector 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::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) + for(vector::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 @@ -2526,19 +2526,19 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) 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 mPartRef(mDesc2->buildPartOfMySelfSlice(eIdx, eIdx+1,1,false)); // false=zipCoords is called MCAuto mPartCand(mDesc2->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), true)); // true=zipCoords is called - MCAuto nodeMap(mPartCand->zipCoordsTraducer()); - int nbElemsNotM1; + MCAuto nodeMap(mPartCand->zipCoordsTraducer()); + mcIdType nbElemsNotM1; { - MCAuto tmp(nodeMap->findIdsNotEqual(-1)); - nbElemsNotM1 = ToIdType(tmp->getNbOfElems()); + MCAuto tmp(nodeMap->findIdsNotEqual(-1)); + nbElemsNotM1 = tmp->getNbOfElems(); } - MCAuto nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1); + MCAuto nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1); double * cooPartRef(mPartRef->_coords->getPointer()); double * cooPartCand(mPartCand->_coords->getPointer()); for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) @@ -2553,42 +2553,42 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto baryPartY = baryPart->keepSelectedComponents(compo); compo[0] = 2; MCAuto baryPartZ = baryPart->keepSelectedComponents(compo); - MCAuto idsGoodLine1 = baryPartY->findIdsInRange(-eps, +eps); - MCAuto idsGoodLine2 = baryPartZ->findIdsInRange(-eps, +eps); - MCAuto idsGoodLine = idsGoodLine1->buildIntersection(idsGoodLine2); + MCAuto idsGoodLine1 = baryPartY->findIdsInRange(-eps, +eps); + MCAuto idsGoodLine2 = baryPartZ->findIdsInRange(-eps, +eps); + MCAuto idsGoodLine = idsGoodLine1->buildIntersection(idsGoodLine2); if (!idsGoodLine->getNumberOfTuples()) continue; // Now the ordering along the Ox axis: - std::vector insidePoints, hitSegs; + std::vector 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::const_iterator its=hitSegs.begin(); its != hitSegs.end(); ++its) + for (vector::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::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit) + for (std::vector::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit) *iit = nodeMapInv->begin()[*iit]; - vector polyIndices, packsIds, facePack; + vector 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 modifiedFace; + vector 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()); @@ -2597,23 +2597,23 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Rebuild 3D connectivity from descending: MCAuto newConn(MEDCouplingSkyLineArray::New()); - MCAuto superIdx(DataArrayInt::New()); superIdx->alloc(getNumberOfCells()+1); superIdx->fillWithValue(0); - MCAuto idx(DataArrayInt::New()); idx->alloc(1); idx->fillWithValue(0); - MCAuto vals(DataArrayInt::New()); vals->alloc(0); + MCAuto superIdx(DataArrayIdType::New()); superIdx->alloc(getNumberOfCells()+1); superIdx->fillWithValue(0); + MCAuto idx(DataArrayIdType::New()); idx->alloc(1); idx->fillWithValue(0); + MCAuto 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 rev(sz-1); - for (int kk=0; kk rev(sz-1); + for (mcIdType kk=0; kkpushBackPack(ii, rev.data(), rev.data()+sz-1); } } diff --git a/src/MEDCoupling/MEDCouplingVoronoi.cxx b/src/MEDCoupling/MEDCouplingVoronoi.cxx index 442be5edb..80e1b0e3d 100755 --- a/src/MEDCoupling/MEDCouplingVoronoi.cxx +++ b/src/MEDCoupling/MEDCouplingVoronoi.cxx @@ -74,17 +74,17 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt 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 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 cellNb10(cellNb1),cellNb20(cellNb2); + MCAuto cellNb10(cellNb1),cellNb20(cellNb2); } - std::vector ccp; + std::vector ccp; sp2->getCellsContainingPoint(pt1,eps,ccp); if(ccp.size()!=1) throw INTERP_KERNEL::Exception("ComputeBigCellFrom : expected single element !"); @@ -96,12 +96,12 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool isZip) { - MCAuto edgeToKeep; + MCAuto edgeToKeep; MCAuto p0; { - MCAuto d(DataArrayInt::New()),di(DataArrayInt::New()),rd(DataArrayInt::New()),rdi(DataArrayInt::New()); + MCAuto d(DataArrayIdType::New()),di(DataArrayIdType::New()),rd(DataArrayIdType::New()),rdi(DataArrayIdType::New()); p0=p->buildDescendingConnectivity(d,di,rd,rdi); - MCAuto dsi(rdi->deltaShiftIndex()); + MCAuto dsi(rdi->deltaShiftIndex()); edgeToKeep=dsi->findIdsEqual(1); } MCAuto skinOfRes(p0->buildPartOfMySelf(edgeToKeep->begin(),edgeToKeep->end())); @@ -111,16 +111,16 @@ MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool i if(ToIdType(skinOfRes->getNumberOfCells())!=skinOfRes->getNumberOfNodes()) throw INTERP_KERNEL::Exception("MergeVorCells : result of merge looks bad !"); } - MCAuto d(skinOfRes->orderConsecutiveCells1D()); + MCAuto d(skinOfRes->orderConsecutiveCells1D()); MCAuto skinOfRes2; { MCAuto part(skinOfRes->buildPartOfMySelf(d->begin(),d->end())); skinOfRes2=MEDCoupling1SGTUMesh::New(part); } - MCAuto c(skinOfRes2->getNodalConnectivity()->deepCopy()); + MCAuto c(skinOfRes2->getNodalConnectivity()->deepCopy()); c->circularPermutation(1); c->rearrange(2); - std::vector< MCAuto > vdi(c->explodeComponents()); + std::vector< MCAuto > vdi(c->explodeComponents()); if(!vdi[0]->isEqual(*vdi[1])) throw INTERP_KERNEL::Exception("MergeVorCells : internal error !"); MCAuto m(MEDCouplingUMesh::New("",2)); @@ -144,8 +144,8 @@ MCAuto MergeVorCells(const std::vector< MCAutozipCoords(); { - bool dummy; int dummy2; - MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); } return MergeVorCells2D(p,eps,true); } @@ -157,13 +157,13 @@ MCAuto SimplifyPolygon(const MEDCouplingUMesh *m, double eps) { 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 resConn; - for(int i=0;i resConn; + for(mcIdType i=0;i MergeVorCells3D(const std::vector< MCAutozipCoords(); { - bool dummy; int dummy2; - MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); } - MCAuto edgeToKeep; + MCAuto edgeToKeep; MCAuto p0; { - MCAuto d(DataArrayInt::New()),di(DataArrayInt::New()),rd(DataArrayInt::New()),rdi(DataArrayInt::New()); + MCAuto d(DataArrayIdType::New()),di(DataArrayIdType::New()),rd(DataArrayIdType::New()),rdi(DataArrayIdType::New()); p0=p->buildDescendingConnectivity(d,di,rd,rdi); - MCAuto dsi(rdi->deltaShiftIndex()); + MCAuto dsi(rdi->deltaShiftIndex()); edgeToKeep=dsi->findIdsEqual(1); } MCAuto skinOfRes(p0->buildPartOfMySelf(edgeToKeep->begin(),edgeToKeep->end())); MCAuto eqn(skinOfRes->computePlaneEquationOf3DFaces()); - MCAuto comm,commI; + MCAuto 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 ret(MEDCouplingUMesh::New("",3)); ret->setCoords(skinOfRes->getCoords()); ret->allocateCells(); - std::vector conn; + std::vector conn; int jj(0); for(mcIdType i=0;igetNumberOfTuples()-1;i++,jj++) { @@ -234,13 +234,13 @@ MCAuto MergeVorCells3D(const std::vector< MCAutogetNodalConnectivity()->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 remain(comm->buildComplement(ToIdType(skinOfRes->getNumberOfCells()))); + MCAuto remain(comm->buildComplement(ToIdType(skinOfRes->getNumberOfCells()))); { MCAuto 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;igetNumberOfTuples();i++,jj++) { if(jj!=0) @@ -254,7 +254,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAuto MergeVorCells1D(const std::vector< MCAuto >& 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) @@ -263,12 +263,12 @@ MCAuto MergeVorCells1D(const std::vector< MCAutogetNodalConnectivity()->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]]; } @@ -283,7 +283,7 @@ MCAuto MergeVorCells1D(const std::vector< MCAuto 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(); @@ -299,7 +299,7 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * m->getBoundingBox(&bbox[0]); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); const double *pts(points->begin()); - for(int i=1;i vorTess; { @@ -308,10 +308,10 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * } { bool dummy; - int newNbNodes; - MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + mcIdType newNbNodes; + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } - std::vector polygsToIterOn; + std::vector polygsToIterOn; const double *pt(pts+i); vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn); if(polygsToIterOn.empty()) @@ -319,9 +319,9 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * if(polygsToIterOn.size()>2) throw INTERP_KERNEL::Exception("Voronoize1D : overlap of points !"); std::vector< MCAuto > newVorCells; - for(std::vector::const_iterator it=polygsToIterOn.begin();it!=polygsToIterOn.end();it++) + for(std::vector::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.); @@ -330,7 +330,7 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * 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]]; } @@ -357,8 +357,8 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0)); MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { - bool dummy; int dummy2; - MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } @@ -380,7 +380,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * m->getBoundingBox(&bbox[0]); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); const double *pts(points->begin()); - for(int i=1;i vorTess; { @@ -389,36 +389,36 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * } { bool dummy; - int newNbNodes; - MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + mcIdType newNbNodes; + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } - std::vector polygsToIterOn; + std::vector 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 elemsToDo,elemsDone; elemsToDo.insert(polygsToIterOn[0]); + std::set elemsToDo,elemsDone; elemsToDo.insert(polygsToIterOn[0]); std::vector< MCAuto > 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 cell(ComputeBigCellFrom(pt,seed,bbox,eps)); MCAuto tile(l0[poly]); tile->zipCoords(); MCAuto a; - MCAuto b,c; + MCAuto 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 part(c->findIdsEqual(-1)); + MCAuto part(c->findIdsEqual(-1)); if(part->getNumberOfTuples()!=1) throw INTERP_KERNEL::Exception("Voronoize2D : internal error"); MCAuto newVorCell; { - MCAuto tmp(part->buildComplement(ToIdType(a->getNumberOfCells()))); + MCAuto tmp(part->buildComplement(ToIdType(a->getNumberOfCells()))); newVorCell=a->buildPartOfMySelf(tmp->begin(),tmp->end()); } newVorCell->zipCoords(); @@ -426,9 +426,9 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * modifiedCell->zipCoords(); l0[poly]=modifiedCell; // - MCAuto ids; + MCAuto ids; { - DataArrayInt *tmp(0); + DataArrayIdType *tmp(0); bool sta(a->getCoords()->areIncludedInMe(cell->getCoords(),eps,tmp)); ids=tmp; if(!sta) @@ -436,19 +436,19 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * } MCAuto newCoords; { - MCAuto tmp(ids->buildComplement(a->getNumberOfNodes())); + MCAuto tmp(ids->buildComplement(a->getNumberOfNodes())); newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end()); } const double *cPtr(newCoords->begin()); for(mcIdType j=0;jgetNumberOfTuples();j++,cPtr+=2) { - std::set zeCandidates; + std::set zeCandidates; { - std::vector zeCandidatesTmp; + std::vector zeCandidatesTmp; vorTess->getCellsContainingPoint(cPtr,eps,zeCandidatesTmp); zeCandidates.insert(zeCandidatesTmp.begin(),zeCandidatesTmp.end()); } - std::set tmp2,newElementsToDo; + std::set 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; @@ -460,13 +460,13 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0)); MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { - bool dummy; int dummy2; - MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } -MCAuto Split3DCellInParts(const MEDCouplingUMesh *m, const double pt[3], const double seed[3], double eps, int tmp[2]) +MCAuto 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 !"); @@ -478,7 +478,7 @@ MCAuto Split3DCellInParts(const MEDCouplingUMesh *m, const dou MCAuto 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(); @@ -492,7 +492,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !"); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); const double *pts(points->begin()); - for(int i=1;i vorTess; { @@ -501,21 +501,21 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * } { bool dummy; - int newNbNodes; - MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + mcIdType newNbNodes; + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } - std::vector polygsToIterOn; + std::vector 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 > newVorCells; - for(int poly=0;polygetNumberOfCells());poly++) + for(mcIdType poly=0;polygetNumberOfCells());poly++) { const double *seed(pts+3*poly); MCAuto tile(l0[poly]); tile->zipCoords(); - int tmp[2]; + mcIdType tmp[2]; MCAuto cells; try { @@ -537,8 +537,8 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0)); MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { - bool dummy; int dummy2; - MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } -- 2.39.2