From: vsr Date: Wed, 24 Apr 2013 14:16:46 +0000 (+0000) Subject: Merge last changes for 0021856: [CEA 663] Documenting API of MEDCoupling and MEDLoade... X-Git-Tag: V7_3_1b1~429 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8227661836f1b2714381d2403ddc1b9c7483079d;p=tools%2Fmedcoupling.git Merge last changes for 0021856: [CEA 663] Documenting API of MEDCoupling and MEDLoader and fixes from V6_main --- diff --git a/doc/doxygen/fakesources/MEDCouplingField.C b/doc/doxygen/fakesources/MEDCouplingField.C new file mode 100644 index 000000000..7793773f4 --- /dev/null +++ b/doc/doxygen/fakesources/MEDCouplingField.C @@ -0,0 +1,56 @@ +// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// This file contains some code used only for +// generation of documentation for inline methods. + + +namespace ParaMEDMEM +{ + /*! + * Checks if \a this field is correctly defined, else an exception is thrown. + * \throw If the mesh is not set. + * \throw If the data array is not set. + * \throw If the spatial discretization of \a this field is NULL. + * \throw If \a this->getTimeTolerance() < 0. + * \throw If the temporal discretization data is incorrect. + * \throw If mesh data does not correspond to field data. + */ + void MEDCouplingField::checkCoherency() const throw(INTERP_KERNEL::Exception) {} + /*! + * Returns the underlying mesh of \a this field. + * \return const ParaMEDMEM::MEDCouplingMesh * - a const pointer to the underlying mesh. + */ + const ParaMEDMEM::MEDCouplingMesh *MEDCouplingField::getMesh() const {} + /*! + * Returns the description of \a this field. + * \return const char * - a string containing the field description. + */ + const char *MEDCouplingField::getDescription() const {} + /*! + * Sets the description of \a this field. + * \param [in] desc - a string containing the field description. + */ + void MEDCouplingField::setDescription(const char *desc) {} + /*! + * Returns the name of \a this field. + * \return const char * - a string containing the field name. + */ + const char *MEDCouplingField::getName() const {} +} diff --git a/doc/doxygen/fakesources/MEDCouplingPointSet.C b/doc/doxygen/fakesources/MEDCouplingPointSet.C index d901b17e4..5e449c9fb 100644 --- a/doc/doxygen/fakesources/MEDCouplingPointSet.C +++ b/doc/doxygen/fakesources/MEDCouplingPointSet.C @@ -37,10 +37,16 @@ namespace ParaMEDMEM */ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception) {} - //! This method returns directly the array in \a this \b without incrementing ref counter. The pointer is dealed by the mesh. The caller should not deal (decrRef) with this pointer + /*! + * Returns a const pointer to the node coordinates array of \a this mesh \b without + * incrementing its reference counter, thus there is no need to decrRef() it by the caller. + */ const DataArrayDouble *MEDCouplingPointSet::getCoords() const { return _coords; } - //! This method returns directly the array in \a this \b without incrementing ref counter. The pointer is dealed by the mesh. The caller should not deal (decrRef) with this pointer + /*! + * Returns a pointer to the node coordinates array of \a this mesh \b without + * incrementing its reference counter, thus there is no need to decrRef() it by the caller. + */ DataArrayDouble *MEDCouplingPointSet::getCoords() { return _coords; } diff --git a/doc/doxygen/fakesources/MEDFileField.C b/doc/doxygen/fakesources/MEDFileField.C new file mode 100644 index 000000000..4b8362a6e --- /dev/null +++ b/doc/doxygen/fakesources/MEDFileField.C @@ -0,0 +1,106 @@ +// MEDFileFieldGlobsReal::Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// This file contains some code used only for +// generation of documentation for inline methods. + + +namespace ParaMEDMEM // inline methods of MEDFileField1TSWithoutSDA +{ + /*! + * Returns the number of iteration where \a this field has been calculated. + * \return int - the iteration number. + */ + int MEDFileField1TSWithoutSDA::getIteration() const {} + /*! + * Returns the order number of iteration where \a this field has been calculated. + * \return int - the order number. + */ + int MEDFileField1TSWithoutSDA::getOrder() const {} + /*! + * Returns time, number of iteration and order number of iteration when + * \a this field has been calculated. + * \param [out] iteration - the iteration number. + * \param [out] order - the order number. + * \return double - the time value. + */ + double MEDFileField1TSWithoutSDA::getTime(int& iteration, int& order) const {} + /*! + * Sets time, number of iteration and order number of iteration when + * \a this field has been calculated. + * \param [in] val - the time value. + * \param [in] iteration - the iteration number. + * \param [in] order - the order number. + */ + void MEDFileField1TSWithoutSDA::setTime(int iteration, int order, double val) {} + /*! + * Returns units in which the time is measured. + * \return const char * - the time unit name. + */ + const std::string& MEDFileField1TSWithoutSDA::getDtUnit() const {} +} + +namespace ParaMEDMEM // inline methods of MEDFileFieldGlobsReal +{ + /*! + * Returns non empty names of all used profiles. To get all profiles call getPfls(). + * \warning If a profile is used several times, its name is returned **only once**. + * To have a profile name in the result each time it is used, call + * getPflsReallyUsedMulti(). + * \return std::vector - a sequence of names of used profiles. + */ + std::vector MEDFileFieldGlobsReal::getPflsReallyUsed() const {} + /*! + * Returns non empty names of all used localizations. To get all localizations call getLocs(). + * \warning If a localization is used several times, its name is returned **only once**. + * To have a localization name in the result each time it is used, call + * getLocsReallyUsedMulti(). + * \return std::vector - a sequence of names of used localizations. + */ + std::vector MEDFileFieldGlobsReal::getLocsReallyUsed() const {} + /*! + * Returns non empty names of all used profiles as many times as they are used. + * \return std::vector - a sequence of names of used profiles. + */ + std::vector MEDFileFieldGlobsReal::getPflsReallyUsedMulti() const {} + /*! + * Returns non empty names of all used localizations as many times as they are used. + * \return std::vector - a sequence of names of used localizations. + */ + std::vector MEDFileFieldGlobsReal::getLocsReallyUsedMulti() const {} + /*! + * Replaces references to some profiles (a reference is a profile name) by references + * to other profiles. + * \param [in] mapOfModif - a sequence describing required replacements. Each element of + * this sequence is a pair whose + * - the first item is a vector of profile names to replace by the second item, + * - the second item is a profile name to replace every profile of the first item. + */ + void MEDFileFieldGlobsReal::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) {} + /*! + * Replaces references to some localizations (a reference is a localization name) by references + * to other localizations. + * \param [in] mapOfModif - a sequence describing required replacements. Each element of + * this sequence is a pair whose + * - the first item is a vector of localization names to replace by the second item, + * - the second item is a localization name to replace every localization of the first + * item. + */ + void MEDFileFieldGlobsReal::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) {} +} diff --git a/doc/doxygen/fakesources/MEDFileMesh.C b/doc/doxygen/fakesources/MEDFileMesh.C new file mode 100644 index 000000000..664e045f2 --- /dev/null +++ b/doc/doxygen/fakesources/MEDFileMesh.C @@ -0,0 +1,353 @@ +// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// This file contains some code used only for +// * generation of documentation for inline methods, +// * groupping methods into "Basic API", "Advanced" and "Others..." sections + + +namespace ParaMEDMEM +{ + /*! + * Sets the name of \a this mesh. + * \param [in] name - the new mesh name. + */ + void MEDFileMesh::setName(const char *name) {} + /*! + * Returns the name of \a this mesh. + * \return const char* name - the mesh name. + */ + const char *MEDFileMesh::getName() const {} + /*! + * Sets the universal name of \a this mesh. The universal name uniquely identifies the mesh. + * \param [in] name - the new universal mesh name. + */ + void MEDFileMesh::setUnivName(const char *name) {} + /*! + * Returns the universal name of \a this mesh. The universal name uniquely identifies the mesh. + * \return const char * - the universal mesh name. + */ + const char *MEDFileMesh::getUnivName() const {} + /*! + * Sets the description of \a this mesh. + * \param [in] name - the new mesh description. + */ + void MEDFileMesh::setDescription(const char *name) {} + /*! + * Returns the description of \a this mesh. + * \return const char* - the mesh description. + */ + const char *MEDFileMesh::getDescription() const {} + /*! + * Sets the order number of iteration of \a this mesh state. + * \param [in] order - the order number. + */ + void MEDFileMesh::setOrder(int order) {} + /*! + * Returns the order number of iteration of \a this mesh state. + * \return int - the order number. + */ + int MEDFileMesh::getOrder() const {} + /*! + * Sets the number of iteration of \a this mesh state. + * \param [in] it - the iteration number. + */ + void MEDFileMesh::setIteration(int it) {} + /*! + * Returns the number of iteration of \a this mesh state. + * \return int - the iteration number. + */ + int MEDFileMesh::getIteration() const {} + /*! + * Sets the time of \a this mesh state. + * \param [in] val - the time value. + */ + void MEDFileMesh::setTimeValue(double time) {} + /*! + * Sets time, the number of iteration and the order number of iteration + * of \a this mesh state. + * \param [in] val - the time value. + * \param [in] iteration - the iteration number. + * \param [in] order - the order number. + */ + void MEDFileMesh::setTime(int dt, int it, double time) {} + /*! + * Returns time, the number of iteration and the order number of iteration + * of \a this mesh state. + * \param [out] iteration - the iteration number. + * \param [out] order - the order number. + * \return double - the time value. + */ + double MEDFileMesh::getTime(int& dt, int& it) {} + /*! + * Returns the time of \a this mesh state. + * \return double - the time value. + */ + double MEDFileMesh::getTimeValue() const {} + /*! + * Sets units in which the time is measured. + * \param [in] unit - the time unit name. + */ + void MEDFileMesh::setTimeUnit(const char *unit) {} + /*! + * Returns units in which the time is measured. + * \return const char * - the time unit name. + */ + const char *MEDFileMesh::getTimeUnit() const {} + /*! + * Returns names and ids of all families in \a this mesh. + * \return const std::map& - a map of a family name to a family id. + */ + const std::map& MEDFileMesh::getFamilyInfo() const {} + /*! + * Returns names of all groups and families constituting them in \a this mesh. + * \return const std::map >& - + * a map of a group name to a vector of names of families constituting the group. + */ + const std::map >& MEDFileMesh::getGroupInfo() const {} + /*! + * Returns relative dimensions of mesh entities (excluding nodes) present in \a this mesh. + * \return std::vector - a sequence of the relative dimensions. + */ + std::vector MEDFileMesh::getNonEmptyLevels() const {} + /*! + * Returns relative dimensions of mesh entities (including nodes) present in \a this mesh. + * \return std::vector - a sequence of the relative dimensions. + */ + std::vector MEDFileMesh::getNonEmptyLevelsExt() const {} + /*! + * Returns number of mesh entities of a given relative dimension in \a this mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of interest. + * \return int - the number of entities. + * \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh. + */ + int MEDFileMesh::getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) {} + /*! + * Returns a MEDCouplingMesh of a given relative dimension. + * \param [in] meshDimRelToMax - 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 MEDCouplingMesh * - a pointer to MEDCouplingMesh that the caller is to + * delete using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a renum == \c true but permutation is impossible. + */ + MEDCouplingMesh *MEDFileMesh::getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception) {} + /*! + * Returns the dimension on cells in \a this mesh. + * \return int - the mesh dimension. + * \throw If there are no cells in this mesh. + */ + int MEDFileMesh::getMeshDimension() const throw(INTERP_KERNEL::Exception) {} + /*! + * Returns a full textual description of \a this mesh. + * \return std::string - the string holding the mesh description. + */ + std::string MEDFileMesh::advancedRepr() const {} + /*! + * Sets the family field of a given relative dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of entities for which + * the family field is set. + * \param [in] famArr - the array of the family field. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a famArr has an invalid size. + */ + void MEDFileMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception) {} + /*! + * Sets the optional numbers of mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \param [in] renumArr - the array of the numbers. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a renumArr has an invalid size. + */ + void MEDFileMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception) {} + /*! + * Returns the family field for mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the family field. It is an array of ids of families + * each mesh entity belongs to. It can be NULL. + */ + const DataArrayInt *MEDFileMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) {} + /*! + * Returns the optional numbers of mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the array of the entity numbers. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ + const DataArrayInt *MEDFileMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) {} + /*! + * Returns the optional numbers of mesh entities of a given dimension transformed using + * DataArrayInt::invertArrayN2O2O2N(). + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the array of the entity numbers transformed using + * DataArrayInt::invertArrayN2O2O2N(). + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ + const DataArrayInt *MEDFileMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) {} + /*! + * Returns ids of mesh entities contained in given families of a given dimension. + * \param [in] meshDimRelToMaxExt - a relative dimension of the mesh entities whose ids + * are required. + * \param [in] fams - the names of the families of interest. + * \param [in] renum - if \c true, the optional numbers of entities, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of mesh entities of the families. The caller + * is to delete this array using decrRef() as it is no more needed. + * \throw If the family field is missing for \a meshDimRelToMaxExt. + */ + DataArrayInt *MEDFileMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception) {} +} + + +namespace ParaMEDMEM +{ + /*! \name Basic API */ + ///@{ + MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map& families, int id, bool& created); +MEDFileMesh::New(const char *fileName); +MEDFileMesh::New(const char *fileName, const char *mName, int dt=-1, int it=-1); +MEDFileMesh::addFamily(const char *familyName, int id); +MEDFileMesh::addFamilyOnGrp(const char *grpName, const char *famName); +MEDFileMesh::advancedRepr() const = 0; +MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) const; +MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) const; +MEDFileMesh::assignFamilyNameWithGroupName(); +MEDFileMesh::changeFamilyId(int oldId, int newId); +MEDFileMesh::changeFamilyName(const char *oldName, const char *newName); +MEDFileMesh::changeGroupName(const char *oldName, const char *newName); +MEDFileMesh::copyFamGrpMapsFrom(const MEDFileMesh& other); +MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const char *groupName); +MEDFileMesh::existsFamily(const char *familyName) const; +MEDFileMesh::existsFamily(int famId) const; +MEDFileMesh::existsGroup(const char *groupName) const; +MEDFileMesh::findOrCreateAndGiveFamilyWithId(int id, bool& created); +MEDFileMesh::getDescription() const; +MEDFileMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; +MEDFileMesh::getFamiliesIds(const std::vector& famNames) const; +MEDFileMesh::getFamiliesIdsOnGroup(const char *name) const; +MEDFileMesh::getFamiliesNames() const; +MEDFileMesh::getFamiliesOnGroup(const char *name) const; +MEDFileMesh::getFamiliesOnGroups(const std::vector& grps) const; +MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const; +MEDFileMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; +MEDFileMesh::getFamilyId(const char *name) const; +MEDFileMesh::getFamilyInfo() const; +MEDFileMesh::getFamilyNameGivenId(int id) const; +MEDFileMesh::getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const; +MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const; +MEDFileMesh::getGroupInfo() const; +MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; +MEDFileMesh::getGroupsNames() const; +MEDFileMesh::getGroupsOnFamily(const char *name) const; +MEDFileMesh::getIteration() const; +MEDFileMesh::getMaxFamilyId() const; +MEDFileMesh::getMeshDimension() const; +MEDFileMesh::getName() const; +MEDFileMesh::getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; +MEDFileMesh::getNodeFamilyArr(const char *fam, bool renum=false) const; +MEDFileMesh::getNodeGroupArr(const char *grp, bool renum=false) const; +MEDFileMesh::getNodeGroupsArr(const std::vector& grps, bool renum=false) const; +MEDFileMesh::getNonEmptyLevels() const = 0; +MEDFileMesh::getNonEmptyLevelsExt() const = 0; +MEDFileMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const; +MEDFileMesh::getOrder() const; +MEDFileMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; +MEDFileMesh::getSizeAtLevel(int meshDimRelToMaxExt) const; +MEDFileMesh::getTime(int& dt, int& it); +MEDFileMesh::getTimeUnit() const; +MEDFileMesh::getTimeValue() const; +MEDFileMesh::getUnivName() const; +MEDFileMesh::isEqual(const MEDFileMesh *other, double eps, std::string& what) const; +MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); +MEDFileMesh::removeFamily(const char *name); +MEDFileMesh::removeGroup(const char *name); +MEDFileMesh::setDescription(const char *name); +MEDFileMesh::setFamiliesIdsOnGroup(const char *name, const std::vector& famIds); +MEDFileMesh::setFamiliesOnGroup(const char *name, const std::vector& fams); +MEDFileMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr); +MEDFileMesh::setFamilyId(const char *familyName, int id); +MEDFileMesh::setFamilyInfo(const std::map& info); +MEDFileMesh::setGroupInfo(const std::map >&info); +MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false); +MEDFileMesh::setGroupsOnFamily(const char *famName, const std::vector& grps); +MEDFileMesh::setIteration(int it); +MEDFileMesh::setName(const char *name); +MEDFileMesh::setOrder(int order); +MEDFileMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr); +MEDFileMesh::setTime(int dt, int it, double time); +MEDFileMesh::setTimeUnit(const char *unit); +MEDFileMesh::setTimeValue(double time); +MEDFileMesh::setUnivName(const char *name); +MEDFileMesh::simpleRepr() const; +MEDFileMesh::write(const char *fileName, int mode) const; +MEDFileMesh::write(med_idt fid) const; +///@} + +/*! \name Advanced API */ +///@{ +MEDFileMesh::clearNonDiscrAttributes() const; +///@} + +/*! \name Others... */ +///@{ +MEDFileMesh::ChangeAllGroupsContainingFamily(std::map >& groups, const char *familyNameToChange, const std::vector& newFamiliesNames); +MEDFileMesh::CreateNameNotIn(const std::string& nameTry, const std::vector& namesToAvoid); +MEDFileMesh::MEDFileMesh(); +MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector& code, int strt); +MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp); +MEDFileMesh::addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName); +MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); +MEDFileMesh::changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector& newFamiliesNames); +MEDFileMesh::changeFamilyIdArr(int oldId, int newId); +MEDFileMesh::changeNames(const std::vector< std::pair >& modifTab); +MEDFileMesh::dealWithTinyInfo(const MEDCouplingMesh *m); +MEDFileMesh::deepCpy() const; +MEDFileMesh::ensureDifferentFamIdsPerLevel(); +MEDFileMesh::getAllFamiliesIdsReferenced() const; +MEDFileMesh::getFamilyRepr(std::ostream& oss) const; +MEDFileMesh::getHeapMemorySize() const; +MEDFileMesh::getMaxFamilyIdInArrays() const; +MEDFileMesh::getMinFamilyId() const; +MEDFileMesh::getMinFamilyIdInArrays() const; +MEDFileMesh::getNameFieldAtLevel(int meshDimRelToMaxExt) const; +MEDFileMesh::getNumberOfNodes() const; +MEDFileMesh::getTheMaxFamilyId() const; +MEDFileMesh::getTheMinFamilyId() const; +MEDFileMesh::normalizeFamIdsMEDFile(); +MEDFileMesh::normalizeFamIdsTrio(); +MEDFileMesh::setFamilyIdUnique(const char *familyName, int id); +MEDFileMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr); +MEDFileMesh::shallowCpy() const; +MEDFileMesh::synchronizeTinyInfoOnLeaves() const = 0; +MEDFileMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); +MEDFileMesh::writeLL(med_idt fid) const; +int MEDFileMesh::_order; +int MEDFileMesh::_iteration; +double MEDFileMesh::_time; +std::string MEDFileMesh::_dt_unit; +std::string MEDFileMesh::_name; +std::string MEDFileMesh::_univ_name; +std::string MEDFileMesh::_desc_name; +std::map > MEDFileMesh::_groups; +std::map MEDFileMesh::_families; +static const char MEDFileMesh::DFT_FAM_NAME[]; +///@} +} + diff --git a/doc/doxygen/medcouplingexamples.doxy b/doc/doxygen/medcouplingexamples.doxy index 04dbb00f2..794b307cd 100644 --- a/doc/doxygen/medcouplingexamples.doxy +++ b/doc/doxygen/medcouplingexamples.doxy @@ -1200,7 +1200,7 @@ As result contents of the array \b da2 are as follows. -\anchor cpp_mcdataarraydouble_setselectedcomponents +\anchor py_mcdataarraydouble_setselectedcomponents

