rbmatlab 0.10.01
Public Member Functions | Public Attributes
cubegrid Class Reference

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 1 of file cubegrid.m.

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

List of all members.

Public Member Functions

 cubegrid ( varargin)
 constructor of a hierarchical cubegrid
function [
compress
, new ] = 
tpart_refine ( lids, new_midpoints)
 refines certain grid entities
function res check_consistency ()
 function checking the consistency of a polygonal grid, i.e. checking, whether the edge centroids correspond (implicit neighbour-index test)
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.
function  demo ()
 small script demonstrating the possibilities of the cubegrid class.
function  display ()
 cubegrid's display method.
function ret get ( propertyname, varargin)
 get-method for cubegrids
function [ p0 ,
p1 ] = 
get_edges ( gid)
 method determining the world coordinates of the edges of a single element with global index gid.
function gids get_leafgids ()
 return leaf ids of cubegrid, i.e. vector with global element indices of leaf elements
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.
function vols get_volume ( gids)
 method determining the volumes of a set of elements
function lids gid2lid ( gids)
 function converting global element ids to leaf element ids
function gids lid2gid ( lids)
 function converting leaf-element ids to global element ids
function p plot ( params)
 plot method for a cubegrid.
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.
function p plot_leafelement_data ( data, params)
 plot method for piecewise constant data on the leaf level of the grid.
function p plot_leafvertex_data ( data, params)
 plot method for data on the leaf level of the grid.
function ngrid refine ( lids)
 refinement routine for cubegrid.
function ngrid remove_duplicate_vertices ( epsilon)
 method to be used, if a vertex list in the grid should be compressed
function cubegrid gcopy copy ()
 a deep copy of the cubegrid

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.

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 80 of file cubegrid.m.


Member Function Documentation

function res = cubegrid.check_consistency ( )

function checking the consistency of a polygonal grid, i.e. checking, whether the edge centroids correspond (implicit neighbour-index test)

Todo:
: perhaps later further extensions
Return values:
resboolean value which is true if the check succeeds, or false if it fails.

Reimplemented from gridbase.

Definition at line 2 of file check_consistency.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

Parameters:
coordcoord
Return values:
leaf_elementleaf element

Definition at line 2 of file coord2leaf_element.m.

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 382 of file cubegrid.m.

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.

Reimplemented from gridbase.

Definition at line 2 of file display.m.

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 2 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 2 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

Return values:
gidsgids
vectorof global leaf indices

Definition at line 2 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

Parameters:
elementelement
Return values:
rangerange

Definition at line 2 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.

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 2 of file get_volume.m.

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 2 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 2 of file lid2gid.m.

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 2 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

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 2 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.

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 2 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.

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 2 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.

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 2 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.

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 2 of file remove_duplicate_vertices.m.

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 317 of file cubegrid.m.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables