2 % a one dimensional grid implementation
6 global_eind; % global enumeration of entity indices
'[1:nelements]'
14 % constructor of a 1d grid
16 % required fields of params:
17 % xnumintervals : number of elements along x directions
18 % xrange : interval covered along the x-axes
20 % Bernard Haasdonk 18.6.2010
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 isa(varargin{1},
'onedgrid')
27 fnames = fieldnames(varargin{1});
28 for i=1:length(fnames)
29 grid.(fnames{i}) = varargin{1}.(fnames{i});
31 % the following only would copy handle!!!
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
default constructor: unit interval
37 params.xrange = [0,1]; % 2 points
38 params.xnumintervals = 9;
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 % construct from params
46 %
if ~isfield(params,
'verbose')
50 dx = (params.xrange(2)-params.xrange(1))/params.xnumintervals;
51 grid.
X = params.xrange(1):dx:params.xrange(2);
52 grid.nelements = length(grid.X);
53 grid.NBI = [2:grid.nelements, -1; -1,1:(grid.nelements-1)]
';
54 grid.global_eind = 1:grid.nelements;
61 gridp=gridpart(grid, eind);
63 function gcopy = copy(grid);
64 % deep copies the grid
67 % 'gcopy
': a copy of type onedgrid.
X
vector of vertex x-coordinates
Base class for all grid classes.
a one dimensional grid implementation