Skip to content

Commit 6716944

Browse files
committed
OTFMUPointToField: Use tolerance on mesh
Closes #115
1 parent 64cee3d commit 6716944

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

otfmi/otfmi.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,16 +730,17 @@ def _assert_mesh_pertinence(self):
730730
"""
731731
mesh = self.getOutputMesh()
732732
mesh_min = mesh.getVertices().getMin()[0]
733+
mesh_max = mesh.getVertices().getMax()[0]
734+
tol = (mesh_max - mesh_min) * 1e-6
733735
assert (
734-
mesh_min >= self.start_time
736+
mesh_min + tol >= self.start_time
735737
), """The mesh start time must be >= to FMU start time.\n
736738
To set the FMU start time, use the argument *start_time* in
737739
FMUPointToFieldFunction constructor."""
738740

739-
mesh_max = mesh.getVertices().getMax()[0]
740741
assert (
741-
mesh_max <= self.final_time
742-
), """The mesh final time must be >= to FMU final time.\n
742+
mesh_max <= self.final_time + tol
743+
), """The mesh final time must be <= to FMU final time.\n
743744
To set the FMU final time, use the argument final_time in
744745
FMUPointToFieldFunction constructor."""
745746

0 commit comments

Comments
 (0)