From: ageay Date: Fri, 14 Dec 2012 09:13:46 +0000 (+0000) Subject: Correction of bug on node fields on profile. X-Git-Tag: V6_main_FINAL~459 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7c822a321a0476b7b4de75cd4138aead848d73fc;p=tools%2Fmedcoupling.git Correction of bug on node fields on profile. --- diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 70d126a7d..783ae845a 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -1925,7 +1925,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t return finishField(type,glob,dads,locs,mesh,isPfl); } else - return finishField3(glob,dads,locs,mesh,notNullPflsPerGeoType3[0],isPfl); + return finishFieldNode2(glob,dads,locs,mesh,notNullPflsPerGeoType3[0],isPfl); } } @@ -2117,15 +2117,14 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, cons /*! * This method is the complement of MEDFileFieldPerMesh::finishField2 method except that this method works for node profiles. */ -MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField3(const MEDFileFieldGlobsReal *glob, - const std::vector >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception) +MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob, + const std::vector >& dads, const std::vector& locs, + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception) { if(da->isIdentity()) { int nbOfTuples=da->getNumberOfTuples(); - const std::vector geoTypes2(1,INTERP_KERNEL::NORM_ERROR); - if(nbOfTuples==ComputeNbOfElems(glob,ON_NODES,geoTypes2,dads,locs))//No problem for NORM_ERROR because it is in context of node + if(nbOfTuples==mesh->getNumberOfNodes())//No problem for NORM_ERROR because it is in context of node return finishField(ON_NODES,glob,dads,locs,mesh,isPfl); } // Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1. @@ -2167,7 +2166,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField3(const MEDFileFieldGlob } else { - std::ostringstream oss; oss << "MEDFileFieldPerMesh::finishField3 : The field on nodes lies on a node profile so that it is impossible to find a submesh having exactly the same nodes of that profile !!!"; + std::ostringstream oss; oss << "MEDFileFieldPerMesh::finishFieldNode2 : The field on nodes lies on a node profile so that it is impossible to find a submesh having exactly the same nodes of that profile !!!"; oss << "So it is impossible to return a well definied MEDCouplingFieldDouble instance on specified mesh on a specified meshDim !" << std::endl; oss << "To retrieve correctly such a field you have 3 possibilities :" << std::endl; oss << " - use an another meshDim compatible with the field on nodes (MED file does not have such information)" << std::endl; @@ -3515,7 +3514,7 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtLevel(TypeOfField t if(mName==0) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else - mm=MEDFileMesh::New(glob->getFileName(),mName,-1,-1); + mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder()); return MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm); } @@ -3535,7 +3534,7 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtTopLevel(TypeOfFiel if(mName==0) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else - mm=MEDFileMesh::New(glob->getFileName(),mName,-1,-1); + mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder()); int absDim=getDimension(); int meshDimRelToMax=absDim-mm->getMeshDimension(); return MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm); diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 6ddb6f209..3b72f44ff 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -262,9 +262,9 @@ namespace ParaMEDMEM const std::vector< std::pair >& dads, const std::vector& locs, const std::vector& geoTypes, const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *finishField3(const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob, + const std::vector< std::pair >& dads, const std::vector& locs, + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception); DataArrayDouble *finishField4(const std::vector< std::pair >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception); void assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) throw(INTERP_KERNEL::Exception); static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type,