From e6ff619c2e60de8f493d037eefd54fcca4d37eff Mon Sep 17 00:00:00 2001
From: Julian Streitberger <julian.streitberger@tuwien.ac.at>
Date: Mon, 27 Jan 2025 15:58:44 +0100
Subject: [PATCH] Start piecewise evaluable

---
 lib/functions/@Evaluable/Evaluable.m |  2 +-
 lib/functions/piecewiseEvaluable.m   | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 lib/functions/piecewiseEvaluable.m

diff --git a/lib/functions/@Evaluable/Evaluable.m b/lib/functions/@Evaluable/Evaluable.m
index 683d351..d8fbca5 100644
--- a/lib/functions/@Evaluable/Evaluable.m
+++ b/lib/functions/@Evaluable/Evaluable.m
@@ -1,6 +1,6 @@
 % Evaluable (abstract handle class) Abstract base class for function classes.
 %
-%   Subclases must implement the eval method:
+%   Subclasses must implement the eval method:
 %       eval(obj, bary, idx)
 %   where bary is a Barycentric2D and idx is an index vector. The method must
 %   return the evaluation of the Evaluable on all barycentric coordinates in
diff --git a/lib/functions/piecewiseEvaluable.m b/lib/functions/piecewiseEvaluable.m
new file mode 100644
index 0000000..f655a6c
--- /dev/null
+++ b/lib/functions/piecewiseEvaluable.m
@@ -0,0 +1,27 @@
+% piecewiseEvaluable (subclass of Evaluable) Evaluate piecewise evaluable on edges.
+%
+%   Subclasses must implement the eval method:
+%       eval(obj, bary, idx)
+%   where bary is a Barycentric2D and idx is an index vector. The method must
+%   return the evaluation of the Evaluable on all barycentric coordinates in
+%   bary on all triangles given by idx.
+
+classdef piecewiseEvaluable < Evaluable
+    %% properties
+    properties (Abstract, GetAccess=public, SetAccess=protected)
+        mesh
+    end
+    
+    %% methods
+    methods (Access=public)
+        function obj = piecewiseEvaluable(mesh, value, normalVector)
+            obj.mesh = mesh;
+            obj.constantValue = value;
+            obj.normalVector = normalVector;
+        end
+        
+        function val = eval(obj, ~, ~)
+            val = obj.constantValue;
+        end
+    end
+end
\ No newline at end of file
-- 
GitLab