Set part of values of DataArrayDouble

setSelectedComponents()

First, we create a 'source' array. @@ -1219,7 +1219,7 @@ The same result can be achieved other way (except that component info is not copied): \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setSelectedComponents3 -\anchor cpp_mcdataarraydouble_setpartofvalues1 +\anchor py_mcdataarraydouble_setpartofvalues1

setPartOfValues1()

We create two arrays: - a "large" (4x4) zero array \b da to assign to and @@ -1271,7 +1271,7 @@ The same result can be achieved other way: -\anchor cpp_mcdataarraydouble_setpartofvaluessimple1 +\anchor py_mcdataarraydouble_setpartofvaluessimple1

setPartOfValuesSimple1()

We create an array (4x4) \b da to assign to and define a value \b dv to assign. \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_1 @@ -1313,7 +1313,7 @@ The same result can be achieved other way: \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_6 -\anchor cpp_mcdataarraydouble_setpartofvaluessimple2 +\anchor py_mcdataarraydouble_setpartofvaluessimple2

setPartOfValuesSimple2()

We create an array (4x4) \b da to assign to and define a value \b dv to assign. \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple2_1 @@ -1356,7 +1356,7 @@ Below more two variants of location of target values are shown. be explicitly called in Python. -\anchor cpp_mcdataarraydouble_setpartofvaluessimple3 +\anchor py_mcdataarraydouble_setpartofvaluessimple3

setPartOfValuesSimple3()

We create an array (4x4) \b da to assign to and define a value \b dv to assign. \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple3_1 @@ -1400,7 +1400,7 @@ Below more two variants of location of target values are shown. be explicitly called in Python. -\anchor cpp_mcdataarraydouble_setpartofvalues2 +\anchor py_mcdataarraydouble_setpartofvalues2

setPartOfValues2()

We create two arrays: - a "large" (4x7) zero array \b da to assign to, @@ -1436,7 +1436,7 @@ Every value of \b dv is repeated in the 3 specified tuples within \b da. be explicitly called in Python. -\anchor cpp_mcdataarraydouble_setpartofvalues3 +\anchor py_mcdataarraydouble_setpartofvalues3

setPartOfValues3()

We create two arrays: - a "large" (4x7) zero array \b da to assign to, @@ -1473,7 +1473,7 @@ Every value of \b dv is repeated in the 3 specified tuples within \b da. be explicitly called in Python. -\anchor cpp_mcdataarrayint_setselectedcomponents +\anchor py_mcdataarrayint_setselectedcomponents

Set part of values of DataArrayInt

setSelectedComponents()

First, we create a 'source' array. @@ -1492,10 +1492,10 @@ The same result can be achieved other way (except that component info is not copied): \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setSelectedComponents3 -\anchor cpp_mcdataarrayint_setpartofvalues1 +\anchor py_mcdataarrayint_setpartofvalues1

setPartOfValues1()

We create two arrays: -- a "large" (4x4) zero array \b da to assign to and +- a "large" (4x4) zero array \b da to assign to, and - a smaller (2x2) array \b dv filled with values [7,8,9,10]. \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues1_1 @@ -1544,7 +1544,7 @@ The same result can be achieved other way: -\anchor cpp_mcdataarrayint_setpartofvaluessimple1 +\anchor py_mcdataarrayint_setpartofvaluessimple1

setPartOfValuesSimple1()

We create an array (4x4) \b da to assign to and define a value \b dv to assign. \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_1 @@ -1586,7 +1586,7 @@ The same result can be achieved other way: \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_6 -\anchor cpp_mcdataarrayint_setpartofvaluessimple2 +\anchor py_mcdataarrayint_setpartofvaluessimple2

setPartOfValuesSimple2()

We create an array (4x4) \b da to assign to and define a value \b dv to assign. \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple2_1 @@ -1629,7 +1629,7 @@ Below more two variants of location of target values are shown. be explicitly called in Python. -\anchor cpp_mcdataarrayint_setpartofvaluessimple3 +\anchor py_mcdataarrayint_setpartofvaluessimple3

setPartOfValuesSimple3()

We create an array (4x4) \b da to assign to and define a value \b dv to assign. \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple3_1 @@ -1673,7 +1673,7 @@ Below more two variants of location of target values are shown. be explicitly called in Python. -\anchor cpp_mcdataarrayint_setpartofvalues2 +\anchor py_mcdataarrayint_setpartofvalues2

setPartOfValues2()

We create two arrays: - a "large" (4x7) zero array \b da to assign to, @@ -1709,7 +1709,7 @@ Every value of \b dv is repeated in the 3 specified tuples within \b da. be explicitly called in Python. -\anchor cpp_mcdataarrayint_setpartofvalues3 +\anchor py_mcdataarrayint_setpartofvalues3

setPartOfValues3()

We create two arrays: - a "large" (4x7) zero array \b da to assign to, @@ -1746,7 +1746,7 @@ Every value of \b dv is repeated in the 3 specified tuples within \b da. be explicitly called in Python. -\anchor cpp_mcdataarraydouble_getdifferentvalues +\anchor py_mcdataarraydouble_getdifferentvalues

Excluding coincident tuples from DataArrayDouble

The code below creates an array of real values and than an array of @@ -1793,7 +1793,7 @@ Now the array \b da1 includes 7 tuples (as before) of 3 components each. Its components are: "c0da1","c1da1","c0da2". -\anchor cpp_mcdataarraydouble_KeepSelectedComponents +\anchor py_mcdataarraydouble_KeepSelectedComponents

Creation of a sub-part of the DataArrayDouble by selecting components

@@ -1806,7 +1806,7 @@ Now each tuple of \b a2 includes components named "b","c","b","c","a","a". Thus the result array \b a2 includes 30 elements (5 tuples per 6 components). -\anchor cpp_mcdataarrayint_keepselectedcomponents +\anchor py_mcdataarrayint_keepselectedcomponents

Creation of a sub-part of the DataArrayInt by selecting components

