X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileBlowStrEltUp.cxx;h=8fa0d2d52bebee9a0144378989a9f757afd8df48;hb=b7e277ad50223814bc479c5bd64cf12abe8fc959;hp=ba577e4b66d99f85a293c034fff634eed2d71fb1;hpb=035aeb375ec85cec427dd23e34de9dca2843dac5;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index ba577e4b6..8fa0d2d52 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -336,9 +336,12 @@ public: private: void checkUniqueLoc(const std::string& loc) const; static MCAuto BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs); + static MCAuto 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); + static MCAuto BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto& ptsForLoc); static MCAuto BuildMeshFromStructure(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs); public: static const char ANGLE_DE_VRILLE[]; + static const char EPAISSEUR[]; private: std::vector _locs; std::vector _pfl; @@ -347,6 +350,8 @@ private: const char LocInfo::ANGLE_DE_VRILLE[]="ANGLE DE VRILLE"; +const char LocInfo::EPAISSEUR[]="EPAISSEUR"; + LocInfo::LocInfo(const std::vector& fw) { std::size_t sz(fw.size()); @@ -371,7 +376,7 @@ void LocInfo::checkUniqueLoc(const std::string& loc) const } } -MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs) +MCAuto LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt,const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto& ptsForLoc) { MCAuto conn(zeStr->getConn()); conn=conn->deepCopy(); conn->rearrange(1); @@ -383,6 +388,19 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali geoMesh=umesh->buildUnstructured(); } // + MCAuto fakeF(MEDCouplingFieldDouble::New(ON_GAUSS_PT)); + fakeF->setMesh(geoMesh); + fakeF->setGaussLocalizationOnType(gt,loc.getRefCoords(),loc.getGaussCoords(),loc.getGaussWeights()); + ptsForLoc=fakeF->getLocalizationOfDiscr(); + // + return geoMesh; +} + +MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs) +{ + MCAuto ptsForLoc; + MCAuto geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc)); + // MCConstAuto angleVrille; if(!pfl.empty()) { @@ -393,22 +411,17 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali else angleVrille.takeRef(angleDeVrille); // - MCAuto fakeF(MEDCouplingFieldDouble::New(ON_GAUSS_PT)); - fakeF->setMesh(geoMesh); - int nbg(loc.getGaussWeights().size()); - fakeF->setGaussLocalizationOnType(gt,loc.getRefCoords(),loc.getGaussCoords(),loc.getGaussWeights()); - MCAuto ptsForLoc(fakeF->getLocalizationOfDiscr()); - // - MCAuto dir(geoMesh->buildDirectionVectorField()); - MCAuto rot(dir->getArray()->fromCartToSpher()); - int nbCells(geoMesh->getNumberOfCells()),nbCompo(ptsForLoc->getNumberOfComponents()); + int nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); - int nbSecPts(secPts->getNumberOfTuples()); + int nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); { const int TAB[3]={2,0,1}; std::vector v(TAB,TAB+3); secPts=secPts->keepSelectedComponents(v); } + MCAuto dir(geoMesh->buildDirectionVectorField()); + MCAuto rot(dir->getArray()->fromCartToSpher()); + // const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; double AX1[3]; AX1[2]=0.; std::vector< MCAuto > arrs(nbCells*nbg); @@ -434,6 +447,49 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali return resu; } +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) +{ + MCAuto ptsForLoc; + MCAuto geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc)); + int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); + MCConstAuto zeThikness; + if(!pfl.empty()) + { + const DataArrayInt *pflArr(globs->getProfile(pfl)); + geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true); + zeThikness=thikness->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); + } + else + zeThikness.takeRef(thikness); + MCAuto orthoArr; + { + MCAuto ortho(geoMesh->buildOrthogonalField()); + orthoArr.takeRef(ortho->getArray()); + } + int nbCompo(orthoArr->getNumberOfComponents()); + MCAuto secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo)); + secPts->rearrange(nbCompo); + std::vector< MCAuto > arrs(nbCells*nbg); + for(int j=0;jgetIJ(j,0)); + MCAuto fact(DataArrayDouble::New()); fact->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.)); + MCAuto p(DataArrayDouble::Multiply(secPts,fact)); + for(int l=0;l p2(p->deepCopy()); + for(int k=0;kapplyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k); + arrs[j*nbg+l]=p2; + } + } + std::vector arrs2(VecAutoToVecOfCstPt(arrs)); + MCAuto resu(DataArrayDouble::Aggregate(arrs2)); + return resu; +} + MCAuto LocInfo::BuildMeshFromStructure(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs) { static const char MSG1[]="BuildMeshFromStructure : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !"; @@ -446,9 +502,11 @@ MCAuto LocInfo::BuildMeshFromStructure(INTERP_KERNEL::Normalize MCAuto zeArr2(DynamicCast(zeArr)); if(zeArr2.isNull()) throw INTERP_KERNEL::Exception(MSG1); - if(zeArr2->getName()!=ANGLE_DE_VRILLE) - throw INTERP_KERNEL::Exception(MSG1); - return BuildMeshFromAngleVrille(gt,zeArr2,pfl,loc,zeStr,mesh,section,globs); + if(zeArr2->getName()==ANGLE_DE_VRILLE) + return BuildMeshFromAngleVrille(gt,zeArr2,pfl,loc,zeStr,mesh,section,globs); + if(zeArr2->getName()==EPAISSEUR) + return BuildMeshFromEpaisseur(gt,zeArr2,pfl,loc,zeStr,mesh,section,globs); + throw INTERP_KERNEL::Exception(MSG1); } MCAuto LocInfo::generateNonClassicalData(int zePos, const MEDFileUMesh *mesh, const MEDFileFieldGlobsReal *globs) const