A hierarchical cubegrid of arbitrary dimension.
This is an axis parallel hexaedral grid, with non-conform refinement structure. All vertices are explicitly generated and stored. Only practical for low dimensions, i.e. 1 to 4 or perhaps 5.
Definition at line 17 of file cubegrid.m.
Public Member Functions | |
cubegrid (varargin) | |
constructor of a hierarchical cubegrid More... | |
function [
compress , new ] = | tpart_refine (lids, new_midpoints) |
refines certain grid entities More... | |
function res = | check_consistency () |
function
leaf_element = | coord2leaf_element (coord) |
function giving the leaf_element of a grid where the values of the coord-vector can be found (coord- can for example be a set of mu-values in a parameter grid. This function utilizes a \(O(log(n))\)-search algorithm. More... | |
function | demo () |
small script demonstrating the possibilities of the cubegrid class. | |
function | display () |
cubegrid's display method. More... | |
function ret = | get (propertyname, varargin) |
get-method for cubegrids More... | |
function [
p0 , p1 ] = | get_edges (gid) |
method determining the world coordinates of the edges of a single element with global index gid . More... | |
function gids = | get_leafgids () |
return leaf ids of cubegrid, i.e. vector with global element indices of leaf elements More... | |
function range = | get_ranges_of_element (element) |
return the ranges corresponding to the element of the grid, i.e. maximum vertex range of the part_num element of the grid. More... | |
function vols = | get_volume (gids) |
method determining the volumes of a set of elements More... | |
function lids = | gid2lid (gids) |
function converting global element ids to leaf element ids More... | |
function gids = | lid2gid (lids) |
function converting leaf-element ids to global element ids More... | |
function p = | plot (params) |
plot method for a cubegrid. More... | |
function p = | plot_grid (params) |
plot method for a cubegrid. A line plot is performed. Text can be plotted in the leafs of the grid. More... | |
function p = | plot_leafelement_data (data, params) |
plot method for piecewise constant data on the leaf level of the grid. More... | |
function p = | plot_leafvertex_data (data, params) |
plot method for data on the leaf level of the grid. More... | |
function ngrid = | refine (lids) |
refinement routine for cubegrid. More... | |
function ngrid = | remove_duplicate_vertices (epsilon) |
method to be used, if a vertex list in the grid should be compressed More... | |
function cubegrid gcopy = | copy () |
a deep copy of the cubegrid 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... | |
Public Attributes | |
dimension | |
dimension of grid/number of coordinates per vertex | |
vertex | |
vertex(i,j) is the j-th coordinate of i-th vertex point | |
vertexindex | |
vertexindex(id,j) is the index of j-th vertex of element id | |
level | |
level(id) equals refinement level of element id | |
isleaf | |
isleaf(id) indicates, wether element id is leaf or not | |
firstchild | |
firstchild(id) indicates the lowest-index of a child element | |
refine_steps | |
number of refinement-steps, that have been performed on the grid so far | |
creation_step | |
creation_step(id) stores the refinement step number that has led to the element id . | |
![]() | |
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 | |
cubegrid.cubegrid | ( | varargin | ) |
constructor of a hierarchical cubegrid
gid
denotes global element indices, i.e. also covering non-leaf elements,lid
denotes indices for leaf indices.gids = lid2gid(grid,lid)
Conversion can be performed by lids = gid2lid(grid,gid)
The constructor has the following
cubegrid()
: construction of a default cubegrid (2d unit square)cubegrid(cgrid)
: copy-constructorcubegrid(params)
: generate cubegrid with certain options. The range
: cell array of intervals, where the array lengths determine the grid dimensionnumintervals
: vector with number of intervals per dimensionvarargin | varargin |
dimension —
dimension of grid/number of coordinates per vertex nelements —
number of overall elements (leaf + nonleaf); nvertices —
number of vertices; vertex —
vertex(i,j) =
j-th coordinate of i
-th vertex point vertexindex —
vertexindex(id,j) =
index of j
-th vertex of element id
level —
level(id) =
level, i.e. refinement steps of element id isleaf —
isleaf(id) =
0 or 1 whether element id is leaf or not refine_steps —
number of refinement-steps, that have been performed on the grid so far creation_step —
creation_step(id)
stores the refinement step number that has led to the element id
. Definition at line 98 of file cubegrid.m.
function leaf_element = cubegrid.coord2leaf_element | ( | coord | ) |
function giving the leaf_element of a grid where the values of the coord-vector can be found (coord- can for example be a set of mu-values in a parameter grid. This function utilizes a \(O(log(n))\)-search algorithm.
coord : vector of coord-values (must have same dimension as grid)
15.02.2010 Markus Dihlmann
coord | coord |
leaf_element | leaf element |
Definition at line 18 of file coord2leaf_element.m.
|
virtual |
a deep copy of the cubegrid
gcopy | a deep copy of this instance also |
Implements gridbase.
Definition at line 334 of file cubegrid.m.
function cubegrid.display | ( | ) |
function ret = cubegrid.get | ( | propertyname, | |
varargin | |||
) |
get-method for cubegrids
propertyname | A property name of the grid which can be one of the following
|
varargin | An optional list of arguments as described above. |
ret | ret |
function [ p0 , p1 ] = cubegrid.get_edges | ( | gid | ) |
method determining the world coordinates of the edges of a single element with global index gid
.
i
-th edge goes from p0(:,i)
to p1(:,i)
gid | global index of element for which edge coordinates are requested |
p0 | lowest coordinate of the edge |
p1 | highest coordinate of the edge |
Definition at line 18 of file get_edges.m.
function gids = cubegrid.get_leafgids | ( | ) |
return leaf ids of cubegrid, i.e. vector with global element indices of leaf elements
Bernard Haasdonk 27.3.2007
gids | gids |
vector | of global leaf indices |
Definition at line 18 of file get_leafgids.m.
function range = cubegrid.get_ranges_of_element | ( | element | ) |
return the ranges corresponding to the element of the grid, i.e. maximum vertex range of the part_num element of the grid.
Markus Dihlmann 16.02.2010
element | element |
range | range |
Definition at line 18 of file get_ranges_of_element.m.
function vols = cubegrid.get_volume | ( | gids | ) |
method determining the volumes of a set of elements
A simple product of edge-lengths is computed, i.e. the edges are assumed to be axis-parallel.
gids | Global indices |
vols | The volumes for the elements given by gids . |
Definition at line 18 of file get_volume.m.
function lids = cubegrid.gid2lid | ( | gids | ) |
function gids = cubegrid.lid2gid | ( | lids | ) |
function p = cubegrid.plot | ( | params | ) |
plot method for a cubegrid.
A line plot is performed. Currently implementation for more than 3D not implemented, as this would be a line-mess
Bernard Haasdonk 1.3.2007
params | params |
p | this is the list of handles to the graphics primitives |
LineStyle —
LineStylecolor —
RGB vector shrink_factor —
if this flag is given, the elements are plotted shrinked plot_level —
if this flag is nonzero, a level plot is performed level —
this integer must be specified in case of level-plot plot_patch —
if this flag is set (only 2D and 3D) the plot is done by colored patches axis_equal —
if this flag is set, set axis to equal scale Definition at line 18 of file plot.m.
function p = cubegrid.plot_grid | ( | params | ) |
plot method for a cubegrid. A line plot is performed. Text can be plotted in the leafs of the grid.
p is the list of handles to the graphics primitives
leaftext : vector of strings. Length must be equal to number of leafelements. The text is shown in the cogs (center of gravities) of the leafelements.
Markus Dihlmann 18.02.2010
params | params |
p | p |
text —
text Definition at line 18 of file plot_grid.m.
function p = cubegrid.plot_leafelement_data | ( | data, | |
params | |||
) |
plot method for piecewise constant data on the leaf level of the grid.
Currently only implemented for 2D. A patch plot is performed.
data | data |
params | params |
p | this is the list of handles to the graphics primitives |
Definition at line 18 of file plot_leafelement_data.m.
function p = cubegrid.plot_leafvertex_data | ( | data, | |
params | |||
) |
plot method for data on the leaf level of the grid.
Currently only implemented for 2D. A patch plot is performed, such that the vertices have corresponding values as given by data, the values in between are interpolated by MATLAB.
data | data |
params | params |
p | this is the list of handles to the graphics primitives |
Definition at line 18 of file plot_leafvertex_data.m.
function ngrid = cubegrid.refine | ( | lids | ) |
refinement routine for cubegrid.
Refinement rule is a simple division into \(2^dim\) smaller cubes After refinement, a condensation of the vertex list is performed by remove_duplicate_vetrices(), i.e. duplicate vertices generated during refinement are removed.
lids | List of leaf-element ids of the to-be-refined codim 0 entities. Only leaf-elements can reasonably be refined, so do not pass global elements here, as internally a translation into global element ids is performed. |
ngrid | the refined grid |
Definition at line 18 of file refine.m.
function ngrid = cubegrid.remove_duplicate_vertices | ( | epsilon | ) |
method to be used, if a vertex list in the grid should be compressed
This might be required after refinement of a grid, merging of grids, etc. Duplicate detection is based on l2-error deviation thresholded by epsilon
.
epsilon | l2-error deviation threshold. (Default = 1e-6 ) |
ngrid | the compressed grid |
vertex —
vertex vertexindex —
vertexindex nvertices —
nvertices Definition at line 18 of file remove_duplicate_vertices.m.
function [ compress , new ] = cubegrid.tpart_refine | ( | lids, | |
new_midpoints | |||
) |
refines certain grid entities
lids | ids of grid entities to be refined |
new_midpoints | the newly created vertices of the refined grid. |
compress | the ids of entities which are getting smaller due to the refinement. |
new | ids of the newly created elements |
Definition at line 272 of file cubegrid.m.