return m->getCellsContainingPoint(pos,eps,elts);
}
+/*!
+ * to improve perf !
+ */
+void MEDCoupling1GTUMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const
+{// See EDF29571
+ MCAuto<MEDCouplingUMesh> m(buildUnstructured());
+ m->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
+}
+
MEDCouplingFieldDouble *MEDCoupling1GTUMesh::buildOrthogonalField() const
{
MCAuto<MEDCouplingUMesh> m=buildUnstructured();
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const override;
+ MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const;
MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
# only the third point is inside
self.assertTrue(b.isEqual(DataArrayInt([0,0,0,1])))
+ def testSGTUMeshGetCellsContainingPts1(self):
+ """
+ EDF29571 : Fix problem of perfomance of GTUMesh::getCellsContainingPts
+ """
+ arr = DataArrayDouble(31) ; arr.iota()
+ m = MEDCouplingCMesh() ; m.setCoords(arr,arr,arr)
+ m = m.buildUnstructured()
+ m2 = MEDCoupling1SGTUMesh( m )
+ pts = m[:100].computeCellCenterOfMass()
+ a = datetime.now()
+ a1,b1 = m.getCellsContainingPoints(pts,1e-5)
+ b = datetime.now()
+ a2,b2 = m2.getCellsContainingPoints(pts,1e-5)
+ c = datetime.now()
+ ref = b-a
+ toTest = c-a
+ self.assertTrue( toTest < 10*ref )
+
+
+
if __name__ == '__main__':
unittest.main()