A cartesian rectangular grid in two dimensions with axis parallel elements.
General geometrical information is stored including neighbour information. Therefore also boundary neighbour relations can be specified. The boundary type is set to be symmetric by default. Additionally, "rectangles" can be defined: the edges with midpoints within such a rectangle are marked accordingly. By this, boundary edges can be marked for later special use Much (partially redundant) information is stored in the grid, which might be useful in simulations.
Definition at line 17 of file rectgrid.m.
Public Member Functions | |
rectgrid (varargin) | |
constructor of a cartesian rectangular grid in 2 dimensions with axis parallel elements. More... | |
function | demo () |
small script demonstrating the possibilities of the rectgrid class. | |
function p = | plot (params) |
plot of a rectgrid via plot_polygon_grid() More... | |
function res = | isequal (grid2) |
function comparing two grids field by field More... | |
function gridbase grid = | set_nbi (nbind, values) |
function setting some neighbour indices of a grid to specified values. More... | |
function gcopy = | copy () |
returns a deep copy object of the grid implementation More... | |
function glob = | local2global (einds, loc, params) |
function performing a local to global coordinate change of vectors of coordinate pairs. More... | |
![]() | |
gridbase () | |
default constructor for gridbase | |
function res = | check_consistency () |
function checking the consistency of a polygonal grid, i.e. checking, whether the edge centroids correspond (implicit neighbour-index test) More... | |
function | display () |
default implementation for display method for unstructured polygonal grids. is used by rectgrid and triagrid | |
function F = | edge_quad_eval (elids, edgeids, degree, FF) |
Compute an edge integral of a scalar function in various edges simultaneously. Approximation by Gauss-quadratures are performed. More... | |
function F = | edge_quad_eval_mean (elids, edgeids, degree, FF) |
Compute an edge-average integral of a scalar function in various edges simultaneously. Approximation by Gauss-quadratures are performed. More... | |
function PP = | edge_quad_points (elids, edgeids, degree) |
get the evaluation points for a quadrature over edges of the given grid. More... | |
function [
P1 , P2 ] = | get_edge_points (elids, edgeids) |
function extracting edge coordinates from the grid. More... | |
function ENBI = | get_enbi (edge, tstep) |
function assembling a matrix with the 5 neighbour's cell indices that are needed in order to compute the gradient over the edge given by edge in each row. see also the sketch below. More... | |
function gridp = | gridpart (eind) |
function extracting a part of a triagrid or rectgrid defined by the given element indices in the vector eind . More... | |
function | inspect (params) |
function plotting various properties of the current grid. More... | |
function p = | plot_polygon_grid (params) |
plot method for a 2D polygonal grid. This routine can be used for triangular and rectangular grids. More... | |
function p = | plot_element_data (data, plot_params) |
plot method for a 2d polygonal grid and elementwise constant data routine can be used for triangular and rectangular grids. More... | |
function | plot_element_data_sequence (data, plot_params) |
plot of a sequence of element_data on the given grid (constructed if empty). performs simple call of plot_data_sequence. More... | |
function p = | plot_vertex_data (data, params) |
plot method for vertex data on a 2D polygonal grid. More... | |
function gridbase grid = | set_boundary_types (params) |
function setting the boundary types of a polygonal grid. More... | |
Additional Inherited Members | |
![]() | |
nelements | |
number of overall elements (leaf + nonleaf) | |
nvertices | |
number of vertices | |
nneigh | |
number of neighbor elements | |
A | |
vector of element area | |
Ainv | |
vector of inverted element area | |
VI | |
matrix of vertex indices: VI(i,j) is the global index of j -th vertex of element i | |
X | |
vector of vertex x-coordinates | |
Y | |
vector of vertex y-coordinates | |
CX | |
vector of centroid x-values | |
CY | |
vector of centroid y-values | |
NBI | |
NBI(i,j) = element index of j -th neighbour of element i boundary faces are set to -1 or negative values are requested by params.boundary_type | |
INB | |
INB(i,j) = local edge number in NBI(i,j) leading from element NBI(i,j) to element i , i.e. satisfying NBI(NBI(i,j), INB(i,j)) = i | |
EL | |
EL(i,j) = length of edge from element i to neighbour j | |
DC | |
DC(i,j) = distance from centroid of element i to NB j for boundary elements, this is the distance to the reflected element (for use in boundary treatment) | |
NX | |
NX(i,j) = x-coordinate of unit outer normal of edge from el i to NB j | |
NY | |
NY(i,j) = y-coordinate of unit outer normal of edge from el i to NB j | |
ECX | |
ECX(i,j) = x-coordinate of midpoint of edge from el i to NB j | |
ECY | |
ECY(i,j) = x-coordinate of midpoint of edge from el i to NB j | |
SX | |
vector of x-coordinates of point \(S_i\) (for rect: identical to centroids) More... | |
SY | |
vector of y-coordinates of point \(S_i\) (for rect: identical to centroids) More... | |
ESX | |
ESX(i,j) = x-coordinate of point \(S_ij\) on edge el i to NB j | |
ESY | |
ESY(i,j) = x-coordinate of point \(S_ij\) on edge el i to NB j | |
DS | |
DS(i,j) = distance from \(S_i\) of element i to \(S_j\) of NB j for boundary elements, this is the distance to the reflected element (for use in boundary treatment) | |
hmin | |
minimal element-diameter | |
alpha | |
geometry bound (simultaneously satisfying \[\alpha h_i^d \leq A(T_i),\] \[\alpha \text{diam}(T_i) \leq h_i^{d-1}\] and \[\alpha h_i \leq \text{distance(midpoint i to any neighbour)}\] | |
JIT | |
Jacobian inverse transposed JIT(i,:,:) is a 2x2 -matrix of the Jacobian Inverse Transposed on element i | |
rectgrid.rectgrid | ( | varargin | ) |
constructor of a cartesian rectangular grid in 2 dimensions with axis parallel elements.
The constructor has sthe following
params.xnumintervals
: number of elements along x directionsparams.ynumintervals
: number of elements along y directionsparams.xrange,yrange
: intervals covered along the axesparams.bnd_rect_corner1
: coordinates of lower corner of to be marked boundariesparams.bnd_rect_corner2
: coordinates of upper corner of to be marked boundariesparams.bnd_rect_index
: integer index to be set on the edges in the above defined rectangle. Should not be positive integer in the range of the number of elements. use negative indices for certain later discrimination.perhaps later: constructor by duneDGF-file? perhaps later: contructor-flag: full vs non-full => only compute redundant information if required.
i j
, the intersection points are denoted \(S_{ij}\)Bernard Haasdonk 9.5.2007
varargin | variable number of input arguments, see above for description of possible configurations. |
nelements —
number of elements nvertices —
number of vertices nneigh —
4 A —
vector of element area Ainv —
vector of inverted element area X —
vector of vertex x-coordinates Y —
vector of vertex y-coordinates VI —
matrix of vertex indices: VI(i,j)
is the global index of j-th vertex of element i CX —
vector of centroid x-values CY —
vector of centroid y-values NBI —
NBI(i,j) =
element index of j-th neighbour of element i boundary faces are set to -1 or negative values are requested by params.boundary_type
INB —
INB(i,j) =
local edge number in NBI(i,j)
leading from element NBI(i,j)
to element i
, i.e. satisfying NBI(NBI(i,j), INB(i,j)) = i
EL —
EL(i,j) =
length of edge from element i
to neighbour j
DC —
DC(i,j) =
distance from centroid of element i to NB j for boundary elements, this is the distance to the reflected element (for use in boundary treatment) NX —
NX(i,j) =
x-coordinate of unit outer normal of edge from el i
to NB j
NY —
NY(i,j) =
y-coordinate of unit outer normal of edge from el i
to NB j
ECX —
ECX(i,j) =
x-coordinate of midpoint of edge from el i
to NB j
ECY —
ECY(i,j) =
y-coordinate of midpoint of edge from el i
to NB j
SX —
vector of x-coordinates of point \(S_i\) (for rect: identical to centroids) SY —
vector of y-coordinate of point \(S_j\) (for rect: identical to centroids) ESX —
ESX(i,j) =
x-coordinate of point \(S_{ij}\) on edge el i to NB j ESY —
ESY(i,j) =
y-coordinate of point \(S_{ij}\) on edge el i to NB j DS —
DS(i,j) =
distance from \(S_i\) of element i to \(S_j\) of NB j for boundary elements, this is the distance to the reflected element (for use in boundary treatment) hmin —
minimal element-diameter alpha —
geometry bound (simultaneously satisfying \(\alpha \cdot h_i^d \leq A(T_i)\), \(\alpha \cdot \mbox{diam}(T_i) \leq h_i^{d-1}\) and \(\alpha \cdot h_i \leq \)dist(midpoint \(i\) to any neigbour) ) Definition at line 42 of file rectgrid.m.
|
virtual |
returns a deep copy object of the grid implementation
returns a deep copy object of the grid implementation Every grid implementations needs to provide a deep copy method, because it is derived from a handle class.
gcopy | Deep copy |
gcopy | gcopy |
Implements gridbase.
Definition at line 412 of file rectgrid.m.
function res = rectgrid.isequal | ( | grid2 | ) |
function glob = rectgrid.local2global | ( | einds, | |
loc, | |||
params | |||
) |
function performing a local to global coordinate change of vectors of coordinate pairs.
If the first three vertices of a rectangle are v1,v2,v3
, then the global coordinate of a single point is
einds | vector of cell indices \(i_k\), \(k=1,...,K\). |
loc | matrix of size \(K \times 2\) holding local barycentric coordinate pairs for each cell index \(i_k\), \(k=1,...,K\). |
params | params |
glob | global coordinate pairs [X, Y] with vectors X and Y of length \(K\). |
Definition at line 18 of file local2global.m.
function p = rectgrid.plot | ( | params | ) |
plot of a rectgrid via plot_polygon_grid()
see help plot_polygon_grid for further information
plot method for a 2D polygonal grid. This routine can be used for triangular and rectangular grids. A line plot is performed as default.
params | optional structure holding fields controlling the plot output. |
p | This is the list of handles to the graphics primitives |
axis_tight —
axis tightcolor —
RGB vector of line/patch color shrink_factor —
if this flag is given, the elements are plotted shrinked plot_patch —
if this flag is set the plot is done by colored patches axis_equal —
if this flag is set, set axis to equal scaleparams | params |
p | p |
Definition at line 18 of file plot.m.
function gridbase grid = rectgrid.set_nbi | ( | nbind, | |
values | |||
) |