diff --git a/doc/doxygen/medcouplingexamplescpponly.dox b/doc/doxygen/medcouplingexamplescpponly.dox new file mode 100644 index 000000000..2049312b9 --- /dev/null +++ b/doc/doxygen/medcouplingexamplescpponly.dox @@ -0,0 +1,36 @@ +/*! +\page medcouplingexamplescpponly MEDCoupling C++ examples + +\anchor cpp_mcfielddouble_fillFromAnalytic_c_func +

Filling a field using a C function

+ +We want to create a 3D vector field lying on a 2D mesh using a C function as a value +generator. For that, first, we define the function that computes 3 values basing on 2 +coordinates of a 2D point. +\snippet MEDCouplingExamplesTest.cxx Snippet_MEDCouplingFieldDouble_fillFromAnalytic_c_func_0 +Then we create the 2D mesh and the field on it, and finally we use +\ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, FunctionToEvaluate func) "fillFromAnalytic()" +to fill the field with values each composed of 3 components. +\snippet MEDCouplingExamplesTest.cxx Snippet_MEDCouplingFieldDouble_fillFromAnalytic_c_func_1 +As a result, number of tuples in the field equals to the number of cells in the mesh, +and number of components equals to 3 as required. + + +\anchor cpp_mcfielddouble_applyFunc_c_func +

Changing a field by applying a C function

+ +We want to transform a 2D vector field to a 3D vector field by +applying a C function to each vector value. For that, first, we define the function +that computes 3 values basing on 2 components of a 2D vector. +\snippet MEDCouplingExamplesTest.cxx Snippet_MEDCouplingFieldDouble_fillFromAnalytic_c_func_0 +Then we create the 2D mesh and the vector field on it. +\snippet MEDCouplingExamplesTest.cxx Snippet_MEDCouplingFieldDouble_applyFunc_c_func_1 +Finally we use +\ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, FunctionToEvaluate func) "applyFunc()" +to change the field values. +\snippet MEDCouplingExamplesTest.cxx Snippet_MEDCouplingFieldDouble_applyFunc_c_func_2 +As a result, number of tuples in the field equals to the number of cells in the mesh, +and number of components becomes equal to 3 as required. + + +*/ diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 2f09e0f6e..4f34f59cb 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -1667,7 +1667,7 @@ void DataArrayDouble::transpose() throw(INTERP_KERNEL::Exception) * \throw If a component index (\a i) is not valid: * \a i < 0 || \a i >= \a this->getNumberOfComponents(). * - * \ref cpp_mcdataarraydouble_keepselectedcomponents "Here is a Python example". + * \ref py_mcdataarraydouble_KeepSelectedComponents "Here is a Python example". */ DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector& compoIds) const throw(INTERP_KERNEL::Exception) { @@ -1919,7 +1919,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) * \throw If \a this is not allocated. * \throw If the number of components is not in [1,2,3]. * - * \ref cpp_mcdataarraydouble_getdifferentvalues "Here is a Python example". + * \ref py_mcdataarraydouble_getdifferentvalues "Here is a Python example". */ DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTupleId) const throw(INTERP_KERNEL::Exception) { @@ -1943,7 +1943,7 @@ DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTuple * \throw If \a compoIds.size() != \a a->getNumberOfComponents(). * \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents(). * - * \ref cpp_mcdataarraydouble_setselectedcomponents "Here is a Python example". + * \ref py_mcdataarraydouble_setselectedcomponents "Here is a Python example". */ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds) throw(INTERP_KERNEL::Exception) { @@ -1993,7 +1993,7 @@ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std: * \throw If \a strictCompoCompare == \a true && \a a->getNumberOfComponents() != * \c len(\c range(\a bgComp,\a endComp,\a stepComp)). * - * \ref cpp_mcdataarraydouble_setpartofvalues1 "Here is a Python example". + * \ref py_mcdataarraydouble_setpartofvalues1 "Here is a Python example". */ void DataArrayDouble::setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -2056,7 +2056,7 @@ void DataArrayDouble::setPartOfValues1(const DataArrayDouble *a, int bgTuples, i * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarraydouble_setpartofvaluessimple1 "Here is a Python example". + * \ref py_mcdataarraydouble_setpartofvaluessimple1 "Here is a Python example". */ void DataArrayDouble::setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception) { @@ -2110,7 +2110,7 @@ void DataArrayDouble::setPartOfValuesSimple1(double a, int bgTuples, int endTupl * \throw In the second *mode of usage*, if \a a->getNumberOfTuples() != 1 or * a->getNumberOfComponents() != (endComp - bgComp). * - * \ref cpp_mcdataarraydouble_setpartofvalues2 "Here is a Python example". + * \ref py_mcdataarraydouble_setpartofvalues2 "Here is a Python example". */ void DataArrayDouble::setPartOfValues2(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -2181,7 +2181,7 @@ void DataArrayDouble::setPartOfValues2(const DataArrayDouble *a, const int *bgTu * \throw If any index of tuple/component given by bgTuples / bgComp is * out of a valid range for \a this array. * - * \ref cpp_mcdataarraydouble_setpartofvaluessimple2 "Here is a Python example". + * \ref py_mcdataarraydouble_setpartofvaluessimple2 "Here is a Python example". */ void DataArrayDouble::setPartOfValuesSimple2(double a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception) { @@ -2241,7 +2241,7 @@ void DataArrayDouble::setPartOfValuesSimple2(double a, const int *bgTuples, cons * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarraydouble_setpartofvalues3 "Here is a Python example". + * \ref py_mcdataarraydouble_setpartofvalues3 "Here is a Python example". */ void DataArrayDouble::setPartOfValues3(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -2313,7 +2313,7 @@ void DataArrayDouble::setPartOfValues3(const DataArrayDouble *a, const int *bgTu * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarraydouble_setpartofvaluessimple3 "Here is a Python example". + * \ref py_mcdataarraydouble_setpartofvaluessimple3 "Here is a Python example". */ void DataArrayDouble::setPartOfValuesSimple3(double a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception) { @@ -6916,7 +6916,7 @@ void DataArrayInt::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception) * \throw If a component index (\a i) is not valid: * \a i < 0 || \a i >= \a this->getNumberOfComponents(). * - * \ref cpp_mcdataarrayint_keepselectedcomponents "Here is a Python example". + * \ref py_mcdataarrayint_keepselectedcomponents "Here is a Python example". */ DataArrayInt *DataArrayInt::keepSelectedComponents(const std::vector& compoIds) const throw(INTERP_KERNEL::Exception) { @@ -6988,7 +6988,7 @@ void DataArrayInt::meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exce * \throw If \a compoIds.size() != \a a->getNumberOfComponents(). * \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents(). * - * \ref cpp_mcdataarrayint_setselectedcomponents "Here is a Python example". + * \ref py_mcdataarrayint_setselectedcomponents "Here is a Python example". */ void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vector& compoIds) throw(INTERP_KERNEL::Exception) { @@ -7039,7 +7039,7 @@ void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vecto * \throw If \a strictCompoCompare == \a true && \a a->getNumberOfComponents() != * \c len(\c range(\a bgComp,\a endComp,\a stepComp)). * - * \ref cpp_mcdataarrayint_setpartofvalues1 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvalues1 "Here is a Python example". */ void DataArrayInt::setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -7102,7 +7102,7 @@ void DataArrayInt::setPartOfValues1(const DataArrayInt *a, int bgTuples, int end * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarrayint_setpartofvaluessimple1 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvaluessimple1 "Here is a Python example". */ void DataArrayInt::setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception) { @@ -7157,7 +7157,7 @@ void DataArrayInt::setPartOfValuesSimple1(int a, int bgTuples, int endTuples, in * \throw In the second *mode of usage*, if \a a->getNumberOfTuples() != 1 or * a->getNumberOfComponents() != (endComp - bgComp). * - * \ref cpp_mcdataarrayint_setpartofvalues2 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvalues2 "Here is a Python example". */ void DataArrayInt::setPartOfValues2(const DataArrayInt *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -7228,7 +7228,7 @@ void DataArrayInt::setPartOfValues2(const DataArrayInt *a, const int *bgTuples, * \throw If any index of tuple/component given by bgTuples / bgComp is * out of a valid range for \a this array. * - * \ref cpp_mcdataarrayint_setpartofvaluessimple2 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvaluessimple2 "Here is a Python example". */ void DataArrayInt::setPartOfValuesSimple2(int a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception) { @@ -7288,7 +7288,7 @@ void DataArrayInt::setPartOfValuesSimple2(int a, const int *bgTuples, const int * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarrayint_setpartofvalues3 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvalues3 "Here is a Python example". */ void DataArrayInt::setPartOfValues3(const DataArrayInt *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -7360,7 +7360,7 @@ void DataArrayInt::setPartOfValues3(const DataArrayInt *a, const int *bgTuples, * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarrayint_setpartofvaluessimple3 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvaluessimple3 "Here is a Python example". */ void DataArrayInt::setPartOfValuesSimple3(int a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception) { diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx index 0906a91ad..2cb71a8bc 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -726,7 +726,7 @@ DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValu * \throw If a component index (\a i) is not valid: * \a i < 0 || \a i >= \a this->getNumberOfComponents(). * - * \ref cpp_mcdataarrayint_keepselectedcomponents "Here is a Python example". + * \ref py_mcdataarrayint_keepselectedcomponents "Here is a Python example". */ DataArrayChar *DataArrayChar::keepSelectedComponents(const std::vector& compoIds) const throw(INTERP_KERNEL::Exception) { @@ -818,7 +818,7 @@ void DataArrayChar::meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Ex * \throw If \a strictCompoCompare == \a true && \a a->getNumberOfComponents() != * \c len(\c range(\a bgComp,\a endComp,\a stepComp)). * - * \ref cpp_mcdataarrayint_setpartofvalues1 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvalues1 "Here is a Python example". */ void DataArrayChar::setPartOfValues1(const DataArrayChar *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -881,7 +881,7 @@ void DataArrayChar::setPartOfValues1(const DataArrayChar *a, int bgTuples, int e * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarrayint_setpartofvaluessimple1 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvaluessimple1 "Here is a Python example". */ void DataArrayChar::setPartOfValuesSimple1(char a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception) { @@ -936,7 +936,7 @@ void DataArrayChar::setPartOfValuesSimple1(char a, int bgTuples, int endTuples, * \throw In the second *mode of usage*, if \a a->getNumberOfTuples() != 1 or * a->getNumberOfComponents() != (endComp - bgComp). * - * \ref cpp_mcdataarrayint_setpartofvalues2 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvalues2 "Here is a Python example". */ void DataArrayChar::setPartOfValues2(const DataArrayChar *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -1007,7 +1007,7 @@ void DataArrayChar::setPartOfValues2(const DataArrayChar *a, const int *bgTuples * \throw If any index of tuple/component given by bgTuples / bgComp is * out of a valid range for \a this array. * - * \ref cpp_mcdataarrayint_setpartofvaluessimple2 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvaluessimple2 "Here is a Python example". */ void DataArrayChar::setPartOfValuesSimple2(char a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception) { @@ -1067,7 +1067,7 @@ void DataArrayChar::setPartOfValuesSimple2(char a, const int *bgTuples, const in * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarrayint_setpartofvalues3 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvalues3 "Here is a Python example". */ void DataArrayChar::setPartOfValues3(const DataArrayChar *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception) { @@ -1139,7 +1139,7 @@ void DataArrayChar::setPartOfValues3(const DataArrayChar *a, const int *bgTuples * non-empty range of increasing indices or indices are out of a valid range * for \this array. * - * \ref cpp_mcdataarrayint_setpartofvaluessimple3 "Here is a Python example". + * \ref py_mcdataarrayint_setpartofvaluessimple3 "Here is a Python example". */ void DataArrayChar::setPartOfValuesSimple3(char a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception) { diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 7a715e20e..b155c5ee9 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -440,7 +440,7 @@ bool MEDCouplingUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec } /*! - * \brief Checks if data arrays of this mesh (node coordinates, nodal + * Checks if data arrays of this mesh (node coordinates, nodal * connectivity of cells, etc) of two meshes are same. Textual data like name etc. are * not considered. * \param [in] other - the mesh to compare with. diff --git a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx index a98c000a0..365d6dd58 100644 --- a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx @@ -928,11 +928,11 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoints() mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); @@ -1141,11 +1141,11 @@ void CppExample_MEDCouplingUMesh_findBoundaryNodes() mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); @@ -1167,11 +1167,11 @@ void CppExample_MEDCouplingUMesh_buildBoundaryMesh() mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); @@ -1294,11 +1294,11 @@ void CppExample_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds() mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); @@ -1440,11 +1440,11 @@ void CppExample_MEDCouplingUMesh_zipCoordsTraducer() mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); @@ -1473,11 +1473,11 @@ void CppExample_MEDCouplingUMesh_getNodeIdsInUse() mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 - mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 - mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); + mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); + mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); diff --git a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py index 30d458d5b..c4351bcc9 100644 --- a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py @@ -729,11 +729,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2); mesh.allocateCells(5); conn=[0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4]; - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); # 0 - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); # 1 - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); # 2 - mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); # 3 - mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); # 4 + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); + mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); + mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); mesh.finishInsertingCells(); coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]; coordsArr=DataArrayDouble.New(); @@ -880,11 +880,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2); mesh.allocateCells(5); conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]; - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); # 0 - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); # 1 - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); # 2 - mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); # 3 - mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); # 4 + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); + mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); + mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); mesh.finishInsertingCells(); coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]; coordsArr=DataArrayDouble.New(); @@ -903,11 +903,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2); mesh.allocateCells(5); conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]; - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); # 0 - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); # 1 - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); # 2 - mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); # 3 - mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); # 4 + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); + mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); + mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); mesh.finishInsertingCells(); coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]; coordsArr=DataArrayDouble.New(); @@ -1012,11 +1012,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2); mesh.allocateCells(5); conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]; - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); # 0 - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); # 1 - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); # 2 - mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); # 3 - mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); # 4 + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); + mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); + mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); mesh.finishInsertingCells(); coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]; coordsArr=DataArrayDouble.New(); @@ -1134,11 +1134,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2); mesh.allocateCells(5); conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]; - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); # 0 - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); # 1 - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); # 2 - mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); # 3 - mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); # 4 + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); + mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); + mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); mesh.finishInsertingCells(); coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]; coordsArr=DataArrayDouble.New(); @@ -1160,11 +1160,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2); mesh.allocateCells(5); conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]; - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); # 0 - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); # 1 - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); # 2 - mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); # 3 - mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); # 4 + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]); + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]); + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]); + mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]); + mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]); mesh.finishInsertingCells(); coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]; coordsArr=DataArrayDouble.New(); diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index fce2b6b6c..cc9e3fe60 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -2803,10 +2803,17 @@ std::string MEDFileFieldGlobs::CreateNewNameNotIn(const char *prefix, const std: throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::CreateNewNameNotIn : impossible to create an additional profile limit of 100000 profiles reached !"); } +/*! + * Creates a MEDFileFieldGlobsReal on a given file name. Nothing is read here. + * \param [in] fname - the file name. + */ MEDFileFieldGlobsReal::MEDFileFieldGlobsReal(const char *fname):_globals(MEDFileFieldGlobs::New(fname)) { } +/*! + * Creates an empty MEDFileFieldGlobsReal. + */ MEDFileFieldGlobsReal::MEDFileFieldGlobsReal():_globals(MEDFileFieldGlobs::New()) { } @@ -2819,6 +2826,10 @@ std::size_t MEDFileFieldGlobsReal::getHeapMemorySize() const return ret; } +/*! + * Returns a string describing profiles and Gauss points held in \a this. + * \return std::string - the description string. + */ void MEDFileFieldGlobsReal::simpleRepr(std::ostream& oss) const { oss << "Globals information on fields :" << "\n*******************************\n\n"; @@ -2833,6 +2844,10 @@ MEDFileFieldGlobsReal::~MEDFileFieldGlobsReal() { } +/*! + * Copies references to profiles and Gauss points from another MEDFileFieldGlobsReal. + * \param [in] other - the other MEDFileFieldGlobsReal to copy data from. + */ void MEDFileFieldGlobsReal::shallowCpyGlobs(const MEDFileFieldGlobsReal& other) { _globals=other._globals; @@ -2845,6 +2860,14 @@ void MEDFileFieldGlobsReal::deepCpyGlobs(const MEDFileFieldGlobsReal& other) _globals=other._globals->deepCpy(); } +/*! + * Adds profiles and Gauss points held by another MEDFileFieldGlobsReal to \a this one. + * \param [in] other - the MEDFileFieldGlobsReal to copy data from. + * \param [in] eps - a precision used to compare Gauss points with same name held by + * \a this and \a other MEDFileFieldGlobsReal. + * \throw If \a this and \a other hold profiles with equal names but different ids. + * \throw If \a this and \a other hold different Gauss points with equal names. + */ void MEDFileFieldGlobsReal::appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception) { _globals->appendGlobs(*other._globals,eps); @@ -2875,21 +2898,41 @@ void MEDFileFieldGlobsReal::writeGlobals(med_idt fid, const MEDFileWritable& opt _globals->writeGlobals(fid,opt); } +/*! + * Returns names of all profiles. To get only used profiles call getPflsReallyUsed() + * or getPflsReallyUsedMulti(). + * \return std::vector - a sequence of names of all profiles. + */ std::vector MEDFileFieldGlobsReal::getPfls() const { return _globals->getPfls(); } +/*! + * Returns names of all localizations. To get only used localizations call getLocsReallyUsed() + * or getLocsReallyUsedMulti(). + * \return std::vector - a sequence of names of all localizations. + */ std::vector MEDFileFieldGlobsReal::getLocs() const { return _globals->getLocs(); } +/*! + * Checks if the profile with a given name exists. + * \param [in] pflName - the profile name of interest. + * \return bool - \c true if the profile named \a pflName exists. + */ bool MEDFileFieldGlobsReal::existsPfl(const char *pflName) const { return _globals->existsPfl(pflName); } +/*! + * Checks if the localization with a given name exists. + * \param [in] locName - the localization name of interest. + * \return bool - \c true if the localization named \a locName exists. + */ bool MEDFileFieldGlobsReal::existsLoc(const char *locName) const { return _globals->existsLoc(locName); @@ -2905,35 +2948,72 @@ std::string MEDFileFieldGlobsReal::createNewNameOfLoc() const throw(INTERP_KERNE return _globals->createNewNameOfLoc(); } +/*! + * Sets the name of a MED file. + * \param [inout] fileName - the file name. + */ void MEDFileFieldGlobsReal::setFileName(const char *fileName) { _globals->setFileName(fileName); } +/*! + * Finds equal profiles. Two profiles are considered equal if they contain the same ids + * in the same order. + * \return std::vector< std::vector > - a sequence of groups of equal profiles. + * Each item of this sequence is a vector containing ids of equal profiles. + */ std::vector< std::vector > MEDFileFieldGlobsReal::whichAreEqualProfiles() const { return _globals->whichAreEqualProfiles(); } +/*! + * Finds equal localizations. + * \param [in] eps - a precision used to compare real values of the localizations. + * \return std::vector< std::vector > - a sequence of groups of equal localizations. + * Each item of this sequence is a vector containing ids of equal localizations. + */ std::vector< std::vector > MEDFileFieldGlobsReal::whichAreEqualLocs(double eps) const { return _globals->whichAreEqualLocs(eps); } +/*! + * Renames the profiles. References to profiles (a reference is a profile name) are not changed. + * \param [in] mapOfModif - a sequence describing required renaming. Each element of + * this sequence is a pair whose + * - the first item is a vector of profile names to replace by the second item, + * - the second item is a profile name to replace every profile name of the first item. + */ void MEDFileFieldGlobsReal::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) { _globals->changePflsNamesInStruct(mapOfModif); } +/*! + * Renames the localizations. References to localizations (a reference is a localization name) are not changed. + * \param [in] mapOfModif - a sequence describing required renaming. Each element of + * this sequence is a pair whose + * - the first item is a vector of localization names to replace by the second item, + * - the second item is a localization name to replace every localization name of the first item. + */ void MEDFileFieldGlobsReal::changeLocsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) { _globals->changeLocsNamesInStruct(mapOfModif); } /*! - * This method is a generalization of MEDFileFieldGlobsReal::changePflName. - * This method contrary to abstract method MEDFileFieldGlobsReal::changePflsRefsNamesGen updates in addition of MEDFileFieldGlobsReal::changePflsRefsNamesGen, - * the profiles themselves and not only leaves of field. + * Replaces references to some profiles (a reference is a profile name) by references + * to other profiles and, contrary to changePflsRefsNamesGen(), renames the profiles + * them-selves accordingly.
+ * This method is a generalization of changePflName(). + * \param [in] mapOfModif - a sequence describing required replacements. Each element of + * this sequence is a pair whose + * - the first item is a vector of profile names to replace by the second item, + * - the second item is a profile name to replace every profile of the first item. + * \sa changePflsRefsNamesGen() + * \sa changePflName() */ void MEDFileFieldGlobsReal::changePflsNames(const std::vector< std::pair, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) { @@ -2942,9 +3022,16 @@ void MEDFileFieldGlobsReal::changePflsNames(const std::vector< std::pair + * This method is a generalization of changeLocName(). + * \param [in] mapOfModif - a sequence describing required replacements. Each element of + * this sequence is a pair whose + * - the first item is a vector of localization names to replace by the second item, + * - the second item is a localization name to replace every localization of the first item. + * \sa changeLocsRefsNamesGen() + * \sa changeLocName() */ void MEDFileFieldGlobsReal::changeLocsNames(const std::vector< std::pair, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) { @@ -2953,7 +3040,10 @@ void MEDFileFieldGlobsReal::changeLocsNames(const std::vector< std::pair, std::string > > - + * a sequence describing the performed replacements of profiles. Each element of + * this sequence is a pair whose + * - the first item is a vector of profile names replaced by the second item, + * - the second item is a profile name replacing every profile of the first item. + */ std::vector< std::pair, std::string > > MEDFileFieldGlobsReal::zipPflsNames() throw(INTERP_KERNEL::Exception) { std::vector< std::vector > pseudoRet=whichAreEqualProfiles(); @@ -2994,6 +3097,17 @@ std::vector< std::pair, std::string > > MEDFileFieldGlo return ret; } +/*! + * Removes duplicated localizations. Returns a map used to update references to removed + * localizations via changeLocsRefsNamesGen(). + * Equal localizations are found using whichAreEqualLocs(). + * \param [in] eps - a precision used to compare real values of the localizations. + * \return std::vector< std::pair, std::string > > - + * a sequence describing the performed replacements of localizations. Each element of + * this sequence is a pair whose + * - the first item is a vector of localization names replaced by the second item, + * - the second item is a localization name replacing every localization of the first item. + */ std::vector< std::pair, std::string > > MEDFileFieldGlobsReal::zipLocsNames(double eps) throw(INTERP_KERNEL::Exception) { std::vector< std::vector > pseudoRet=whichAreEqualLocs(eps); @@ -3014,16 +3128,31 @@ std::vector< std::pair, std::string > > MEDFileFieldGlo return ret; } +/*! + * Returns number of Gauss points per cell in a given localization. + * \param [in] locId - an id of the localization of interest. + * \return int - the number of the Gauss points per cell. + */ int MEDFileFieldGlobsReal::getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception) { return _globals->getNbOfGaussPtPerCell(locId); } +/*! + * Returns an id of a localization by its name. + * \param [in] loc - the localization name of interest. + * \return int - the id of the localization. + * \throw If there is no a localization named \a loc. + */ int MEDFileFieldGlobsReal::getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception) { return _globals->getLocalizationId(loc); } +/*! + * Returns the name of the MED file. + * \return const char * - the MED file name. + */ const char *MEDFileFieldGlobsReal::getFileName() const { return _globals->getFileName(); @@ -3034,69 +3163,148 @@ std::string MEDFileFieldGlobsReal::getFileName2() const return _globals->getFileName2(); } +/*! + * Returns a localization object by its name. + * \param [in] locName - the name of the localization of interest. + * \return const MEDFileFieldLoc& - the localization object having the name \a locName. + * \throw If there is no a localization named \a locName. + */ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception) { return _globals->getLocalization(locName); } +/*! + * Returns a localization object by its id. + * \param [in] locId - the id of the localization of interest. + * \return const MEDFileFieldLoc& - the localization object having the id \a locId. + * \throw If there is no a localization with id \a locId. + */ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception) { return _globals->getLocalizationFromId(locId); } +/*! + * Returns a profile array by its name. + * \param [in] pflName - the name of the profile of interest. + * \return const DataArrayInt * - the profile array having the name \a pflName. + * \throw If there is no a profile named \a pflName. + */ const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception) { return _globals->getProfile(pflName); } +/*! + * Returns a profile array by its id. + * \param [in] pflId - the id of the profile of interest. + * \return const DataArrayInt * - the profile array having the id \a pflId. + * \throw If there is no a profile with id \a pflId. + */ const DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception) { return _globals->getProfileFromId(pflId); } +/*! + * Returns a localization object, apt for modification, by its id. + * \param [in] locId - the id of the localization of interest. + * \return MEDFileFieldLoc& - a non-const reference to the localization object + * having the id \a locId. + * \throw If there is no a localization with id \a locId. + */ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception) { return _globals->getLocalizationFromId(locId); } +/*! + * Returns a localization object, apt for modification, by its name. + * \param [in] locName - the name of the localization of interest. + * \return MEDFileFieldLoc& - a non-const reference to the localization object + * having the name \a locName. + * \throw If there is no a localization named \a locName. + */ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) throw(INTERP_KERNEL::Exception) { return _globals->getLocalization(locName); } +/*! + * Returns a profile array, apt for modification, by its name. + * \param [in] pflName - the name of the profile of interest. + * \return DataArrayInt * - a non-const pointer to the profile array having the name \a pflName. + * \throw If there is no a profile named \a pflName. + */ DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) throw(INTERP_KERNEL::Exception) { return _globals->getProfile(pflName); } +/*! + * Returns a profile array, apt for modification, by its id. + * \param [in] pflId - the id of the profile of interest. + * \return DataArrayInt * - a non-const pointer to the profile array having the id \a pflId. + * \throw If there is no a profile with id \a pflId. + */ DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception) { return _globals->getProfileFromId(pflId); } +/*! + * Removes profiles given by their ids. No data is updated to track this removal. + * \param [in] pflIds - a sequence of ids of the profiles to remove. + */ void MEDFileFieldGlobsReal::killProfileIds(const std::vector& pflIds) throw(INTERP_KERNEL::Exception) { _globals->killProfileIds(pflIds); } +/*! + * Removes localizations given by their ids. No data is updated to track this removal. + * \param [in] locIds - a sequence of ids of the localizations to remove. + */ void MEDFileFieldGlobsReal::killLocalizationIds(const std::vector& locIds) throw(INTERP_KERNEL::Exception) { _globals->killLocalizationIds(locIds); } +/*! + * Stores a profile array. + * \param [in] pfl - the profile array to store. + * \throw If the name of \a pfl is empty. + * \throw If a profile with the same name as that of \a pfl already exists but contains + * different ids. + */ void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception) { _globals->appendProfile(pfl); } +/*! + * Adds a new localization of Gauss points. + * \param [in] locName - the name of the new localization. + * \param [in] geoType - a geometrical type of the reference cell. + * \param [in] refCoo - coordinates of points of the reference cell. Size of this vector + * must be \c nbOfNodesPerCell * \c dimOfType. + * \param [in] gsCoo - coordinates of Gauss points on the reference cell. Size of this vector + * must be _wg_.size() * \c dimOfType. + * \param [in] w - the weights of Gauss points. + * \throw If \a locName is empty. + * \throw If a localization with the name \a locName already exists but is + * different form the new one. + */ void MEDFileFieldGlobsReal::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) throw(INTERP_KERNEL::Exception) { _globals->appendLoc(locName,geoType,refCoo,gsCoo,w); } /*! - * This method returns the max dimension of 'this'. - * This method returns -2 if 'this' is empty, -1 if only nodes are defined. + * Returns the maximal dimension of supporting elements. Returns -2 if \a this is + * empty. Returns -1 if this in on nodes. + * \return int - the dimension of \a this. */ int MEDFileField1TSWithoutSDA::getDimension() const { @@ -3106,12 +3314,27 @@ int MEDFileField1TSWithoutSDA::getDimension() const return ret; } +/*! + * Throws if a given value is not a valid (non-extended) relative dimension. + * \param [in] meshDimRelToMax - the relative dimension value. + * \throw If \a meshDimRelToMax > 0. + */ void MEDFileField1TSWithoutSDA::CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception) { if(meshDimRelToMax>0) throw INTERP_KERNEL::Exception("CheckMeshDimRel : This is a meshDimRel not a meshDimRelExt ! So value should be <=0 !"); } +/*! + * Checks if elements of a given mesh are in the order suitable for writing + * to the MED file. If this is not so, an exception is thrown. In a case of success, returns a + * vector describing types of elements and their number. + * \param [in] mesh - the mesh to check. + * \return std::vector - a vector holding for each element type (1) item of + * INTERP_KERNEL::NormalizedCellType, (2) number of elements, (3) -1. + * These values are in full-interlace mode. + * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. + */ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception) { // @@ -3151,10 +3374,16 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const char *fieldName, } /*! - * This method copyies tiny info but also preallocated the DataArrayDouble instance in this->_arr. - * This not allocated it allocates to the size of 'field' array. If already allocated it grows the array to - * the previous size + the size of the array of the input 'field'. - * This method returns the position (in tuple id) where to start to feed 'this->_arr' + * Copies tiny info and allocates \a this->_arr instance of DataArrayDouble to + * append data of a given MEDCouplingFieldDouble. So that the size of \a this->_arr becomes + * larger by the size of \a field. Returns an id of the first not filled + * tuple of \a this->_arr. + * \param [in] field - the field to copy the info on components and the name from. + * \return int - the id of first not initialized tuple of \a this->_arr. + * \throw If the name of \a field is empty. + * \throw If the data array of \a field is not set. + * \throw If \a this->_arr is already allocated but has different number of components + * than \a field. */ int MEDFileField1TSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception) { @@ -3186,18 +3415,34 @@ int MEDFileField1TSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *fi } } +/*! + * Returns the name of \a this field. + * \return std::string - a string containing the field name. + */ std::string MEDFileField1TSWithoutSDA::getName() const { const DataArrayDouble *arr=getOrCreateAndGetArray(); return arr->getName(); } +/*! + * Sets name of \a this field + * \param [in] name - the new field name. + */ void MEDFileField1TSWithoutSDA::setName(const char *name) { DataArrayDouble *arr=getOrCreateAndGetArray(); arr->setName(name); } +/*! + * Prints a string describing \a this field into a stream. This string is outputted + * by \c print Python command. + * \param [in] bkOffset - number of white spaces printed at the beginning of each line. + * \param [in,out] oss - the out stream. + * \param [in] f1tsId - the field index within a MED file. If \a f1tsId < 0, the tiny + * info id printed, else, not. + */ void MEDFileField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const { std::string startOfLine(bkOffset,' '); @@ -3248,6 +3493,11 @@ void MEDFileField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int oss << startOfLine << "----------------------" << std::endl; } +/*! + * Returns the mesh name. + * \return std::string - a string holding the mesh name. + * \throw If \c _field_per_mesh.empty() + */ std::string MEDFileField1TSWithoutSDA::getMeshName() const throw(INTERP_KERNEL::Exception) { if(_field_per_mesh.empty()) @@ -3288,6 +3538,11 @@ bool MEDFileField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName return ret; } +/*! + * Returns the number of iteration of the state of underlying mesh. + * \return int - the iteration number. + * \throw If \c _field_per_mesh.empty() + */ int MEDFileField1TSWithoutSDA::getMeshIteration() const throw(INTERP_KERNEL::Exception) { if(_field_per_mesh.empty()) @@ -3295,6 +3550,11 @@ int MEDFileField1TSWithoutSDA::getMeshIteration() const throw(INTERP_KERNEL::Exc return _field_per_mesh[0]->getMeshIteration(); } +/*! + * Returns the order number of iteration of the state of underlying mesh. + * \return int - the order number. + * \throw If \c _field_per_mesh.empty() + */ int MEDFileField1TSWithoutSDA::getMeshOrder() const throw(INTERP_KERNEL::Exception) { if(_field_per_mesh.empty()) @@ -3302,16 +3562,34 @@ int MEDFileField1TSWithoutSDA::getMeshOrder() const throw(INTERP_KERNEL::Excepti return _field_per_mesh[0]->getMeshOrder(); } +/*! + * Returns number of components in \a this field + * \return int - the number of components. + */ int MEDFileField1TSWithoutSDA::getNumberOfComponents() const { return getOrCreateAndGetArray()->getNumberOfComponents(); } +/*! + * Checks if \a this field is tagged by a given iteration number and a given + * iteration order number. + * \param [in] iteration - the iteration number of interest. + * \param [in] order - the iteration order number of interest. + * \return bool - \c true if \a this->getIteration() == \a iteration && + * \a this->getOrder() == \a order. + */ bool MEDFileField1TSWithoutSDA::isDealingTS(int iteration, int order) const { return iteration==_iteration && order==_order; } +/*! + * Returns number of iteration and order number of iteration when + * \a this field has been calculated. + * \return std::pair - a pair of the iteration number and the iteration + * order number. + */ std::pair MEDFileField1TSWithoutSDA::getDtIt() const { std::pair p; @@ -3319,12 +3597,22 @@ std::pair MEDFileField1TSWithoutSDA::getDtIt() const return p; } +/*! + * Returns number of iteration and order number of iteration when + * \a this field has been calculated. + * \param [in,out] p - a pair returning the iteration number and the iteration + * order number. + */ void MEDFileField1TSWithoutSDA::fillIteration(std::pair& p) const { p.first=_iteration; p.second=_order; } +/*! + * Returns all types of spatial discretization of \a this field. + * \param [in,out] types - a sequence of types of \a this field. + */ void MEDFileField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector& types) const throw(INTERP_KERNEL::Exception) { std::set types2; @@ -3336,12 +3624,22 @@ void MEDFileField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector& - a sequence of strings each being an + * information on _i_-th component. + */ const std::vector& MEDFileField1TSWithoutSDA::getInfo() const { const DataArrayDouble *arr=getOrCreateAndGetArray(); return arr->getInfoOnComponents(); } +/*! + * Returns a mutable info on components of \a this field. + * \return std::vector& - a sequence of strings each being an + * information on _i_-th component. + */ std::vector& MEDFileField1TSWithoutSDA::getInfo() { DataArrayDouble *arr=getOrCreateAndGetArray(); @@ -3349,35 +3647,45 @@ std::vector& MEDFileField1TSWithoutSDA::getInfo() } /*! - * This method has one input 'mname'. It can be null if the user is the general case where there is only one meshName lying on 'this' - * This method returns two things. - * - The absolute dimension of 'this' in first parameter. - * - The available ext levels relative to the absolute dimension returned in first parameter. These relative levels are relative - * to the first output parameter. The values in 'levs' will be returned in decreasing order. - * - * This method is designed for MEDFileField1TS instances that have a discritization ON_CELLS, ON_GAUSS_NE and ON_GAUSS. - * Only these 3 discretizations will be taken into account here. - * - * If 'this' is empty this method will throw an INTERP_KERNEL::Exception. - * If there is \b only node fields defined in 'this' -1 is returned and 'levs' output parameter will be empty. In this - * case the caller has to know the underlying mesh it refers to. By defaut it is the level 0 of the corresponding mesh. - * - * This method is usefull to make the link between meshDimension of the underlying mesh in 'this' and the levels on 'this'. - * It is possible (even if it is not common) that the highest level in 'this' were not equal to the meshDimension of the underlying mesh in 'this'. + * Returns dimensions of mesh elements \a this field lies on. The returned value is a + * maximal absolute dimension and values returned via the out parameter \a levs are + * dimensions relative to the maximal absolute dimension.
+ * This method is designed for MEDFileField1TS instances that have a discretization + * \ref ParaMEDMEM::ON_CELLS "ON_CELLS", + * \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT", + * \ref ParaMEDMEM::ON_GAUSS_NE "ON_GAUSS_NE". + * Only these 3 discretizations will be taken into account here. If \a this is + * \ref ParaMEDMEM::ON_NODES "ON_NODES", -1 is returned and \a levs are empty.
+ * This method is useful to make the link between the dimension of the underlying mesh + * and the levels of \a this, because it is possible that the highest dimension of \a this + * field is not equal to the dimension of the underlying mesh. * - * Let's consider the typical following case : - * - a mesh 'm1' has a meshDimension 3 and has the following non empty levels - * [0,-1,-2] for example 'm1' lies on TETRA4, HEXA8 TRI3 and SEG2 - * - 'f1' lies on 'm1' and is defined on 3D and 1D cells for example - * TETRA4 and SEG2 - * - 'f2' lies on 'm1' too and is defined on 2D and 1D cells for example TRI3 and SEG2 + * Let's consider the following case: + * - mesh \a m1 has a meshDimension 3 and has non empty levels [0,-1,-2] with elements + * TETRA4, HEXA8, TRI3 and SEG2. + * - field \a f1 lies on \a m1 and is defined on 3D and 1D elements TETRA4 and SEG2. + * - field \a f2 lies on \a m1 and is defined on 2D and 1D elements TRI3 and SEG2. * - * In this case f1->getNonEmptyLevelsExt will return (3,[0,-2]) and f2->getNonEmptyLevelsExt will return (2,[0,-1]) - * - * To retrieve the highest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+0);//absDim-meshDim+relativeLev - * To retrieve the lowest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+(-2));//absDim-meshDim+relativeLev - * To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev - * To retrieve the lowest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+(-1));//absDim-meshDim+relativeLev + * In this case \a f1->getNonEmptyLevels() returns (3,[0,-2]) and \a + * f2->getNonEmptyLevels() returns (2,[0,-1]).
+ * The returned values can be used for example to retrieve a MEDCouplingFieldDouble lying + * on elements of a certain relative level by calling getFieldAtLevel(). \a meshDimRelToMax + * parameter of getFieldAtLevel() is computed basing on the returned values as this: + * meshDimRelToMax = absDim - meshDim + relativeLev . + * For example
+ * to retrieve the highest level of + * \a f1: f1->getFieldAtLevel( ON_CELLS, 3-3+0 ); // absDim - meshDim + relativeLev
+ * to retrieve the lowest level of \a f1: f1->getFieldAtLevel( ON_CELLS, 3-3+(-2) );
+ * to retrieve the highest level of \a f2: f2->getFieldAtLevel( ON_CELLS, 2-3+0 );
+ * to retrieve the lowest level of \a f2: f2->getFieldAtLevel( ON_CELLS, 2-3+(-1) ). + * \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid + * for the case with only one underlying mesh. (Actually, the number of meshes is + * not checked if \a mname == \c NULL). + * \param [in,out] levs - a sequence returning the dimensions relative to the maximal + * absolute one. They are in decreasing order. This sequence is cleared before + * filling it in. + * \return int - the maximal absolute dimension of elements \a this fields lies on. + * \throw If no field is lying on \a mname. */ int MEDFileField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::vector& levs) const throw(INTERP_KERNEL::Exception) { @@ -3405,6 +3713,11 @@ int MEDFileField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::vector< return ret; } +/*! + * Returns all types of spatial discretization of \a this field. + * \return std::vector - a sequence of types of spatial discretization + * of \a this field. + */ std::vector MEDFileField1TSWithoutSDA::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception) { std::vector ret; @@ -3413,7 +3726,34 @@ std::vector MEDFileField1TSWithoutSDA::getTypesOfFieldAvailable() c } /*! - * entry point for users that want to iterate into MEDFile DataStructure without any overhead. + * Returns all attributes of parts of \a this field lying on a given mesh. + * Each part differs from other ones by a type of supporting mesh entity. The _i_-th + * item of every of returned sequences refers to the _i_-th part of \a this field. + * Thus all sequences returned by this method are of the same length equal to number + * of different types of supporting entities.
+ * A field part can include sub-parts with several different spatial discretizations, + * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" + * for example. Hence, some of the returned sequences contains nested sequences, and an item + * of a nested sequence corresponds to a type of spatial discretization.
+ * This method allows for iteration over MEDFile DataStructure without any overhead. + * \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid + * for the case with only one underlying mesh. (Actually, the number of meshes is + * not checked if \a mname == \c NULL). + * \param [in,out] types - a sequence of types of underlying mesh entities. A type per + * a field part is returned. + * \param [in,out] typesF - a sequence of sequences of types of spatial discretizations. + * This sequence is of the same length as \a types. + * \param [in,out] pfls - a sequence returning a profile name per each type of spatial + * discretization. A profile name can be empty. + * Length of this and of nested sequences is the same as that of \a typesF. + * \param [in,out] locs - a sequence returning a localization name per each type of spatial + * discretization. A localization name can be empty. + * Length of this and of nested sequences is the same as that of \a typesF. + * \return std::vector< std::vector< std::pair > > - a sequence holding a range + * of ids of tuples within the data array, per each type of spatial + * discretization within one mesh entity type. + * Length of this and of nested sequences is the same as that of \a typesF. + * \throw If no field is lying on \a mname. */ std::vector< std::vector< std::pair > > MEDFileField1TSWithoutSDA::getFieldSplitedByType(const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const throw(INTERP_KERNEL::Exception) { @@ -3427,8 +3767,38 @@ std::vector< std::vector< std::pair > > MEDFileField1TSWithoutSDA::getF } /*! - * entry point for users that want to iterate into MEDFile DataStructure with a reduced overhead because output arrays are extracted (created) specially - * for the call of this method. That's why the DataArrayDouble instance in returned vector of vector should be dealed by the caller. + * Returns all attributes and values of parts of \a this field lying on a given mesh. + * Each part differs from other ones by a type of supporting mesh entity. The _i_-th + * item of every of returned sequences refers to the _i_-th part of \a this field. + * Thus all sequences returned by this method are of the same length equal to number + * of different types of supporting entities.
+ * A field part can include sub-parts with several different spatial discretizations, + * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" + * for example. Hence, some of the returned sequences contains nested sequences, and an item + * of a nested sequence corresponds to a type of spatial discretization.
+ * This method allows for iteration over MEDFile DataStructure with a reduced overhead. + * The overhead is due to selecting values into new instances of DataArrayDouble. + * \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid + * for the case with only one underlying mesh. (Actually, the number of meshes is + * not checked if \a mname == \c NULL). + * \param [in,out] types - a sequence of types of underlying mesh entities. A type per + * a field part is returned. + * \param [in,out] typesF - a sequence of sequences of types of spatial discretizations. + * A field part can include sub-parts with several different spatial discretizations, + * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and + * \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" for example. + * This sequence is of the same length as \a types. + * \param [in,out] pfls - a sequence returning a profile name per each type of spatial + * discretization. A profile name can be empty. + * Length of this and of nested sequences is the same as that of \a typesF. + * \param [in,out] locs - a sequence returning a localization name per each type of spatial + * discretization. A localization name can be empty. + * Length of this and of nested sequences is the same as that of \a typesF. + * \return std::vector< std::vector > - a sequence holding arrays of values + * per each type of spatial discretization within one mesh entity type. + * The caller is to delete each DataArrayDouble using decrRef() as it is no more needed. + * Length of this and of nested sequences is the same as that of \a typesF. + * \throw If no field is lying on \a mname. */ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const throw(INTERP_KERNEL::Exception) { @@ -3562,8 +3932,18 @@ void MEDFileField1TSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts } /*! - * SBT means Sort By Type. - * This method is the most basic method to assign field in this. Basic in sense that no renumbering is done. Underlying mesh in 'field' is globaly ignored except for type contiguous check. + * Adds a MEDCouplingFieldDouble to \a this. The underlying mesh of the given field is + * checked if its elements are sorted suitable for writing to MED file ("STB" stands for + * "Sort By Type"), if not, an exception is thrown. + * \param [in] field - the field to add to \a this. + * \param [in,out] glob - the global data where profiles and localization present in + * \a field, if any, are added. + * \throw If the name of \a field is empty. + * \throw If the data array of \a field is not set. + * \throw If \a this->_arr is already allocated but has different number of components + * than \a field. + * \throw If the underlying mesh of \a field has no name. + * \throw If elements in the mesh are not in the order suitable for writing to the MED file. */ void MEDFileField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception) { @@ -3583,7 +3963,26 @@ void MEDFileField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFieldDoubl } /*! - * Generalization of MEDFileField1TSWithoutSDA::setFieldNoProfileSBT method. + * Adds a MEDCouplingFieldDouble to \a this. Specified entities of a given dimension + * of a given mesh are used as the support of the given field (a real support is not used). + * Elements of the given mesh must be sorted suitable for writing to MED file. + * Order of underlying mesh entities of the given field specified by \a profile parameter + * is not prescribed; this method permutes field values to have them sorted by element + * type as required for writing to MED file. A new profile is added only if no equal + * profile is missing. + * \param [in] field - the field to add to \a this. + * \param [in] mesh - the supporting mesh of \a field. + * \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on. + * \param [in] profile - ids of mesh entities on which corresponding field values lie. + * \param [in,out] glob - the global data where profiles and localization present in + * \a field, if any, are added. + * \throw If either \a field or \a mesh or \a profile has an empty name. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. + * \throw If the data array of \a field is not set. + * \throw If \a this->_arr is already allocated but has different number of components + * than \a field. + * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. + * \sa setFieldNoProfileSBT() */ void MEDFileField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception) { @@ -3615,6 +4014,27 @@ void MEDFileField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDouble *fi } } +/*! + * Returns a new MEDCouplingFieldDouble of given type lying on a given support. + * \param [in] type - a spatial discretization of the new field. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] mName - a name of the supporting mesh. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \param [in] glob - the global data storing profiles and localization. + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If the MED file is not readable. + * \throw If there is no mesh named \a mName in the MED file. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. + * \throw If no field of \a this is lying on the mesh \a mName. + * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. + */ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception) { MEDCouplingAutoRefCountObjectPtr mm; @@ -3625,6 +4045,26 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtLevel(TypeOfField t return MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm); } +/*! + * Returns a new MEDCouplingFieldDouble of given type lying on a given support. + * \param [in] type - a spatial discretization of the new field. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \param [in] glob - the global data storing profiles and localization. + * \param [in] mesh - the supporting mesh. + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If the MED file is not readable. + * \throw If no field of \a this is lying on \a mesh. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. + * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. + */ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception) { MEDCouplingAutoRefCountObjectPtr m=mesh->getGenMeshAtLevel(meshDimRelToMax,false); @@ -3635,6 +4075,26 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfF return MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e); } +/*! + * Returns a new MEDCouplingFieldDouble of a given type lying on the top level cells of a + * given mesh. + * \param [in] type - a spatial discretization of the new field. + * \param [in] mName - a name of the supporting mesh. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \param [in] glob - the global data storing profiles and localization. + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If the MED file is not readable. + * \throw If there is no mesh named \a mName in the MED file. + * \throw If there are no mesh entities in the mesh. + * \throw If no field values of the given \a type are available. + */ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception) { MEDCouplingAutoRefCountObjectPtr mm; @@ -3648,7 +4108,26 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtTopLevel(TypeOfFiel } /*! - * \param [in] mesh is the whole mesh. + * Returns a new MEDCouplingFieldDouble of given type lying on a given support. + * \param [in] type - a spatial discretization of the new field. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \param [in] glob - the global data storing profiles and localization. + * \param [in] mesh - the supporting mesh. + * \param [in] cellRenum - the cell numbers array used for permutation of the result + * field according to \a renumPol. + * \param [in] nodeRenum - the node numbers array used for permutation of the result + * field according to \a renumPol. + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. + * \throw If no field of \a this is lying on \a mesh. + * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception) { @@ -3705,6 +4184,22 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfF } } +/*! + * Returns values and a profile of the field of a given type lying on a given support. + * \param [in] type - a spatial discretization of the field. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] mesh - the supporting mesh. + * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the + * field of interest lies on. If the field lies on all entities of the given + * dimension, all ids in \a pfl are zero. The caller is to delete this array + * using decrRef() as it is no more needed. + * \param [in] glob - the global data storing profiles and localization. + * \return DataArrayDouble * - a new instance of DataArrayDouble holding values of the + * field. The caller is to delete this array using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. + * \throw If no field of \a this is lying on \a mesh. + * \throw If no field values of the given \a type are available. + */ DataArrayDouble *MEDFileField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception) { MEDCouplingAutoRefCountObjectPtr m=mesh->getGenMeshAtLevel(meshDimRelToMax); @@ -3713,10 +4208,11 @@ DataArrayDouble *MEDFileField1TSWithoutSDA::getFieldWithProfile(TypeOfField type } /*! - * This method retrieves direct access to the underground ParaMEDMEM::DataArrayDouble instance. The returned array is not a newly - * created array so it should \b not be dealed by the caller. - * This method allows to the user a direct access to the values. - * This method is quite unusable if there is more than a nodal field or a cell field on single geometric cell type. + * Returns a pointer to the underground DataArrayDouble instance. So the + * caller should not decrRef() it. This method allows for a direct access to the field + * values. This method is quite unusable if there is more than a nodal field or a cell + * field on single geometric cell type. + * \return DataArrayDouble * - the pointer to the field values array. */ DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArray() const throw(INTERP_KERNEL::Exception) { @@ -3728,11 +4224,20 @@ DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArray() const thro } /*! - * This method returns an array that the caller must deal with (contrary to those returned by MEDFileField1TSWithoutSDA::getUndergroundDataArray method). - * The returned array is the result of the aggregation of all sub arrays stored in the MED file. So to allow the caller to select the output param - * 'entries' is returned. This output param is a vector of a pair of 2 pairs. The first pair of pair informs of the geometric type it refers to and the discretization - * id attached to it. The second pair of pair precise the range [begin,end) into the returned array. - * This method makes the hypothesis that the field lies only on one mesh. If it is not the case an exception will be thrown. + * Returns a pointer to the underground DataArrayDouble instance and a + * sequence describing parameters of a support of each part of \a this field. The + * caller should not decrRef() the returned DataArrayDouble. This method allows for a + * direct access to the field values. This method is intended for the field lying on one + * mesh only. + * \param [in,out] entries - the sequence describing parameters of a support of each + * part of \a this field. Each item of this sequence consists of two parts. The + * first part describes a type of mesh entity and an id of discretization of a + * current field part. The second part describes a range of values [begin,end) + * within the returned array relating to the current field part. + * \return DataArrayDouble * - the pointer to the field values array. + * \throw If the number of underlying meshes is not equal to 1. + * \throw If no field values are available. + * \sa getUndergroundDataArray() */ DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const throw(INTERP_KERNEL::Exception) { @@ -3865,9 +4370,12 @@ const DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray() const } /*! - * This methods returns a new instance (to be dealt by the caller). - * This method returns for the first field in the file \a fileName the first time step of this first field, if - * such field exists and time step exists. If not, an INTERP_KERNEL::Exception will be thrown. + * Returns a new instance of MEDFileField1TS holding data of the first time step of + * the first field that has been read from a specified MED file. + * \param [in] fileName - the name of the MED file to read. + * \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. + * \throw If reading the file fails. */ MEDFileField1TS *MEDFileField1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception) { @@ -3875,33 +4383,66 @@ MEDFileField1TS *MEDFileField1TS::New(const char *fileName) throw(INTERP_KERNEL: } /*! - * This methods returns a new instance (to be dealt by the caller). - * This method returns the first time step of the field \a fieldName in file \a fieldName, if - * such field exists. If not, an INTERP_KERNEL::Exception will be thrown. + * Returns a new instance of MEDFileField1TS holding data of the first time step of + * a given field that has been read from a specified MED file. + * \param [in] fileName - the name of the MED file to read. + * \param [in] fieldName - the name of the field to read. + * \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. + * \throw If reading the file fails. + * \throw If there is no field named \a fieldName in the file. */ MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) { return new MEDFileField1TS(fileName,fieldName); } +/*! + * Returns a new instance of MEDFileField1TS holding data of a given time step of + * a given field that has been read from a specified MED file. + * \param [in] fileName - the name of the MED file to read. + * \param [in] fieldName - the name of the field to read. + * \param [in] iteration - the iteration number of a required time step. + * \param [in] order - the iteration order number of required time step. + * \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. + * \throw If reading the file fails. + * \throw If there is no field named \a fieldName in the file. + * \throw If the required time step is missing from the file. + */ MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception) { return new MEDFileField1TS(fileName,fieldName,iteration,order); } /*! + * Returns a new instance of MEDFileField1TS holding either deep or shallow copy + * of a given MEDFileField1TSWithoutSDA. * \warning this is a shallow copy constructor + * \param [in] other - a MEDFileField1TSWithoutSDA to copy. + * \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created. + * \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. */ MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent) { return new MEDFileField1TS(other,shallowCopyOfContent); } +/*! + * Returns a new empty instance of MEDFileField1TS. + * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller + * is to delete this field using decrRef() as it is no more needed. + */ MEDFileField1TS *MEDFileField1TS::New() { return new MEDFileField1TS; } +/*! + * Returns a string describing \a this field. This string is outputted + * by \c print Python command. + */ std::string MEDFileField1TS::simpleRepr() const { std::ostringstream oss; @@ -3930,6 +4471,17 @@ void MEDFileField1TS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) _content->writeLL(fid,*this); } +/*! + * Writes \a this field into a MED file specified by its name. + * \param [in] fileName - the MED file name. + * \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics. + * - 2 - erase; an existing file is removed. + * - 1 - append; same data should not be present in an existing file. + * - 0 - overwrite; same data present in an existing file is overwritten. + * \throw If the field name is not set. + * \throw If no field data is set. + * \throw If \a mode == 1 and the same data is present in an existing file. + */ void MEDFileField1TS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception) { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); @@ -4168,10 +4720,27 @@ void MEDFileField1TS::changeLocsRefsNamesGen(const std::vector< std::pairgetFieldAtLevel(type,meshDimRelToMax,0,renumPol,this); } - /*! - * This method is close to MEDFileField1TS::getFieldAtLevel except that here the 'meshDimRelToMax' param is ignored and the maximal dimension is taken - * automatically. If the field lies on different level and that an another level than the maximal is requested MEDFileField1TS::getFieldAtLevel - * should be called instead. + * Returns a new MEDCouplingFieldDouble of a given type lying on + * the top level cells of the first mesh in MED file. If \a this field + * has not been constructed via file reading, an exception is thrown. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of interest. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If \a this field has not been constructed via file reading. + * \throw If the MED file is not readable. + * \throw If there is no mesh in the MED file. + * \throw If no field values of the given \a type. + * \throw If no field values lying on the top level support. + * \sa getFieldAtLevel() */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, int renumPol) const throw(INTERP_KERNEL::Exception) { @@ -4192,11 +4777,26 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, in return _content->getFieldAtTopLevel(type,0,renumPol,this); } + /*! - * \b WARNING, there is a main difference with the two close methods (MEDFileField1TS::getFieldAtLevel and MEDFileField1TS::getFieldOnMeshAtLevel method) ! - * Here the mesh-dimension of 'mesh' is used by this to automatically request the right geoTypes regarding 'type'. - * If no such element fufilled the deduced dimension and 'type' an exception will be thrown. - * It leads that the returned field of this method is always coherent. + * Returns a new MEDCouplingFieldDouble of given type lying on a given mesh. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of the new field. + * \param [in] mesh - the supporting mesh. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If no field of \a this is lying on \a mesh. + * \throw If the mesh is empty. + * \throw If no field values of the given \a type are available. + * \sa getFieldAtLevel() + * \sa getFieldOnMeshAtLevel() */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception) { @@ -4204,9 +4804,25 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, } /*! - * This method can be called whatever the mode of instance feeding of this (MED file or from scratch). - * But the parameter ''meshDimRelToMax' is applyied on 'mesh' (like MEDFileField1TS::getFieldAtLevel does). \b WARNING the dim of 'this' can be different from those in 'mesh' ! - * It leads that the returned field of this method is always coherent. + * Returns a new MEDCouplingFieldDouble of a given type lying on a given support. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of interest. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] mesh - the supporting mesh. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. + * \throw If no field of \a this is lying on \a mesh. + * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. + * \sa getFieldAtLevel() + * \sa getFieldOnMeshAtLevel() */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception) { @@ -4214,9 +4830,30 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, } /*! - * This method is identical to MEDFileField1TS::getFieldAtLevel method except that meshName 'mname' should be specified. - * This method is called "Old" because in MED3 norm a field has only one meshName attached. This method is only here for reader of MED2 files. - * See MEDFileField1TS::getFieldAtLevel for more information. + * Returns a new MEDCouplingFieldDouble of a given type lying on a given support. + * This method is called "Old" because in MED3 norm a field has only one meshName + * attached, so this method is for readers of MED2 files. If \a this field + * has not been constructed via file reading, an exception is thrown. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of interest. + * \param [in] mName - a name of the supporting mesh. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If the MED file is not readable. + * \throw If there is no mesh named \a mName in the MED file. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. + * \throw If \a this field has not been constructed via file reading. + * \throw If no field of \a this is lying on the mesh named \a mName. + * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. + * \sa getFieldAtLevel() */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception) { @@ -4225,15 +4862,40 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, co return _content->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this); } + +/*! + * Returns values and a profile of the field of a given type lying on a given support. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of the field. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] mesh - the supporting mesh. + * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the + * field of interest lies on. If the field lies on all entities of the given + * dimension, all ids in \a pfl are zero. The caller is to delete this array + * using decrRef() as it is no more needed. + * \return DataArrayDouble * - a new instance of DataArrayDouble holding values of the + * field. The caller is to delete this array using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. + * \throw If no field of \a this is lying on \a mesh. + * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. + */ DataArrayDouble *MEDFileField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception) { return _content->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this); } /*! - * SBT means Sort By Type. - * This method is the most basic method to assign field in this. Basic in sense that no renumbering is done. Underlying mesh in 'field' is globaly ignored except for type contiguous check. - * + * Adds a MEDCouplingFieldDouble to \a this. The underlying mesh of the given field is + * checked if its elements are sorted suitable for writing to MED file ("STB" stands for + * "Sort By Type"), if not, an exception is thrown. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] field - the field to add to \a this. + * \throw If the name of \a field is empty. + * \throw If the data array of \a field is not set. + * \throw If the data array is already allocated but has different number of components + * than \a field. + * \throw If the underlying mesh of \a field has no name. + * \throw If elements in the mesh are not in the order suitable for writing to the MED file. */ void MEDFileField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception) { @@ -4242,12 +4904,25 @@ void MEDFileField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) } /*! - * This method is a generalization of MEDFileField1TS::setFieldNoProfileSBT method. Here a profile array is given in input. - * The support of field 'field' is \b not used by this method, so it can be null or incoherent with field. - * This method uses input parameters 'mesh', 'meshDimRelToMax' and 'profile' to determine what is really the support of field 'field'. If field is incoherent regarding this deduced support, - * an exception will be thrown. - * This method is trying to reduce the size of MEDfile file so profile is created only if it is absolutely necessary. If it is necessary the name of 'profile' will be used to create it in 'this'. - * In this case, if this profile name is empty an exception will be thrown. + * Adds a MEDCouplingFieldDouble to \a this. Specified entities of a given dimension + * of a given mesh are used as the support of the given field (a real support is not used). + * Elements of the given mesh must be sorted suitable for writing to MED file. + * Order of underlying mesh entities of the given field specified by \a profile parameter + * is not prescribed; this method permutes field values to have them sorted by element + * type as required for writing to MED file. A new profile is added only if no equal + * profile is missing. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] field - the field to add to \a this. + * \param [in] mesh - the supporting mesh of \a field. + * \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on. + * \param [in] profile - ids of mesh entities on which corresponding field values lie. + * \throw If either \a field or \a mesh or \a profile has an empty name. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. + * \throw If the data array of \a field is not set. + * \throw If the data array of \a this is already allocated but has different number of + * components than \a field. + * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. + * \sa setFieldNoProfileSBT() */ void MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception) { @@ -5088,21 +5763,52 @@ void MEDFileFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< s (*it)->changeLocsRefsNamesGen2(mapOfModif); } +/*! + * Returns a new empty instance of MEDFileFieldMultiTS. + * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. + */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New() { return new MEDFileFieldMultiTS; } +/*! + * Returns a new instance of MEDFileFieldMultiTS holding data of the first field + * that has been read from a specified MED file. + * \param [in] fileName - the name of the MED file to read. + * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. + * \throw If reading the file fails. + */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception) { return new MEDFileFieldMultiTS(fileName); } +/*! + * Returns a new instance of MEDFileFieldMultiTS holding data of a given field + * that has been read from a specified MED file. + * \param [in] fileName - the name of the MED file to read. + * \param [in] fieldName - the name of the field to read. + * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. + * \throw If reading the file fails. + * \throw If there is no field named \a fieldName in the file. + */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) { return new MEDFileFieldMultiTS(fileName,fieldName); } +/*! + * Returns a new instance of MEDFileFieldMultiTS holding either deep or shallow copy + * of a given MEDFileFieldMultiTSWithoutSDA. + * \param [in] other - a MEDFileFieldMultiTSWithoutSDA to copy. + * \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created. + * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller + * is to delete this field using decrRef() as it is no more needed. + */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent) { return new MEDFileFieldMultiTS(other,shallowCopyOfContent); @@ -5126,7 +5832,11 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::deepCpy() const throw(INTERP_KERNEL::E } /*! - * \return a new allocated object that the caller should deal with. + * Returns a new MEDFileField1TS holding data of a given time step of \a this field. + * \param [in] pos - a time step id. + * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to + * delete this field using decrRef() as it is no more needed. + * \throw If \a pos is not a valid time step id. */ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception) { @@ -5137,7 +5847,12 @@ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const throw(INTE } /*! - * \return a new allocated object that the caller should deal with. + * Returns a new MEDFileField1TS holding data of a given time step of \a this field. + * \param [in] iteration - the iteration number of a required time step. + * \param [in] order - the iteration order number of required time step. + * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to + * delete this field using decrRef() as it is no more needed. + * \throw If there is no required time step in \a this field. */ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception) { @@ -5146,7 +5861,12 @@ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStep(int iteration, int order) cons } /*! - * \return a new allocated object that the caller should deal with. + * Returns a new MEDFileField1TS holding data of a given time step of \a this field. + * \param [in] time - the time of the time step of interest. + * \param [in] eps - a precision used to compare time values. + * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to + * delete this field using decrRef() as it is no more needed. + * \throw If there is no required time step in \a this field. */ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception) { @@ -5173,6 +5893,17 @@ void MEDFileFieldMultiTS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Except _content->writeLL(fid,*this); } +/*! + * Writes \a this field into a MED file specified by its name. + * \param [in] fileName - the MED file name. + * \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics. + * - 2 - erase; an existing file is removed. + * - 1 - append; same data should not be present in an existing file. + * - 0 - overwrite; same data present in an existing file is overwritten. + * \throw If the field name is not set. + * \throw If no field data is set. + * \throw If \a mode == 1 and the same data is present in an existing file. + */ void MEDFileFieldMultiTS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception) { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); @@ -5181,8 +5912,26 @@ void MEDFileFieldMultiTS::write(const char *fileName, int mode) const throw(INTE } /*! - * Performs the job than MEDFileField1TS::getFieldAtLevel except that (iteration,order) couple should be specified ! - * If such couple does not exist an exception is thrown. + * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on + * mesh entities of a given dimension of the first mesh in MED file. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of interest. + * \param [in] iteration - the iteration number of a required time step. + * \param [in] order - the iteration order number of required time step. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If the MED file is not readable. + * \throw If there is no mesh in the MED file. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. + * \throw If no field values of the required parameters are available. */ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception) { @@ -5190,6 +5939,26 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, i return myF1TS.getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this); } +/*! + * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on + * the top level cells of the first mesh in MED file. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of interest. + * \param [in] iteration - the iteration number of a required time step. + * \param [in] order - the iteration order number of required time step. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If the MED file is not readable. + * \throw If there is no mesh in the MED file. + * \throw If no field values of the required parameters are available. + */ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol) const throw(INTERP_KERNEL::Exception) { const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order); @@ -5197,8 +5966,26 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type } /*! - * Performs the job than MEDFileField1TS::getFieldOnMeshAtLevel except that (iteration,order) couple should be specified ! - * If such couple does not exist an exception is thrown. + * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on + * a given support. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of interest. + * \param [in] iteration - the iteration number of a required time step. + * \param [in] order - the iteration order number of required time step. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] mesh - the supporting mesh. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. + * \throw If no field of \a this is lying on \a mesh. + * \throw If no field values of the required parameters are available. */ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception) { @@ -5207,8 +5994,24 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t } /*! - * Performs the job than MEDFileField1TS::getFieldOnMeshAtLevel except that (iteration,order) couple should be specified ! - * If such couple does not exist an exception is thrown. + * Returns a new MEDCouplingFieldDouble of given type, of a given time step, lying on a + * given support. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of the new field. + * \param [in] iteration - the iteration number of a required time step. + * \param [in] order - the iteration order number of required time step. + * \param [in] mesh - the supporting mesh. + * \param [in] renumPol - specifies how to permute values of the result field according to + * the optional numbers of cells and nodes, if any. The valid values are + * - 0 - do not permute. + * - 1 - permute cells. + * - 2 - permute nodes. + * - 3 - permute cells and nodes. + * + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. + * \throw If no field of \a this is lying on \a mesh. + * \throw If no field values of the required parameters are available. */ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception) { @@ -5227,17 +6030,67 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type return myF1TS.getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this); } +/*! + * Returns values and a profile of the field of a given type, of a given time step, + * lying on a given support. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] type - a spatial discretization of the field. + * \param [in] iteration - the iteration number of a required time step. + * \param [in] order - the iteration order number of required time step. + * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. + * \param [in] mesh - the supporting mesh. + * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the + * field of interest lies on. If the field lies on all entities of the given + * dimension, all ids in \a pfl are zero. The caller is to delete this array + * using decrRef() as it is no more needed. + * \param [in] glob - the global data storing profiles and localization. + * \return DataArrayDouble * - a new instance of DataArrayDouble holding values of the + * field. The caller is to delete this array using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. + * \throw If no field of \a this is lying on \a mesh. + * \throw If no field values of the required parameters are available. + */ DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception) { const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order); return myF1TS.getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this); } +/*! + * Adds a MEDCouplingFieldDouble to \a this as another time step. The underlying mesh of + * the given field is checked if its elements are sorted suitable for writing to MED file + * ("STB" stands for "Sort By Type"), if not, an exception is thrown. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] field - the field to add to \a this. + * \throw If the name of \a field is empty. + * \throw If the data array of \a field is not set. + * \throw If existing time steps have different name or number of components than \a field. + * \throw If the underlying mesh of \a field has no name. + * \throw If elements in the mesh are not in the order suitable for writing to the MED file. + */ void MEDFileFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception) { _content->appendFieldNoProfileSBT(field,*this); } +/*! + * Adds a MEDCouplingFieldDouble to \a this as another time step. Specified entities of + * a given dimension of a given mesh are used as the support of the given field. + * Elements of the given mesh must be sorted suitable for writing to MED file. + * Order of underlying mesh entities of the given field specified by \a profile parameter + * is not prescribed; this method permutes field values to have them sorted by element + * type as required for writing to MED file. + * For more info, see \ref AdvMEDLoaderAPIFieldRW + * \param [in] field - the field to add to \a this. + * \param [in] mesh - the supporting mesh of \a field. + * \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on. + * \param [in] profile - ids of mesh entities on which corresponding field values lie. + * \throw If either \a field or \a mesh or \a profile has an empty name. + * \throw If existing time steps have different name or number of components than \a field. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. + * \throw If the data array of \a field is not set. + * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. + */ void MEDFileFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception) { _content->appendFieldProfile(field,mesh,meshDimRelToMax,profile,*this); diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index be85b93ba..9b0363e9e 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -34,7 +34,7 @@ using namespace ParaMEDMEM; const char MEDFileMesh::DFT_FAM_NAME[]="FAMILLE_ZERO"; -MEDFileMesh::MEDFileMesh():_order(-1),_iteration(-1),_time(0.) +MEDFileMesh::MEDFileMesh():_order(-1),_iteration(-1),_time(0.),_univ_wr_status(true) { } @@ -52,6 +52,16 @@ std::size_t MEDFileMesh::getHeapMemorySize() const return ret; } +/*! + * Returns a new MEDFileMesh holding the mesh data that has been read from a given MED + * file. The first mesh in the file is loaded. + * \param [in] fileName - the name of MED file to read. + * \return MEDFileMesh * - a new instance of MEDFileMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + * \throw If the file is not readable. + * \throw If there is no meshes in the file. + * \throw If the mesh in the file is of a not supported type. + */ MEDFileMesh *MEDFileMesh::New(const char *fileName) throw(INTERP_KERNEL::Exception) { std::vector ms=MEDLoader::GetMeshNames(fileName); @@ -84,7 +94,7 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName) throw(INTERP_KERNEL::Excepti { MEDCouplingAutoRefCountObjectPtr ret=MEDFileCurveLinearMesh::New(); ret->loadCLMeshFromFile(fid,ms.front().c_str(),dt,it); - return (MEDFileCMesh *)ret.retn(); + return (MEDFileCurveLinearMesh *)ret.retn(); } default: { @@ -94,6 +104,20 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName) throw(INTERP_KERNEL::Excepti } } +/*! + * Returns a new MEDFileMesh holding the mesh data that has been read from a given MED + * file. The mesh to load is specified by its name and numbers of a time step and an + * iteration. + * \param [in] fileName - the name of MED file to read. + * \param [in] mName - the name of the mesh to read. + * \param [in] dt - the number of a time step. + * \param [in] it - the number of an iteration. + * \return MEDFileMesh * - a new instance of MEDFileMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + * \throw If the file is not readable. + * \throw If there is no mesh with given attributes in the file. + * \throw If the mesh in the file is of a not supported type. + */ MEDFileMesh *MEDFileMesh::New(const char *fileName, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception) { MEDFileUtilities::CheckFileForRead(fileName); @@ -116,6 +140,12 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName, const char *mName, int dt, i ret->loadCMeshFromFile(fid,mName,dt,it); return (MEDFileCMesh *)ret.retn(); } + case CURVE_LINEAR: + { + MEDCouplingAutoRefCountObjectPtr ret=MEDFileCurveLinearMesh::New(); + ret->loadCLMeshFromFile(fid,mName,dt,it); + return (MEDFileCurveLinearMesh *)ret.retn(); + } default: { std::ostringstream oss; oss << "MEDFileMesh::New : MED file exists and has mesh '" << mName << "' exists but unsupported type yet !"; @@ -124,6 +154,13 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName, const char *mName, int dt, i } } +/*! + * Writes \a this mesh into an open MED file specified by its descriptor. + * \param [in] fid - the MED file descriptor. + * \throw If the mesh name is not set. + * \throw If the file is open for reading only. + * \throw If the writing mode == 1 and the same data is present in an existing file. + */ void MEDFileMesh::write(med_idt fid) const throw(INTERP_KERNEL::Exception) { if(!existsFamily(0)) @@ -133,6 +170,16 @@ void MEDFileMesh::write(med_idt fid) const throw(INTERP_KERNEL::Exception) writeLL(fid); } +/*! + * Writes \a this mesh into a MED file specified by its name. + * \param [in] fileName - the MED file name. + * \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics. + * - 2 - erase; an existing file is removed. + * - 1 - append; same data should not be present in an existing file. + * - 0 - overwrite; same data present in an existing file is overwritten. + * \throw If the mesh name is not set. + * \throw If \a mode == 1 and the same data is present in an existing file. + */ void MEDFileMesh::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception) { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); @@ -142,6 +189,13 @@ void MEDFileMesh::write(const char *fileName, int mode) const throw(INTERP_KERNE write(fid); } +/*! + * Checks if \a this and another mesh are equal. + * \param [in] other - the mesh to compare with. + * \param [in] eps - a precision used to compare real values. + * \param [in,out] what - the string returning description of unequal data. + * \return bool - \c true if the meshes are equal, \c false, else. + */ bool MEDFileMesh::isEqual(const MEDFileMesh *other, double eps, std::string& what) const { if(_order!=other->_order) @@ -169,11 +223,7 @@ bool MEDFileMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wha what="Names differ !"; return false; } - if(_univ_name!=other->_univ_name) - { - what="Univ names differ !"; - return false; - } + //univ_name has been ignored -> not a bug because it is a mutable attribute if(_desc_name!=other->_desc_name) { what="Description names differ !"; @@ -186,6 +236,9 @@ bool MEDFileMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wha return true; } +/*! + * Clears redundant attributes of incorporated data arrays. + */ void MEDFileMesh::clearNonDiscrAttributes() const { @@ -204,12 +257,22 @@ bool MEDFileMesh::changeNames(const std::vector< std::pair - a sequence of names of the families. + * \throw If the name of a nonexistent group is specified. + */ std::vector MEDFileMesh::getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception) { std::string oname(name); @@ -224,6 +287,12 @@ std::vector MEDFileMesh::getFamiliesOnGroup(const char *name) const return (*it).second; } +/*! + * Returns names of families constituting some groups. + * \param [in] grps - a sequence of names of groups of interest. + * \return std::vector - a sequence of names of the families. + * \throw If a name of a nonexistent group is present in \a grps. + */ std::vector MEDFileMesh::getFamiliesOnGroups(const std::vector& grps) const throw(INTERP_KERNEL::Exception) { std::set fams; @@ -243,6 +312,12 @@ std::vector MEDFileMesh::getFamiliesOnGroups(const std::vector - sequence of ids of the families. + * \throw If the name of a nonexistent group is specified. + */ std::vector MEDFileMesh::getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception) { std::string oname(name); @@ -258,8 +333,11 @@ std::vector MEDFileMesh::getFamiliesIdsOnGroup(const char *name) const thro } /*! - * This method sets families at a corresponding groups existing or not. If it existed, it is replaced by new 'fams'. - * Each entry in 'fams' is checked if it is not still existing default id 0 is set. + * Sets names of families constituting a group. If data on families of this group is + * already present, it is overwritten. Every family in \a fams is checked, and if a + family is not yet in \a this mesh, the default group id \c 0 is assigned to it. + * \param [in] name - the name of the group of interest. + * \param [in] fams - a sequence of names of families constituting the group. */ void MEDFileMesh::setFamiliesOnGroup(const char *name, const std::vector& fams) throw(INTERP_KERNEL::Exception) { @@ -274,8 +352,12 @@ void MEDFileMesh::setFamiliesOnGroup(const char *name, const std::vector& famIds) throw(INTERP_KERNEL::Exception) { @@ -290,6 +372,11 @@ void MEDFileMesh::setFamiliesIdsOnGroup(const char *name, const std::vector _groups[oname]=fams; } +/*! + * Returns names of groups including a given family. + * \param [in] name - the name of the family of interest. + * \return std::vector - a sequence of names of groups including the family. + */ std::vector MEDFileMesh::getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception) { std::vector ret; @@ -306,7 +393,10 @@ std::vector MEDFileMesh::getGroupsOnFamily(const char *name) const } /*! - * This method expects that family 'famName' is already existing. If not an exception will be thrown. + * Adds an existing family to groups. + * \param [in] famName - a name of family to add to \a grps. + * \param [in] grps - a sequence of group names to add the family in. + * \throw If a family named \a famName not yet exists. */ void MEDFileMesh::setGroupsOnFamily(const char *famName, const std::vector& grps) throw(INTERP_KERNEL::Exception) { @@ -332,6 +422,10 @@ void MEDFileMesh::setGroupsOnFamily(const char *famName, const std::vector - a sequence of group names. + */ std::vector MEDFileMesh::getGroupsNames() const { std::vector ret(_groups.size()); @@ -341,6 +435,10 @@ std::vector MEDFileMesh::getGroupsNames() const return ret; } +/*! + * Returns names of all families of \a this mesh. + * \return std::vector - a sequence of family names. + */ std::vector MEDFileMesh::getFamiliesNames() const { std::vector ret(_families.size()); @@ -351,7 +449,8 @@ std::vector MEDFileMesh::getFamiliesNames() const } /*! - * This method scans every families and for each families shared by only one group, the corresponding family takes the same name than the group. + * Changes a name of every family, included in one group only, to be same as the group name. + * \throw If there are families with equal names in \a this mesh. */ void MEDFileMesh::assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception) { @@ -386,6 +485,11 @@ void MEDFileMesh::assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception _groups=groups; } +/*! + * Removes a group from \a this mesh. + * \param [in] name - the name of the group to remove. + * \throw If no group with such a \a name exists. + */ void MEDFileMesh::removeGroup(const char *name) throw(INTERP_KERNEL::Exception) { std::string oname(name); @@ -400,6 +504,11 @@ void MEDFileMesh::removeGroup(const char *name) throw(INTERP_KERNEL::Exception) _groups.erase(it); } +/*! + * Removes a family from \a this mesh. + * \param [in] name - the name of the family to remove. + * \throw If no family with such a \a name exists. + */ void MEDFileMesh::removeFamily(const char *name) throw(INTERP_KERNEL::Exception) { std::string oname(name); @@ -421,6 +530,13 @@ void MEDFileMesh::removeFamily(const char *name) throw(INTERP_KERNEL::Exception) } } +/*! + * Renames a group in \a this mesh. + * \param [in] oldName - a current name of the group to rename. + * \param [in] newName - a new group name. + * \throw If no group named \a oldName exists in \a this mesh. + * \throw If a group named \a newName already exists. + */ void MEDFileMesh::changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception) { std::string oname(oldName); @@ -445,8 +561,10 @@ void MEDFileMesh::changeGroupName(const char *oldName, const char *newName) thro } /*! - * This method changes the family ids in 'this'. It leads to a modification into '_families' attributes \b and in - * ids stored in arrays. This method calls MEDFileMesh::changeFamilyIdArr method. + * Changes an id of a family in \a this mesh. + * This method calls changeFamilyIdArr(). + * \param [in] oldId - a current id of the family. + * \param [in] newId - a new family id. */ void MEDFileMesh::changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception) { @@ -462,6 +580,13 @@ void MEDFileMesh::changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exce _families=fam2; } +/*! + * Renames a family in \a this mesh. + * \param [in] oldName - a current name of the family to rename. + * \param [in] newName - a new family name. + * \throw If no family named \a oldName exists in \a this mesh. + * \throw If a family named \a newName already exists. + */ void MEDFileMesh::changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception) { std::string oname(oldName); @@ -492,6 +617,13 @@ void MEDFileMesh::changeFamilyName(const char *oldName, const char *newName) thr } } +/*! + * Checks if \a this and another mesh contains the same families. + * \param [in] other - the mesh to compare with \a this one. + * \param [in,out] what - an unused parameter. + * \return bool - \c true if number of families and their ids are the same in the two + * meshes. Families with the id == \c 0 are not considered. + */ bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) const { if(_families==other->_families) @@ -507,6 +639,14 @@ bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) cons return fam0==fam1; } +/*! + * Checks if \a this and another mesh contains the same groups. + * \param [in] other - the mesh to compare with \a this one. + * \param [in,out] what - a string describing a difference of groups of the two meshes + * in case if this method returns \c false. + * \return bool - \c true if number of groups and families constituting them are the + * same in the two meshes. + */ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) const { if(_groups==other->_groups) @@ -559,12 +699,22 @@ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) cons return ret; } +/*! + * Checks if a group with a given name exists in \a this mesh. + * \param [in] groupName - the group name. + * \return bool - \c true the group \a groupName exists in \a this mesh. + */ bool MEDFileMesh::existsGroup(const char *groupName) const { std::string grpName(groupName); return _groups.find(grpName)!=_groups.end(); } +/*! + * Checks if a family with a given id exists in \a this mesh. + * \param [in] famId - the family id. + * \return bool - \c true the family with the id \a famId exists in \a this mesh. + */ bool MEDFileMesh::existsFamily(int famId) const { for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) @@ -573,12 +723,22 @@ bool MEDFileMesh::existsFamily(int famId) const return false; } +/*! + * Checks if a family with a given name exists in \a this mesh. + * \param [in] familyName - the family name. + * \return bool - \c true the family \a familyName exists in \a this mesh. + */ bool MEDFileMesh::existsFamily(const char *familyName) const { std::string fname(familyName); return _families.find(fname)!=_families.end(); } +/*! + * Sets an id of a family. + * \param [in] familyName - the family name. + * \param [in] id - a new id of the family. + */ void MEDFileMesh::setFamilyId(const char *familyName, int id) { std::string fname(familyName); @@ -601,8 +761,10 @@ void MEDFileMesh::setFamilyIdUnique(const char *familyName, int id) throw(INTERP } /*! - * This method appends a new entry in _families attribute. An exception is thrown if either the famId is already - * kept by an another familyName. An exception is thrown if name 'familyName' is alreadyset with a different 'famId'. + * Adds a family to \a this mesh. + * \param [in] familyName - a name of the family. + * \param [in] famId - an id of the family. + * \throw If a family with the same name or id already exists in \a this mesh. */ void MEDFileMesh::addFamily(const char *familyName, int famId) throw(INTERP_KERNEL::Exception) { @@ -631,12 +793,17 @@ void MEDFileMesh::addFamily(const char *familyName, int famId) throw(INTERP_KERN } /*! - * This method creates a new group called 'groupName' in 'this'. If it exists a group with the same name an INTERP_KERNEL::Exception will be thrown. - * If the 'meshDimRelToMaxExt' is not existing an INTERP_KERNEL::Exception will be thrown too. - * \b WARNING : This method does \b not garantee that 'groupName' lies only on a single level specified by 'meshDimRelToMaxExt'. - * in the case of a presence of one or more family id in family field at 'meshDimRelToMaxExt' level that appears in another level. - * If there is a risk of such case call MEDFileMesh::keepFamIdsOnlyOnLevs method \b before calling this method. - * (call to MEDFileMesh::keepFamIdsOnlyOnLevs should be done with MEDFileMesh::getFamiliesIdsOnGroup('groupName' as first input ). + * Creates a group including all mesh entities of given dimension. + * \warning This method does \b not guarantee that the created group includes mesh + * entities of only \a meshDimRelToMaxExt dimension in the case if some family id is + * present in family fields of different dimensions. To assure this, call + * ensureDifferentFamIdsPerLevel() \b before calling this method. + * \param [in] meshDimRelToMaxExt - a relative dimension of mesh entities to include to + * the group. + * \param [in] groupName - a name of the new group. + * \throw If a group named \a groupName already exists. + * \throw If no mesh entities of dimension \a meshDimRelToMaxExt exist in \a this mesh. + * \throw If no family field of dimension \a meshDimRelToMaxExt is present in \a this mesh. */ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception) { @@ -671,10 +838,13 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const char *groupName } /*! - * This method checks that family Ids in 'famIds' are not present in levels \b not in 'vMeshDimRelToMaxExt'. - * If it is the case true is returned and 'this' is not modified. - * If there is some levels not in 'vMeshDimRelToMaxExt' where one or more family ids in 'famIds' appear - * new families are created and groups are updated in consequence. + * Ensures that given family ids do not present in family fields of dimensions different + * than given ones. If a family id is present in the family fields of dimensions different + * than the given ones, a new family is created and the whole data is updated accordingly. + * \param [in] famIds - a sequence of family ids to check. + * \param [in] vMeshDimRelToMaxExt - a sequence of relative dimensions to which the \a + * famIds should exclusively belong. + * \return bool - \c true if no modification is done in \a this mesh by this method. */ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& vMeshDimRelToMaxExt) throw(INTERP_KERNEL::Exception) { @@ -714,10 +884,12 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std } /*! - * This method add into the family list of a group 'grpName' the family with name 'famName'. - * If the group 'grpName' does not exist it is created and 'famName' is added to the list. - * If the group 'grpName' already exists, 'famName' will be added into family list of the existing group. - * This method throws an INTERP_KERNEL::Exception if 'famName' does not exit. + * Adds a family to a given group in \a this mesh. If the group with a given name does + * not exist, it is created. + * \param [in] grpName - the name of the group to add the family in. + * \param [in] famName - the name of the family to add to the group named \a grpName. + * \throw If \a grpName or \a famName is an empty string. + * \throw If no family named \a famName is present in \a this mesh. */ void MEDFileMesh::addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception) { @@ -786,12 +958,12 @@ void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map& info) { _families=info; } +/*! + * Sets names of all groups and families constituting them in \a this mesh. + * \param [in] info - a map of a group name to a vector of names of families + * constituting the group. + */ void MEDFileMesh::setGroupInfo(const std::map >&info) { _groups=info; } +/*! + * Returns an id of the family having a given name. + * \param [in] name - the name of the family of interest. + * \return int - the id of the family of interest. + * \throw If no family with such a \a name exists. + */ int MEDFileMesh::getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception) { std::string oname(name); @@ -853,6 +1040,12 @@ int MEDFileMesh::getFamilyId(const char *name) const throw(INTERP_KERNEL::Except return (*it).second; } +/*! + * Returns ids of the families having given names. + * \param [in] fams - a sequence of the names of families of interest. + * \return std::vector - a sequence of the ids of families of interest. + * \throw If \a fams contains a name of an inexistent family. + */ std::vector MEDFileMesh::getFamiliesIds(const std::vector& fams) const throw(INTERP_KERNEL::Exception) { std::vector ret(fams.size()); @@ -872,6 +1065,11 @@ std::vector MEDFileMesh::getFamiliesIds(const std::vector& fam return ret; } +/*! + * Returns a maximal id of families in \a this mesh. + * \return int - the maximal family id. + * \throw If there are no families in \a this mesh. + */ int MEDFileMesh::getMaxFamilyId() const throw(INTERP_KERNEL::Exception) { if(_families.empty()) @@ -884,6 +1082,11 @@ int MEDFileMesh::getMaxFamilyId() const throw(INTERP_KERNEL::Exception) return ret; } +/*! + * Returns a minimal id of families in \a this mesh. + * \return int - the minimal family id. + * \throw If there are no families in \a this mesh. + */ int MEDFileMesh::getMinFamilyId() const throw(INTERP_KERNEL::Exception) { if(_families.empty()) @@ -896,6 +1099,11 @@ int MEDFileMesh::getMinFamilyId() const throw(INTERP_KERNEL::Exception) return ret; } +/*! + * Returns a maximal id of families in \a this mesh. Not only named families are + * considered but all family fields as well. + * \return int - the maximal family id. + */ int MEDFileMesh::getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception) { int m1=-std::numeric_limits::max(); @@ -1146,7 +1354,11 @@ void MEDFileMesh::normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception) } /*! - * Returns the first (in lexical order) family name having family id equal to 'id'. + * Returns a name of the family by its id. If there are several families having the given + * id, the name first in lexical order is returned. + * \param [in] id - the id of the family whose name is required. + * \return std::string - the name of the found family. + * \throw If no family with the given \a id exists. */ std::string MEDFileMesh::getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception) { @@ -1157,6 +1369,11 @@ std::string MEDFileMesh::getFamilyNameGivenId(int id) const throw(INTERP_KERNEL: throw INTERP_KERNEL::Exception(oss.str().c_str()); } +/*! + * Returns a string describing \a this mesh. This description includes the mesh name and + * the mesh description string. + * \return std::string - the mesh information string. + */ std::string MEDFileMesh::simpleRepr() const { std::ostringstream oss; @@ -1166,6 +1383,19 @@ std::string MEDFileMesh::simpleRepr() const return oss.str(); } +/*! + * Returns ids of mesh entities contained in a given group of a given dimension. + * \param [in] meshDimRelToMaxExt - a relative dimension of the mesh entities whose ids + * are required. + * \param [in] grp - the name of the group of interest. + * \param [in] renum - if \c true, the optional numbers of entities, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of mesh entities of the group. 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 family field is missing for \a meshDimRelToMaxExt. + */ DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum) const throw(INTERP_KERNEL::Exception) { std::vector tmp(1); @@ -1175,12 +1405,37 @@ DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const char *grp, return ret; } +/*! + * Returns ids of mesh entities contained in given groups of a given dimension. + * \param [in] meshDimRelToMaxExt - a relative dimension of the mesh entities whose ids + * are required. + * \param [in] grps - the names of the groups of interest. + * \param [in] renum - if \c true, the optional numbers of entities, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of mesh entities of the groups. The caller + * is to delete this array using decrRef() as it is no more needed. + * \throw If the name of a nonexistent group is present in \a grps. + * \throw If the family field is missing for \a meshDimRelToMaxExt. + */ DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum) const throw(INTERP_KERNEL::Exception) { std::vector fams2=getFamiliesOnGroups(grps); return getFamiliesArr(meshDimRelToMaxExt,fams2,renum); } +/*! + * Returns ids of mesh entities contained in a given family of a given dimension. + * \param [in] meshDimRelToMaxExt - a relative dimension of the mesh entities whose ids + * are required. + * \param [in] fam - the name of the family of interest. + * \param [in] renum - if \c true, the optional numbers of entities, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of mesh entities of the family. The caller + * is to delete this array using decrRef() as it is no more needed. + * \throw If the family field is missing for \a meshDimRelToMaxExt. + */ DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum) const throw(INTERP_KERNEL::Exception) { std::vector tmp(1); @@ -1190,6 +1445,17 @@ DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const char *fam, return ret; } +/*! + * Returns ids of nodes contained in a given group. + * \param [in] grp - the name of the group of interest. + * \param [in] renum - if \c true, the optional numbers of nodes, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of nodes of the group. 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 family field is missing for nodes. + */ DataArrayInt *MEDFileMesh::getNodeGroupArr(const char *grp, bool renum) const throw(INTERP_KERNEL::Exception) { std::vector tmp(1); @@ -1199,11 +1465,33 @@ DataArrayInt *MEDFileMesh::getNodeGroupArr(const char *grp, bool renum) const th return ret; } +/*! + * Returns ids of nodes contained in given groups. + * \param [in] grps - the names of the groups of interest. + * \param [in] renum - if \c true, the optional numbers of nodes, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of nodes of the groups. The caller + * is to delete this array using decrRef() as it is no more needed. + * \throw If the name of a nonexistent group is present in \a grps. + * \throw If the family field is missing for nodes. + */ DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector& grps, bool renum) const throw(INTERP_KERNEL::Exception) { return getGroupsArr(1,grps,renum); } +/*! + * Returns ids of nodes contained in a given group. + * \param [in] grp - the name of the group of interest. + * \param [in] renum - if \c true, the optional numbers of nodes, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of nodes of the group. 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 family field is missing for nodes. + */ DataArrayInt *MEDFileMesh::getNodeFamilyArr(const char *fam, bool renum) const throw(INTERP_KERNEL::Exception) { std::vector tmp(1); @@ -1213,11 +1501,33 @@ DataArrayInt *MEDFileMesh::getNodeFamilyArr(const char *fam, bool renum) const t return ret; } +/*! + * Returns ids of nodes contained in given families. + * \param [in] fams - the names of the families of interest. + * \param [in] renum - if \c true, the optional numbers of nodes, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of nodes of the families. The caller + * is to delete this array using decrRef() as it is no more needed. + * \throw If the family field is missing for nodes. + */ DataArrayInt *MEDFileMesh::getNodeFamiliesArr(const std::vector& fams, bool renum) const throw(INTERP_KERNEL::Exception) { return getFamiliesArr(1,fams,renum); } +/*! + * Adds groups of given dimension and creates corresponding families and family fields + * given ids of mesh entities of each group. + * \param [in] meshDimRelToMaxExt - the relative mesh dimension of given mesh entities. + * \param [in] grps - a sequence of arrays of ids each describing a group. + * \param [in] renum - \c true means that \a grps contains not ids but optional numbers + * of mesh entities. + * \throw If names of some groups in \a grps are equal. + * \throw If \a grps includes a group with an empty name. + * \throw If \a grps includes invalid ids (or numbers if \a renum == \c true ). + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum) throw(INTERP_KERNEL::Exception) { if(grps.empty()) @@ -1354,6 +1664,8 @@ int MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector& code, int str */ void MEDFileMesh::dealWithTinyInfo(const MEDCouplingMesh *m) throw(INTERP_KERNEL::Exception) { + if(!m) + throw INTERP_KERNEL::Exception("MEDFileMesh::dealWithTinyInfo : input mesh in NULL !"); if(_name.empty()) _name=m->getName(); else @@ -1399,6 +1711,20 @@ void MEDFileMesh::getFamilyRepr(std::ostream& oss) const } } +/*! + * Returns a new MEDFileUMesh holding the mesh data that has been read from a given MED + * file. The mesh to load is specified by its name and numbers of a time step and an + * iteration. + * \param [in] fileName - the name of MED file to read. + * \param [in] mName - the name of the mesh to read. + * \param [in] dt - the number of a time step. + * \param [in] it - the number of an iteration. + * \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + * \throw If the file is not readable. + * \throw If there is no mesh with given attributes in the file. + * \throw If the mesh in the file is not an unstructured one. + */ MEDFileUMesh *MEDFileUMesh::New(const char *fileName, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception) { MEDFileUtilities::CheckFileForRead(fileName); @@ -1406,6 +1732,16 @@ MEDFileUMesh *MEDFileUMesh::New(const char *fileName, const char *mName, int dt, return new MEDFileUMesh(fid,mName,dt,it); } +/*! + * Returns a new MEDFileUMesh holding the mesh data that has been read from a given MED + * file. The first mesh in the file is loaded. + * \param [in] fileName - the name of MED file to read. + * \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + * \throw If the file is not readable. + * \throw If there is no meshes in the file. + * \throw If the mesh in the file is not an unstructured one. + */ MEDFileUMesh *MEDFileUMesh::New(const char *fileName) throw(INTERP_KERNEL::Exception) { std::vector ms=MEDLoader::GetMeshNames(fileName); @@ -1423,6 +1759,11 @@ MEDFileUMesh *MEDFileUMesh::New(const char *fileName) throw(INTERP_KERNEL::Excep return new MEDFileUMesh(fid,ms.front().c_str(),dt,it); } +/*! + * Returns an empty instance of MEDFileUMesh. + * \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + */ MEDFileUMesh *MEDFileUMesh::New() { return new MEDFileUMesh; @@ -1476,6 +1817,13 @@ MEDFileMesh *MEDFileUMesh::deepCpy() const throw(INTERP_KERNEL::Exception) return ret.retn(); } +/*! + * Checks if \a this and another mesh are equal. + * \param [in] other - the mesh to compare with. + * \param [in] eps - a precision used to compare real values. + * \param [in,out] what - the string returning description of unequal data. + * \return bool - \c true if the meshes are equal, \c false, else. + */ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& what) const { if(!MEDFileMesh::isEqual(other,eps,what)) @@ -1577,6 +1925,9 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh return true; } +/*! + * Clears redundant attributes of incorporated data arrays. + */ void MEDFileUMesh::clearNonDiscrAttributes() const { MEDFileMesh::clearNonDiscrAttributes(); @@ -1640,6 +1991,7 @@ void MEDFileUMesh::loadUMeshFromFile(med_idt fid, const char *mName, int dt, int // setName(loaderl2.getName()); setDescription(loaderl2.getDescription()); + setUnivName(loaderl2.getUnivName()); setIteration(loaderl2.getIteration()); setOrder(loaderl2.getOrder()); setTimeValue(loaderl2.getTime()); @@ -1675,6 +2027,7 @@ void MEDFileUMesh::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo } MEDmeshCr(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit); + MEDmeshUniversalNameWr(fid,maa); MEDFileUMeshL2::WriteCoords(fid,maa,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) if((const MEDFileUMeshSplitL1 *)(*it)!=0) @@ -1682,6 +2035,10 @@ void MEDFileUMesh::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa,_families,_groups,_too_long_str); } +/*! + * Returns relative dimensions of mesh entities (excluding nodes) present in \a this mesh. + * \return std::vector - a sequence of the relative dimensions. + */ std::vector MEDFileUMesh::getNonEmptyLevels() const { std::vector ret; @@ -1693,6 +2050,10 @@ std::vector MEDFileUMesh::getNonEmptyLevels() const return ret; } +/*! + * Returns relative dimensions of mesh entities (including nodes) present in \a this mesh. + * \return std::vector - a sequence of the relative dimensions. + */ std::vector MEDFileUMesh::getNonEmptyLevelsExt() const { std::vector ret0=getNonEmptyLevels(); @@ -1707,8 +2068,10 @@ std::vector MEDFileUMesh::getNonEmptyLevelsExt() const } /*! - * This methods returns all relative mesh levels where group 'grp' is defined \b excluded \b nodes. - * To include nodes call MEDFileUMesh::getGrpNonEmptyLevelsExt method. + * Returns all relative mesh levels (**excluding nodes**) where a given group is defined. + * To include nodes, call getGrpNonEmptyLevelsExt() method. + * \param [in] grp - the name of the group of interest. + * \return std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception) { @@ -1717,7 +2080,9 @@ std::vector MEDFileUMesh::getGrpNonEmptyLevels(const char *grp) const throw } /*! - * This method is a generalization of MEDFileUMesh::getGrpNonEmptyLevelsExt. It looks at the node level to state if the group 'grp' has a part lying on node. + * Returns all relative mesh levels (including nodes) where a given group is defined. + * \param [in] grp - the name of the group of interest. + * \return std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception) { @@ -1726,8 +2091,10 @@ std::vector MEDFileUMesh::getGrpNonEmptyLevelsExt(const char *grp) const th } /*! - * This methods returns all relative mesh levels where family 'fam' is defined \b excluded \b nodes. - * To include nodes call MEDFileUMesh::getFamNonEmptyLevelsExt method. + * Returns all relative mesh levels (**excluding nodes**) where a given family is defined. + * To include nodes, call getFamNonEmptyLevelsExt() method. + * \param [in] fam - the name of the family of interest. + * \return std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception) { @@ -1736,7 +2103,9 @@ std::vector MEDFileUMesh::getFamNonEmptyLevels(const char *fam) const throw } /*! - * This method is a generalization of MEDFileUMesh::getFamNonEmptyLevels. It looks at the node level to state if the family 'fam' has a part lying on node. + * Returns all relative mesh levels (including nodes) where a given family is defined. + * \param [in] fam - the name of the family of interest. + * \return std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception) { @@ -1745,8 +2114,10 @@ std::vector MEDFileUMesh::getFamNonEmptyLevelsExt(const char *fam) const th } /*! - * This methods returns all relative mesh levels where groups 'grps' are defined \b excluded \b nodes. - * To include nodes call MEDFileUMesh::getGrpsNonEmptyLevelsExt method. + * Returns all relative mesh levels (**excluding nodes**) where given groups are defined. + * To include nodes, call getGrpsNonEmptyLevelsExt() method. + * \param [in] grps - a sequence of names of the groups of interest. + * \return std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getGrpsNonEmptyLevels(const std::vector& grps) const throw(INTERP_KERNEL::Exception) { @@ -1755,7 +2126,9 @@ std::vector MEDFileUMesh::getGrpsNonEmptyLevels(const std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getGrpsNonEmptyLevelsExt(const std::vector& grps) const throw(INTERP_KERNEL::Exception) { @@ -1764,8 +2137,10 @@ std::vector MEDFileUMesh::getGrpsNonEmptyLevelsExt(const std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector& fams) const throw(INTERP_KERNEL::Exception) { @@ -1779,7 +2154,9 @@ std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector - a sequence of the relative dimensions. */ std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const throw(INTERP_KERNEL::Exception) { @@ -1800,7 +2177,10 @@ std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector - a sequence of group names at \a meshDimRelToMaxExt + * level. */ std::vector MEDFileUMesh::getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { @@ -1830,7 +2210,7 @@ int MEDFileUMesh::getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) const DataArrayInt *da=(*it)->getFamilyField(); if(da) { - int val=_fam_coords->getMaxValue(tmp); + int val=da->getMaxValue(tmp); ret=std::max(ret,val); } } @@ -1853,7 +2233,7 @@ int MEDFileUMesh::getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) const DataArrayInt *da=(*it)->getFamilyField(); if(da) { - int val=_fam_coords->getMinValue(tmp); + int val=da->getMinValue(tmp); ret=std::min(ret,val); } } @@ -1861,6 +2241,11 @@ int MEDFileUMesh::getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) return ret; } +/*! + * Returns the dimension on cells in \a this mesh. + * \return int - the mesh dimension. + * \throw If there are no cells in this mesh. + */ int MEDFileUMesh::getMeshDimension() const throw(INTERP_KERNEL::Exception) { int lev=0; @@ -1870,6 +2255,12 @@ int MEDFileUMesh::getMeshDimension() const throw(INTERP_KERNEL::Exception) throw INTERP_KERNEL::Exception("MEDFileUMesh::getMeshDimension : impossible to find a mesh dimension !"); } +/*! + * Returns the space dimension of \a this mesh that is equal to number of components in + * the node coordinates array. + * \return int - the space dimension of \a this mesh. + * \throw If the node coordinates array is not available. + */ int MEDFileUMesh::getSpaceDimension() const throw(INTERP_KERNEL::Exception) { const DataArrayDouble *coo=_coords; @@ -1878,6 +2269,10 @@ int MEDFileUMesh::getSpaceDimension() const throw(INTERP_KERNEL::Exception) return coo->getNumberOfComponents(); } +/*! + * Returns a string describing \a this mesh. + * \return std::string - the mesh information string. + */ std::string MEDFileUMesh::simpleRepr() const { std::ostringstream oss; @@ -1926,11 +2321,21 @@ std::string MEDFileUMesh::simpleRepr() const return oss.str(); } +/*! + * Returns a full textual description of \a this mesh. + * \return std::string - the string holding the mesh description. + */ std::string MEDFileUMesh::advancedRepr() const { return simpleRepr(); } +/*! + * Returns number of mesh entities of a given relative dimension in \a this mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of interest. + * \return int - the number of entities. + * \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh. + */ int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -1942,6 +2347,12 @@ int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERN return getMeshAtLevSafe(meshDimRelToMaxExt)->getSize(); } +/*! + * Returns the family field for mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the family field. It is an array of ids of families + * each mesh entity belongs to. It can be \c NULL. + */ const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -1950,6 +2361,12 @@ const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) return l1->getFamilyField(); } +/*! + * Returns the optional numbers of mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the array of the entity numbers. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ const DataArrayInt *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -1974,6 +2391,14 @@ int MEDFileUMesh::getNumberOfNodes() const throw(INTERP_KERNEL::Exception) return coo->getNumberOfTuples(); } +/*! + * Returns the optional numbers of mesh entities of a given dimension transformed using + * DataArrayInt::invertArrayN2O2O2N(). + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the array of the entity numbers transformed using + * DataArrayInt::invertArrayN2O2O2N(). + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -1987,7 +2412,8 @@ const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxEx } /*! - * This method returns coordinates in 'this'. The returned array reference counter is \b not incremented by this method (as MEDCouplingPointSet::getCoords does). + * Returns a pointer to the node coordinates array of \a this mesh \b without + * incrementing its reference counter, thus there is no need to decrRef() it by the caller. */ DataArrayDouble *MEDFileUMesh::getCoords() const { @@ -1999,6 +2425,20 @@ DataArrayDouble *MEDFileUMesh::getCoords() const return 0; } +/*! + * Returns a new MEDCouplingUMesh corresponding to mesh entities included in a given + * group of \a this mesh. Only mesh entities of a given dimension are included in the + * new mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities of interest. + * \param [in] grp - the name of the group whose mesh entities are included in the + * new mesh. + * \param [in] renum - if \c true, cells and nodes of the result mesh are permuted + * according to the optional numbers of entities, if available. + * \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. The caller is to + * delete this mesh using decrRef() as it is no more needed. + * \throw If the name of a nonexistent group is specified. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getGroup(int meshDimRelToMaxExt, const char *grp, bool renum) const throw(INTERP_KERNEL::Exception) { synchronizeTinyInfoOnLeaves(); @@ -2009,6 +2449,20 @@ MEDCouplingUMesh *MEDFileUMesh::getGroup(int meshDimRelToMaxExt, const char *grp return ret; } +/*! + * Returns a new MEDCouplingUMesh corresponding to mesh entities included in given + * groups of \a this mesh. Only mesh entities of a given dimension are included in the + * new mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities of interest. + * \param [in] grps - a sequence of group names whose mesh entities are included in the + * new mesh. + * \param [in] renum - if \c true, cells and nodes of the result mesh are permuted + * according to the optional numbers of entities, if available. + * \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. The caller is to + * delete this mesh using decrRef() as it is no more needed. + * \throw If a name of a nonexistent group is present in \a grps. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum) const throw(INTERP_KERNEL::Exception) { synchronizeTinyInfoOnLeaves(); @@ -2016,6 +2470,20 @@ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vec return getFamilies(meshDimRelToMaxExt,fams2,renum); } +/*! + * Returns a new MEDCouplingUMesh corresponding to mesh entities included in a given + * family of \a this mesh. Only mesh entities of a given dimension are included in the + * new mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities of interest. + * \param [in] fam - the name of the family whose mesh entities are included in the + * new mesh. + * \param [in] renum - if \c true, cells and nodes of the result mesh are permuted + * according to the optional numbers of entities, if available. + * \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. The caller is to + * delete this mesh using decrRef() as it is no more needed. + * \throw If a name of a nonexistent family is present in \a grps. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getFamily(int meshDimRelToMaxExt, const char *fam, bool renum) const throw(INTERP_KERNEL::Exception) { synchronizeTinyInfoOnLeaves(); @@ -2026,6 +2494,20 @@ MEDCouplingUMesh *MEDFileUMesh::getFamily(int meshDimRelToMaxExt, const char *fa return ret; } +/*! + * Returns a new MEDCouplingUMesh corresponding to mesh entities included in given + * families of \a this mesh. Only mesh entities of a given dimension are included in the + * new mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities of interest. + * \param [in] fams - a sequence of family names whose mesh entities are included in the + * new mesh. + * \param [in] renum - if \c true, cells and nodes of the result mesh are permuted + * according to the optional numbers of entities, if available. + * \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. The caller is to + * delete this mesh using decrRef() as it is no more needed. + * \throw If a name of a nonexistent family is present in \a fams. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const throw(INTERP_KERNEL::Exception) { synchronizeTinyInfoOnLeaves(); @@ -2045,6 +2527,18 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v return l1->getFamilyPart(0,0,renum); } +/*! + * Returns ids of mesh entities contained in given families of a given dimension. + * \param [in] meshDimRelToMaxExt - a relative dimension of the mesh entities whose ids + * are required. + * \param [in] fams - the names of the families of interest. + * \param [in] renum - if \c true, the optional numbers of entities, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of mesh entities of the families. The caller + * is to delete this array using decrRef() as it is no more needed. + * \throw If the family field is missing for \a meshDimRelToMaxExt. + */ DataArrayInt *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const throw(INTERP_KERNEL::Exception) { std::vector famIds=getFamiliesIds(fams); @@ -2073,14 +2567,18 @@ DataArrayInt *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::ve } /*! - * Returns a pointer to mesh at the specified level. ** WARNING **, if the input \a meshDimRelToMaxExt is set to one (nodes), - * The returned mesh ** will be not valid **. It is a feature, because MEDLoader do not creates cells that do not exist ! - * To build a valid MEDCouplingUMesh instance from the returned value when \a meshDimRelToMaxExt is equal to one, simply - * call MEDCouplingUMesh::Build0DMeshFromCoords. - * - * \return a pointer to unstructured mesh that need to be managed by the caller. - * \warning the returned pointer has to be managed by the caller. - * \sa MEDFileUMesh::getGenMeshAtLevel + * Returns a MEDCouplingUMesh of a given relative dimension. + * \warning If \a meshDimRelToMaxExt == 1 (which means nodes), the returned mesh **is not + * 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] 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 + * delete using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \sa getGenMeshAtLevel() */ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renum) const throw(INTERP_KERNEL::Exception) { @@ -2102,32 +2600,71 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu } /*! - * Returns a pointer to mesh at the specified level. - * - * \return a pointer to unstructured mesh that need to be managed by the caller. - * \warning the returned pointer has to be managed by the caller. - * \sa MEDFileUMesh::getMeshAtLevel + * Returns a MEDCouplingUMesh of a given relative dimension. + * \warning If \a meshDimRelToMaxExt == 1 (which means nodes), the returned mesh **is not + * 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] renum - if \c true, the returned mesh is permuted according to the + * optional numbers of mesh entities. + * \return MEDCouplingMesh * - a pointer to MEDCouplingUMesh that the caller is to + * delete using decrRef() as it is no more needed. + * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a this mesh. + * \sa getMeshAtLevel() */ MEDCouplingMesh *MEDFileUMesh::getGenMeshAtLevel(int meshDimRelToMax, bool renum) const throw(INTERP_KERNEL::Exception) { return getMeshAtLevel(meshDimRelToMax,renum); } +/*! + * Returns a MEDCouplingUMesh of a relative dimension == 0. + * \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 + * delete using decrRef() as it is no more needed. + * \throw If there are no mesh entities of the relative dimension == 0 in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getLevel0Mesh(bool renum) const throw(INTERP_KERNEL::Exception) { return getMeshAtLevel(0,renum); } +/*! + * Returns a MEDCouplingUMesh of a relative dimension == -1. + * \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 + * delete using decrRef() as it is no more needed. + * \throw If there are no mesh entities of the relative dimension == -1 in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getLevelM1Mesh(bool renum) const throw(INTERP_KERNEL::Exception) { return getMeshAtLevel(-1,renum); } +/*! + * Returns a MEDCouplingUMesh of a relative dimension == -2. + * \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 + * delete using decrRef() as it is no more needed. + * \throw If there are no mesh entities of the relative dimension == -2 in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getLevelM2Mesh(bool renum) const throw(INTERP_KERNEL::Exception) { return getMeshAtLevel(-2,renum); } +/*! + * Returns a MEDCouplingUMesh of a relative dimension == -3. + * \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 + * delete using decrRef() as it is no more needed. + * \throw If there are no mesh entities of the relative dimension == -3 in \a this mesh. + */ MEDCouplingUMesh *MEDFileUMesh::getLevelM3Mesh(bool renum) const throw(INTERP_KERNEL::Exception) { return getMeshAtLevel(-3,renum); @@ -2177,6 +2714,12 @@ void MEDFileUMesh::checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const } } +/*! + * Sets the node coordinates array of \a this mesh. + * \param [in] coords - the new node coordinates array. + * \throw If \a coords == \c NULL. + */ + void MEDFileUMesh::setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception) { if(!coords) @@ -2190,6 +2733,11 @@ void MEDFileUMesh::setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Excep _fam_coords->fillWithZero(); } +/*! + * Removes all groups of a given dimension in \a this mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of interest. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ void MEDFileUMesh::eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -2203,6 +2751,9 @@ void MEDFileUMesh::eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNE optimizeFamilies(); } +/*! + * Removes all families with ids not present in the family fields of \a this mesh. + */ void MEDFileUMesh::optimizeFamilies() throw(INTERP_KERNEL::Exception) { std::vector levs=getNonEmptyLevelsExt(); @@ -2414,7 +2965,7 @@ struct MEDLoaderAccVisit1 * The size of returned array is the number of nodes of the old (previous to the call of this method) number of nodes. * -1 values in returned array means that the corresponding old node is no more used. * - * \return newly allocated array containing correspondance in \b old \b to \b new format. If all nodes in \a this are fetched NULL pointer is returned and nothing + * \return newly allocated array containing correspondance in \b old \b to \b new format. If all nodes in \a this are fetched \c NULL pointer is returned and nothing * is modified in \a this. * \throw If no coordinates are set in \a this or if there is in any available mesh in \a this a cell having a nodal connectivity containing a node id not in the range of * set coordinates. @@ -2458,10 +3009,14 @@ DataArrayInt *MEDFileUMesh::zipCoords() throw(INTERP_KERNEL::Exception) } /*! - * This method is here only to add a group on node. - * MEDFileUMesh::setGroupsAtLevel with 1 in the first parameter. - * - * \param [in] ids node ids and group name of the new group to add. The ids should be sorted and different each other (MED file norm). + * Adds a group of nodes to \a this mesh. + * \param [in] ids - a DataArrayInt providing ids and a name of the group to add. + * The ids should be sorted and different each other (MED file norm). + * \throw If the node coordinates array is not set. + * \throw If \a ids == \c NULL. + * \throw If \a ids->getName() == "". + * \throw If \a ids does not respect the MED file norm. + * \throw If a group with name \a ids->getName() already exists. */ void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception) { @@ -2492,7 +3047,7 @@ void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) thr /*! * \param [in] ids ids and group name of the new group to add. The ids should be sorted and different each other (MED file norm). - * \parma [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not NULL (no check of that will be performed) + * \parma [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed) */ void MEDFileUMesh::addGroupUnderground(const DataArrayInt *ids, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception) { @@ -2568,6 +3123,12 @@ void MEDFileUMesh::addGroupUnderground(const DataArrayInt *ids, DataArrayInt *fa _groups[grpName]=fams; } +/*! + * Changes a name of a family specified by its id. + * \param [in] id - the id of the family of interest. + * \param [in] newFamName - the new family name. + * \throw If no family with the given \a id exists. + */ void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception) { std::string oldName=getFamilyNameGivenId(id); @@ -2575,6 +3136,11 @@ void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamNa _families[newFamName]=id; } +/*! + * Removes a mesh of a given dimension. + * \param [in] meshDimRelToMax - the relative dimension of interest. + * \throw If there is no mesh at level \a meshDimRelToMax in \a this mesh. + */ void MEDFileUMesh::removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception) { std::vector levSet=getNonEmptyLevels(); @@ -2585,12 +3151,20 @@ void MEDFileUMesh::removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::E _ms[pos]=0; } +/*! + * Sets a new MEDCouplingUMesh at a given level in \a this mesh. + * \param [in] meshDimRelToMax - a relative level to set the mesh at. + * \param [in] m - the new mesh to set. + * \param [in] newOrOld - if \c true, cells in \a m are sorted by type to be ready for + * writing \a this mesh in a MED file. + * \throw If the name or the description of \a this mesh and \a m are not empty and are + * different. + * \throw If the node coordinates array is set \a this in mesh and \a m refers to + * another node coordinates array. + * \throw If the mesh dimension of \a m does not correspond to \a meshDimRelToMax or + * to the existing meshes of other levels of \a this mesh. + */ void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception) -{ - setMeshAtLevelGen(meshDimRelToMax,m,newOrOld); -} - -void MEDFileUMesh::setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception) { dealWithTinyInfo(m); std::vector levSet=getNonEmptyLevels(); @@ -2615,6 +3189,23 @@ void MEDFileUMesh::setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, b _ms[-meshDimRelToMax]=new MEDFileUMeshSplitL1(m,newOrOld); } +/*! + * Creates one MEDCouplingUMesh at a given level in \a this mesh from a sequence of + * meshes each representing a group, and creates corresponding groups in \a this mesh. + * The given meshes must share the same node coordinates array. + * \param [in] meshDimRelToMax - the relative dimension to create the mesh and groups at. + * \param [in] ms - the sequence of meshes. Each mesh in \a ms represents a group to + * create in \a this mesh. + * \throw If \a ms is empty. + * \throw If dimension of meshes in \a ms does not correspond to \a meshDimRelToMax or + * to the existing meshes of other levels of \a this mesh. + * \throw If the meshes in \a ms do not share the same node coordinates array. + * \throw If the node coordinates array of \a this mesh (if any) is not the same as that + * of the given meshes. + * \throw If \a ms[ i ] is not well defined (MEDCouplingUMesh::checkCoherency()). + * \throw If names of some meshes in \a ms are equal. + * \throw If \a ms includes a mesh with an empty name. + */ void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception) { if(ms.empty()) @@ -2640,6 +3231,25 @@ void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms, bool renum) throw(INTERP_KERNEL::Exception) { if(ms.empty()) @@ -2690,6 +3300,14 @@ DataArrayDouble *MEDFileUMesh::checkMultiMesh(const std::vector(ret); } +/*! + * Sets the family field of a given relative dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of entities for which + * the family field is set. + * \param [in] famArr - the array of the family field. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a famArr has an invalid size. + */ void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -2717,6 +3335,13 @@ void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famAr return _ms[traducedRk]->setFamilyArr(famArr); } +/*! + * Sets the optional numbers of mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \param [in] renumArr - the array of the numbers. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a renumArr has an invalid size. + */ void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt==1) @@ -3003,6 +3628,18 @@ void MEDFileStructuredMesh::clearNonDiscrAttributes() const (const_cast(tmp))->setName(""); } +/*! + * Returns ids of mesh entities contained in given families of a given dimension. + * \param [in] meshDimRelToMaxExt - a relative dimension of the mesh entities whose ids + * are required. + * \param [in] fams - the names of the families of interest. + * \param [in] renum - if \c true, the optional numbers of entities, if available, are + * returned instead of ids. + * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * numbers, if available and required, of mesh entities of the families. The caller + * is to delete this array using decrRef() as it is no more needed. + * \throw If the family field is missing for \a meshDimRelToMaxExt. + */ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) @@ -3044,6 +3681,15 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons } } +/*! + * Sets the family field of a given relative dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of entities for which + * the family field is set. + * \param [in] famArr - the array of the family field. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a famArr has an invalid size. + * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. + */ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) @@ -3067,6 +3713,14 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI famArr->incrRef(); } +/*! + * Sets the optional numbers of mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \param [in] renumArr - the array of the numbers. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a renumArr has an invalid size. + * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. + */ void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) @@ -3113,6 +3767,13 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra nameArr->incrRef(); } +/*! + * Returns the family field for mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the family field. It is an array of ids of families + * each mesh entity belongs to. It can be \c NULL. + * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. + */ const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) @@ -3123,6 +3784,13 @@ const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelT return _fam_nodes; } +/*! + * Returns the optional numbers of mesh entities of a given dimension. + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the array of the entity numbers. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. + */ const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) @@ -3133,6 +3801,15 @@ const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelT return _num_nodes; } +/*! + * Returns the optional numbers of mesh entities of a given dimension transformed using + * DataArrayInt::invertArrayN2O2O2N(). + * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. + * \return const DataArrayInt * - the array of the entity numbers transformed using + * DataArrayInt::invertArrayN2O2O2N(). + * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. + * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. + */ const DataArrayInt *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) @@ -3173,12 +3850,20 @@ const DataArrayAsciiChar *MEDFileStructuredMesh::getNameFieldAtLevel(int meshDim return _names_nodes; } +/*! + * Returns relative dimensions of mesh entities (excluding nodes) present in \a this mesh. + * \return std::vector - a sequence of the relative dimensions: [0]. + */ std::vector MEDFileStructuredMesh::getNonEmptyLevels() const { std::vector ret(1); return ret; } +/*! + * Returns relative dimensions of mesh entities (including nodes) present in \a this mesh. + * \return std::vector - a sequence of the relative dimensions: [1,0]. + */ std::vector MEDFileStructuredMesh::getNonEmptyLevelsExt() const { std::vector ret(2); @@ -3227,6 +3912,14 @@ void MEDFileStructuredMesh::deepCpyAttributes() throw(INTERP_KERNEL::Exception) * \return a pointer to cartesian mesh that need to be managed by the caller. * \warning the returned pointer has to be managed by the caller. */ + +/*! + * Returns a pointer to MEDCouplingStructuredMesh held by \a this. + * \param [in] meshDimRelToMax - it must be \c 0. + * \param [in] renum - it must be \c false. + * \return MEDCouplingMesh * - a pointer to MEDCouplingMesh that the caller is to + * delete using decrRef() as it is no more needed. + */ MEDCouplingMesh *MEDFileStructuredMesh::getGenMeshAtLevel(int meshDimRelToMax, bool renum) const throw(INTERP_KERNEL::Exception) { if(renum) @@ -3239,6 +3932,12 @@ MEDCouplingMesh *MEDFileStructuredMesh::getGenMeshAtLevel(int meshDimRelToMax, b return const_cast(m); } +/*! + * Returns number of mesh entities of a given relative dimension in \a this mesh. + * \param [in] meshDimRelToMaxExt - the relative dimension of interest. + * \return int - the number of entities. + * \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh. + */ int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) @@ -3287,6 +3986,7 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt { setName(strm->getName()); setDescription(strm->getDescription()); + setUnivName(strm->getUnivName()); setIteration(strm->getIteration()); setOrder(strm->getOrder()); setTimeValue(strm->getTime()); @@ -3378,11 +4078,26 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) cons MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa,_families,_groups,_too_long_str); } +/*! + * Returns an empty instance of MEDFileCMesh. + * \return MEDFileCMesh * - a new instance of MEDFileCMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + */ MEDFileCMesh *MEDFileCMesh::New() { return new MEDFileCMesh; } +/*! + * Returns a new MEDFileCMesh holding the mesh data that has been read from a given MED + * file. The first mesh in the file is loaded. + * \param [in] fileName - the name of MED file to read. + * \return MEDFileCMesh * - a new instance of MEDFileCMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + * \throw If the file is not readable. + * \throw If there is no meshes in the file. + * \throw If the mesh in the file is not a Cartesian one. + */ MEDFileCMesh *MEDFileCMesh::New(const char *fileName) throw(INTERP_KERNEL::Exception) { std::vector ms=MEDLoader::GetMeshNames(fileName); @@ -3400,6 +4115,20 @@ MEDFileCMesh *MEDFileCMesh::New(const char *fileName) throw(INTERP_KERNEL::Excep return new MEDFileCMesh(fid,ms.front().c_str(),dt,it); } +/*! + * Returns a new MEDFileCMesh holding the mesh data that has been read from a given MED + * file. The mesh to load is specified by its name and numbers of a time step and an + * iteration. + * \param [in] fileName - the name of MED file to read. + * \param [in] mName - the name of the mesh to read. + * \param [in] dt - the number of a time step. + * \param [in] it - the number of an iteration. + * \return MEDFileCMesh * - a new instance of MEDFileCMesh. The caller is to delete this + * mesh using decrRef() as it is no more needed. + * \throw If the file is not readable. + * \throw If there is no mesh with given attributes in the file. + * \throw If the mesh in the file is not a Cartesian one. + */ MEDFileCMesh *MEDFileCMesh::New(const char *fileName, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception) { MEDFileUtilities::CheckFileForRead(fileName); @@ -3415,6 +4144,11 @@ std::size_t MEDFileCMesh::getHeapMemorySize() const return ret; } +/*! + * Returns the dimension on cells in \a this mesh. + * \return int - the mesh dimension. + * \throw If there are no cells in this mesh. + */ int MEDFileCMesh::getMeshDimension() const throw(INTERP_KERNEL::Exception) { if(!((const MEDCouplingCMesh*)_cmesh)) @@ -3422,11 +4156,19 @@ int MEDFileCMesh::getMeshDimension() const throw(INTERP_KERNEL::Exception) return _cmesh->getMeshDimension(); } +/*! + * Returns a string describing \a this mesh. + * \return std::string - the mesh information string. + */ std::string MEDFileCMesh::simpleRepr() const { return MEDFileStructuredMesh::simpleRepr(); } +/*! + * Returns a full textual description of \a this mesh. + * \return std::string - the string holding the mesh description. + */ std::string MEDFileCMesh::advancedRepr() const { return simpleRepr(); @@ -3447,6 +4189,13 @@ MEDFileMesh *MEDFileCMesh::deepCpy() const throw(INTERP_KERNEL::Exception) return ret.retn(); } +/*! + * Checks if \a this and another mesh are equal. + * \param [in] other - the mesh to compare with. + * \param [in] eps - a precision used to compare real values. + * \param [in,out] what - the string returning description of unequal data. + * \return bool - \c true if the meshes are equal, \c false, else. + */ bool MEDFileCMesh::isEqual(const MEDFileMesh *other, double eps, std::string& what) const { if(!MEDFileStructuredMesh::isEqual(other,eps,what)) @@ -3478,6 +4227,9 @@ bool MEDFileCMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh return true; } +/*! + * Clears redundant attributes of incorporated data arrays. + */ void MEDFileCMesh::clearNonDiscrAttributes() const { MEDFileStructuredMesh::clearNonDiscrAttributes(); @@ -3517,6 +4269,10 @@ void MEDFileCMesh::loadCMeshFromFile(med_idt fid, const char *mName, int dt, int loadStrMeshFromFile(&loaderl2,fid,mName,dt,it); } +/*! + * Returns a const pointer to MEDCouplingCMesh held by \a this mesh. + * \return const MEDCouplingCMesh * - a pointer to the held MEDCouplingCMesh. + */ const MEDCouplingCMesh *MEDFileCMesh::getMesh() const { synchronizeTinyInfoOnLeaves(); @@ -3529,6 +4285,12 @@ const MEDCouplingStructuredMesh *MEDFileCMesh::getStructuredMesh() const return _cmesh; } +/*! + * Sets the MEDCouplingCMesh holding the data of \a this mesh. + * \param [in] m - the new MEDCouplingCMesh to refer to. + * \throw If the name or the description of \a this mesh and \a m are not empty and are + * different. + */ void MEDFileCMesh::setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception) { dealWithTinyInfo(m); @@ -3558,6 +4320,7 @@ void MEDFileCMesh::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo } MEDmeshCr(fid,maa,spaceDim,meshDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit); + MEDmeshUniversalNameWr(fid,maa); MEDmeshGridTypeWr(fid,maa,MED_CARTESIAN_GRID); for(int i=0;i nodeGridSt=_clmesh->getNodeGridStructure(); MEDmeshGridStructWr(fid,maa,_iteration,_order,_time,&nodeGridSt[0]); diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 3f81bbce9..cb1207799 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -43,8 +43,9 @@ namespace ParaMEDMEM void setName(const char *name) { _name=name; } bool changeNames(const std::vector< std::pair >& modifTab) throw(INTERP_KERNEL::Exception); const char *getName() const { return _name.c_str(); } - void setUnivName(const char *name) { _univ_name=name; } const char *getUnivName() const { return _univ_name.c_str(); } + bool getUnivNameWrStatus() const { return _univ_wr_status; } + void setUnivNameWrStatus(bool newStatus) { _univ_wr_status=newStatus; } void setDescription(const char *name) { _desc_name=name; } const char *getDescription() const { return _desc_name.c_str(); } void setOrder(int order) { _order=order; } @@ -135,6 +136,8 @@ namespace ParaMEDMEM virtual bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) throw(INTERP_KERNEL::Exception) = 0; protected: MEDFileMesh(); + //! protected because no way in MED file API to specify this name + void setUnivName(const char *name) { _univ_name=name; } void addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName) throw(INTERP_KERNEL::Exception); virtual void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) = 0; void dealWithTinyInfo(const MEDCouplingMesh *m) throw(INTERP_KERNEL::Exception); @@ -153,7 +156,9 @@ namespace ParaMEDMEM double _time; std::string _dt_unit; std::string _name; - std::string _univ_name; + //! this attribute do not impact the state of instance -> mutable + mutable std::string _univ_name; + bool _univ_wr_status; std::string _desc_name; protected: std::map > _groups; @@ -222,7 +227,6 @@ namespace ParaMEDMEM void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception); void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception); void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception); - void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception); void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms, bool renum) throw(INTERP_KERNEL::Exception); void optimizeFamilies() throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 6aa50bae7..7423fdbde 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -35,7 +35,7 @@ extern med_geometry_type typmainoeud[1]; using namespace ParaMEDMEM; -MEDFileMeshL2::MEDFileMeshL2():_name(MED_NAME_SIZE),_description(MED_COMMENT_SIZE),_dt_unit(MED_LNAME_SIZE) +MEDFileMeshL2::MEDFileMeshL2():_name(MED_NAME_SIZE),_description(MED_COMMENT_SIZE),_univ_name(MED_LNAME_SIZE),_dt_unit(MED_LNAME_SIZE) { } @@ -140,9 +140,11 @@ std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, INTERP_KERNEL::AutoPtr nameTmp=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); + INTERP_KERNEL::AutoPtr univTmp=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); if(MEDmeshInfo(fid,mId,nameTmp,&spaceDim,&Mdim,&type_maillage,_description.getPointer(),_dt_unit.getPointer(), &stype,&nstep,&axistype,axisname,axisunit)!=0) throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !"); + MEDmeshUniversalNameRd(fid,nameTmp,_univ_name.getPointer()); switch(type_maillage) { case MED_UNSTRUCTURED_MESH: diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 377dc48b9..f2d16704b 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -42,6 +42,7 @@ namespace ParaMEDMEM std::size_t getHeapMemorySize() const { return 0; } const char *getName() const { return _name.getReprForWrite(); } const char *getDescription() const { return _description.getReprForWrite(); } + const char *getUnivName() const { return _univ_name.getReprForWrite(); } const char *getTimeUnit() const { return _dt_unit.getReprForWrite(); } int getIteration() const { return _iteration; } int getOrder() const { return _order; } @@ -54,6 +55,7 @@ namespace ParaMEDMEM protected: MEDFileString _name; MEDFileString _description; + MEDFileString _univ_name; MEDFileString _dt_unit; int _iteration; int _order; diff --git a/src/MEDLoader/Swig/CMakeLists.txt b/src/MEDLoader/Swig/CMakeLists.txt index f72dfc8d0..91ba8b348 100644 --- a/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/MEDLoader/Swig/CMakeLists.txt @@ -66,7 +66,8 @@ INSTALL(FILES MEDLoader.i MEDLoaderTypemaps.i MEDLoaderCommon.i DESTINATION ${ME SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDLoader.py ${CMAKE_CURRENT_SOURCE_DIR}/libMEDLoader_Swig.py) INSTALL_AND_COMPILE_PYTHON_FILE("${PYFILES_TO_INSTALL}" ${MED_salomescript_PYTHON}) -INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py DESTINATION ${MED_salomescript_PYTHON}) +INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py medutilities.py DESTINATION ${MED_salomescript_PYTHON}) +INSTALL(FILES med2sauv sauv2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MED_salomescript_PYTHON} ) ADD_TEST(MEDLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest.py) ADD_TEST(MEDLoaderTest2 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest2.py) diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 311657240..ee908bcb1 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -368,8 +368,9 @@ namespace ParaMEDMEM virtual void clearNonDiscrAttributes() const; void setName(const char *name); const char *getName(); - void setUnivName(const char *name); const char *getUnivName() const; + bool getUnivNameWrStatus() const; + void setUnivNameWrStatus(bool newStatus); void setDescription(const char *name); const char *getDescription() const; void setOrder(int order); @@ -623,7 +624,6 @@ namespace ParaMEDMEM void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception); void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception); void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception); - void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception); void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms, bool renum) throw(INTERP_KERNEL::Exception); void optimizeFamilies() throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 1f7d5d68e..4595fa67f 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -119,6 +119,7 @@ class MEDLoaderTest(unittest.TestCase): m2.checkCoherency() # mm=MEDFileUMesh.New() + self.assertTrue(mm.getUnivNameWrStatus()) mm.setName("MyFirstMEDCouplingMEDmesh") mm.setDescription("IHopeToConvinceLastMEDMEMUsers") mm.setCoords(c) @@ -170,6 +171,9 @@ class MEDLoaderTest(unittest.TestCase): mmCpy.write(outFileName,2); # mm=MEDFileMesh.New(outFileName) + self.assertTrue(mm.getUnivNameWrStatus()) + self.assertTrue(isinstance(mm.getUnivName(),str)) + self.assertTrue(len(mm.getUnivName())!=0) mbis=mm.getMeshAtLevel(0) m.setName(mm.getName()) ; m.setDescription(mm.getDescription()) self.assertTrue(m.isEqual(mbis,1e-12)); @@ -325,8 +329,12 @@ class MEDLoaderTest(unittest.TestCase): da=m.getFamilyArr(1,"family1") expected1=[2,4,9] self.assertEqual(expected1,da.getValues()) + self.assertTrue(m.getUnivNameWrStatus()) m.write(outFileName,2); mm=MEDFileMesh.New(outFileName) + self.assertTrue(isinstance(mm,MEDFileCMesh)) + self.assertTrue(isinstance(mm.getUnivName(),str)) + self.assertTrue(len(mm.getUnivName())!=0) self.assertTrue(m.isEqual(mm,1e-12)[0]) self.assertEqual(expected1,mm.getFamilyArr(1,"family1").getValues()) m2=mm.getMesh() @@ -2021,6 +2029,8 @@ class MEDLoaderTest(unittest.TestCase): # m1=MEDFileMesh.New(fname) self.assertTrue(isinstance(m1,MEDFileCurveLinearMesh)) + self.assertTrue(isinstance(m1.getUnivName(),str)) + self.assertTrue(len(m1.getUnivName())!=0) self.assertTrue(m1.getMesh().isEqual(mesh,1e-12)) pass