X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingIMesh.cxx;h=16dc17763bc9d3ad709b6ed5f1783e1e12e23b00;hb=f13ce72017fd205546293a53f7b041824cb50eec;hp=dc2cf8793494b41f9b1d9ee2f8714ab4d0a34a23;hpb=adb05294eddb7cd796a4bebee7b3164ad1440f8f;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx index dc2cf8793..16dc17763 100644 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -164,7 +164,7 @@ MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingCMesh::New()); try { ret->copyTinyInfoFrom(this); } - catch(INTERP_KERNEL::Exception& e) { } + catch(INTERP_KERNEL::Exception& ) { } int spaceDim(getSpaceDimension()); std::vector infos(buildInfoOnComponents()); for(int i=0;i& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse) +{ + if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) + throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !"); + int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); + int nbCompo(fineDA->getNumberOfComponents()); + if(coarseDA->getNumberOfComponents()!=nbCompo) + throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !"); + if(meshDim!=(int)fineLocInCoarse.size()) + throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) must be equal to the sier of coarseSt (2nd param) !"); + if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + { + std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " having " << coarseDA->getNumberOfTuples() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + int nbTuplesFine(fineDA->getNumberOfTuples()); + if(nbTuplesFine%nbOfTuplesInCoarseExp!=0) + throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : Invalid nb of tuples in fine DataArray regarding its structure !"); + int factN(nbTuplesFine/nbOfTuplesInFineExp); + int fact(FindIntRoot(factN,meshDim)); + // to improve use jump-iterator. Factorizes with SwitchOnIdsFrom BuildExplicitIdsFrom + MEDCouplingAutoRefCountObjectPtr ids(BuildExplicitIdsFrom(coarseSt,fineLocInCoarse)); + const int *idsPtr(ids->begin()); + double *outPtr(coarseDA->getPointer()); + const double *inPtr(fineDA->begin()); + coarseDA->setPartOfValuesSimple3(0.,ids->begin(),ids->end(),0,nbCompo,1); + // + switch(meshDim) + { + case 2: + { + int kk(0); + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + for(int it=0;it()); + } + } + kk+=it; + } + break; + } + default: + throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : only dimensions 2 supported !"); + } +} + void MEDCouplingIMesh::setSpaceDimension(int spaceDim) { if(spaceDim==_space_dim) @@ -347,30 +409,6 @@ void MEDCouplingIMesh::checkCoherency2(double eps) const checkCoherency1(eps); } -void MEDCouplingIMesh::getSplitCellValues(int *res) const -{ - int meshDim(getMeshDimension()); - for(int l=0;l=0 && tmp