classdef vertexLoad < pde.internal.FEDisplay
% vertexLoad Create a vertexLoad object
%
% vertexLoad is used to set a load on a vertex.
%
% vertexLoad properties:
%
% Force - Force, specified as a number or function handle.

% Copyright 2022 The MathWorks, Inc.
    properties
        Force (1,:) {pde.internal.validators.mustBeDoubleVectorOrFunctionHandle}
    end

   methods
        function obj = vertexLoad(options)
            arguments
                options.?vertexLoad
            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"
            c = { ...
                "structuralStatic", ["Force"]; ...
                "structuralModal",  ["Force"];...
                "structuralTransient", ["Force"]; ...
                "structuralFrequency", [""]; ...
                "thermalTransient", [""]; ...
                "thermalSteady", [""]; ...
                "electrostatic", [""]; ...
                "magnetostatic", [""]; ...
                "electricHarmonic", [""]; ...
                "magneticHarmonic", [""]; ...
                };
            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
