]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Correction of bugs
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 14 Feb 2017 06:35:28 +0000 (07:35 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 14 Feb 2017 06:35:28 +0000 (07:35 +0100)
src/MEDLoader/MEDFileBlowStrEltUp.cxx
src/MEDLoader/MEDFileMeshLL.cxx

index dc70e19d11e95c36b986a723487d80c463d1d98f..a0f0e507e5ccd163f8f965b915bca65e80de0dfb 100644 (file)
@@ -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<MEDCouplingFieldDouble> fakeF(MEDCouplingFieldDouble::New(ON_GAUSS_PT));
       fakeF->setMesh(geoMesh);
+      int nbg(loc.getGaussWeights().size());
       fakeF->setGaussLocalizationOnType(gt,loc.getRefCoords(),loc.getGaussCoords(),loc.getGaussWeights());
       MCAuto<DataArrayDouble> ptsForLoc(fakeF->getLocalizationOfDiscr());
+      {
+        MCAuto<MEDCouplingUMesh> ptsForLoc1(MEDCouplingUMesh::Build0DMeshFromCoords(ptsForLoc));
+        ptsForLoc1->writeVTK("pts.vtu");
+      }
       //
       MCAuto<DataArrayDouble> rot;
       {
         MCAuto<MEDCouplingFieldDouble> dir(geoMesh->buildDirectionVectorField());
         rot=dir->getArray()->fromCartToSpher();
       }
-      int nbPts(ptsForLoc->getNumberOfTuples()),nbCompo(ptsForLoc->getNumberOfComponents());
+      int nbCells(geoMesh->getNumberOfCells()),nbCompo(ptsForLoc->getNumberOfComponents());
       MCAuto<DataArrayDouble> 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<DataArrayDouble> > arrs(nbPts);
-      for(int j=0;j<nbPts;j++)
+      std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
+      for(int j=0;j<nbCells;j++)
         {
           MCAuto<DataArrayDouble> 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;k<nbCompo;k++)
-            p->applyLin(1.,ptsForLoc->getIJ(j,k),k);
-          arrs[j]=p;
+          for(int l=0;l<nbg;l++)
+            {
+               MCAuto<DataArrayDouble> p2(p->deepCopy());
+               for(int k=0;k<nbCompo;k++)
+                p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
+              arrs[j*nbg+l]=p2;
+            }
         }
       std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
       MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
index 337ea7d17b4ece78044cfb98428ac8aa0f83d013..65d4e4c4cde45496570400039e6c177e310a1b7f 100644 (file)
@@ -2092,8 +2092,10 @@ MEDFileEltStruct4Mesh::MEDFileEltStruct4Mesh(med_idt fid, const std::string& mNa
   MCAuto<MEDFileMeshSupports> mss(MEDFileMeshSupports::New(fid));
   MCAuto<MEDFileStructureElements> 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<std::string> vns(mse->getVarAttsOf(_geo_type_name));