#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingFieldT.txx"
#include "MEDCouplingFieldInt32.hxx"
+#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
* Creates a new MEDCouplingFieldDouble, of given spatial type and time discretization.
* For more info, see \ref MEDCouplingFirstSteps3.
* \param [in] type - the type of spatial discretization of the created field, one of
- * (\ref MEDCoupling::ON_CELLS "ON_CELLS",
+ * (\ref MEDCoupling::ON_CELLS "ON_CELLS",
* \ref MEDCoupling::ON_NODES "ON_NODES",
- * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT",
+ * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT",
* \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE",
* \ref MEDCoupling::ON_NODES_KR "ON_NODES_KR").
* \param [in] td - the type of time discretization of the created field, one of
- * (\ref MEDCoupling::NO_TIME "NO_TIME",
- * \ref MEDCoupling::ONE_TIME "ONE_TIME",
- * \ref MEDCoupling::LINEAR_TIME "LINEAR_TIME",
+ * (\ref MEDCoupling::NO_TIME "NO_TIME",
+ * \ref MEDCoupling::ONE_TIME "ONE_TIME",
+ * \ref MEDCoupling::LINEAR_TIME "LINEAR_TIME",
* \ref MEDCoupling::CONST_ON_TIME_INTERVAL "CONST_ON_TIME_INTERVAL").
* \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The
- * caller is to delete this field using decrRef() as it is no more needed.
+ * caller is to delete this field using decrRef() as it is no more needed.
*/
MEDCouplingFieldDouble* MEDCouplingFieldDouble::New(TypeOfField type, TypeOfTimeDiscretization td)
{
/*!
* Creates a new MEDCouplingFieldDouble, of a given time discretization and with a
- * spatial type and supporting mesh copied from a given
+ * spatial type and supporting mesh copied from a given
* \ref MEDCouplingFieldTemplatesPage "field template".
* For more info, see \ref MEDCouplingFirstSteps3.
* \warning This method does not deeply copy neither the mesh nor the spatial
* \param [in] ft - the \ref MEDCouplingFieldTemplatesPage "field template" defining
* the spatial discretization and the supporting mesh.
* \param [in] td - the type of time discretization of the created field, one of
- * (\ref MEDCoupling::NO_TIME "NO_TIME",
- * \ref MEDCoupling::ONE_TIME "ONE_TIME",
- * \ref MEDCoupling::LINEAR_TIME "LINEAR_TIME",
+ * (\ref MEDCoupling::NO_TIME "NO_TIME",
+ * \ref MEDCoupling::ONE_TIME "ONE_TIME",
+ * \ref MEDCoupling::LINEAR_TIME "LINEAR_TIME",
* \ref MEDCoupling::CONST_ON_TIME_INTERVAL "CONST_ON_TIME_INTERVAL").
* \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The
- * caller is to delete this field using decrRef() as it is no more needed.
+ * caller is to delete this field using decrRef() as it is no more needed.
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td)
{
/*!
* This method if possible the time information (time unit, time iteration, time unit and time value) with its support
* that is to say its mesh.
- *
+ *
* \throw If \c this->_mesh is null an exception will be thrown. An exception will also be throw if the spatial discretization is
* NO_TIME.
*/
* - \ref MEDCouplingTemporalDisc "temporal discretization" data that holds array(s)
* of field values,
* - \ref MEDCouplingSpatialDisc "a spatial discretization".
- *
+ *
* \c clone(false) is rather dedicated for advanced users that want to limit the amount
* of memory. It allows the user to perform methods like operator+(), operator*()
* etc. with \a this and the returned field. If the user wants to duplicate deeply the
- * underlying mesh he should call cloneWithMesh() method or deepCopy() instead.
+ * underlying mesh he should call cloneWithMesh() method or deepCopy() instead.
* \warning The underlying \b mesh of the returned field is **always the same**
* (pointer) as \a this one **whatever the value** of \a recDeepCpy parameter.
* \param [in] recDeepCpy - if \c true, the copy of the underlying data arrays is
* shares the data array(s) with \a this field, or holds a deep copy of it, depending on
* \a deepCopy parameter. But the underlying \b mesh is always **shallow copied**.
* \param [in] td - the type of time discretization of the created field, one of
- * (\ref MEDCoupling::NO_TIME "NO_TIME",
- * \ref MEDCoupling::ONE_TIME "ONE_TIME",
- * \ref MEDCoupling::LINEAR_TIME "LINEAR_TIME",
+ * (\ref MEDCoupling::NO_TIME "NO_TIME",
+ * \ref MEDCoupling::ONE_TIME "ONE_TIME",
+ * \ref MEDCoupling::LINEAR_TIME "LINEAR_TIME",
* \ref MEDCoupling::CONST_ON_TIME_INTERVAL "CONST_ON_TIME_INTERVAL").
* \param [in] deepCpy - if \c true, the copy of the underlying data arrays is
* deep, else all data arrays of \a this field are shared by the new field.
* \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The
- * caller is to delete this field using decrRef() as it is no more needed.
- *
+ * 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."
* caller is to delete this field using decrRef() as it is no more needed. The returned field will share the same mesh object object than those in \a this.
* \throw If \a this spatial discretization is empty or not ON_NODES.
* \throw If \a this is not coherent (see MEDCouplingFieldDouble::checkConsistencyLight).
- *
+ *
* \warning This method is a \b non \b conservative method of remapping from node spatial discretization to cell spatial discretization.
* If a conservative method of interpolation is required MEDCoupling::MEDCouplingRemapper class should be used instead with "P1P0" method.
*/
/*!
* Permutes values of \a this field according to a given permutation array for node
- * renumbering. The underlying mesh is deeply copied and its nodes are also permuted.
+ * renumbering. The underlying mesh is deeply copied and its nodes are also permuted.
* The number of nodes can change, contrary to renumberCells().
* \param [in] old2NewBg - the permutation array in "Old to New" mode. Its length is
* to be equal to \a this->getMesh()->getNumberOfNodes().
* \throw If \a check == \c true and \a old2NewBg contains equal ids.
* \throw If mesh nature does not allow renumbering (e.g. structured mesh).
* \throw If values at merged nodes differ 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".
/*!
* Permutes values of \a this field according to a given permutation array for nodes
- * renumbering. The underlying mesh is \b not permuted.
+ * renumbering. The underlying mesh is \b not permuted.
* The number of nodes can change, contrary to renumberCells().
* A given epsilon specifies a threshold of error in case of two nodes are merged but
* the difference of values on these nodes are higher than \a eps.
* This method performs a part of job of renumberNodes(), excluding node renumbering
* in mesh. The reasonable use of this
* method is only for multi-field instances lying on the same mesh to avoid a
- * systematic duplication and renumbering of _mesh attribute.
+ * systematic duplication and renumbering of _mesh attribute.
* \warning Use this method with a lot of care!
* \warning In case of an exception thrown, the contents of the data array can be
- * partially modified until the exception occurs.
+ * partially modified until the exception occurs.
* \param [in] old2NewBg - the permutation array in "Old to New" mode. Its length is
* to be equal to \a this->getMesh()->getNumberOfNodes().
* \param [in] newNbOfNodes - a number of nodes in the mesh after renumbering.
{
return ConvertToUField<int>(this);
}
-
+MEDCouplingFieldInt64 *MEDCouplingFieldDouble::convertToInt64Field() const
+{
+ return ConvertToUField<Int64>(this);
+}
MEDCouplingFieldFloat *MEDCouplingFieldDouble::convertToFloatField() const
{
return ConvertToUField<float>(this);
/*!
* Accumulates values of each component of \a this array.
- * \param [out] res - an array of length \a this->getNumberOfComponents(), allocated
+ * \param [out] res - an array of length \a this->getNumberOfComponents(), allocated
* by the caller, that is filled by this method with sum value for each
* component.
* \throw If the data array is not set.
/*!
* Computes the weighted average of values of each component of \a this field, the weights being the
- * values returned by buildMeasureField().
+ * values returned by buildMeasureField().
* \param [out] res - pointer to an array of result sum values, of size at least \a
* this->getNumberOfComponents(), that is to be allocated by the caller.
* \param [in] isWAbs - if \c true (default), \c abs() is applied to the weights computed by
* \param [in] nbOfPoints - number of points of interest.
* \return DataArrayDouble * - a new instance of DataArrayDouble holding field
* values relating to the input points. This array is of size \a nbOfPoints
- * tuples per \a this->getNumberOfComponents() components. The caller is to
+ * tuples per \a this->getNumberOfComponents() components. The caller is to
* delete this array using decrRef() as it is no more needed.
* \throw If the spatial discretization of \a this field is NULL.
* \throw If the mesh is not set.
* a corresponding node coordinates array (where it is set via
* DataArrayDouble::setInfoOnComponent()).<br>
* For more info on supported expressions that can be used in the function, see \ref
- * MEDCouplingArrayApplyFuncExpr. <br>
+ * MEDCouplingArrayApplyFuncExpr. <br>
* In a general case, a value resulting from the function evaluation is assigned to all
* components of a field value. But there is a possibility to have its own expression for
* each component within one function. For this purpose, there are predefined variable
* MEDCouplingArrayApplyFuncExpr. <br>
* The function can include **only one** arbitrary named variable
* (e.g. "x","y" or "va44") to refer to a field atomic value. <br>
- * In a general case, a value resulting from the function evaluation is assigned to
+ * In a general case, a value resulting from the function evaluation is assigned to
* a single field value. But there is a possibility to have its own expression for
* each component within one function. For this purpose, there are predefined variable
* names (IVec, JVec, KVec, LVec etc) each dedicated to a certain component (IVec, to
* Use MEDCouplingField::getNumberOfTuplesExpected instead of this method. This method will be removed soon, because it is
* confusing compared to getNumberOfComponents() and getNumberOfValues() behaviour.
*
- * Returns number of tuples in \a this field, that depends on
+ * Returns number of tuples in \a this field, that depends on
* - the number of entities in the underlying mesh
* - \ref MEDCouplingSpatialDisc "spatial discretization" of \a this field (e.g. number
- * of Gauss points if \a this->getTypeOfField() ==
+ * of Gauss points if \a this->getTypeOfField() ==
* \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT").
*
* The returned value does \b not \b depend on the number of tuples in the data array
* \throw If the data array is not set.
* \throw If the mesh is not set.
* \throw If the spatial discretization of \a this field is NULL.
- * \throw If \a this field if of type other than
+ * \throw If \a this field if of type other than
* \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" or
* \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE".
*/
}
/*!
- * Sets the data array.
+ * Sets the data array.
* \param [in] array - the data array holding values of \a this field. It's size
* should correspond to the mesh and
* \ref MEDCouplingSpatialDisc "spatial discretization" of \a this field
* Subtracts another field from \a this one in case when the two fields have different
* supporting meshes. The subtraction is performed provided that the tho meshes can be
* considered equal with use of specified equality criteria, else an exception is thrown.
- * If the meshes match, the mesh of \a f is set to \a this field (\a this is permuted if
+ * If the meshes match, the mesh of \a f is set to \a this field (\a this is permuted if
* necessary) and field values are subtracted. No interpolation is done here, only an
* analysis of two underlying mesh is done to see if the meshes are geometrically
* equivalent.<br>
/*!
* This method calls MEDCouplingUMesh::buildSlice3D method. So this method makes the assumption that underlying mesh exists.
* For the moment, this method is implemented for fields on cells.
- *
+ *
* \return a newly allocated field double containing the result that the user should deallocate.
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::extractSlice3D(const double *origin, const double *vec, double eps) const
/*!
* Divides every cell of the underlying mesh into simplices (triangles in 2D and
* tetrahedra in 3D). If some cells are divided, the underlying mesh is replaced by a new
- * mesh instance containing the simplices.<br>
+ * mesh instance containing the simplices.<br>
* \param [in] policy - specifies a pattern used for splitting. For its description, see
* MEDCouplingUMesh::simplexize().
* \return bool - \c true if some cells have been divided and hence \a this field lies
* on another mesh.
- * \throw If \a policy has an invalid value. For valid values, see the description of
+ * \throw If \a policy has an invalid value. For valid values, see the description of
* MEDCouplingUMesh::simplexize().
* \throw If MEDCouplingMesh::simplexize() is not applicable to the underlying mesh.
* \throw If the mesh is not well defined.
* Finally \a this is also expected to be consistent.
* In these conditions this method returns a newly created field (to be dealed by the caller).
* The returned field will also 3 compo vector field be on nodes lying on the same mesh than \a this.
- *
+ *
* For each 3 compo tuple \a tup in \a this the returned tuple is the result of the transformation of \a tup in the new referential. This referential is defined by \a Ur, \a Uteta, \a Uz.
* \a Ur is the vector between \a center point and the associated node with \a tuple. \a Uz is \a vect normalized. And Uteta is the cross product of \a Uz with \a Ur.
*
* every tensor of \a this 6-componental field.
* \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble, whose
* each tuple is calculated from the tuple <em>(t)</em> of \a this field as
- * follows: \f$ t[0]^2+t[1]^2+t[2]^2+2*t[3]^2+2*t[4]^2+2*t[5]^2\f$.
+ * follows: \f$ t[0]^2+t[1]^2+t[2]^2+2*t[3]^2+2*t[4]^2+2*t[5]^2\f$.
* This new field lies on the same mesh as \a this one. The caller is to delete
* this field using decrRef() as it is no more needed.
* \throw If \a this->getNumberOfComponents() != 6.
/*!
* Creates a new MEDCouplingFieldDouble filled with the determinant of a square
* matrix defined by every tuple of \a this field, having either 4, 6 or 9 components.
- * The case of 6 components corresponds to that of the upper triangular matrix.
+ * The case of 6 components corresponds to that of the upper triangular matrix.
* \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble, whose
- * each tuple is the determinant of matrix of the corresponding tuple of \a this
- * field. This new field lies on the same mesh as \a this one. The caller is to
+ * each tuple is the determinant of matrix of the corresponding tuple of \a this
+ * field. This new field lies on the same mesh as \a this one. The caller is to
* delete this field using decrRef() as it is no more needed.
* \throw If \a this->getNumberOfComponents() is not in [4,6,9].
* \throw If the spatial discretization of \a this field is NULL.
/*!
* Creates a new MEDCouplingFieldDouble with 3 components filled with 3 eigenvalues of
* an upper triangular matrix defined by every tuple of \a this 6-componental field.
- * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
+ * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
* having 3 components, whose each tuple contains the eigenvalues of the matrix of
* corresponding tuple of \a this field. This new field lies on the same mesh as
* \a this one. The caller is to delete this field using decrRef() as it is no
- * more needed.
+ * more needed.
* \throw If \a this->getNumberOfComponents() != 6.
* \throw If the spatial discretization of \a this field is NULL.
*/
/*!
* Creates a new MEDCouplingFieldDouble with 9 components filled with 3 eigenvectors of
* an upper triangular matrix defined by every tuple of \a this 6-componental field.
- * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
+ * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
* having 9 components, whose each tuple contains the eigenvectors of the matrix of
* corresponding tuple of \a this field. This new field lies on the same mesh as
* \a this one. The caller is to delete this field using decrRef() as it is no
- * more needed.
+ * more needed.
* \throw If \a this->getNumberOfComponents() != 6.
* \throw If the spatial discretization of \a this field is NULL.
*/
* a matrix defined by every tuple of \a this field having either 4, 6 or 9
* components. The case of 6 components corresponds to that of the upper triangular
* matrix.
- * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
+ * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
* having the same number of components as \a this one, whose each tuple
* contains the inverse matrix of the matrix of corresponding tuple of \a this
* field. This new field lies on the same mesh as \a this one. The caller is to
- * delete this field using decrRef() as it is no more needed.
+ * delete this field using decrRef() as it is no more needed.
* \throw If \a this->getNumberOfComponents() is not in [4,6,9].
* \throw If the spatial discretization of \a this field is NULL.
*/
* a matrix defined by every tuple of \a this field having either 4, 6 or 9
* components. The case of 6 components corresponds to that of the upper triangular
* matrix.
- * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
+ * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
* having 1 component, whose each tuple is the trace of the matrix of
* corresponding tuple of \a this field.
* This new field lies on the same mesh as \a this one. The caller is to
- * delete this field using decrRef() as it is no more needed.
+ * delete this field using decrRef() as it is no more needed.
* \throw If \a this->getNumberOfComponents() is not in [4,6,9].
* \throw If the spatial discretization of \a this field is NULL.
*/
/*!
* Creates a new MEDCouplingFieldDouble filled with the stress deviator tensor of
* a stress tensor defined by every tuple of \a this 6-componental field.
- * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
+ * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
* having same number of components and tuples as \a this field,
* whose each tuple contains the stress deviator tensor of the stress tensor of
* corresponding tuple of \a this field. This new field lies on the same mesh as
* \a this one. The caller is to delete this field using decrRef() as it is no
- * more needed.
+ * more needed.
* \throw If \a this->getNumberOfComponents() != 6.
* \throw If the spatial discretization of \a this field is NULL.
*/
/*!
* Creates a new MEDCouplingFieldDouble filled with the magnitude of
* every vector of \a this field.
- * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
+ * \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble,
* having one component, whose each tuple is the magnitude of the vector
* of corresponding tuple of \a this field. This new field lies on the
* same mesh as \a this one. The caller is to
- * delete this field using decrRef() as it is no more needed.
+ * delete this field using decrRef() as it is no more needed.
* \throw If the spatial discretization of \a this field is NULL.
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::magnitude() const
* values of every tuple of \a this field.
* \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble.
* This new field lies on the same mesh as \a this one. The caller is to
- * delete this field using decrRef() as it is no more needed.
+ * delete this field using decrRef() as it is no more needed.
* \throw If the spatial discretization of \a this field is NULL.
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::maxPerTuple() const
* Changes number of components in \a this field. If \a newNbOfComp is less
* than \a this->getNumberOfComponents() then each tuple
* is truncated to have \a newNbOfComp components, keeping first components. If \a
- * newNbOfComp is more than \a this->getNumberOfComponents() then
- * each tuple is populated with \a dftValue to have \a newNbOfComp components.
+ * newNbOfComp is more than \a this->getNumberOfComponents() then
+ * each tuple is populated with \a dftValue to have \a newNbOfComp components.
* \param [in] newNbOfComp - number of components for the new field to have.
* \param [in] dftValue - value assigned to new values added to \a this field.
* \throw If \a this is not allocated.
* into the new field.
* \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble that the caller
* is to delete using decrRef() as it is no more needed.
- * \throw If a component index (\a i) is not valid:
+ * \throw If a component index (\a i) is not valid:
* \a i < 0 || \a i >= \a this->getNumberOfComponents().
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector<std::size_t>& compoIds) const
* \param [in] f1 - the first field.
* \param [in] f2 - the second field.
* \return MEDCouplingFieldDouble * - the result field. It is a new instance of
- * MEDCouplingFieldDouble. The caller is to delete this mesh using decrRef()
+ * MEDCouplingFieldDouble. The caller is to delete this mesh using decrRef()
* as it is no more needed.
* \throw If the fields are not compatible for the merge.
* \throw If the spatial discretization of \a f1 is NULL.
* Creates a new MEDCouplingFieldDouble by concatenating all given fields.
* Values of the *i*-th field precede values of the (*i*+1)-th field within the result.
* If there is only one field in \a a, a deepCopy() (except time information of mesh and
- * field) of the field is returned.
+ * field) of the field is returned.
* Generally speaking the first field in \a a is used to assign tiny attributes of the
- * returned field.
+ * returned field.
* \param [in] a - a vector of fields (MEDCouplingFieldDouble) to concatenate.
* \return MEDCouplingFieldDouble * - the result field. It is a new instance of
- * MEDCouplingFieldDouble. The caller is to delete this mesh using decrRef()
+ * MEDCouplingFieldDouble. The caller is to delete this mesh using decrRef()
* as it is no more needed.
* \throw If \a a is empty.
* \throw If the fields are not compatible for the merge.
}
/*!
- * Returns a new MEDCouplingFieldDouble containing a dot product of two given fields,
+ * Returns a new MEDCouplingFieldDouble containing a dot product of two given fields,
* so that the i-th tuple of the result field is a sum of products of j-th components of
- * i-th tuples of given fields (\f$ f_i = \sum_{j=1}^n f1_j * f2_j \f$).
+ * i-th tuples of given fields (\f$ f_i = \sum_{j=1}^n f1_j * f2_j \f$).
* Number of tuples and components in the given fields must be the same.
* \param [in] f1 - a given field.
* \param [in] f2 - another given field.
}
/*!
- * Returns a new MEDCouplingFieldDouble containing a cross product of two given fields,
+ * Returns a new MEDCouplingFieldDouble containing a cross product of two given fields,
* so that
* the i-th tuple of the result field is a 3D vector which is a cross
* product of two vectors defined by the i-th tuples of given fields.
/*!
* Returns a copy of \a this field in which sign of all values is reversed.
* \return MEDCouplingFieldDouble * - the new instance of MEDCouplingFieldDouble
- * containing the same number of tuples and components as \a this field.
+ * containing the same number of tuples and components as \a this field.
* The caller is to delete this result field using decrRef() as it is no more
- * needed.
+ * needed.
* \throw If the spatial discretization of \a this field is NULL.
* \throw If a data array is not allocated.
*/
/*!
* Directly called by MEDCouplingFieldDouble::operator^.
- *
+ *
* \sa MEDCouplingFieldDouble::operator^
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::PowFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2)
/*!
* Directly call MEDCouplingFieldDouble::PowFields static method.
- *
+ *
* \sa MEDCouplingFieldDouble::PowFields
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::operator^(const MEDCouplingFieldDouble& other) const
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const;
MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *convertToIntField() const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *convertToInt64Field() const;
MEDCOUPLING_EXPORT MEDCouplingFieldFloat *convertToFloatField() const;
MEDCOUPLING_EXPORT double getIJK(mcIdType cellId, int nodeIdInCell, int compoId) const;
MEDCOUPLING_EXPORT double accumulate(int compId) const;
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldT.txx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMesh.hxx"
#include "MEDCouplingMemArray.txx"
return new MEDCouplingFieldFloat(*this,recDeepCpy);
}
-MEDCouplingFieldDouble *MEDCouplingFieldFloat::convertToDblField() const
+template<class U>
+typename Traits<U>::FieldType *ConvertToUField(const MEDCouplingFieldFloat *self)
{
- MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*this));
+ MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*self));
int t1,t2;
- double t0(getTime(t1,t2));
- MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization()));
+ double t0(self->getTime(t1,t2));
+ MCAuto<typename Traits<U>::FieldType> ret(Traits<U>::FieldType::New(*tmp,self->getTimeDiscretization()));
ret->setTime(t0,t1,t2);
- if(getArray())
+ if(self->getArray())
{
- MCAuto<DataArrayDouble> arr(getArray()->convertToDblArr());
+ MCAuto<typename Traits<U>::ArrayType> arr(self->getArray()->convertToOtherTypeOfArr<U>());
ret->setArray(arr);
}
return ret.retn();
}
+
+MEDCouplingFieldDouble * MEDCouplingFieldFloat::convertToDblField() const
+{
+ return ConvertToUField<double>(this);
+}
+
+MEDCouplingFieldInt32 * MEDCouplingFieldFloat::convertToIntField() const
+{
+ return ConvertToUField<int>(this);
+}
+
+MEDCouplingFieldInt64 * MEDCouplingFieldFloat::convertToInt64Field() const
+{
+ return ConvertToUField<Int64>(this);
+}
{
class MEDCouplingFieldDouble;
class MEDCouplingFieldTemplate;
-
+
class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
{
public:
MEDCOUPLING_EXPORT MEDCouplingFieldFloat *deepCopy() const;
MEDCOUPLING_EXPORT MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *convertToIntField() const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *convertToInt64Field() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldFloat"); }
protected:
MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td);
// Author : Yann Pora (EDF R&D)
#include "MEDCouplingFieldInt32.hxx"
+#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldT.txx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMesh.hxx"
#include "MEDCouplingMemArray.txx"
return new MEDCouplingFieldInt32(*this,recDeepCpy);
}
-MEDCouplingFieldDouble *MEDCouplingFieldInt32::convertToDblField() const
+template<class U>
+typename Traits<U>::FieldType *ConvertToUField(const MEDCouplingFieldInt32 *self)
{
- MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*this));
+ MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*self));
int t1,t2;
- double t0(getTime(t1,t2));
- MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization()));
+ double t0(self->getTime(t1,t2));
+ MCAuto<typename Traits<U>::FieldType > ret(Traits<U>::FieldType::New(*tmp,self->getTimeDiscretization()));
ret->setTime(t0,t1,t2);
- if(getArray())
+ if(self->getArray())
{
- MCAuto<DataArrayDouble> arr(getArray()->convertToDblArr());
+ MCAuto<typename Traits<U>::ArrayType> arr(self->getArray()->convertToOtherTypeOfArr<U>());
ret->setArray(arr);
}
return ret.retn();
}
+
+MEDCouplingFieldDouble *MEDCouplingFieldInt32::convertToDblField() const
+{
+ return ConvertToUField<double>(this);
+}
+
+MEDCouplingFieldInt64 *MEDCouplingFieldInt32::convertToInt64Field() const
+{
+ return ConvertToUField<Int64>(this);
+}
+
+MEDCouplingFieldFloat *MEDCouplingFieldInt32::convertToFloatField() const
+{
+ return ConvertToUField<float>(this);
+}
\ No newline at end of file
{
class MEDCouplingFieldDouble;
class MEDCouplingFieldTemplate;
-
+
class MEDCouplingFieldInt32 : public MEDCouplingFieldT<Int32>
{
public:
MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *deepCopy() const;
MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldFloat *convertToFloatField() const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *convertToInt64Field() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldInt32"); }
protected:
MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td);
// -- WARNING this enum must be synchronized with MEDCouplingCommon.i file ! --
class PartDefinition;
-
+
template<class T>
class MEDCouplingPointer
{
public:
MCAuto<DataArrayDouble> convertToDblArr() const;
MCAuto<DataArrayInt> convertToIntArr() const;
+ MCAuto<DataArrayInt64> convertToInt64Arr() const;
MCAuto<DataArrayFloat> convertToFloatArr() const;
void applyLin(T a, T b, std::size_t compoId);
void applyLin(T a, T b);
template<class FCT>
void somethingEqual(const typename Traits<T>::ArrayType *other);
};
-
+
template<class T>
class DataArrayTemplateFP : public DataArrayTemplateClassic<T>
{
protected:
~DataArrayDiscrete() { }
};
-
+
template<class T>
class DataArrayDiscreteSigned : public DataArrayDiscrete<T>
{
DataArrayChar *buildEmptySpecializedDAChar() const;
DataArrayByteIterator *iterator();
DataArrayByte *deepCopy() const;
- DataArrayByte *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); }
+ DataArrayByte *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); }
DataArrayByte *performCopyOrIncrRef(bool deepCopy) const;
DataArrayByte *buildNewEmptyInstance() const { return DataArrayByte::New(); }
char byteValue() const;
float floatValue() const;
DataArrayFloat *buildDAFloat(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
};
-
+
class MEDCOUPLING_EXPORT DataArrayInt32Iterator : public DataArrayIterator<Int32>
{
public:
char *_pt;
std::size_t _nb_of_compo;
};
-
+
class DataArrayByteTuple;
class MEDCOUPLING_EXPORT DataArrayByteIterator
/*!
* This method performs systematically an allocation of \a newNbOfElements elements in \a this.
* \a _nb_of_elem and \a _nb_of_elem_alloc will \b NOT be systematically equal (contrary to MemArray<T>::reAlloc method.
- * So after the call of this method \a _nb_of_elem will be equal tostd::min<std::size_t>(_nb_of_elem,newNbOfElements) and \a _nb_of_elem_alloc equal to
+ * So after the call of this method \a _nb_of_elem will be equal tostd::min<std::size_t>(_nb_of_elem,newNbOfElements) and \a _nb_of_elem_alloc equal to
* \a newNbOfElements. This method is typically used to perform a pushBack to avoid systematic allocations-copy-deallocation.
* So after the call of this method the accessible content is perfectly set.
- *
+ *
* So this method should not be confused with MemArray<T>::reserve that is close to MemArray<T>::reAlloc but not same.
*/
template<class T>
* This method performs systematically an allocation of \a newNbOfElements elements in \a this.
* \a _nb_of_elem and \a _nb_of_elem_alloc will be equal even if only std::min<std::size_t>(_nb_of_elem,newNbOfElements) come from the .
* The remaining part of the new allocated chunk are available but not set previously !
- *
+ *
* So this method should not be confused with MemArray<T>::reserve that is close to MemArray<T>::reAlloc but not same.
*/
template<class T>
}
}
}
-
+
template<class T>
DataArrayIterator<T>::~DataArrayIterator()
{
DataArrayTuple<T>::DataArrayTuple(T *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
{
}
-
+
template<class T>
T DataArrayTuple<T>::zeValue() const
{
return *_pt;
throw INTERP_KERNEL::Exception("DataArrayTuple<T>::zeValue : DataArrayTuple instance has not exactly 1 component -> Not possible to convert it into a single value !");
}
-
+
template<class T>
typename Traits<T>::ArrayType *DataArrayTuple<T>::buildDA(std::size_t nbOfTuples, std::size_t nbOfCompo) const
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-
+
//////////////////////////////////
/*!
std::copy(arrBegin,arrEnd,ret->getPointer());
return ret;
}
-
+
template<class T>
std::vector< MCAuto< typename Traits<T>::ArrayTypeCh > > DataArrayTemplate<T>::explodeComponents() const
{
}
return ret;
}
-
+
template<class T>
std::size_t DataArrayTemplate<T>::getHeapMemorySizeWithoutChildren() const
{
sz*=sizeof(T);
return DataArray::getHeapMemorySizeWithoutChildren()+sz;
}
-
+
/*!
* Allocates the raw data in memory. If the memory was already allocated, then it is
* freed and re-allocated. See an example of this method use
/*!
* Sets a C array to be used as raw data of \a this. The previously set info
- * of components is retained and re-sized.
+ * of components is retained and re-sized.
* For more info see \ref MEDCouplingArraySteps1.
* \param [in] array - the C array to be used as raw data of \a this.
* \param [in] ownership - if \a true, \a array will be deallocated at destruction of \a this.
_mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo);
declareAsNew();
}
-
+
template<class T>
void DataArrayTemplate<T>::useExternalArrayWithRWAccess(const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo)
{
{
return getConstPointer()!=0;
}
-
+
/*!
* Checks if raw data is allocated and throws an exception if it is not the case.
* \throw If the raw data is not allocated.
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-
+
/*!
* This method deallocated \a this without modification of information relative to the components.
* After call of this method, DataArrayDouble::isAllocated will return false.
* If \a this has already been allocated, this method checks that \a this has only one component. If not an INTERP_KERNEL::Exception will be thrown.
* If \a this has not already been allocated, number of components is set to one.
* This method allows to reduce number of reallocations on invocation of DataArrayDouble::pushBackSilent and DataArrayDouble::pushBackValsSilent on \a this.
- *
+ *
* \sa DataArrayDouble::pack, DataArrayDouble::pushBackSilent, DataArrayDouble::pushBackValsSilent
*/
template<class T>
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-
+
/*!
* This method adds at the end of \a this the single value \a val. This method do \b not update its time label to avoid useless incrementation
* of counter. So the caller is expected to call TimeLabel::declareAsNew on \a this at the end of the push session.
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-
+
/*!
* This method adds at the end of \a this a series of values [\c valsBg,\c valsEnd). This method do \b not update its time label to avoid useless incrementation
* of counter. So the caller is expected to call TimeLabel::declareAsNew on \a this at the end of the push session.
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-
+
/*!
* This method returns silently ( without updating time label in \a this ) the last value, if any and suppress it.
* \throw If \a this is already empty.
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-
+
/*!
* Allocates the raw data in memory. If exactly same memory as needed already
* allocated, it is not re-allocated.
/*!
* Changes number of tuples in the array. If the new number of tuples is smaller
* than the current number the array is truncated, otherwise the array is extended.
- * \param [in] nbOfTuples - new number of tuples.
+ * \param [in] nbOfTuples - new number of tuples.
* \throw If \a this is not allocated.
* \throw If \a nbOfTuples is negative.
*/
/*!
* Sorts values of the array. \b Warning, this method is not const, it alterates \a this content.
- *
+ *
* \param [in] asc - \a true means ascending order, \a false, descending.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
/*!
* Sorts values of the array and put the result in a newly allocated returned array.
* This method does not alterate \a this content.
- *
+ *
* \param [in] asc - \a true means ascending order, \a false, descending.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
* Returns a shorten and permuted copy of \a this array. The new DataArrayDouble is
* of size \a newNbOfTuple and it's values are permuted as required by \a old2New array.
* The values are permuted so that \c new[ \a old2New[ i ]] = \c old[ i ] for all
- * \a old2New[ i ] >= 0. In other words every i-th tuple in \a this array, for which
+ * \a old2New[ i ] >= 0. In other words every i-th tuple in \a this array, for which
* \a old2New[ i ] is negative, is missing from the result array.
* For more info on renumbering see \ref numbering.
* \param [in] old2New - C array of length equal to \a this->getNumberOfTuples()
MCAuto<DataArrayIdType> arr(dpd->toDAI());
MCAuto<DataArray> ret2(selectByTupleIdSafe(arr->begin(),arr->end()));
return DynamicCastSafe<DataArray,typename Traits<T>::ArrayTypeCh>(ret2);
-
+
}
throw INTERP_KERNEL::Exception("DataArrayTemplate<T>::selectPartDef : unrecognized part def !");
}
-
+
/*!
* Returns a shorten and permuted copy of \a this array. The new DataArrayDouble is
* of size \a new2OldEnd - \a new2OldBg and it's values are permuted as required by
/*!
* Changes the number of components within \a this array to be equal to its number
- * of tuples, and inversely its number of tuples to become equal to its number of
+ * of tuples, and inversely its number of tuples to become equal to its number of
* components. So that its raw data **does not** change, instead splitting this
* data into tuples changes.
* \warning This method erases all (name and unit) component info set before!
* is truncated to have \a newNbOfComp components, keeping first components. If \a
* newNbOfComp is more than \a this->getNumberOfComponents() then the result array is
* expanded as each tuple is populated with \a dftValue to have \a newNbOfComp
- * components.
+ * components.
* \param [in] newNbOfComp - number of components for the new array to have.
* \param [in] dftValue - value assigned to new values added to the new array.
* \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
* \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
* is to delete using decrRef() as it is no more needed.
* \throw If \a this is not allocated.
- * \throw If a component index (\a i) is not valid:
+ * \throw If a component index (\a i) is not valid:
* \a i < 0 || \a i >= \a this->getNumberOfComponents().
*
* \if ENABLE_EXAMPLES
ret->copyStringInfoFrom(*this);
return ret.retn();
}
-
+
/*!
* Copy all values from another DataArrayDouble into specified tuples and components
* of \a this array. Textual data is not copied.
* \param [in] endComp - index of the component before which the components to assign
* to are located.
* \param [in] stepComp - index increment to get index of the next component to assign to.
- * \param [in] strictCompoCompare - if \a true (by default), then \a a->getNumberOfComponents()
+ * \param [in] strictCompoCompare - if \a true (by default), then \a a->getNumberOfComponents()
* must be equal to the number of columns to assign to, else an
* exception is thrown; if \a false, then it is only required that \a
* a->getNbOfElems() equals to number of values to assign to (this condition
- * must be respected even if \a strictCompoCompare is \a true). The number of
+ * must be respected even if \a strictCompoCompare is \a true). The number of
* values to assign to is given by following Python expression:
- * \a nbTargetValues =
+ * \a nbTargetValues =
* \c len(\c range(\a bgTuples,\a endTuples,\a stepTuples)) *
* \c len(\c range(\a bgComp,\a endComp,\a stepComp)).
* \throw If \a a is NULL.
}
}
}
-
+
/*!
* Assign a given value to values at specified tuples and components of \a this array.
* The tree parameters defining set of indices of tuples and components are similar to
for(mcIdType j=0;j<newNbOfComp;j++)
pt[j*stepComp]=a;
}
-
+
/*!
- * Copy all values from another DataArrayDouble (\a a) into specified tuples and
+ * Copy all values from another DataArrayDouble (\a a) into specified tuples and
* components of \a this array. Textual data is not copied.
* The tuples and components to assign to are defined by C arrays of indices.
* There are two *modes of usage*:
* - If \a a->getNbOfElems() equals to number of values to assign to, then every value
- * of \a a is assigned to its own location within \a this array.
+ * of \a a is assigned to its own location within \a this array.
* - If \a a includes one tuple, then all values of \a a are assigned to the specified
* components of every specified tuple of \a this array. In this mode it is required
* that \a a->getNumberOfComponents() equals to the number of specified components.
* \param [in] bgTuples - pointer to an array of tuple indices of \a this array to
* assign values of \a a to.
* \param [in] endTuples - specifies the end of the array \a bgTuples, so that
- * pointer to a tuple index <em>(pi)</em> varies as this:
+ * pointer to a tuple index <em>(pi)</em> varies as this:
* \a bgTuples <= \a pi < \a endTuples.
* \param [in] bgComp - pointer to an array of component indices of \a this array to
* assign values of \a a to.
* \param [in] endComp - specifies the end of the array \a bgTuples, so that
- * pointer to a component index <em>(pi)</em> varies as this:
+ * pointer to a component index <em>(pi)</em> varies as this:
* \a bgComp <= \a pi < \a endComp.
* \param [in] strictCompoCompare - this parameter is checked only if the
- * *mode of usage* is the first; if it is \a true (default),
- * then \a a->getNumberOfComponents() must be equal
+ * *mode of usage* is the first; if it is \a true (default),
+ * then \a a->getNumberOfComponents() must be equal
* to the number of specified columns, else this is not required.
* \throw If \a a is NULL.
* \throw If \a a is not allocated.
T *pt(getPointer());
const T *srcPt(a->getConstPointer());
if(assignTech)
- {
+ {
for(const mcIdType *w=bgTuples;w!=endTuples;w++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt++)
- {
+ {
pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt;
}
}
const T *srcPt2=srcPt;
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt2++)
- {
+ {
pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt2;
}
}
}
}
-
+
/*!
* Assign a given value to values at specified tuples and components of \a this array.
* The tuples and components to assign to are defined by C arrays of indices.
* \param [in] bgTuples - pointer to an array of tuple indices of \a this array to
* assign \a a to.
* \param [in] endTuples - specifies the end of the array \a bgTuples, so that
- * pointer to a tuple index (\a pi) varies as this:
+ * pointer to a tuple index (\a pi) varies as this:
* \a bgTuples <= \a pi < \a endTuples.
* \param [in] bgComp - pointer to an array of component indices of \a this array to
* assign \a a to.
* \param [in] endComp - specifies the end of the array \a bgTuples, so that
- * pointer to a component index (\a pi) varies as this:
+ * pointer to a component index (\a pi) varies as this:
* \a bgComp <= \a pi < \a endComp.
* \throw If \a this is not allocated.
* \throw If any index of tuple/component given by <em>bgTuples / bgComp</em> is
pt[(std::size_t)(*w)*nbComp+(*z)]=a;
}
}
-
+
/*!
- * Copy all values from another DataArrayDouble (\a a) into specified tuples and
+ * Copy all values from another DataArrayDouble (\a a) into specified tuples and
* components of \a this array. Textual data is not copied.
* The tuples to assign to are defined by a C array of indices.
* The components to assign to are defined by three values similar to parameters of
* the Python function \c range(\c start,\c stop,\c step).
* There are two *modes of usage*:
* - If \a a->getNbOfElems() equals to number of values to assign to, then every value
- * of \a a is assigned to its own location within \a this array.
+ * of \a a is assigned to its own location within \a this array.
* - If \a a includes one tuple, then all values of \a a are assigned to the specified
* components of every specified tuple of \a this array. In this mode it is required
* that \a a->getNumberOfComponents() equals to the number of specified components.
* \param [in] bgTuples - pointer to an array of tuple indices of \a this array to
* assign values of \a a to.
* \param [in] endTuples - specifies the end of the array \a bgTuples, so that
- * pointer to a tuple index <em>(pi)</em> varies as this:
+ * pointer to a tuple index <em>(pi)</em> varies as this:
* \a bgTuples <= \a pi < \a endTuples.
* \param [in] bgComp - index of the first component of \a this array to assign to.
* \param [in] endComp - index of the component before which the components to assign
* to are located.
* \param [in] stepComp - index increment to get index of the next component to assign to.
* \param [in] strictCompoCompare - this parameter is checked only in the first
- * *mode of usage*; if \a strictCompoCompare is \a true (default),
- * then \a a->getNumberOfComponents() must be equal
+ * *mode of usage*; if \a strictCompoCompare is \a true (default),
+ * then \a a->getNumberOfComponents() must be equal
* to the number of specified columns, else this is not required.
* \throw If \a a is NULL.
* \throw If \a a is not allocated.
* \throw If \a this is not allocated.
- * \throw If any index of tuple given by \a bgTuples is out of a valid range for
+ * \throw If any index of tuple given by \a bgTuples is out of a valid range for
* \a this array.
* \throw In the first *mode of usage*, if <em>strictCompoCompare == true </em> and
* if <em> a->getNumberOfComponents()</em> is unequal to the number of components
}
}
}
-
+
/*!
* Assign a given value to values at specified tuples and components of \a this array.
* The tuples to assign to are defined by a C array of indices.
* \param [in] bgTuples - pointer to an array of tuple indices of \a this array to
* assign \a a to.
* \param [in] endTuples - specifies the end of the array \a bgTuples, so that
- * pointer to a tuple index <em>(pi)</em> varies as this:
+ * pointer to a tuple index <em>(pi)</em> varies as this:
* \a bgTuples <= \a pi < \a endTuples.
* \param [in] bgComp - index of the first component of \a this array to assign to.
* \param [in] endComp - index of the component before which the components to assign
* to are located.
* \param [in] stepComp - index increment to get index of the next component to assign to.
* \throw If \a this is not allocated.
- * \throw If any index of tuple given by \a bgTuples is out of a valid range for
+ * \throw If any index of tuple given by \a bgTuples is out of a valid range for
* \a this array.
* \throw If parameters specifying components to assign to, do not give a
* non-empty range of increasing indices or indices are out of a valid range
* \param [in] bgComp - pointer to an array of component indices of \a this array to
* assign \a a to.
* \param [in] endComp - specifies the end of the array \a bgTuples, so that
- * pointer to a component index (\a pi) varies as this:
+ * pointer to a component index (\a pi) varies as this:
* \a bgComp <= \a pi < \a endComp.
- * \param [in] strictCompoCompare - if \a true (by default), then \a a->getNumberOfComponents()
+ * \param [in] strictCompoCompare - if \a true (by default), then \a a->getNumberOfComponents()
* must be equal to the number of columns to assign to, else an
* exception is thrown; if \a false, then it is only required that \a
* a->getNbOfElems() equals to number of values to assign to (this condition
- * must be respected even if \a strictCompoCompare is \a true). The number of
+ * must be respected even if \a strictCompoCompare is \a true). The number of
* values to assign to is given by following Python expression:
- * \a nbTargetValues =
+ * \a nbTargetValues =
* \c len(\c range(\a bgTuples,\a endTuples,\a stepTuples)) *
* \c len(\c range(\a bgComp,\a endComp,\a stepComp)).
* \throw If \a a is NULL.
for(const mcIdType *z=bgComp;z!=endComp;z++)
pt[*z]=a;
}
-
+
/*!
* Copy some tuples from another DataArrayDouble into specified tuples
* of \a this array. Textual data is not copied. Both arrays must have equal number of
* \throw If \a tuplesSelec is not allocated.
* \throw If <em>this->getNumberOfComponents() != a->getNumberOfComponents()</em>.
* \throw If \a tuplesSelec->getNumberOfComponents() != 2.
- * \throw If any tuple index given by \a tuplesSelec is out of a valid range for
+ * \throw If any tuple index given by \a tuplesSelec is out of a valid range for
* the corresponding (\a this or \a a) array.
*/
template<class T>
}
}
}
-
+
/*!
* Copy some tuples from another DataArrayDouble (\a aBase) into contiguous tuples
* of \a this array. Textual data is not copied. Both arrays must have equal number of
* \throw If <em>this->getNumberOfComponents() != aBase->getNumberOfComponents()</em>.
* \throw If \a tuplesSelec->getNumberOfComponents() != 1.
* \throw If <em>tupleIdStart + tuplesSelec->getNumberOfTuples() > this->getNumberOfTuples().</em>
- * \throw If any tuple index given by \a tuplesSelec is out of a valid range for
+ * \throw If any tuple index given by \a tuplesSelec is out of a valid range for
* \a aBase array.
*/
template<class T>
}
}
}
-
+
/*!
* Copy some tuples from another DataArrayDouble (\a aBase) into contiguous tuples
* of \a this array. Textual data is not copied. Both arrays must have equal number of
}
/*!
- * Returns the first value of \a this.
+ * Returns the first value of \a this.
* \return double - the last value of \a this array.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of tuples must be >= 1 !");
return *(getConstPointer());
}
-
+
/*!
- * Returns the last value of \a this.
+ * Returns the last value of \a this.
* \return double - the last value of \a this array.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of tuples must be >= 1 !");
return *(getConstPointer()+nbOfTuples-1);
}
-
+
/*!
* Returns the maximal value and its location within \a this one-dimensional array.
* \param [out] tupleId - index of the tuple holding the maximal value.
tupleId=ToIdType(std::distance(vals,loc));
return *loc;
}
-
+
/*!
* Returns the maximal value within \a this array that is allowed to have more than
* one component.
const T *loc(std::max_element(begin(),end()));
return *loc;
}
-
+
/*!
* Returns the maximal absolute value in \a this and the first occurrence location associated to it.
* \return the element in this (positive or negative) having the max abs value in \a this.
tupleId=ToIdType(std::distance(vals,loc));
return *loc;
}
-
+
/*!
* Returns the minimal value within \a this array that is allowed to have more than
* one component.
const T *loc=std::min_element(begin(),end());
return *loc;
}
-
+
template<class T>
void DataArrayTemplate<T>::circularPermutation(mcIdType nbOfShift)
{
std::copy((T*)buf,(T *)buf+(nbTuples-effNbSh)*nbOfCompo,work);
}
}
-
+
template<class T>
void DataArrayTemplate<T>::circularPermutationPerTuple(mcIdType nbOfShift)
{
sts[i]=_info_on_compo[(i+effNbSh)%nbOfCompo];
setInfoOnComponents(sts);
}
-
+
template<class T>
void DataArrayTemplate<T>::reversePerTuple()
{
ret->copyStringInfoFrom(*this);
return ret;
}
-
+
/*!
* Creates a new DataArrayDouble and assigns all (textual and numerical) data of \a this
* array to the new one.
return convertToOtherTypeOfArr<int>();
}
+ /*!
+ * Creates a new DataArrayInt64 and assigns all (textual and numerical) data of \a this
+ * array to the new one.
+ * \return DataArrayInt * - the new instance of DataArrayInt64.
+ */
+ template<class T>
+ MCAuto<DataArrayInt64> DataArrayTemplateClassic<T>::convertToInt64Arr() const
+ {
+ return convertToOtherTypeOfArr<Int64>();
+ }
/*!
* Creates a new DataArrayFloat and assigns all (textual and numerical) data of \a this
* array to the new one.
*ptr=a*(*ptr)+b;
this->declareAsNew();
}
-
+
/*!
* Returns a full copy of \a this array except that sign of all elements is reversed.
* \return DataArrayDouble * - the new instance of DataArrayDouble containing the
throw INTERP_KERNEL::Exception(msg);
this->declareAsNew();
}
-
+
/*!
* Adds values of another DataArrayDouble to values of \a this one. There are 3
* valid cases.
{
this->somethingEqual< std::minus<T> >(other);
}
-
+
/*!
* Multiply values of another DataArrayDouble to values of \a this one. There are 3
* valid cases.
{
this->somethingEqual< std::divides<T> >(other);
}
-
+
template<class T, class FCT>
typename Traits<T>::ArrayType *DivSub(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
{
return 0;
}
}
-
+
/*!
* Returns a new DataArrayDouble that is a subtraction of two given arrays. There are 3
* valid cases.
{
return DivSub< T,std::minus<T> >(a1,a2);
}
-
+
/*!
* Returns a new DataArrayDouble that is a division of two given arrays. There are 3
* valid cases.
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array MulAdd !");
return ret.retn();
}
-
+
/*!
* Returns a new DataArrayDouble that is a product of two given arrays. There are 3
* valid cases.
{
return MulAdd< T , std::multiplies<T> >(a1,a2);
}
-
+
/*!
* Returns a new DataArrayDouble that is a sum of two given arrays. There are 3
* valid cases.
{
return MulAdd< T , std::plus<T> >(a1,a2);
}
-
+
/*!
* Returns either a \a deep or \a shallow copy of this array. For more info see
* \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
bool operator()(T v) const { return v>=_v; }
T _v;
};
-
+
template<class T>
struct GreaterThan
{
bool operator()(T v) const { return v>_v; }
T _v;
};
-
+
template<class T>
struct LowerEqual
{
bool operator()(T v) const { return v<=_v; }
T _v;
};
-
+
template<class T>
struct LowerThan
{
bool operator()(T v) const { return v<_v; }
T _v;
};
-
+
template<class T>
struct InRange
{
MCAuto<DataArrayIdType> ret(findIdsAdv(lt));
return ret.retn();
}
-
+
template<class T>
MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsGreaterOrEqualTo(T val) const
{
GreatEqual<T> ge(val);
return findIdsAdv(ge);
}
-
+
template<class T>
MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsGreaterThan(T val) const
{
GreaterThan<T> gt(val);
return findIdsAdv(gt);
}
-
+
template<class T>
MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsLowerOrEqualTo(T val) const
{
LowerEqual<T> le(val);
return findIdsAdv(le);
}
-
+
template<class T>
MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::findIdsLowerThan(T val) const
{
ret->useArray(tab,true,DeallocType::C_DEALLOC,this->getNumberOfTuples(),this->getNumberOfComponents());
return ret.retn();
}
-
+
/*!
* Appends components of another array to components of \a this one, tuple by tuple.
- * So that the number of tuples of \a this array remains the same and the number of
+ * So that the number of tuples of \a this array remains the same and the number of
* components increases.
* \param [in] other - the DataArrayDouble to append to \a this one.
* \throw If \a this is not allocated.
}
/*!
- *
+ *
* \param [in] nbTimes specifies the nb of times each tuples in \a this will be duplicated contiguouly in returned DataArrayDouble instance.
* \a nbTimes should be at least equal to 1.
* \return a newly allocated DataArrayDouble having one component and number of tuples equal to \a nbTimes * \c this->getNumberOfTuples.
ret->copyStringInfoFrom(*this);
return ret.retn();
}
-
+
template<class T>
void DataArrayTemplateClassic<T>::aggregate(const typename Traits<T>::ArrayType *other)
{
/*!
* Computes for each tuple the sum of number of components values in the tuple and return it.
- *
+ *
* \return DataArrayDouble * - the new instance of DataArrayDouble containing the
* same number of tuples as \a this array and one component.
* The caller is to delete this result array using decrRef() as it is no more
template<>
struct ImplReprTraits<double> { static void SetPrecision(std::ostream& oss) { oss.precision(17); } };
-
+
template<>
struct ImplReprTraits<float> { static void SetPrecision(std::ostream& oss) { oss.precision(7); } };
-
+
template<class T>
void DataArrayTemplateClassic<T>::reprStream(std::ostream& stream) const
{
reprNotTooLongStream(ret);
return ret.str();
}
-
+
/*!
* Returns a textual and human readable representation of \a this instance of
* DataArrayInt. This text is shown when a DataArrayInt is printed in Python.
DataArrayTemplateClassic<T>::reprStream(ret);
return ret.str();
}
-
+
template<class T>
std::string DataArrayTemplateClassic<T>::reprZip() const
{
DataArrayTemplateClassic<T>::reprZipStream(ret);
return ret.str();
}
-
+
/////////////////////////////////
-
+
/*!
* Checks if all values in \a this array are equal to \a val at precision \a eps.
* \param [in] val - value to check equality of array values to.
/*!
* Equivalent to DataArrayInt::isEqual except that if false the reason of
* mismatch is given.
- *
+ *
* \param [in] other the instance to be compared with \a this
* \param [out] reason In case of inequality returns the reason.
* \sa DataArrayInt::isEqual
std::string tmp;
return isEqualIfNotWhy(other,tmp);
}
-
+
/*!
* Returns a new instance of DataArrayInt. The caller is to delete this array
* using decrRef() as it is no more needed.
{
return new typename Traits<T>::ArrayType;
}
-
+
/*!
* Checks if values of \a this and another DataArrayInt are equal. For more info see
* \ref MEDCouplingArrayBasicsCompare.
b->sort();
return a->isEqualWithoutConsideringStr(*b);
}
-
+
template<class T>
template<class ALG>
void DataArrayDiscrete<T>::switchOnTupleAlg(T val, std::vector<bool>& vec, ALG algo) const
if(algo(pt[i],val))
vec[i]=true;
}
-
+
/*!
* This method assumes that \a this has one component and is allocated. This method scans all tuples in \a this and for all tuple equal to \a val
* put True to the corresponding entry in \a vec.
* This method assumes that \a this has one component and is allocated. This method scans all tuples in \a this and for all tuple different from \a val
* put True to the corresponding entry in \a vec.
* \a vec is expected to be with the same size than the number of tuples of \a this.
- *
+ *
* \sa DataArrayInt::switchOnTupleEqualTo.
*/
template<class T>
/*!
* Creates a new one-dimensional DataArrayInt of the same size as \a this and a given
* one-dimensional arrays that must be of the same length. The result array describes
- * correspondence between \a this and \a other arrays, so that
+ * correspondence between \a this and \a other arrays, so that
* <em> other.getIJ(i,0) == this->getIJ(ret->getIJ(i),0)</em>. If such a permutation is
* not possible because some element in \a other is not in \a this, an exception is thrown.
* \param [in] other - an array to compute permutation to.
* \throw If \a other->getNumberOfComponents() != 1.
* \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples().
* \throw If \a other includes a value which is not in \a this array.
- *
+ *
* \if ENABLE_EXAMPLES
* \ref cpp_mcdataarrayint_buildpermutationarr "Here is a C++ example".
*
/*!
* Computes distribution of values of \a this one-dimensional array between given value
* ranges (casts). This method is typically useful for entity number splitting by types,
- * for example.
+ * for example.
* \warning The values contained in \a arrBg should be sorted ascendently. No
- * check of this is be done. If not, the result is not warranted.
+ * check of this is be done. If not, the result is not warranted.
* \param [in] arrBg - the array of ascending values defining the value ranges. The i-th
* value of \a arrBg (\a arrBg[ i ]) gives the lowest value of the i-th range,
* and the greatest value of the i-th range equals to \a arrBg[ i+1 ] - 1. \a
/*!
* Creates a map, whose contents are computed
- * from values of \a this array, which is supposed to contain a renumbering map in
+ * from values of \a this array, which is supposed to contain a renumbering map in
* "New to Old" mode. The result array contains a renumbering map in "New to Old" mode as C++ map for performance reasons.
*
* \sa invertArrayN2O2O2NOptimized, MEDCouplingPointSet::renumberNodesInConn
ret->pushBackSilent(i);
return ret.retn();
}
-
+
/*!
* Creates a new DataArrayInt containing IDs (indices) of tuples holding tuple equal to those defined by [ \a tupleBg , \a tupleEnd )
* This method is an extension of DataArrayInt::findIdsEqual method.
ret->pushBackSilent(i);
return ret.retn();
}
-
+
/*!
* Creates a new DataArrayInt containing IDs (indices) of tuples holding values \b not
* equal to any of given values.
return ToIdType(std::distance(cptr,ret));
return -1;
}
-
+
/*!
* This method expects to be called when number of components of this is equal to one.
* This method returns the tuple id, if it exists, of the first tuple so that the value is contained in \b vals.
{
return this->findIdFirstEqualTuple(tupl)!=-1;
}
-
-
+
+
/*!
* Returns \a true if a given value is present within \a this one-dimensional array.
* \param [in] value - the value to find within \a this array.
{
return this->findIdFirstEqual(value)!=-1;
}
-
+
/*!
* This method expects to be called when number of components of this is equal to one.
* This method returns true if it exists a tuple so that the value is contained in \b vals.
for(mcIdType i=0;i<nbTuple;i++)
std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<T>());
}
-
+
template <class T>
T DataArrayDiscrete<T>::accumulate(std::size_t compId) const
{
}
this->declareAsNew();
}
-
+
/*!
* Modify all elements of \a this array, so that
* an element _x_ becomes \f$ val ^ x \f$.
MCAuto<DataArrayIdType> ret(this->findIdsAdv(ir));
return ret.retn();
}
-
+
/*!
* This method works only on data array with one component.
* This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that
* Locate groups of all consecutive same values in \a this and return them into an indexed array of positions pointing to \a this starting with 0.
* Number of tuples of returned array is equal to size of \a this->buildUnique() + 1.
* Last value of returned array is equal to \a this->getNumberOfTuples()
- *
+ *
* \b Example:
* - \a this : [0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 5, 11]
* - \a return is : [0, 1, 3, 5, 6, 8, 11, 12]
* \a ids1 and \a ids2 are expected to be both a list of ids (both with number of components equal to one) not sorted and with values that can be negative.
* This method will throw an exception is no such permutation array can be obtained. It is typically the case if there is some ids in \a ids1 not in \a ids2 or
* inversely.
- * The difference with DataArrayInt::FindPermutationFromFirstToSecond is that this method supports multiple same values in \a ids1 and \a ids2 whereas
+ * The difference with DataArrayInt::FindPermutationFromFirstToSecond is that this method supports multiple same values in \a ids1 and \a ids2 whereas
* DataArrayInt::FindPermutationFromFirstToSecond doesn't. It implies that this method my be slower than the DataArrayInt::FindPermutationFromFirstToSecond one.
- *
+ *
* In case of success both assertion will be true (no throw) :
* \c ids1->renumber(ret)->isEqual(ids2) where \a ret is the return of this method.
* \c ret->transformWithIndArr(ids2)->isEqual(ids1)
}
else
{
- std::ostringstream oss; oss << MSG0 << "At pos " << std::distance(ids1->begin(),it1) << " value is " << *it1 << " and occurence rank is " << occRk1 << ". No such item into second array !";
+ std::ostringstream oss; oss << MSG0 << "At pos " << std::distance(ids1->begin(),it1) << " value is " << *it1 << " and occurence rank is " << occRk1 << ". No such item into second array !";
throw INTERP_KERNEL::Exception(oss.str());
}
-
+
}
return ret.retn();
}
public:
static MCAuto< MapII > New();
};
-
+
class PartDefinition : public RefCountObject, public TimeLabel
{
public:
{
return self->getRepr();
}
-
+
std::string __repr__() const
{
std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
self->getSlice(a,b,c);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
}
-
+
std::string __str__() const
{
return self->getRepr();
}
-
+
std::string __repr__() const
{
std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
protected:
virtual ~SlicePartDefinition();
};
-
+
class DataArray : public RefCountObject, public TimeLabel
{
public:
PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
return ret;
}
-
+
void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li)
{
std::vector<std::size_t> tmp;
}
self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
}
-
+
virtual void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, PyObject *aBase, mcIdType bg, mcIdType end2, mcIdType step)
{
DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
return DataArray::GetNumberOfItemGivenBESRelative(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
-
+
static DataArray *Aggregate(PyObject *arrs)
{
std::vector<const DataArray *> tmp;
{
return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
}
-
+
DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0)
{
return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
return ret;
}
-
+
PyObject *__getitem__(PyObject *obj)
{
return DataArrayT__getitem<float>(self,obj);
{
return DataArrayT__setitem__<float>(self,obj,value);
}
-
+
PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
{
return DataArrayT_iadd<float>(trueSelf,obj,self);
{
return DataArrayT_idiv<float>(trueSelf,obj,self);
}
-
+
#ifdef WITH_NUMPY
PyObject *toNumPyArray() // not const. It is not a bug !
{
{
return self->buildDAFloat(1,self->getNumberOfCompo());
}
-
+
/*PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
{
MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
}
}
};
-
+
class DataArrayDoubleIterator;
-
+
class DataArrayDouble : public DataArray
{
public:
MCAuto<DataArrayIdType> findIdsLowerOrEqualTo(double val) const;
MCAuto<DataArrayIdType> findIdsLowerThan(double val) const;
MCAuto<DataArrayInt32> convertToIntArr() const;
+ MCAuto<DataArrayInt64> convertToInt64Arr() const;
MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const;
MCAuto<DataArrayDouble> cumSum() const;
MCAuto<DataArrayFloat> convertToFloatArr() const;
{
return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
}
-
+
DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0)
{
return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
PyTuple_SetItem(ret,0,ret0);
}
PyTuple_SetItem(ret,1,PyFloat_FromDouble(radius));
- PyTuple_SetItem(ret,2,PyFloat_FromDouble(ang));
+ PyTuple_SetItem(ret,2,PyFloat_FromDouble(ang));
return ret;
}
{
return self->iterator();
}
-
+
void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
{
const char *msg="MEDCoupling::DataArrayDouble::setValues : Available API are : \n-DataArrayDouble.setValues([1.,3.,4.])\n-DataArrayDouble.setValues([1.,3.,4.],3)\n-DataArrayDouble.setValues([1.,3.,4.,5.],2,2)\n-DataArrayDouble.setValues([(1.,1.7),(3.,3.7),(4.,4.7)])\n !";
PyTuple_SetItem(ret,1,PyFloat_FromDouble(res1));
return ret;
}
-
+
DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector)
{
const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
}
-
+
DataArrayDouble *renumber(PyObject *li)
{
void *da=0;
PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,ToIdType(nbOfCompo));
return ret;
}
-
+
PyObject *normMaxPerComponent() const
{
std::size_t nbOfCompo(self->getNumberOfComponents());
PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
return res;
}
-
+
PyObject *getTuple(mcIdType tupleId)
{
std::size_t sz=self->getNumberOfComponents();
throw INTERP_KERNEL::Exception(msg);
}
}
-
+
PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
{
return DataArrayT_iadd<double>(trueSelf,obj,self);
{
return DataArrayT_idiv<double>(trueSelf,obj,self);
}
-
+
DataArrayDouble *__pow__(PyObject *obj)
{
const char msg[]="Unexpected situation in __pow__ !";
throw INTERP_KERNEL::Exception(msg);
}
}
-
+
PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
{
DataArrayIdType *c=0,*cI=0;
Py_XINCREF(trueSelf);
return trueSelf;
}
-
+
PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
{
MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
Py_XINCREF(trueSelf);
return trueSelf;
}
-
+
PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
{
MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
}
}
-
+
PyObject *isEqualIfNotWhy(const DataArrayChar& other) const
{
std::string ret1;
PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
return ret;
}
-
+
DataArrayChar *renumber(PyObject *li)
{
void *da=0;
return self->renumber(da2->getConstPointer());
}
}
-
+
DataArrayChar *renumberR(PyObject *li)
{
void *da=0;
return self->renumberR(da2->getConstPointer());
}
}
-
+
DataArrayChar *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple)
{
void *da=0;
return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
}
}
-
+
static DataArrayChar *Aggregate(PyObject *dachs)
{
std::vector<const MEDCoupling::DataArrayChar *> tmp;
convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
return DataArrayChar::Aggregate(tmp);
}
-
+
static DataArrayChar *Meld(PyObject *dachs)
{
std::vector<const MEDCoupling::DataArrayChar *> tmp;
}
}
};
-
+
class DataArrayByteIterator;
class DataArrayByte : public DataArrayChar
{
return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
}
-
+
std::string __repr__() const
{
std::ostringstream oss;
self->reprQuickOverview(oss);
return oss.str();
}
-
+
int __int__() const
{
return (int) self->byteValue();
{
return (mcIdType)self->getIJ(tupleId,compoId);
}
-
+
mcIdType getIJSafe(mcIdType tupleId, mcIdType compoId) const
{
return (mcIdType)self->getIJSafe(tupleId,compoId);
mcIdType nbOfTuples=self->getNumberOfTuples();
return convertCharArrToPyListOfTuple(vals,(int)nbOfComp,nbOfTuples);
}
-
+
bool presenceOfTuple(PyObject *tupl) const
{
mcIdType sz=-1,sw=-1;
return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
}
}
-
+
#ifdef WITH_NUMPY
PyObject *toNumPyArray() // not const. It is not a bug !
{
{
return self->repr();
}
-
+
char __int__() const
{
return self->byteValue();
}
-
+
DataArrayByte *buildDAByte()
{
return self->buildDAByte(1,self->getNumberOfCompo());
}
}
};
-
+
class DataArrayAsciiCharIterator;
-
+
class DataArrayAsciiChar : public DataArrayChar
{
public:
tmp[0]=self->getIJ(tupleId,compoId);
return std::string(tmp);
}
-
+
std::string getIJSafe(mcIdType tupleId, mcIdType compoId) const
{
char tmp[2]; tmp[1]='\0';
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
}
-
+
bool presenceOfValue(PyObject *vals) const
{
if(PyString_Check(vals))
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
}
-
+
PyObject *getTuple(mcIdType tupleId) const
{
std::size_t sz=self->getNumberOfComponents();
{
return self->repr();
}
-
+
DataArrayAsciiChar *buildDAAsciiChar()
{
return self->buildDAAsciiChar(1,self->getNumberOfCompo());
}
/*!
- * Prints a string describing \a this field into a stream. This string is outputted
+ * 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.
* 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 &&
+ * \return bool - \c true if \a this->getIteration() == \a iteration &&
* \a this->getOrder() == \a order.
*/
bool MEDFileAnyTypeField1TSWithoutSDA::isDealingTS(int iteration, int order) const
* 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.
+ * 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.
+ * 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.
* Length of this and of nested sequences is the same as that of \a typesF.
* \return std::vector< std::vector< std::pair<int,int> > > - a sequence holding a range
* of ids of tuples within the data array, per each type of spatial
- * discretization within one mesh entity type.
+ * 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.
*/
/*!
* 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
+ * maximal absolute dimension and values returned via the out parameter \a levs are
* dimensions relative to the maximal absolute dimension. <br>
* This method is designed for MEDFileField1TS instances that have a discretization
- * \ref MEDCoupling::ON_CELLS "ON_CELLS",
- * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT",
+ * \ref MEDCoupling::ON_CELLS "ON_CELLS",
+ * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT",
* \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE".
* Only these 3 discretizations will be taken into account here. If \a this is
* \ref MEDCoupling::ON_NODES "ON_NODES", -1 is returned and \a levs are empty.<br>
* 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 following case:
* - mesh \a m1 has a meshDimension 3 and has non empty levels [0,-1,-2] with elements
* TETRA4, HEXA8, TRI3 and SEG2.
* <em> meshDimRelToMax = absDim - meshDim + relativeLev </em>.
* For example<br>
* to retrieve the highest level of
- * \a f1: <em>f1->getFieldAtLevel( ON_CELLS, 3-3+0 ); // absDim - meshDim + relativeLev</em><br>
+ * \a f1: <em>f1->getFieldAtLevel( ON_CELLS, 3-3+0 ); // absDim - meshDim + relativeLev</em><br>
* to retrieve the lowest level of \a f1: <em>f1->getFieldAtLevel( ON_CELLS, 3-3+(-2) );</em><br>
* to retrieve the highest level of \a f2: <em>f2->getFieldAtLevel( ON_CELLS, 2-3+0 );</em><br>
* to retrieve the lowest level of \a f2: <em>f2->getFieldAtLevel( ON_CELLS, 2-3+(-1) )</em>.
/*!
* \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
* \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
* \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
*/
MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId)
/*!
* \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
* \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
* \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
*/
const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const
/*!
* 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.
+ * "Sort By Type"), if not, an exception is thrown.
* \param [in] field - the field to add to \a this. The array of field \a field is ignored
* \param [in] arr - the array of values.
* \param [in,out] glob - the global data where profiles and localization present in
/*!
* 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.
+ * 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.
+ * profile is missing.
* \param [in] field - the field to add to \a this. The field double values are ignored.
* \param [in] arrOfVals - the values of the field \a field used.
* \param [in] mesh - the supporting mesh of \a field.
{
m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
std::vector< MCAuto<DataArrayIdType> > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin());
- std::vector< MCAuto<DataArrayIdType> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
+ std::vector< MCAuto<DataArrayIdType> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
std::vector<const DataArrayIdType *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
// start of check
MCAuto<MEDCouplingFieldTemplate> field2=field->clone(false);
*
* \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.
+ * 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.
* \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.
+ * 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.
/*!
* Returns a new MEDCouplingFieldDouble of a given type lying on the top level cells of a
- * given mesh.
+ * 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
*
* \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.
+ * 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.
* \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.
+ * 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.
* \param [out] pfl - a new instance of DataArrayIdType 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.
+ * 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.
}
/*!
- * Checks if elements of a given mesh are in the order suitable for writing
+ * 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<int> - a vector holding for each element type (1) item of
- * INTERP_KERNEL::NormalizedCellType, (2) number of elements, (3) -1.
+ * 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.
*/
* 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.
+ * 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 MEDCoupling::ON_CELLS "ON_CELLS" and
+ * \ref MEDCoupling::ON_CELLS "ON_CELLS" and
* \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" for example.
- * This sequence is of the same length as \a types.
+ * 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.
return ret.retn();
}
+MEDFileInt64Field1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt64() const
+{
+ MCAuto<MEDFileInt64Field1TSWithoutSDA> ret(new MEDFileInt64Field1TSWithoutSDA);
+ ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this);
+ ret->deepCpyLeavesFrom(*this);
+ const DataArrayDouble *arr(_arr);
+ if(arr)
+ {
+ MCAuto<DataArrayInt64> arr2(arr->convertToInt64Arr());
+ ret->setArray(arr2);
+ }
+ return ret.retn();
+}
+
/*!
* Returns a pointer to the underground DataArrayDouble instance and a
* sequence describing parameters of a support of each part of \a this field. The
/*!
* This method throws an INTERP_KERNEL::Exception if \a fieldName field is not in file pointed by \a fid and with name \a fileName.
- *
+ *
* \return in case of success the number of time steps available for the field with name \a fieldName.
*/
int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut, std::string& meshName)
*
* \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
* \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
* \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
* \param [in] newLocName is the new localization name.
* \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newPflName already exists. If true, the renaming is done without check. It can lead to major bug.
*
* \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
* \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
* \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
* \param [in] newLocName is the new localization name.
* \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newLocName already exists. If true, the renaming is done without check. It can lead to major bug.
* This method alloc the arrays and load potentially huge arrays contained in this field.
* This method should be called when a MEDFileAnyTypeField1TS::New constructor has been with false as the last parameter.
* This method can be also called to refresh or reinit values from a file.
- *
+ *
* \throw If the fileName is not set or points to a non readable MED file.
* \sa MEDFileAnyTypeField1TS::loadArraysIfNecessary
*/
* This method behaves as MEDFileAnyTypeField1TS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
* But once data loaded once, this method does nothing. Contrary to MEDFileAnyTypeField1TS::loadArrays and MEDFileAnyTypeField1TS::unloadArrays
* this method does not throw if \a this does not come from file read.
- *
+ *
* \sa MEDFileAnyTypeField1TS::loadArrays, MEDFileAnyTypeField1TS::unloadArrays
*/
void MEDFileAnyTypeField1TS::loadArraysIfNecessary()
* This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
* \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
* So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss instead.
- *
+ *
* \sa MEDFileAnyTypeField1TS::loadArrays, MEDFileAnyTypeField1TS::loadArraysIfNecessary, MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss
*/
void MEDFileAnyTypeField1TS::unloadArrays()
* This method potentially releases big data arrays if \a this is coming from a file. If \a this has been built from scratch this method will have no effect.
* This method is the symmetrical method of MEDFileAnyTypeField1TS::loadArraysIfNecessary.
* This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
- *
+ *
* \sa MEDFileAnyTypeField1TS::loadArraysIfNecessary
*/
void MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss()
}
/*!
- * Returns a string describing \a this field. This string is outputted
+ * Returns a string describing \a this field. This string is outputted
* by \c print Python command.
*/
std::string MEDFileAnyTypeField1TS::simpleRepr() const
return ret.retn();
}
+/*!
+ * This method performs a copy with datatype modification ( float64->int64 ) of \a this. The globals information are copied
+ * following the given input policy.
+ *
+ * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+ * By default (true) the globals are deeply copied.
+ * \return MEDFileInt32Field1TS * - a new object that is the result of the conversion of \a this to int64 field.
+ */
+MEDFileInt64Field1TS *MEDFileField1TS::convertToInt64(bool isDeepCpyGlobs) const
+{
+ MCAuto<MEDFileInt64Field1TS> ret;
+ const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
+ if(content)
+ {
+ const MEDFileField1TSWithoutSDA *contc=dynamic_cast<const MEDFileField1TSWithoutSDA *>(content);
+ if(!contc)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
+ MCAuto<MEDFileInt64Field1TSWithoutSDA> newc(contc->convertToInt64());
+ ret=static_cast<MEDFileInt64Field1TS *>(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileInt64Field1TSWithoutSDA *)newc));
+ }
+ else
+ ret=MEDFileInt64Field1TS::New();
+ if(isDeepCpyGlobs)
+ ret->deepCpyGlobs(*this);
+ else
+ ret->shallowCpyGlobs(*this);
+ return ret.retn();
+}
+
MEDFileField1TS::MEDFileField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
try:MEDFileTemplateField1TS<double>(fid,loadAll,ms)
{
{
class TimeHolder;
class MEDFileMeshes;
-
+
/*!
* SDA is for Shared Data Arrays such as profiles.
*/
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const;
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *convertToInt() const;
+ MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *convertToInt64() const;
+ MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *convertToFloat() const;
public:
static const char TYPE_STR[];
};
MEDFileField1TSNDTemplateWithoutSDA() { }
MEDFileField1TSNDTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos):MEDFileField1TSTemplateWithoutSDA<T>(fieldName,meshName,csit,iteration,order) { }
};
-
+
/*!
* SDA is for Shared Data Arrays such as profiles.
*/
friend class MEDFileTemplateField1TS<double>;
public:
MEDLOADER_EXPORT MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const;
+ MEDLOADER_EXPORT MEDFileInt64Field1TS *convertToInt64(bool isDeepCpyGlobs=true) const;
public:
MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const;
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
{
public:
MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
+ MEDLOADER_EXPORT MEDFileField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
+ MEDLOADER_EXPORT MEDFileField1TS *convertToInt64(bool isDeepCpyGlobs=true) const;
protected:
~MEDFileNDTemplateField1TS() { }
MEDFileNDTemplateField1TS() { }
%newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
%newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
%newobject MEDCoupling::MEDFileField1TS::convertToInt;
+%newobject MEDCoupling::MEDFileField1TS::convertToInt64;
%newobject MEDCoupling::MEDFileInt32Field1TS::New;
%newobject MEDCoupling::MEDFileInt32Field1TS::field;
PyTuple_SetItem(ret,1,b.retn());
return ret.retn();
}
-
+
MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
{
MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
return ret.retn();
}
-
+
MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
{
MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
return ret.retn();
}
-
+
MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
}
return ret;
}
-
+
PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
{
std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
}
return ret;
}
-
+
PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
return ret;
}
-
+
PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
const std::string& fieldName, PyObject *liIts)
{
std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
return convertFieldDoubleVecToPy(res);
}
-
+
void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
{
std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
}
-
+
void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
{
std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
}
-
+
void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
{
std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
}
-
+
PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
return ret;
}
-
+
MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
{
std::vector<std::string> grps;
int getZipConnPolicy();
void setZipConnPolicy(int newVal);
};
-
+
class MEDFileWritableStandAlone : public MEDFileWritable
{
public:
}
}
};
-
+
class MEDFileMeshReadSelector
{
public:
self->reprAll(oss);
return oss.str();
}
-
+
std::string __repr__() const
{
std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
{
return self->simpleRepr();
}
-
+
DataArrayIdType *getCorrespondence() const
{
const DataArrayIdType *ret(self->getCorrespondence());
{
return self->simpleRepr();
}
-
+
MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
{
MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
{
return MEDFileJoint::New();
}
-
+
MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
{
return MEDFileJoint::New(fileName,mName,num);
{
return self->simpleRepr();
}
-
+
MEDFileJointOneStep *getStepAtPos(int i) const
{
MEDFileJointOneStep *ret(self->getStepAtPos(i));
{
return MEDFileJoints::New();
}
-
+
MEDFileJoints(const std::string& fileName, const std::string& meshName)
{
return MEDFileJoints::New(fileName,meshName);
}
}
};
-
+
class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
{
private:
if(ret) ret->incrRef();
return ret;
}
-
+
PyObject *getTypes() const
{
std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
if(ret) ret->incrRef();
return ret;
}
-
+
MEDFileEquivalenceCell *getCell()
{
MEDFileEquivalenceCell *ret(self->getCell());
if(ret) ret->incrRef();
return ret;
}
-
+
MEDFileEquivalenceNode *getNode()
{
MEDFileEquivalenceNode *ret(self->getNode());
}
}
};
-
+
class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
{
private:
convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
}
-
+
PyObject *areFamsEqual(const MEDFileMesh *other) const
{
std::string what;
tmp->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
-
+
PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
{
const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
return ret;
}
-
+
PyObject *unPolyze()
{
DataArrayIdType *ret3=0;
MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
%extend
- {
+ {
MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
{
return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
return convertVecPairIntToPy(ret);
}
-
+
DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
{
std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
}
-
+
void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
{
std::vector<const MEDCouplingUMesh *> ms;
PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
-
+
MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
{
MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
{
return MEDFileCMesh::New(db);
}
-
+
PyObject *getMesh() const
{
const MEDCouplingCMesh *tmp=self->getMesh();
{
return MEDFileCurveLinearMesh::New(db);
}
-
+
PyObject *getMesh() const
{
const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
void cartesianizeMe();
%extend
- {
+ {
MEDFileMeshMultiTS()
{
return MEDFileMeshMultiTS::New();
{
return self->getNumberOfMeshes();
}
-
+
MEDFileMesh *getMeshAtPos(int i) const
{
MEDFileMesh *ret=self->getMeshAtPos(i);
loc->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
}
-
+
PyObject *getLocalization(const std::string& locName) const
{
const MEDFileFieldLoc *loc=&self->getLocalization(locName);
loc->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
}
-
+
PyObject *zipPflsNames()
{
std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
self->changeLocsRefsNamesGen(v);
}
-
+
void changeLocsNamesInStruct(PyObject *li)
{
std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
{
self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
}
-
+
void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
{
self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
return self->changeMeshNames(modifTab);
}
-
+
PyObject *getTypesOfFieldAvailable() const
{
std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
static MEDFileField1TS *New(DataArrayByte *db);
static MEDFileField1TS *New();
MEDCoupling::MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const;
+ MEDCoupling::MEDFileInt64Field1TS *convertToInt64(bool isDeepCpyGlobs=true) const;
void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
{
return MEDFileField1TS::New(fileName,loadAll);
}
-
+
MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
{
return MEDFileField1TS::New(fileName,fieldName,loadAll);
{
return MEDFileField1TS::New();
}
-
+
void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
{
const DataArrayDouble *arr=0;
arr=field->getArray();
self->copyTinyInfoFrom(field,arr);
}
-
+
std::string __str__() const
{
return self->simpleRepr();
}
-
+
PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
{
return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
{
return MEDFileField1TS_getFieldWithProfile<Int32>(self,type,meshDimRelToMax,mesh);
}
-
+
DataArrayInt32 *getUndergroundDataArray() const
{
DataArrayInt32 *ret=self->getUndergroundDataArray();
{
return MEDFileField1TS_getFieldWithProfile<Int64>(self,type,meshDimRelToMax,mesh);
}
-
+
DataArrayInt64 *getUndergroundDataArray() const
{
DataArrayInt64 *ret=self->getUndergroundDataArray();
{
return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
}
-
+
DataArrayFloat *getUndergroundDataArray() const
{
DataArrayFloat *ret=self->getUndergroundDataArray();
ret->incrRef();
return ret;
}
-
+
PyObject *getUndergroundDataArrayExt() const
{
return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
else
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
}
-
+
PyObject *getIterations() const
{
std::vector< std::pair<int,int> > res(self->getIterations());
return convertVecPairIntToPy(res);
}
-
+
PyObject *getTimeSteps() const
{
std::vector<double> ret1;
}
return ret2;
}
-
+
PyObject *getTypesOfFieldAvailable() const
{
std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
}
return ret2;
}
-
+
PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
{
std::vector<int> ret1;
PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
return elt;
}
-
+
PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
{
std::vector<INTERP_KERNEL::NormalizedCellType> types;
return ret;
}
}
-
+
void __delitem__(PyObject *elts)
{
if(PySlice_Check(elts))
self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
}
}
-
+
void eraseTimeStepIds(PyObject *li)
{
mcIdType sw;
}
return retPy;
}
-
+
static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
{
std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
class MEDFileInt32FieldMultiTS;
class MEDFileInt64FieldMultiTS;
-
+
class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
{
public:
{
return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
}
-
+
MEDFileFieldMultiTS(DataArrayByte *db)
{
return MEDFileFieldMultiTS::New(db);
}
return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
}
-
+
std::string __str__() const
{
return self->simpleRepr();
ret->incrRef();
return ret;
}
-
+
PyObject *getUndergroundDataArrayExt(int iteration, int order) const
{
std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
{
return MEDFileInt32FieldMultiTS::New();
}
-
+
MEDFileInt32FieldMultiTS(const std::string& fileName, bool loadAll=true)
{
return MEDFileInt32FieldMultiTS::New(fileName,loadAll);
}
-
+
MEDFileInt32FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
{
return MEDFileInt32FieldMultiTS::New(fileName,fieldName,loadAll);
{
return MEDFileInt32FieldMultiTS::New(db);
}
-
+
static MEDFileInt32FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
{
std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
{
return MEDFileInt64FieldMultiTS::New();
}
-
+
MEDFileInt64FieldMultiTS(const std::string& fileName, bool loadAll=true)
{
return MEDFileInt64FieldMultiTS::New(fileName,loadAll);
}
-
+
MEDFileInt64FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
{
return MEDFileInt64FieldMultiTS::New(fileName,fieldName,loadAll);
{
return MEDFileInt64FieldMultiTS::New(db);
}
-
+
static MEDFileInt64FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
{
std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
{
return MEDFileFloatFieldMultiTS::New();
}
-
+
MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
{
return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
}
-
+
MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
{
return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
{
return MEDFileFloatFieldMultiTS::New(db);
}
-
+
static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
{
std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
}
}
};
-
+
class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
{
public:
}
}
};
-
+
class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
{
public:
{
return MEDFileFields::NewAdv(fileName,loadAll,entities);
}
-
+
std::string __str__() const
{
return self->simpleRepr();
}
-
+
MEDFileFields *partOfThisOnStructureElements() const
{
MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
return ret.retn();
}
-
+
static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
{
std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
}
-
+
PyObject *__getitem__(PyObject *obj)
{
if(obj && PyList_Check(obj))
{
return self->iterator();
}
-
+
bool changeMeshNames(PyObject *li)
{
std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
}
return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
}
-
+
std::vector<int> getPosOfFields(PyObject *elts) const
{
if(PyList_Check(elts))
convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
self->pushFields(tmp);
}
-
+
void __delitem__(PyObject *elts)
{
if(elts && PySlice_Check(elts))
{
return MEDFileParameterDouble1TS::New();
}
-
+
MEDFileParameterDouble1TS(const std::string& fileName)
{
return MEDFileParameterDouble1TS::New(fileName);
{
return MEDFileParameterMultiTS::New();
}
-
+
MEDFileParameterMultiTS(const std::string& fileName)
{
return MEDFileParameterMultiTS::New(fileName);
{
return self->simpleRepr();
}
-
+
PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
{
std::string what;
PyList_SetItem(res,1,PyString_FromString(what.c_str()));
return res;
}
-
+
void eraseTimeStepIds(PyObject *ids)
{
mcIdType sw;
if(!idsToRemove.empty())
self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
}
-
+
MEDFileParameter1TS *getTimeStepAtPos(int posId) const
{
MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
{
return MEDFileParameters::New();
}
-
+
MEDFileParameters(const std::string& fileName)
{
return MEDFileParameters::New(fileName);
{
return MEDFileParameters::New(db);
}
-
+
std::string __str__() const
{
return self->simpleRepr();
{
return self->getNumberOfParams();
}
-
+
MEDFileParameterMultiTS *getParamAtPos(int i) const
{
MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
ret->incrRef();
return ret;
}
-
+
PyObject *isEqual(const MEDFileParameters *other, double eps) const
{
std::string what;
}
}
};
-
+
///////////////
class MEDFileMeshStruct;
protected:
~MEDFileMeshStruct();
};
-
+
class MEDMeshMultiLev : public RefCountObject
{
public:
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
-
+
PyObject *retrieveFamilyIdsOnNodes() const
{
DataArrayIdType *famIds(0);
}
}
};
-
+
class MeshFormatReader
{
public:
void setMEDFileDS(MEDCoupling::MEDFileData* mfd);
void write();
};
-
+
}
%pythoncode %{
ff1=ff0i.convertToDouble()
self.assertTrue(ff1.getUndergroundDataArray().isEqual(ff0.getUndergroundDataArray(),1e-13))
self.assertEqual(ff1.getFieldSplitedByType(),fspExp)
+ # For int64
+ ff0i64=ff0.convertToInt64()
+ self.assertEqual(ff0i64.getFieldSplitedByType(),fspExp)
+ self.assertTrue(arr.convertToInt64Arr().isEqual(ff0i64.getUndergroundDataArray()))
+ #
+ ff2=ff0i64.convertToDouble()
+ self.assertTrue(ff2.getUndergroundDataArray().isEqual(ff0.getUndergroundDataArray(),1e-13))
+ self.assertEqual(ff2.getFieldSplitedByType(),fspExp)
# With profiles
- del arr,f0,ff0,ff1,ff0i,fspExp
+ del arr,f0,ff0,ff1,ff2,ff0i,ff0i64,fspExp
ff0=MEDFileField1TS()
f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m[:7]) ; arr=DataArrayDouble(7*2) ; arr.iota() ; arr.rearrange(2) ; arr.setInfoOnComponents(["XX [pm]","YYY [hm]"]) ; f0.setArray(arr) ; f0.setName("FieldCellPfl")
f0.checkConsistencyLight()
self.assertTrue(isinstance(ff1,MEDFileField1TS))
self.assertTrue(ff1.getUndergroundDataArray().isEqual(ff0.getUndergroundDataArray(),1e-13))
self.assertEqual(ff1.getFieldSplitedByType(),fspExp)
+ # For Int64
+ ff0i64=ff0.convertToInt64()
+ self.assertTrue(isinstance(ff0i64,MEDFileInt64Field1TS))
+ self.assertEqual(ff0i64.getFieldSplitedByType(),fspExp)
+ self.assertTrue(arr.convertToInt64Arr().isEqual(ff0i64.getUndergroundDataArray()))
+ #
+ ff2=ff0i64.convertToDouble()
+ self.assertTrue(isinstance(ff2,MEDFileField1TS))
+ self.assertTrue(ff2.getUndergroundDataArray().isEqual(ff0.getUndergroundDataArray(),1e-13))
+ self.assertEqual(ff2.getFieldSplitedByType(),fspExp)
## MultiTimeSteps
ff0=MEDFileFieldMultiTS()
f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m[:7]) ; arr=DataArrayDouble(7*2) ; arr.iota() ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName("FieldCellMTime") ; f0.setTime(0.1,0,10)