From 4ce7ffe29c7db3161c3e4447d5e5ab4b80f826a2 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 14 Feb 2017 07:35:28 +0100 Subject: [PATCH] Correction of bugs --- src/MEDLoader/MEDFileBlowStrEltUp.cxx | 23 +++++++++++++++++------ src/MEDLoader/MEDFileMeshLL.cxx | 4 +++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index dc70e19d1..a0f0e507e 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -423,17 +423,24 @@ void LocInfo::generateNonClassicalData(const MEDFileUMesh *mesh, const MEDFileFi geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true); } // + geoMesh->writeVTK("geo.vtu"); + // 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 ptsForLoc1(MEDCouplingUMesh::Build0DMeshFromCoords(ptsForLoc)); + ptsForLoc1->writeVTK("pts.vtu"); + } // MCAuto rot; { MCAuto dir(geoMesh->buildDirectionVectorField()); rot=dir->getArray()->fromCartToSpher(); } - int nbPts(ptsForLoc->getNumberOfTuples()),nbCompo(ptsForLoc->getNumberOfComponents()); + int nbCells(geoMesh->getNumberOfCells()),nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); int nbSecPts(secPts->getNumberOfTuples()); { @@ -443,8 +450,8 @@ void LocInfo::generateNonClassicalData(const MEDFileUMesh *mesh, const MEDFileFi } const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; double AX1[3]; AX1[2]=0.; - std::vector< MCAuto > arrs(nbPts); - for(int j=0;j > arrs(nbCells*nbg); + for(int j=0;j p(secPts->deepCopy()); double ang0(rot->getIJ(j,2)); @@ -452,9 +459,13 @@ void LocInfo::generateNonClassicalData(const MEDFileUMesh *mesh, const MEDFileFi AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ double ang1(M_PI/2.-rot->getIJ(j,1)); DataArrayDouble::Rotate3DAlg(CENTER,AX1,ang1,nbSecPts,p->begin(),p->getPointer()); - for(int k=0;kapplyLin(1.,ptsForLoc->getIJ(j,k),k); - arrs[j]=p; + 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)); diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 337ea7d17..65d4e4c4c 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -2092,8 +2092,10 @@ MEDFileEltStruct4Mesh::MEDFileEltStruct4Mesh(med_idt fid, const std::string& mNa MCAuto mss(MEDFileMeshSupports::New(fid)); MCAuto mse(MEDFileStructureElements::New(fid,mss)); int nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name)); - _conn=DataArrayInt::New(); _conn->alloc(nCells,nbEntities); + _conn=DataArrayInt::New(); _conn->alloc(nCells*nbEntities); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,_conn->getPointer())); + _conn->applyLin(1,-1); + _conn->rearrange(nbEntities); _common=MEDFileUMeshPerTypeCommon::New(); _common->loadCommonPart(fid,mName.c_str(),dt,it,nCells,geoType,MED_STRUCT_ELEMENT,mrs); std::vector vns(mse->getVarAttsOf(_geo_type_name)); -- 2.39.2