X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingFieldDouble.cxx;h=3c2e2eb8c8c955c23917b717e72adb8bf2a6e4f4;hb=a7a49bcd1fbbf89a8d7e4de71baf27d323b0a109;hp=1619b2984080a252944bc0a5be6a86ffff1131c0;hpb=b4b11b30ec3c8c59b9124a2c4efbd4b99039556f;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 1619b2984..3c2e2eb8c 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -200,8 +200,10 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::deepCpy() const * \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The * caller is to delete this field using decrRef() as it is no more needed. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_buildNewTimeReprFromThis "Here is a C++ example."
* \ref py_mcfielddouble_buildNewTimeReprFromThis "Here is a Python example." + * \endif * \sa clone() */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const @@ -345,7 +347,6 @@ void MEDCouplingFieldDouble::copyTinyAttrFrom(const MEDCouplingFieldDouble *othe { _time_discr->copyTinyAttrFrom(*other->_time_discr); } - } void MEDCouplingFieldDouble::copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) @@ -596,8 +597,10 @@ bool MEDCouplingFieldDouble::areCompatibleForMeld(const MEDCouplingFieldDouble * * \throw If \a check == \c true and \a old2NewBg contains equal ids. * \throw If mesh nature does not allow renumbering (e.g. structured mesh). * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_renumberCells "Here is a C++ example".
* \ref py_mcfielddouble_renumberCells "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::renumberCells(const int *old2NewBg, bool check) { @@ -631,10 +634,10 @@ void MEDCouplingFieldDouble::renumberCells(const int *old2NewBg, bool check) */ void MEDCouplingFieldDouble::renumberCellsWithoutMesh(const int *old2NewBg, bool check) { - if(!_mesh) - throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !"); - if(!((const MEDCouplingFieldDiscretization *)_type)) - throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !"); + if(!_mesh) + throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !"); + if(!((const MEDCouplingFieldDiscretization *)_type)) + throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !"); // _type->renumberCells(old2NewBg,check); std::vector arrays; @@ -659,8 +662,10 @@ void MEDCouplingFieldDouble::renumberCellsWithoutMesh(const int *old2NewBg, bool * \throw If mesh nature does not allow renumbering (e.g. structured mesh). * \throw If values at merged nodes deffer more than \a eps. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_renumberNodes "Here is a C++ example".
* \ref py_mcfielddouble_renumberNodes "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::renumberNodes(const int *old2NewBg, double eps) { @@ -752,8 +757,10 @@ DataArrayInt *MEDCouplingFieldDouble::getIdsInRange(double vmin, double vmax) co * \param [in] part - an array of cell ids to include to the result field. * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The caller is to delete this field using decrRef() as it is no more needed. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_subpart1 "Here is a C++ example".
* \ref py_mcfielddouble_subpart1 "Here is a Python example". + * \endif * \sa MEDCouplingFieldDouble::buildSubPartRange */ @@ -791,8 +798,10 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPart(const DataArrayInt * * \throw if there is presence of an invalid cell id in [ \a partBg, \a partEnd ) regarding the number of cells of \a this->getMesh(). * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_subpart1 "Here a C++ example."
* \ref py_mcfielddouble_subpart1 "Here a Python example." + * \endif * \sa ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *) const, MEDCouplingFieldDouble::buildSubPartRange */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPart(const int *partBg, const int *partEnd) const @@ -878,7 +887,7 @@ TypeOfTimeDiscretization MEDCouplingFieldDouble::getTimeDiscretization() const } MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingField(type), - _time_discr(MEDCouplingTimeDiscretization::New(td)) + _time_discr(MEDCouplingTimeDiscretization::New(td)) { } @@ -886,12 +895,12 @@ MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscr * ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! ** */ MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingField(ft,false), - _time_discr(MEDCouplingTimeDiscretization::New(td)) + _time_discr(MEDCouplingTimeDiscretization::New(td)) { } MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingField(other,deepCopy), - _time_discr(other._time_discr->performCpy(deepCopy)) + _time_discr(other._time_discr->performCpy(deepCopy)) { } @@ -1334,8 +1343,10 @@ void MEDCouplingFieldDouble::integral(bool isWAbs, double *res) const * \throw If the mesh is not set. * \throw If the mesh is not a structured one. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_getValueOnPos "Here is a C++ example".
* \ref py_mcfielddouble_getValueOnPos "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const { @@ -1356,8 +1367,10 @@ void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) con * \throw If the mesh is not set. * \throw If \a spaceLoc is out of the spatial discretization. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_getValueOn "Here is a C++ example".
* \ref py_mcfielddouble_getValueOn "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double *res) const { @@ -1382,8 +1395,10 @@ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double *res) con * \throw If the mesh is not set. * \throw If any point in \a spaceLoc is out of the spatial discretization. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_getValueOnMulti "Here is a C++ example".
* \ref py_mcfielddouble_getValueOnMulti "Here is a Python example". + * \endif */ DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, int nbOfPoints) const { @@ -1407,8 +1422,10 @@ DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, * \throw If \a spaceLoc is out of the spatial discretization. * \throw If \a time is not covered by \a this->_time_discr. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_getValueOn_time "Here is a C++ example".
* \ref py_mcfielddouble_getValueOn_time "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, double *res) const { @@ -1445,7 +1462,7 @@ void MEDCouplingFieldDouble::applyLin(double a, double b, int compoId) * All tuples will have the same value 'value'. * An exception is thrown if no underlying mesh is defined. */ -MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value) throw(INTERP_KERNEL::Exception) +MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value) { if(!_mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::operator= : no mesh defined !"); @@ -1466,7 +1483,9 @@ MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value) throw(IN * \throw If \a func returns \c false. * \throw If the spatial discretization of \a this field is NULL. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_fillFromAnalytic_c_func "Here is a C++ example". + * \endif */ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, FunctionToEvaluate func) { @@ -1510,8 +1529,10 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, FunctionToEvaluate f * \throw If the spatial discretization of \a this field is NULL. * \throw If computing \a func fails. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_fillFromAnalytic "Here is a C++ example".
* \ref py_mcfielddouble_fillFromAnalytic "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) { @@ -1557,8 +1578,10 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& f * \throw If the spatial discretization of \a this field is NULL. * \throw If computing \a func fails. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_fillFromAnalytic2 "Here is a C++ example".
* \ref py_mcfielddouble_fillFromAnalytic2 "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& func) { @@ -1604,8 +1627,10 @@ void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& * \throw If the spatial discretization of \a this field is NULL. * \throw If computing \a func fails. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_fillFromAnalytic3 "Here is a C++ example".
* \ref py_mcfielddouble_fillFromAnalytic3 "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func) { @@ -1625,7 +1650,9 @@ void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector * \ref py_mcfielddouble_applyFunc_val "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, double val) { @@ -1681,8 +1710,10 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, double val) * This function is to compute a field value basing on a current field value. * \throw If computing \a func fails. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_applyFunc "Here is a C++ example".
* \ref py_mcfielddouble_applyFunc "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) { @@ -1719,8 +1750,10 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) * This function is to compute a new field value basing on a current field value. * \throw If computing \a func fails. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_applyFunc2 "Here is a C++ example".
* \ref py_mcfielddouble_applyFunc2 "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const std::string& func) { @@ -1756,8 +1789,10 @@ void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const std::string& func) * This function is to compute a new field value basing on a current field value. * \throw If computing \a func fails. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_applyFunc3 "Here is a C++ example".
* \ref py_mcfielddouble_applyFunc3 "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) { @@ -1786,8 +1821,10 @@ void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector * \ref py_mcfielddouble_applyFunc_same_nb_comp "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::applyFunc(const std::string& func) { @@ -2101,8 +2138,10 @@ void MEDCouplingFieldDouble::serialize(DataArrayInt *&dataInt, std::vector * \ref py_mcfielddouble_changeUnderlyingMesh "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps) { @@ -2115,7 +2154,7 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, renumberCellsWithoutMesh(cellCor->getConstPointer(),false); if(nodeCor) renumberNodesWithoutMesh(nodeCor->getConstPointer(),nodeCor->getMaxValueInArray()+1,eps); - setMesh(const_cast(other)); + setMesh(other); } /*! @@ -2147,8 +2186,10 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, * \throw If the two fields are not coherent for merge. * \throw If field values at merged nodes (if any) deffer more than \a eps. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_substractInPlaceDM "Here is a C++ example".
* \ref py_mcfielddouble_substractInPlaceDM "Here is a Python example". + * \endif * \sa changeUnderlyingMesh(). */ void MEDCouplingFieldDouble::substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps) @@ -2683,8 +2724,10 @@ void MEDCouplingFieldDouble::sortPerTuple(bool asc) * \throw If the spatial discretization of \a f1 is NULL. * \throw If the time discretization of \a f1 is NULL. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_MergeFields "Here is a C++ example".
* \ref py_mcfielddouble_MergeFields "Here is a Python example". + * \endif */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) { @@ -2722,8 +2765,10 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const MEDCouplingFie * \throw If \a a is empty. * \throw If the fields are not compatible for the merge. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_MergeFields "Here is a C++ example".
* \ref py_mcfielddouble_MergeFields "Here is a Python example". + * \endif */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vector& a) { @@ -2857,8 +2902,10 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::CrossProductFields(const MEDCoup * \throw If the fields are not strictly compatible (areStrictlyCompatible()), i.e. they * differ not only in values. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_MaxFields "Here is a C++ example".
* \ref py_mcfielddouble_MaxFields "Here is a Python example". + * \endif */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) { @@ -2885,8 +2932,10 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MaxFields(const MEDCouplingField * \throw If the fields are not strictly compatible (areStrictlyCompatible()), i.e. they * differ not only in values. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_MaxFields "Here is a C++ example".
* \ref py_mcfielddouble_MaxFields "Here is a Python example". + * \endif */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) { @@ -2957,7 +3006,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::AddFields(const MEDCouplingField * \throw If the fields are not strictly compatible (areStrictlyCompatible()), i.e. they * differ not only in values. */ -const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception) +const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator+=(const MEDCouplingFieldDouble& other) { if(!areStrictlyCompatible(&other)) throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply += on them !"); @@ -3001,7 +3050,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::SubstractFields(const MEDCouplin * \throw If the fields are not strictly compatible (areStrictlyCompatible()), i.e. they * differ not only in values. */ -const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator-=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception) +const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator-=(const MEDCouplingFieldDouble& other) { if(!areStrictlyCompatible(&other)) throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply -= on them !"); @@ -3063,7 +3112,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MultiplyFields(const MEDCoupling * (areCompatibleForMul()), * i.e. they differ not only in values and possibly in number of components. */ -const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator*=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception) +const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator*=(const MEDCouplingFieldDouble& other) { if(!areCompatibleForMul(&other)) throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply *= on them !"); @@ -3119,7 +3168,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::DivideFields(const MEDCouplingFi * \throw If the fields are not compatible for division (areCompatibleForDiv()), * i.e. they differ not only in values and possibly in number of components. */ -const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception) +const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator/=(const MEDCouplingFieldDouble& other) { if(!areCompatibleForDiv(&other)) throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply /= on them !"); @@ -3150,12 +3199,12 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::PowFields(const MEDCouplingField * * \sa MEDCouplingFieldDouble::PowFields */ -MEDCouplingFieldDouble *MEDCouplingFieldDouble::operator^(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) +MEDCouplingFieldDouble *MEDCouplingFieldDouble::operator^(const MEDCouplingFieldDouble& other) const { return PowFields(this,&other); } -const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator^=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception) +const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator^=(const MEDCouplingFieldDouble& other) { if(!areCompatibleForDiv(&other)) throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply /= on them !"); @@ -3176,8 +3225,10 @@ const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator^=(const MEDCoupli * \throw If the mesh is not set. * \throw If any of the fields has no name. * + * \if ENABLE_EXAMPLES * \ref cpp_mcfielddouble_WriteVTK "Here is a C++ example".
* \ref py_mcfielddouble_WriteVTK "Here is a Python example". + * \endif */ void MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const std::vector& fs, bool isBinary) { @@ -3223,12 +3274,12 @@ void MEDCouplingFieldDouble::reprQuickOverview(std::ostream& stream) const stream << "MEDCouplingFieldDouble C++ instance at " << this << ". Name : \"" << _name << "\"." << std::endl; const char *nat=0; try - { + { nat=MEDCouplingNatureOfField::GetRepr(_nature); stream << "Nature of field : " << nat << ".\n"; - } + } catch(INTERP_KERNEL::Exception& /*e*/) - { } + { } const MEDCouplingFieldDiscretization *fd(_type); if(!fd) stream << "No spatial discretization set !";