X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileMesh.cxx;h=076c7c1776044156b20fb9787b48b4dc350f65bc;hb=e4063d87dbb8dad309dc1880af096d521934cf24;hp=ec244f8dab34abad544f5824faaba476a6218cbb;hpb=e0c843a1fe827a90af91ada8d2033ffb3a7dd1d8;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index ec244f8da..076c7c177 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -35,6 +35,7 @@ #include #include +// From MEDLOader.cxx TU extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO]; extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO]; extern med_geometry_type typmai3[INTERP_KERNEL::NORM_MAXTYPE]; @@ -695,10 +696,10 @@ void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& if(idsToKill->empty()) return ; std::vector newFamsOnGrp; - for(std::vector::const_iterator it=famsOnGrp.begin();it!=famsOnGrp.end();it++) + for(std::vector::const_iterator itt=famsOnGrp.begin();itt!=famsOnGrp.end();itt++) { - if(!idsToKill->presenceOfValue(getFamilyId(*it))) - newFamsOnGrp.push_back(*it); + if(!idsToKill->presenceOfValue(getFamilyId(*itt))) + newFamsOnGrp.push_back(*itt); } (*it).second=newFamsOnGrp; } @@ -859,7 +860,7 @@ void MEDFileMesh::rearrangeFamilies() { fams=getFamilyFieldAtLevel(*it); } - catch(INTERP_KERNEL::Exception& e) { } + catch(INTERP_KERNEL::Exception& ) { } if(!fams) continue; std::vector v(fams->getNumberOfTuples(),false); @@ -942,7 +943,7 @@ void MEDFileMesh::zipFamilies() { fams=getFamilyFieldAtLevel(*it); } - catch(INTERP_KERNEL::Exception& e) { } + catch(INTERP_KERNEL::Exception& ) { } if(!fams) continue; MCAuto idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size())); @@ -2091,14 +2092,14 @@ DataArrayIdType *MEDFileMesh::getNodeGroupsArr(const std::vector& g } /*! - * Returns ids of nodes contained in a given group. - * \param [in] grp - the name of the group of interest. + * Returns ids of nodes contained in a given family. + * \param [in] fam - the name of the family of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or - * numbers, if available and required, of nodes of the group. The caller + * numbers, if available and required, of nodes of the family. The caller * is to delete this array using decrRef() as it is no more needed. - * \throw If the name of a nonexistent group is specified. + * \throw If the name of a nonexistent family is specified. * \throw If the family field is missing for nodes. */ DataArrayIdType *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const @@ -2454,7 +2455,7 @@ MEDFileUMesh *MEDFileUMesh::New() * \param [in] fileName - the name of the file. * \param [in] mName - the name of the mesh to be read. * \param [in] types - the list of the geo types of which some part will be taken. A geometric type in \a types must appear only once at most. - * \param [in] slicPerType - an array of size 3 times larger than \a types that specifies for each type in \a types (in the same order) resp the start, the stop and the step. + * \param [in] slicPerTyp - an array of size 3 times larger than \a types that specifies for each type in \a types (in the same order) resp the start, the stop and the step. * \param [in] dt - the iteration, that is to say the first element of the pair that locates the asked time step. * \param [in] it - the order, that is to say the second element of the pair that locates the asked time step. * \param [in] mrs - the request for what to be loaded. @@ -2478,6 +2479,33 @@ MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, co return ret.retn(); } +/*! + * This method is an helper to load only consecutive nodes chunk of data of MED file pointed by \a fileName. + * Consecutive chunk is specified classicaly by start (included) stop (excluded) format with \a startNodeId and \a stopNodeId respectively. + * This method returns 5 elements. + * + * \param [in] fileName - Name of file nodes to be read of. + * \param [in] mName - Name of the mesh inside file pointed be \a fileName nodes to be read of. + * \param [in] dt - Time iteration inside file pointed be \a fileName nodes to be read of. + * \param [in] it - Time order inside file pointed be \a fileName nodes to be read of. + * \param [in] infosOnComp - Components info of nodes to be read of. The size of string vector should be equal to space dimension of mesh to be read. + * \param [in] startNodeId - Start Node Id (included) of chunk of data to be read + * \param [in] stopNodeId - Start Node Id (included) of chunk of data to be read + * \param [out] coords - output coordinates of requested chunk (DataArrayDouble) + * \param [out] partCoords - output PartDefinition object of chunk + * \param [out] famCoords - output family id field of requested chunk (DataArrayIdType) + * \param [out] numCoords - output num id field of requested chunk (DataArrayIdType) + * \param [out] nameCoords - output names on nodes of requested chunk (DataArrayAsciiChar) + * + * \sa MEDLoaderUMesh::LoadPartOf + */ +void MEDFileUMesh::LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId, +MCAuto& coords, MCAuto& partCoords, MCAuto& famCoords, MCAuto& numCoords, MCAuto& nameCoords) +{ + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); + MEDFileUMeshL2::LoadPartCoords(fid,infosOnComp,mName,dt,it,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoords); +} + std::size_t MEDFileUMesh::getHeapMemorySizeWithoutChildren() const { std::size_t ret(MEDFileMesh::getHeapMemorySizeWithoutChildren()); @@ -3681,7 +3709,7 @@ DataArrayIdType *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std: * valid**. This is a feature, because MEDLoader does not create cells that do not exist! * To build a valid MEDCouplingUMesh from the returned one in this case, * call MEDCouplingUMesh::Build0DMeshFromCoords(). - * \param [in] meshDimRelToMax - the relative dimension of interest. + * \param [in] meshDimRelToMaxExt - the relative dimension of interest. * \param [in] renum - if \c true, the returned mesh is permuted according to the * optional numbers of mesh entities. * \return MEDCouplingUMesh * - a pointer to MEDCouplingUMesh that the caller is to @@ -4338,6 +4366,23 @@ DataArrayIdType *MEDFileUMesh::zipCoords() return ret.retn(); } +/*! + * This method is the extension of MEDCouplingUMesh::computeFetchedNodeIds. Except that here all levels are considered here. + * + * \return newly allocated array containing all nodes in \a this that are part of nodal connectivity of at least one cell in \a this whatever its level. + */ +DataArrayIdType *MEDFileUMesh::computeFetchedNodeIds() const +{ + std::vector neLevs(this->getNonEmptyLevels()); + std::vector nodesHighlighted(this->getNumberOfNodes(),false); + for(auto lev : neLevs) + { + const MEDFileUMeshSplitL1 *zeLev(this->getMeshAtLevSafe(lev)); + zeLev->highlightUsedNodes(nodesHighlighted); + } + return DataArrayIdType::BuildListOfSwitchedOn(nodesHighlighted); +} + /*! * This method is a const method. It computes the minimal set of node ids covered by the cell extraction of \a this. * The extraction of \a this is specified by the extractDef \a input map. @@ -6016,6 +6061,7 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of faces of mesh !"); _names_faces=nameArr; + break; } default: throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setNameFieldAtLevel : Only available for levels 0 or 1 or -1 !");