* Returns a new DataArrayDouble holding barycenters of all cells. The barycenter is
* computed by averaging coordinates of cell nodes, so this method is not a right
* choice for degenerated meshes (not well oriented, cells with measure close to zero).
+ * Beware also that for quadratic meshes, degenerated arc of circles are turned into linear edges for the computation.
+ * This happens with a default detection precision of eps=1.0e-14. If you need control over this use computeCellCenterOfMassWithPrecision().
* \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
* \throw If the coordinates array is not set.
* \throw If the nodal connectivity of cells is not defined.
* \sa MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell
+ * \sa MEDCouplingUMesh::computeCellCenterOfMassWithPrecision
*/
DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const
{
return ret.retn();
}
+
+/*!
+ * See computeCellCenterOfMass().
+ * \param eps a precision for the detection of degenerated arc of circles.
+ * \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.
+ * \throw If the coordinates array is not set.
+ * \throw If the nodal connectivity of cells is not defined.
+ * \sa MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell
+ * \sa MEDCouplingUMesh::computeCellCenterOfMassWithPrecision
+ */
+DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMassWithPrecision(double eps) const
+{
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ MCAuto<DataArrayDouble> ret = computeCellCenterOfMass();
+ return ret.retn();
+}
+
+
/*!
* This method computes for each cell in \a this, the location of the iso barycenter of nodes constituting
* the cell. Contrary to badly named MEDCouplingUMesh::computeCellCenterOfMass method that returns the center of inertia of the
//
MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps) const;
MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const int *begin, const int *end) const;
MEDCOUPLING_EXPORT DataArrayDouble *computePlaneEquationOf3DFaces() const;
DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
void changeOrientationOfCells();
+ DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0);
static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);