rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
List of all members | Public Member Functions | Public Attributes

Detailed Description

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.

Inheritance diagram for cubegrid:
Inheritance graph
[legend]
Collaboration diagram for cubegrid:
Collaboration graph
[legend]

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...
 
- Public Member Functions inherited from gridbase
 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.
 
- Public Attributes inherited from gridbase
 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
 

Constructor & Destructor Documentation

cubegrid.cubegrid (   varargin)

constructor of a hierarchical cubegrid

Preliminaries
In the following
  • gid denotes global element indices, i.e. also covering non-leaf elements,
  • lid denotes indices for leaf indices.
Conversion can be performed by gids = lid2gid(grid,lid) Conversion can be performed by lids = gid2lid(grid,gid)

The constructor has the following

Synopsis
  • cubegrid() : construction of a default cubegrid (2d unit square)
  • cubegrid(cgrid) : copy-constructor
  • cubegrid(params): generate cubegrid with certain options. The
    argument params requires the following fields
    1. range : cell array of intervals, where the array lengths determine the grid dimension
    2. numintervals: vector with number of intervals per dimension
    perhaps later: constructor by duneDGF-file?
Parameters
vararginvarargin
Generated fields of grid:
  • 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.

Here is the caller graph for this function:

Member Function Documentation

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

Parameters
coordcoord
Return values
leaf_elementleaf element

Definition at line 18 of file coord2leaf_element.m.

Here is the call graph for this function:

function cubegrid gcopy = cubegrid.copy ( )
virtual

a deep copy of the cubegrid

Return values
gcopya deep copy of this instance also

Implements gridbase.

Definition at line 334 of file cubegrid.m.

Here is the call graph for this function:

function cubegrid.display ( )

cubegrid's display method.

All scalar quantities are displayed. Internal pointlists, vectors and flags of elements are not displayed. These can be accessed by the get() method.

Definition at line 18 of file display.m.

Here is the caller graph for this function:

function ret = cubegrid.get (   propertyname,
  varargin 
)

get-method for cubegrids

Parameters
propertynameA property name of the grid which can be one of the following
  • level : get vector of levels of all elements
  • dimension : get dimension of grid
  • nvertices : get number of vertices of grid
  • nelements : get number of elements of grid
  • isleaf : get vector of isleaf-indices of all elements
  • vertexindex returns a matrix (i,j) index of j-th vertex of element i a further optional argument with element indices can be passed, then only the vertices of these elements are returned,
    get(grid,'vertexindex',[2,3])
    returns a 2 x nvertices_per_element matrix with indices
  • vertex : returns a matrix of all vertex coordinates, i.e. ret(i,j) => j-th coordinate of i-th vertex point optionally, a subset of vertex-indices can be determined as further parameter, i.e.
    get(grid,'vertex',[2 3 4])
    produces a 3 x dim matrix with the coordinates of the points
or property can be equal to one of the following strings returning quantities which are derived from the above grid properties
  • nleafelements : get number of leaf elements of grid
  • leafelements : get vector of indices of elements that are leaf elements
  • leafcogs : returns a matrix of all centers of gravity of the leaf elements. ret(i,j) is the j-th coordinate of the i-th leaf element
vararginAn optional list of arguments as described above.
Return values
retret

Definition at line 18 of file get.m.

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)

Note
vectorized version for multiple elements not yet implemented
Parameters
gidglobal index of element for which edge coordinates are requested
Return values
p0lowest coordinate of the edge
p1highest coordinate of the edge

Definition at line 18 of file get_edges.m.

Here is the caller graph for this function:

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

Return values
gidsgids
vectorof global leaf indices

Definition at line 18 of file get_leafgids.m.

Here is the caller graph for this function:

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

Parameters
elementelement
Return values
rangerange

Definition at line 18 of file get_ranges_of_element.m.

Here is the caller graph for this function:

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.

Note
The computation for multiple gids is trivially performed by a loop. Vectorization must be done sometime!!
Parameters
gidsGlobal indices
Return values
volsThe volumes for the elements given by gids.

Definition at line 18 of file get_volume.m.

Here is the call graph for this function:

function lids = cubegrid.gid2lid (   gids)

function converting global element ids to leaf element ids

Parameters
gidsglobal indices of elements to which the local indices shall be computed.
Return values
lidsleaf element ids or -1 if a global id was not a leaf element

Definition at line 18 of file gid2lid.m.

function gids = cubegrid.lid2gid (   lids)

function converting leaf-element ids to global element ids

Parameters
lidslocal indices for which the global ones shall be computed
Return values
gidsglobal indices of leaf indices

Definition at line 18 of file lid2gid.m.

Here is the caller graph for this function:

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

Parameters
paramsparams
Return values
pthis is the list of handles to the graphics primitives
Required fields of params:
  • LineStyle —  LineStyle
Optional fields of params:
  • color —  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.

Here is the caller graph for this function:

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

optional params
color : 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

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

Parameters
paramsparams
Return values
pp
Required fields of params:
  • text —  text

Definition at line 18 of file plot_grid.m.

Here is the call graph for this function:

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.

See also
plot_element_data() for general possible options in params
Parameters
datadata
paramsparams
Return values
pthis is the list of handles to the graphics primitives

Definition at line 18 of file plot_leafelement_data.m.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

See also
plot_vertex_data() for optional params fields
Parameters
datadata
paramsparams
Return values
pthis is the list of handles to the graphics primitives

Definition at line 18 of file plot_leafvertex_data.m.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
lidsList 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.
Return values
ngridthe refined grid

Definition at line 18 of file refine.m.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
epsilonl2-error deviation threshold. (Default = 1e-6)
Return values
ngridthe compressed grid
Generated fields of ngrid:
  • vertex —  vertex
  • vertexindex —  vertexindex
  • nvertices —  nvertices

Definition at line 18 of file remove_duplicate_vertices.m.

Here is the caller graph for this function:

function [ compress , new ] = cubegrid.tpart_refine (   lids,
  new_midpoints 
)

refines certain grid entities

Parameters
lidsids of grid entities to be refined
new_midpointsthe newly created vertices of the refined grid.
Return values
compressthe ids of entities which are getting smaller due to the refinement.
newids of the newly created elements

Definition at line 272 of file cubegrid.m.

Here is the call graph for this function:


The documentation for this class was generated from the following files: