-// 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
* \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."<br>
* \ref py_mcfielddouble_buildNewTimeReprFromThis "Here is a Python example."
+ * \endif
* \sa clone()
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const
{
_time_discr->copyTinyAttrFrom(*other->_time_discr);
}
-
}
void MEDCouplingFieldDouble::copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other)
* \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".<br>
* \ref py_mcfielddouble_renumberCells "Here is a Python example".
+ * \endif
*/
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<DataArrayDouble *> arrays;
* \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".<br>
* \ref py_mcfielddouble_renumberNodes "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::renumberNodes(const int *old2NewBg, double eps)
{
* \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".<br>
* \ref py_mcfielddouble_subpart1 "Here is a Python example".
+ * \endif
* \sa MEDCouplingFieldDouble::buildSubPartRange
*/
*
* \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."<br>
* \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
}
MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingField(type),
- _time_discr(MEDCouplingTimeDiscretization::New(td))
+ _time_discr(MEDCouplingTimeDiscretization::New(td))
{
}
* ** 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))
{
}
* \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".<br>
* \ref py_mcfielddouble_getValueOnPos "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const
{
* \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".<br>
* \ref py_mcfielddouble_getValueOn "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double *res) const
{
* \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".<br>
* \ref py_mcfielddouble_getValueOnMulti "Here is a Python example".
+ * \endif
*/
DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, int nbOfPoints) const
{
* \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".<br>
* \ref py_mcfielddouble_getValueOn_time "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, double *res) const
{
* 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 !");
* \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)
{
* \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".<br>
* \ref py_mcfielddouble_fillFromAnalytic "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func)
{
* \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".<br>
* \ref py_mcfielddouble_fillFromAnalytic2 "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& func)
{
* \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".<br>
* \ref py_mcfielddouble_fillFromAnalytic3 "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
* This function is to compute a field value basing on a current field value.
* \throw If \a func returns \c false.
*
+ * \if ENABLE_EXAMPLES
* \ref cpp_mcfielddouble_applyFunc_c_func "Here is a C++ example".
+ * \endif
*/
void MEDCouplingFieldDouble::applyFunc(int nbOfComp, FunctionToEvaluate func)
{
* \throw If the spatial discretization of \a this field is NULL.
* \throw If the mesh is not set.
*
+ * \if ENABLE_EXAMPLES
* \ref cpp_mcfielddouble_applyFunc_val "Here is a C++ example".<br>
* \ref py_mcfielddouble_applyFunc_val "Here is a Python example".
+ * \endif
*/
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".<br>
* \ref py_mcfielddouble_applyFunc "Here is a Python example".
+ * \endif
*/
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".<br>
* \ref py_mcfielddouble_applyFunc2 "Here is a Python example".
+ * \endif
*/
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".<br>
* \ref py_mcfielddouble_applyFunc3 "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
* 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_same_nb_comp "Here is a C++ example".<br>
* \ref py_mcfielddouble_applyFunc_same_nb_comp "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::applyFunc(const std::string& func)
{
* \throw If the two meshes do not match.
* \throw If field values at merged nodes (if any) deffer more than \a eps.
*
+ * \if ENABLE_EXAMPLES
* \ref cpp_mcfielddouble_changeUnderlyingMesh "Here is a C++ example".<br>
* \ref py_mcfielddouble_changeUnderlyingMesh "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps)
{
renumberCellsWithoutMesh(cellCor->getConstPointer(),false);
if(nodeCor)
renumberNodesWithoutMesh(nodeCor->getConstPointer(),nodeCor->getMaxValueInArray()+1,eps);
- setMesh(const_cast<MEDCouplingMesh *>(other));
+ setMesh(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".<br>
* \ref py_mcfielddouble_substractInPlaceDM "Here is a Python example".
+ * \endif
* \sa changeUnderlyingMesh().
*/
void MEDCouplingFieldDouble::substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps)
* \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".<br>
* \ref py_mcfielddouble_MergeFields "Here is a Python example".
+ * \endif
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2)
{
* \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".<br>
* \ref py_mcfielddouble_MergeFields "Here is a Python example".
+ * \endif
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vector<const MEDCouplingFieldDouble *>& a)
{
* \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".<br>
* \ref py_mcfielddouble_MaxFields "Here is a Python example".
+ * \endif
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2)
{
* \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".<br>
* \ref py_mcfielddouble_MaxFields "Here is a Python example".
+ * \endif
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2)
{
* \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 !");
* \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 !");
* (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 !");
* \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 !");
*
* \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 !");
* \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".<br>
* \ref py_mcfielddouble_WriteVTK "Here is a Python example".
+ * \endif
*/
void MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary)
{
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 !";