From d776304cd20315704caedad9585a4f6c75b807c7 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 5 Apr 2013 07:50:51 +0000 Subject: [PATCH] 0021856: [CEA 663] Documenting API of MEDCoupling and MEDLoader --- src/MEDCoupling/MEDCouplingCMesh.cxx | 87 ++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 742b7ad03..17042caed 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -388,6 +388,17 @@ std::string MEDCouplingCMesh::advancedRepr() const return simpleRepr(); } +/*! + * Returns a DataArrayDouble holding positions of nodes along a given axis. + * For more info on Cartesian meshes, see \ref MEDCouplingCMeshPage. + * \param [in] i - an index of axis, a value from [1,2,3]. + * \return const DataArrayDouble * - a pointer to the data array of node coordinates + * referred by \a this mesh. + * \throw If \a i is not one of [1,2,3]. + * + * \ref cpp_mccmesh_getCoordsAt "Here is a C++ example".
+ * \ref py_mccmesh_getCoordsAt "Here is a Python example". + */ const DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) const throw(INTERP_KERNEL::Exception) { switch(i) @@ -403,6 +414,17 @@ const DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) const throw(INTERP_K } } +/*! + * Returns a DataArrayDouble holding positions of nodes along a given axis. + * For more info on Cartesian meshes, see \ref MEDCouplingCMeshPage. + * \param [in] i - an index of axis, a value from [1,2,3]. + * \return const DataArrayDouble * - a pointer to the data array of node coordinates + * referred by \a this mesh. + * \throw If \a i is not one of [1,2,3]. + * + * \ref cpp_mccmesh_getCoordsAt "Here is a C++ example".
+ * \ref py_mccmesh_getCoordsAt "Here is a Python example". + */ DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) throw(INTERP_KERNEL::Exception) { switch(i) @@ -418,6 +440,18 @@ DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) throw(INTERP_KERNEL::Excep } } +/*! + * Sets node coordinates along a given axis. For more info on Cartesian meshes, see + * \ref MEDCouplingCMeshPage. + * \param [in] i - an index of axis, a value in range [1,2,3]. + * \param [in] arr - DataArrayDouble holding positions of nodes along the i-th + * axis. It must be an array of one component. + * \throw If \a arr->getNumberOfComponents() != 1. + * \throw If \a i is not one of [1,2,3]. + * + * \ref medcouplingcppexamplesCmeshStdBuild1 "Here is a C++ example".
+ * \ref medcouplingpyexamplesCmeshStdBuild1 "Here is a Python example". + */ void MEDCouplingCMesh::setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception) { if(arr) @@ -436,6 +470,21 @@ void MEDCouplingCMesh::setCoordsAt(int i, const DataArrayDouble *arr) throw(INTE } } +/*! + * Sets node coordinates along some of the tree axes. This method updates all the + * three node coordinates arrays at once. For more info on Cartesian meshes, see + * \ref MEDCouplingCMeshPage. + * \param [in] coordsX - DataArrayDouble holding positions of nodes along the X + * axis. It must be an array of one component or \c NULL. + * \param [in] coordsY - DataArrayDouble holding positions of nodes along the Y + * axis. It must be an array of one component or \c NULL. + * \param [in] coordsZ - DataArrayDouble holding positions of nodes along the Z + * axis. It must be an array of one component or \c NULL. + * \throw If \a coords*->getNumberOfComponents() != 1. + * + * \ref medcouplingcppexamplesCmeshStdBuild1 "Here is a C++ example".
+ * \ref medcouplingpyexamplesCmeshStdBuild1 "Here is a Python example". + */ void MEDCouplingCMesh::setCoords(const DataArrayDouble *coordsX, const DataArrayDouble *coordsY, const DataArrayDouble *coordsZ) { if(coordsX) @@ -480,6 +529,17 @@ void MEDCouplingCMesh::getBoundingBox(double *bbox) const } } +/*! + * Returns a new MEDCouplingFieldDouble containing volumes of cells constituting \a this + * mesh.
+ * For 1D cells, the returned field contains lengths.
+ * For 2D cells, the returned field contains areas.
+ * For 3D cells, the returned field contains volumes. + * \param [in] isAbs - a not used parameter. + * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble on cells + * and one time . The caller is to delete this field using decrRef() as it is no + * more needed. + */ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; @@ -557,6 +617,12 @@ void MEDCouplingCMesh::rotate(const double *center, const double *vector, double throw INTERP_KERNEL::Exception("No rotation available on CMesh : Traduce it to StructuredMesh to apply it !"); } +/*! + * Translates all nodes of \a this mesh by a given vector. Actually, it adds each + * component of the \a vector to all node coordinates of a corresponding axis. + * \param [in] vector - the translation vector whose size must be not less than \a + * this->getSpaceDimension(). + */ void MEDCouplingCMesh::translate(const double *vector) { if(_x_array) @@ -570,6 +636,12 @@ void MEDCouplingCMesh::translate(const double *vector) _z_array->getPointer(),std::bind2nd(std::plus(),vector[2])); } +/*! + * Applies scaling transformation to all nodes of \a this mesh. + * \param [in] point - coordinates of a scaling center. This array is to be of + * size \a this->getSpaceDimension() at least. + * \param [in] factor - a scale factor. + */ void MEDCouplingCMesh::scale(const double *point, double factor) { for(int i=0;i<3;i++) @@ -594,6 +666,13 @@ MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh *other) return 0; } +/*! + * Returns a new DataArrayDouble holding coordinates of all nodes of \a this mesh. + * \return DataArrayDouble * - a new instance of DataArrayDouble, of size \a + * this->getNumberOfNodes() tuples per \a this->getSpaceDimension() + * components. The caller is to delete this array using decrRef() as it is + * no more needed. + */ DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const { DataArrayDouble *ret=DataArrayDouble::New(); @@ -620,6 +699,14 @@ DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const return ret; } +/*! + * Returns a new DataArrayDouble holding barycenters of all cells. The barycenter is + * computed by averaging coordinates of cell nodes. + * \return DataArrayDouble * - a new instance of DataArrayDouble, of size \a + * this->getNumberOfCells() tuples per \a this->getSpaceDimension() + * components. The caller is to delete this array using decrRef() as it is + * no more needed. + */ DataArrayDouble *MEDCouplingCMesh::getBarycenterAndOwner() const { DataArrayDouble *ret=DataArrayDouble::New(); -- 2.39.2