From: ageay Date: Thu, 23 Sep 2010 10:13:43 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V5_1_main_FINAL~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=df0be2c1abe9e15f163dfb182943cce2ac3f0fd2;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 3a08625fc..aeb69c038 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -598,11 +598,25 @@ void MEDCouplingFieldDouble::applyFuncFast64(const char *func) throw(INTERP_KERN _time_discr->applyFuncFast64(func); } -int MEDCouplingFieldDouble::getNumberOfComponents() const +/*! + * This method makes the assumption that the default array has been set before. + * If not an exception will be sent. + * If default array set, the number of components will be sent. + */ +int MEDCouplingFieldDouble::getNumberOfComponents() const throw(INTERP_KERNEL::Exception) { + if(getArray()==0) + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfComponents : No array specified !"); return getArray()->getNumberOfComponents(); } +/*! + * This method makes the assumption that _mesh has be set before the call of this method and description of gauss + * localizations in case of Gauss field. If not an exception will sent. + * \b Contrary to MEDCouplingFieldDouble::getNumberOfComponents and MEDCouplingFieldDouble::getNumberOfValues is + * \b not aware of the presence of the default array. + * \b WARNING \b no coherency check is done here. MEDCouplingFieldDouble::checkCoherency method should be called to check that ! + */ int MEDCouplingFieldDouble::getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { if(!_mesh) @@ -610,6 +624,18 @@ int MEDCouplingFieldDouble::getNumberOfTuples() const throw(INTERP_KERNEL::Excep return _type->getNumberOfTuples(_mesh); } +/*! + * This method makes the assumption that the default array has been set before. + * If not an exception will be sent. + * If default array set, the number of values present in the default array will be sent. + */ +int MEDCouplingFieldDouble::getNumberOfValues() const throw(INTERP_KERNEL::Exception) +{ + if(getArray()==0) + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfValues : No array specified !"); + return getArray()->getNbOfElems(); +} + void MEDCouplingFieldDouble::updateTime() { MEDCouplingField::updateTime(); diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index f86b013be..a3c40d86c 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -84,8 +84,9 @@ namespace ParaMEDMEM void applyFunc(const char *func); void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception); void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception); - int getNumberOfComponents() const; + int getNumberOfComponents() const throw(INTERP_KERNEL::Exception); int getNumberOfTuples() const throw(INTERP_KERNEL::Exception); + int getNumberOfValues() const throw(INTERP_KERNEL::Exception); void updateTime(); // void getTinySerializationIntInformation(std::vector& tinyInfo) const; diff --git a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i index 9d783c3d3..a1ee44c36 100644 --- a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i +++ b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i @@ -778,8 +778,9 @@ namespace ParaMEDMEM DataArrayDouble *getArray() const throw(INTERP_KERNEL::Exception); DataArrayDouble *getEndArray() const throw(INTERP_KERNEL::Exception); void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception); - int getNumberOfComponents() const; + int getNumberOfComponents() const throw(INTERP_KERNEL::Exception); int getNumberOfTuples() const throw(INTERP_KERNEL::Exception); + int getNumberOfValues() const throw(INTERP_KERNEL::Exception); NatureOfField getNature() const { return _nature; } void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception); void updateTime();