Salome HOME
Minor doc: isIota()
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingField.cxx
index 463a44bbb95f56a63be75b0d4dd1bd508995f948..4afc32168ddf94a64f24540f6ddd8a0bd6487bc4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
 
 #include <sstream>
 
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
+
+void MEDCouplingField::checkConsistencyLight() const
+{
+  if(!_mesh)
+    throw INTERP_KERNEL::Exception("Field invalid because no mesh specified !");
+  if(_type.isNull())
+    throw INTERP_KERNEL::Exception("MEDCouplingField::checkConsistencyLight : no spatial discretization !");
+}
 
 bool MEDCouplingField::isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const
 {
@@ -186,8 +194,8 @@ std::vector<const BigMemoryObject *> MEDCouplingField::getDirectChildrenWithNull
 
 /*!
  * Returns a type of \ref MEDCouplingSpatialDisc "spatial discretization" of \a this
- * field in terms of enum ParaMEDMEM::TypeOfField. 
- * \return ParaMEDMEM::TypeOfField - the type of \a this field.
+ * field in terms of enum MEDCoupling::TypeOfField. 
+ * \return MEDCoupling::TypeOfField - the type of \a this field.
  * \throw If the geometric type is empty.
  */
 TypeOfField MEDCouplingField::getTypeOfField() const
@@ -199,7 +207,7 @@ TypeOfField MEDCouplingField::getTypeOfField() const
 
 /*!
  * Returns the nature of \a this field. This information is very important during
- * interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC.
+ * interpolation process using MEDCoupling::MEDCouplingRemapper or MEDCoupling::InterpKernelDEC.
  * In other context than the two mentioned above, this attribute is unimportant. This
  * attribute is not stored in the MED file.
  * For more information of the semantics and the influence of this attribute to the
@@ -214,7 +222,7 @@ NatureOfField MEDCouplingField::getNature() const
 
 /*!
  * Sets the nature of \a this field. This information is very important during
- * interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC.
+ * interpolation process using MEDCoupling::MEDCouplingRemapper or MEDCoupling::InterpKernelDEC.
  * In other context than the two mentioned above, this attribute is unimportant. This
  * attribute is not stored in the MED file.
  * For more information of the semantics and the influence of this attribute to the
@@ -228,6 +236,8 @@ NatureOfField MEDCouplingField::getNature() const
 void MEDCouplingField::setNature(NatureOfField nat)
 {
   MEDCouplingNatureOfField::GetRepr(nat);//generate a throw if nat not recognized
+  if(_type)
+    _type->checkCompatibilityWithNature(nat);
   _nature=nat;
 }
 
@@ -366,7 +376,7 @@ void MEDCouplingField::clearGaussLocalizations()
  *          problem.
  *  \param [in] locId - the id of the Gauss localization object of interest.
  *         It must be in range <em> 0 <= locId < getNbOfGaussLocalization() </em>.
- *  \return \ref ParaMEDMEM::MEDCouplingGaussLocalization "MEDCouplingGaussLocalization" & - the
+ *  \return \ref MEDCoupling::MEDCouplingGaussLocalization "MEDCouplingGaussLocalization" & - the
  *  Gauss localization object.
  *  \throw If \a this field is not on Gauss points.
  *  \throw If \a locId is not within the valid range.
@@ -503,7 +513,7 @@ MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy)
 
 /*!
  * Returns a new MEDCouplingMesh constituted by some cells of the underlying mesh of \a
- * this filed, and returns ids of entities (nodes, cells, Gauss points) lying on the 
+ * this field, and returns ids of entities (nodes, cells, Gauss points) lying on the
  * specified cells. The cells to include to the result mesh are specified by an array of
  * cell ids. The new mesh shares the coordinates array with the underlying mesh. 
  *  \param [in] start - an array of cell ids to include to the result mesh.