Skip to content

Commit bbe8834

Browse files
committed
add warning
1 parent b16232a commit bbe8834

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

docs/source/point-evaluation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ and :ref:`here <tolerance>` respectively) can be set when creating the :py:class
278278
and will be passed to the :func:`~.VertexOnlyMesh` it creates internally.
279279

280280
If the :ref:`mesh coordinates are changed <changing_coordinate_fs>`, then the vertex-only mesh
281-
will be re-immersed in the new mesh the next time :meth:`~.PointEvaluator.evaluate` is called.
281+
will be reconstructed on the new mesh the next time :meth:`~.PointEvaluator.evaluate` is called.
282282

283283

284284
Expressions with point evaluations

firedrake/function.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,13 @@ def evaluate(self, function: Function) -> np.ndarray | Tuple[np.ndarray, ...]:
753753
``(len(points), n)``. If the function is tensor-valued with shape ``(n, m)``, the Numpy array has shape
754754
``(len(points), n, m)``. If the function is a mixed function, a tuple of Numpy arrays is returned,
755755
one for each subfunction.
756+
757+
758+
.. warning::
759+
760+
This method returns a numpy array and hence isn't taped for use with firedrake-adjoint.
761+
If you want to use point evaluation with the adjoint, create a :class:`~.VertexOnlyMesh`
762+
as described in the manual.
756763
"""
757764
from firedrake import assemble, interpolate
758765
if not isinstance(function, Function):
@@ -762,6 +769,7 @@ def evaluate(self, function: Function) -> np.ndarray | Tuple[np.ndarray, ...]:
762769
if function_mesh is not self.mesh:
763770
raise ValueError("Function mesh must be the same Mesh object as the PointEvaluator mesh.")
764771
if coord_changed := function_mesh.coordinates.dat.dat_version != self.mesh._saved_coordinate_dat_version:
772+
# TODO: This is here until https://github.com/firedrakeproject/firedrake/issues/4540 is solved
765773
self.mesh = function_mesh
766774
if tol_changed := self.mesh.tolerance != self.tolerance:
767775
self.tolerance = self.mesh.tolerance

0 commit comments

Comments
 (0)