classdef edgeIC < pde.internal.FEDisplay

% edgeIC Create an edgeIC object
%
% edgeIC is used to set an initial condition on an edge.
%
% edgeIC properties:
%
% Displacement - Initial displacement, specified as a numeric vector or 
%   function handle. A numeric vector must contain two elements for a 2-D 
%   model and three elements for a 3-D model.
% Velocity - Initial velocity, specified as a numeric vector or function 
%   handle. A numeric vector must contain two elements for a 2-D model and 
%   three elements for a 3-D model.
% Temperature - Initial temperature or initial guess for temperature, 
%   specified as a number or a function handle. 

% Copyright 2022 The MathWorks, Inc.

    properties
        Displacement {pde.internal.validators.mustBeDoubleVectorOrFunctionHandle}
        Velocity {pde.internal.validators.mustBeDoubleVectorOrFunctionHandle}
        Temperature {pde.internal.validators.mustBeDoubleOrFunctionHandle}
    end

    methods
        function obj = edgeIC(options)
            arguments
                options.?edgeIC
            end

            for k=fields(options)'
                obj.(k{:}) = options.(k{:});            
            end
        end
    end

    methods(Hidden)
        function obj = reparent(obj,parent)
            % Update display to reflect parent's new AnalysisType.
            % "structuralStatic" | "structuralModal" | "structuralTransient"
            % | "structuralFrequency" | "thermalTransient" | "thermalSteady" 
            % | "electrostatic" | "magnetostatic" | "electricHarmonic" |
            % "magneticHarmonic" | "dcConduction"
            c = { ...
                "structuralTransient", ["Displacement","Velocity"]; ...
                "thermalTransient", "Temperature"; ...
                };
            d = dictionary(string(c(:,1)), c(:,2));
            props = "";
            if isKey(d,parent.AnalysisType)
                props = d(parent.AnalysisType);
                props = props{:};
            end

            for k=1:numel(obj)
                obj(k).DisplayAnalysisType = parent.AnalysisType;
                obj(k).DisplayPropertyList = props;
            end
        end
    end

end
