view +multiblock/Contour.m @ 975:47b48a97c675 feature/getBoundaryOperator

Stupid merge makes this branch dangerous. Merging with other branches will result in unexpected changes. Never merge this branch with anything. Closing branch.
author Martin Almquist <malmquist@stanford.edu>
date Thu, 03 Jan 2019 13:24:39 +0100
parents 97b9a0023d38
children
line wrap: on
line source

classdef Contour < handle
    properties
        grid
        contours
        nContours

        ZData
        CData

    end

    methods
        function obj = Contour(g, gf, nContours)
            obj.grid = g;
            obj.nContours = nContours;

            coords = obj.grid.points();
            X = obj.grid.funcToPlotMatrices(coords(:,1));
            Y = obj.grid.funcToPlotMatrices(coords(:,2));

            V = obj.grid.funcToPlotMatrices(gf);


            holdState = ishold();
            hold on

            contours = {1, obj.grid.nBlocks};
            for i = 1:obj.grid.nBlocks
                [~, contours{i}] = contour(X{i}, Y{i}, V{i},obj.nContours);
                contours{i}.LevelList = contours{1}.LevelList;
            end

            if holdState == false
                hold off
            end

            obj.contours = [contours{:}];

            obj.ZData = gf;
            obj.CData = gf;
        end

        function set(obj, propertyName, propertyValue)
            set(obj.contours, propertyName, propertyValue);
        end

        function obj = set.ZData(obj, gf)
            obj.ZData = gf;

            V = obj.grid.funcToPlotMatrices(gf);
            for i = 1:obj.grid.nBlocks
                obj.contours(i).ZData = V{i};
            end
        end

        function obj = set.CData(obj, gf)
            obj.CData = gf;

            V = obj.grid.funcToPlotMatrices(gf);
            for i = 1:obj.grid.nBlocks
                obj.contours(i).CData = V{i};
            end
        end
    end
end