changeset 153:7aee9eba3bb8 feature/grids

Added abstract classes for some different types of grids.
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 22 Dec 2015 11:59:55 +0100
parents 276dcccf6155
children c7b2f645101f
files +grid/Grid.m +grid/Mapped.m +grid/Multiblock.m
diffstat 3 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+grid/Grid.m	Tue Dec 22 11:59:55 2015 +0100
@@ -0,0 +1,19 @@
+classdef Grid < handle
+    % General d dimensional grid with n points
+    methods (Abstract)
+        % n returns the number of points in the grid
+        o = N(obj)
+
+        % d returns the spatial dimension of the grid
+        o = D(obj)
+
+        % points returns a n x d matrix containing the coordianets for all points.
+        X = points(obj)
+    end
+end
+
+
+
+%% Should it be able to return a cell size aswell? For an equidistant grid this would be know
+%% for other grids the constructor would have to make something up.
+%% For example the grid.Cartesian constructor would take a h (1 x d) vector as an in parameter.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+grid/Mapped.m	Tue Dec 22 11:59:55 2015 +0100
@@ -0,0 +1,10 @@
+classdef Mapped < grid.Grid
+    % General grid mapping
+    methods (Abstract)
+        % baseGrid returns the domain grid of the mapping.
+        g = baseGrid(obj);
+
+        % mapping returns the mapped coordinates as a grid.Function
+        m = mapping(obj);
+    end
+end
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+grid/Multiblock.m	Tue Dec 22 11:59:55 2015 +0100
@@ -0,0 +1,13 @@
+classdef Grid < grid.Grid
+    % General multiblock grid
+    methods (Abstract)
+        % NBlocks returns the number of blocks in the grid.
+        o = NBlocks(obj);
+
+        % Grid returns the ith grid in the multiblockgrid
+        gs = Grid(obj,i);
+
+        % Grids returns a cell array of all the grids in the multiblock grid.
+        gs = Grids(obj);
+    end
+end
\ No newline at end of file