comparison +grid/Empty.m @ 582:ce44af8d7dd1 feature/grids

Rename grid.EmptyGrid to grid.Empty
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 07 Sep 2017 10:21:15 +0200
parents +grid/EmptyGrid.m@e45c9b56d50d
children
comparison
equal deleted inserted replaced
581:00261f8d7e15 582:ce44af8d7dd1
1 classdef Empty < grid.Grid & grid.Structured
2 properties
3 dim
4 end
5
6 methods
7 function obj = Empty(D)
8 obj.dim = D;
9 end
10 % n returns the number of points in the grid
11 function o = N(obj)
12 o = 0;
13 end
14
15 % d returns the spatial dimension of the grid
16 function o = D(obj)
17 o = obj.dim;
18 end
19
20 % points returns a n x d matrix containing the coordinates for all points.
21 function X = points(obj)
22 X = sparse(0,obj.dim);
23 end
24
25 % Restricts the grid function gf on obj to the subgrid g.
26 function gf = restrictFunc(obj, gf, g)
27 error('Restrict does not make sense for an empty grid')
28 end
29
30 % Projects the grid function gf on obj to the grid g.
31 function gf = projectFunc(obj, gf, g)
32 error('Project does not make sense for an empty grid')
33 end
34
35 % Return the grid.boundaryIdentifiers of all boundaries in a cell array.
36 function bs = getBoundaryNames(obj)
37 bs = {};
38 end
39
40 % Return coordinates for the given boundary
41 function b = getBoundary(obj, name)
42 b = sparse(0,obj.dim-1);
43 end
44
45 function h = scaling(obj)
46 h = 1;
47 end
48
49 function s = size(obj)
50 s = zeros(1, obj.dim);
51 end
52 end
53 end