X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileMeshLL.cxx;h=898c501450d98740fde68fd77f76f409b12c7bc2;hb=88916ccf9c681624b682d10a62c1ee376324c946;hp=337ea7d17b4ece78044cfb98428ac8aa0f83d013;hpb=ac09eb5d30ca4f7f01420b4b48ba0f0af35c50c8;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 337ea7d17..898c50145 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -331,7 +331,7 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, INTERP_KERNEL::AutoPtr groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro); int i=0; for(std::vector::const_iterator it2=(*it).second.second.begin();it2!=(*it).second.second.end();it2++,i++) - MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE-1,groName+i*MED_LNAME_SIZE,tooLongStrPol); + MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE,groName+i*MED_LNAME_SIZE,tooLongStrPol); INTERP_KERNEL::AutoPtr famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol); int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second.first,ngro,groName); @@ -354,7 +354,7 @@ void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams) { @@ -387,7 +387,7 @@ bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famN /*! * This method is dedicated to the killers that use a same family name to store different family ids. MED file API authorizes it. - * So this method renames families (if needed generaly not !) in order to have a discriminant name for families. + * So this method renames families (if needed generally not !) in order to have a discriminant name for families. */ void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams) { @@ -633,6 +633,12 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf } else _name_coords=0; + if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0) + { + _global_num_coords=DataArrayInt::New(); + _global_num_coords->alloc(nCoords,1); + MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_global_num_coords->getPointer())); + } for(int i=0;isetInfoOnComponent(i,infosOnComp[i]); } @@ -716,15 +722,15 @@ void MEDFileUMeshL2::sortTypes() _per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev); } -void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords) +void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords) { if(!coords) return ; - MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin())); if(famCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->begin())); if(numCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->begin())); if(nameCoords) { if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -733,8 +739,10 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin())); } + if(globalNumCoords) + MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),globalNumCoords->begin())); } bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const @@ -858,7 +866,7 @@ MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const { updateTime(); _m=static_cast(_st->_m_by_types.getUmesh()->deepCopy()); - _m->renumberCells(_st->_num->getConstPointer(),true); + _m->renumberCells(_st->_num->begin(),true); return _m.retn(); } else @@ -869,7 +877,7 @@ MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const { updateTime(); _m=static_cast(_st->_m_by_types.getUmesh()->deepCopy()); - _m->renumberCells(_st->_num->getConstPointer(),true); + _m->renumberCells(_st->_num->begin(),true); return _m.retn(); } } @@ -1124,7 +1132,7 @@ void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld) _num=da->invertArrayO2N2N2O(m->getNumberOfCells()); _m.updateTime(); computeRevNum(); - _m_by_types.getUmesh()->renumberCells(da->getConstPointer(),false); + _m_by_types.getUmesh()->renumberCells(da->begin(),false); } } else @@ -1196,9 +1204,9 @@ int MEDFileUMeshSplitL1::getSize() const MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const { MCAuto eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd); - MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->getConstPointer(),eltsToKeep->getConstPointer()+eltsToKeep->getNumberOfTuples(),true); + MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true); if(renum) - return renumIfNeeded(m,eltsToKeep->getConstPointer()); + return renumIfNeeded(m,eltsToKeep->begin()); return m; } @@ -1413,11 +1421,11 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDC if(renum==0) return m; if(cellIds==0) - m->renumberCells(renum->getConstPointer(),true); + m->renumberCells(renum->begin(),true); else { MCAuto locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells()); - m->renumberCells(locnum->getConstPointer(),true); + m->renumberCells(locnum->begin(),true); } return m; } @@ -1441,7 +1449,7 @@ DataArrayInt *MEDFileUMeshSplitL1::Renumber(const DataArrayInt *renum, const Dat da->incrRef(); return const_cast(da); } - return renum->selectByTupleId(da->getConstPointer(),da->getConstPointer()+da->getNumberOfTuples()); + return renum->selectByTupleId(da->begin(),da->end()); } DataArrayInt *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayInt *da) const @@ -2092,8 +2100,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));