diff --git a/lib/functions/@Evaluable/Evaluable.m b/lib/functions/@Evaluable/Evaluable.m index 683d3516f77e94165b7c7c7e454f41d3b0d1e613..d8fbca55530cda000eef47c4605f7e82ff9db9ae 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 0000000000000000000000000000000000000000..f655a6c9cd21d71721e42e833d1dbb135c91001e --- /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