From 720b258526ff4aa638d14ed1cb3d5a70bac4d404 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Thu, 17 Oct 2024 14:14:12 +0200 Subject: [PATCH] OTFMUPointToField: Use tolerance on mesh Closes #115 --- otfmi/otfmi.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/otfmi/otfmi.py b/otfmi/otfmi.py index 404531c..27236c7 100644 --- a/otfmi/otfmi.py +++ b/otfmi/otfmi.py @@ -730,16 +730,17 @@ def _assert_mesh_pertinence(self): """ mesh = self.getOutputMesh() mesh_min = mesh.getVertices().getMin()[0] + mesh_max = mesh.getVertices().getMax()[0] + tol = (mesh_max - mesh_min) * 1e-6 assert ( - mesh_min >= self.start_time + mesh_min + tol >= self.start_time ), """The mesh start time must be >= to FMU start time.\n To set the FMU start time, use the argument *start_time* in FMUPointToFieldFunction constructor.""" - mesh_max = mesh.getVertices().getMax()[0] assert ( - mesh_max <= self.final_time - ), """The mesh final time must be >= to FMU final time.\n + mesh_max <= self.final_time + tol + ), """The mesh final time must be <= to FMU final time.\n To set the FMU final time, use the argument final_time in FMUPointToFieldFunction constructor."""