From: Anthony Geay Date: Wed, 28 Feb 2018 16:24:38 +0000 (+0100) Subject: Deal with eccentricity for structure element X-Git-Tag: V8_5_0a2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=573fb808e87aa94cacbfaae6ca639527509268ab;p=tools%2Fmedcoupling.git Deal with eccentricity for structure element --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 6e74370e4..edb12b566 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -234,6 +234,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT const T *getConstPointer() const { return _mem.getConstPointer(); } MEDCOUPLING_EXPORT const T *begin() const { return getConstPointer(); } MEDCOUPLING_EXPORT const T *end() const { return getConstPointer()+getNbOfElems(); } + MEDCOUPLING_EXPORT T *rwBegin() { return getPointer(); } + MEDCOUPLING_EXPORT T *rwEnd() { return getPointer()+getNbOfElems(); } void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1); void useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo); void useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo); diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index 793c93525..c2403ff3e 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -460,6 +460,7 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *thikness, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs) { +#if __cplusplus >= 201103L MCAuto ptsForLoc; MCAuto geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc)); int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); @@ -482,11 +483,14 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize std::vector< MCAuto > arrs(nbCells*nbg); for(int j=0;jgetIJ(j,0)); - MCAuto fact(DataArrayDouble::New()); fact->alloc(1,nbCompo); + double thck(zeThikness->getIJ(j,0)),eccentricity(zeThikness->getIJ(j,1)); + MCAuto fact(DataArrayDouble::New()),fact2(DataArrayDouble::New()); fact->alloc(1,nbCompo); fact2->alloc(1,nbCompo); std::copy(orthoArr->begin()+j*nbCompo,orthoArr->begin()+(j+1)*nbCompo,fact->getPointer()); - std::transform(fact->begin(),fact->end(),fact->getPointer(),std::bind2nd(std::multiplies(),thck/2.)); + std::copy(orthoArr->begin()+j*nbCompo,orthoArr->begin()+(j+1)*nbCompo,fact2->getPointer()); + std::for_each(fact2->rwBegin(),fact2->rwEnd(),[eccentricity](double& val){ val*=eccentricity; }); + std::transform(fact->begin(),fact->end(),fact->getPointer(),[thck](const double& val){ return val*thck/2.; }); MCAuto p(DataArrayDouble::Multiply(secPts,fact)); + p=DataArrayDouble::Add(p,fact2); for(int l=0;l p2(p->deepCopy()); @@ -498,6 +502,9 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize std::vector arrs2(VecAutoToVecOfCstPt(arrs)); MCAuto resu(DataArrayDouble::Aggregate(arrs2)); return resu; +#else + throw INTERP_KERNEL::Exception("Broken news : 10% off for C++11 compiler :)"); +#endif } MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, const DataArrayDouble *scale, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs) @@ -510,7 +517,6 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, if(!pfl.empty()) { const DataArrayInt *pflArr(globs->getProfile(pfl)); - geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true); zeAngle=angle->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); zeScale=scale->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); }