From: ageay Date: Thu, 21 Apr 2011 10:40:48 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EndWorkDidier~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ea86424bfe8de21989871b255b7832719818f36a;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 27d9aec67..b75539d64 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -422,46 +422,21 @@ const std::vector& MEDFileFieldPerMesh::getInfo() const } /*! - * geoTypes,dads,pfls,locs are input/output parameters. They should have the same size. - * After the call of this method 'geoTypes','dads','pfls','locs' are reorganized so that types in geoTypes are contiguous and ordered following typmai2 array. + * geoTypes,dads,pfls,locs are input parameters. They should have the same size. + * Before the call of this method 'geoTypes','dads','pfls','locs' must be reorganized so that types in geoTypes are contiguous and ordered following typmai2 array. * It returns 2 output vectors : * - 'code' of size 3*sz where sz is the number of different values into 'geoTypes' * - 'notNullPfls' contains sz2 values that are extracted from 'pfls' in which null profiles have been removed. * 'code' and 'notNullPfls' are in MEDCouplingUMesh::checkTypeConsistencyAndContig format. */ -void MEDFileFieldPerMesh::SortArraysPerType(const MEDFieldFieldGlobs *glob, std::vector& geoTypes, std::vector& dads, std::vector& pfls, std::vector& locs, std::vector& code, std::vector& notNullPfls) +void MEDFileFieldPerMesh::SortArraysPerType(const MEDFieldFieldGlobs *glob, const std::vector& geoTypes, const std::vector& dads, const std::vector& pfls, const std::vector& locs, std::vector& code, std::vector& notNullPfls) { - MEDCouplingAutoRefCountObjectPtr cvrtor=DataArrayInt::New(); - int nbOfArrs=geoTypes.size(); - cvrtor->alloc(nbOfArrs,1); - int *cvrtorPtr=cvrtor->getPointer(); - for(int i=0;i cvrtor2=cvrtor->buildPermArrPerLevel(); - const int *cvrtor2Ptr=cvrtor2->getConstPointer(); - std::vector geoTypes2(geoTypes.size()); - std::vector dads2(dads.size()); - std::vector pfls2(pfls.size()); - std::vector locs2(locs.size()); int notNullPflsSz=0; + int nbOfArrs=geoTypes.size(); for(int i=0;i geoTypes3(geoTypes2.begin(),geoTypes2.end()); + if(pfls[i]) + notNullPflsSz++; + std::set geoTypes3(geoTypes.begin(),geoTypes.end()); int nbOfDiffGeoTypes=geoTypes3.size(); code.resize(3*nbOfDiffGeoTypes); notNullPfls.resize(notNullPflsSz); @@ -470,21 +445,21 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFieldFieldGlobs *glob, std: for(int i=0;i notNullTmp; - if(pfls2[j]) - notNullTmp.push_back(pfls2[j]); + if(pfls[j]) + notNullTmp.push_back(pfls[j]); j++; for(;j tmpDads(dads.begin()+startZone,dads.begin()+j); - std::vector tmpPfls(pfls2.begin()+startZone,pfls2.begin()+j); + std::vector tmpPfls(pfls.begin()+startZone,pfls.begin()+j); std::vector tmpLocs(locs.begin()+startZone,locs.begin()+j); code[3*i]=(int)refType; code[3*i+1]=ComputeNbOfElems(glob,tmpDads,tmpLocs); @@ -890,40 +865,40 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutDAS::getFieldAtLevel(TypeOfField t MEDCouplingFieldDouble *MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFieldFieldGlobs *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception) { CheckMeshDimRel(meshDimRelToMax); + MEDCouplingAutoRefCountObjectPtr m=mesh->getGenMeshAtLevel(meshDimRelToMax,false); + const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax); + const DataArrayInt *e=mesh->getNumberFieldAtLevel(1); + return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e); +} + +MEDCouplingFieldDouble *MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFieldFieldGlobs *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception) +{ if(renumPol==0) { - MEDCouplingAutoRefCountObjectPtr m=mesh->getGenMeshAtLevel(meshDimRelToMax,false); - int dimRequested=m->getMeshDimension(); + int dimRequested=mesh->getMeshDimension(); //no need to test _field_per_mesh.empty() because geMeshName has already done it - return _field_per_mesh[0]->getFieldOnMeshAtLevel(type,dimRequested,glob,m); + return _field_per_mesh[0]->getFieldOnMeshAtLevel(type,dimRequested,glob,mesh); } if(renumPol==1) { - MEDCouplingAutoRefCountObjectPtr m=mesh->getGenMeshAtLevel(meshDimRelToMax,false); - int dimRequested=m->getMeshDimension(); + int dimRequested=mesh->getMeshDimension(); //no need to test _field_per_mesh.empty() because geMeshName has already done it - MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[0]->getFieldOnMeshAtLevel(type,dimRequested,glob,m); - const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax); - if(d) + MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[0]->getFieldOnMeshAtLevel(type,dimRequested,glob,mesh); + if(cellRenum) { - if(d->getNbOfElems()!=m->getNumberOfCells()) + if(cellRenum->getNbOfElems()!=mesh->getNumberOfCells()) { - std::ostringstream oss; oss << "MEDFileField1TSWithoutDAS::getFieldAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field "; + std::ostringstream oss; oss << "MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field "; oss << "\"" << getName() << "\" has partial renumbering (some geotype has no renumber) !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - ret->renumberCells(d->getConstPointer(),true); + ret->renumberCells(cellRenum->getConstPointer(),true); } ret->incrRef(); return ret; } else - throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::getFieldAtLevel : unsupported renum policy ! Dealing with policy 0 and 1 !"); -} - -MEDCouplingFieldDouble *MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFieldFieldGlobs *glob, const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception) -{ - return 0;//_field_per_mesh[0]->getFieldOnMeshAtLevel(type,0/* tony */,glob,mesh); + throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel : unsupported renum policy ! Dealing with policy 0 and 1 !"); } MEDFileField1TSWithoutDAS::MEDFileField1TSWithoutDAS(const char *fieldName, int csit, int iteration, int order, @@ -1057,7 +1032,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int m */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception) { - return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,renumPol,this,mesh); + return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0); } /*! @@ -1262,7 +1237,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception) { const MEDFileField1TSWithoutDAS& myF1TS=getTimeStepEntry(iteration,order); - return myF1TS.getFieldOnMeshAtLevel(type,renumPol,this,mesh); + return myF1TS.getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0); } MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 20007d42c..b8b9acc7d 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -161,7 +161,7 @@ namespace ParaMEDMEM const std::vector& dads, const std::vector& pfls, const std::vector& locs, const MEDCouplingMesh *mesh, const DataArrayInt *da) const throw(INTERP_KERNEL::Exception); static void SortArraysPerType(const MEDFieldFieldGlobs *glob, - std::vector& geoTypes, std::vector& dads, std::vector& pfls, std::vector& locs, + const std::vector& geoTypes, const std::vector& dads, const std::vector& pfls, const std::vector& locs, std::vector& code, std::vector& notNullPfls); static int ComputeNbOfElems(const MEDFieldFieldGlobs *glob, const std::vector& dads, const std::vector& locs) throw(INTERP_KERNEL::Exception); MEDFileFieldPerMesh(MEDFileField1TSWithoutDAS *fath, int meshCsit, int meshIteration, int meshOrder); @@ -223,8 +223,8 @@ namespace ParaMEDMEM static void CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception); public: MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFieldFieldGlobs *glob) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFieldFieldGlobs *glob, const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFieldFieldGlobs *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFieldFieldGlobs *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception); protected: MEDFileField1TSWithoutDAS(const char *fieldName, int csit, int iteration, int order, const std::vector& infos); protected: diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 64703d453..8955b8ca8 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -982,11 +982,7 @@ const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const DataArrayInt *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) - { - if(!((const DataArrayInt *)_num_coords)) - throw INTERP_KERNEL::Exception("MEDFileUMesh::getNumberFieldAtLevel : no coordinates renum specified !"); - return _num_coords; - } + return _num_coords; const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt); return l1->getNumberField(); }