rbmatlab 0.10.01
|
A triangular conforming grid in two dimensions.
General geometrical information is stored including neighbour information. Therefore also boundary neighbour relations can be specified. Boundary edges can be marked by "painting rectangles": 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 1 of file triagrid.m.
Public Member Functions | |
triagrid ( varargin) | |
constructor of a triangular conform grid in 2 dimensions with following Synopsis: | |
function | demo () |
small script demonstrating the possibilities of the triagrid class. | |
function | display () |
display method for triagrid | |
function gridp = | gridpart ( eind) |
function extracting a part of a triagrid defined by the given element indices in the vector eind . | |
function lcoord = | llocal2local ( faceinds, llcoord) |
function performing a 1D edge-local coordinate (lcoord) to 2D local coordinate transformation of given faces | |
function glob = | local2global ( einds, loc, params) |
function performing a local to global coordinate change of vectors of coordinate pairs. | |
function p = | plot ( params) |
plot of a rectgrid via plot_polygon_grid() | |
function gridbase grid = | set_nbi ( nbind, values) |
function setting some neighbour indices of a grid to specified values. | |
function triagrid gcopy = | copy () |
returns a deep copy object of the grid implementation | |
Static Public Member Functions | |
static function [ C , G ] = | aff_trafo_glob2loc ( x0, y0) |
function giving the coefficients for the affine transformation from original/global triangle to the reference/local one. | |
static function [ C , G ] = | aff_trafo_loc2glob ( x0, y0) |
function giving the coefficients for the affine transformation from reference/local triangle to the original/global one. | |
static function [ C , G ] = | aff_trafo_orig2ref ( x0, y0, varargin) |
function giving the coefficients for the affine transformation from original triangle to the reference one, | |
static function loc = | global2local ( gridbase grid, elementid, glob) |
function getting a triagrid, an element-ID and a vector of points and giving a vector of transformed points. The triangle given by elementid is used for the creation of an affine map to the standard tringle, then this transformation is used for all the points in glob | |
static function
micro2macro = | micro2macro_map ( microgrid, macrogrid) |
function defining a vector micro2macro containing the information which triangle of the microgrid lies in which triangle of the macrogrid, defined in the model micro2macro(5) = 7 means that micro-triangle nr 5 lies in macro-triangle nr 7 | |
Public Attributes | |
nedges_interior | |
number of interior edges | |
nedges_boundary | |
number of boundary edges |
triagrid.triagrid | ( | varargin | ) |
constructor of a triangular conform grid in 2 dimensions with following Synopsis:
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.pdetools => generate your grid and export p
and t
to MATLAB workspace
save('mygrid','p','t') grid = triagrid(struct('grid_initfile','mygrid'));
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 varargin | variable number of input arguments, see above for description of possible configurations. |
nelements —
number of elements nvertices —
number of vertices nneigh —
3 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 SY —
vector of y-coordinate of point ESX —
ESX(i,j) =
x-coordinate of point ESY —
ESY(i,j) =
y-coordinate of point DS —
DS(i,j) =
distance from hmin —
minimal element-diameter alpha —
geometry bound (simultaneously satisfying JIT —
Jacobian inverse transposed JIT(i,:,:)
is a 2x2-matrix of the Jac. Inv. Tr. on element i
Definition at line 39 of file triagrid.m.
function [ C , G ] = triagrid.aff_trafo_glob2loc | ( | x0, | |
y0 | |||
) | [static] |
function giving the coefficients for the affine transformation from original/global triangle to the reference/local one.
In detail, this implements a transformation of the type
triangle: /| (x0(3),y0(3)) (0,1) |\ / | ---T---> | \ (x0(1),y0(1)) /__| (x0(2),y0(2)) (0,0) |__\ (1,0)
x0 | vector of size 3 x 1 holding x values of the original/global triangle |
y0 | vector of size 3 x 1 holding y values of the original/global triangle |
C | matrix of size 2 x 1 with entries C=[c1; c2] |
G | matrix of size 2 x 2 with entries G=[g11, g12; g21, g22] |
Definition at line 2 of file aff_trafo_glob2loc.m.
function [ C , G ] = triagrid.aff_trafo_loc2glob | ( | x0, | |
y0 | |||
) | [static] |
function giving the coefficients for the affine transformation from reference/local triangle to the original/global one.
In detail, this implements a transformation of the type
triangle: (0,1) |\ /| (x0(3),y0(3)) | \ ---T---> / | (0,0) |__\ (1,0) (x0(1),y0(1)) /__| (x0(2),y0(2))
x0 | vector of size 3 x 1 holding x values of the original/global triangle |
y0 | vector of size 3 x 1 holding y values of the original/global triangle |
C | matrix of size 2 x 1 with entries C=[c1; c2] |
G | matrix of size 2 x 2 with entries G=[g11, g12; g21, g22] |
Definition at line 2 of file aff_trafo_loc2glob.m.
function [ C , G ] = triagrid.aff_trafo_orig2ref | ( | x0, | |
y0, | |||
varargin | |||
) | [static] |
function giving the coefficients for the affine transformation from original triangle to the reference one,
triangle: /| (x0(3),y0(3)) (0,1) |\ / | ---T---> | \ (x0(1),y0(1)) /__| (x0(2),y0(2)) (0,0) |__\ (1,0)
function giving c1, c2, g11, g12, g21, g22 so: C=[c1; c2] and G=[g11, g12; g21, g22]
x0 | x0 |
y0 | y0 |
varargin | varargin |
C | C |
G | G |
Definition at line 2 of file aff_trafo_orig2ref.m.
function triagrid gcopy = triagrid.copy | ( | ) | [virtual] |
returns a deep copy object of the grid implementation
gcopy | object This is a deep copy of the current instance. |
Implements gridbase.
Definition at line 988 of file triagrid.m.
function triagrid.display | ( | ) |
display method for triagrid
This inherits gridbase.display() and adds information on
Reimplemented from gridbase.
function loc = triagrid.global2local | ( | gridbase | grid, |
elementid, | |||
glob | |||
) | [static] |
function getting a triagrid, an element-ID and a vector of points and giving a vector of transformed points. The triangle given by elementid is used for the creation of an affine map to the standard tringle, then this transformation is used for all the points in glob
Oliver Zeeb, 02.02.11
grid | an object |
elementid | elementid |
glob | glob |
loc | loc |
VI —
matrix of vertex indices: VI(i,j)
is the global index of the j
-th vertex of element i
X —
vector of vertex Y —
vector of vertex Definition at line 2 of file global2local.m.
function gridbase gridp = triagrid.gridpart | ( | eind | ) |
function extracting a part of a triagrid defined by the given element indices in the vector eind
.
-10
gridp
would be really identical to the result generated by the constructor on the subset of points.eind | vector of cell indices which shall be extracted from the grid. |
gridp | the partial grid with extracted cells eind . |
nelements —
nelements nvertices —
nvertices A —
A Ainv —
Ainv X —
X Y —
Y VI —
VI CX —
CX CY —
CY NBI —
NBI INB —
INB EL —
EL DC —
DC NX —
NX NY —
NY ECX —
ECX ECY —
ECY SX —
SX SY —
SY ESX —
ESX ESY —
ESY DS —
DS JIT —
JIT Reimplemented from gridbase.
Definition at line 2 of file gridpart.m.
function lcoord = triagrid.llocal2local | ( | faceinds, | |
llcoord | |||
) |
function performing a 1D edge-local coordinate (lcoord) to 2D local coordinate transformation of given faces
faceinds | The face indices on which the transformation shall take place. (1:3) |
llcoord | single real number between 0 and 1 defining the edge-local vertex coordinate. |
lcoord | matrix of size 2 x |faceinds| holding the local coordinates. |
Definition at line 2 of file llocal2local.m.
function glob = triagrid.local2global | ( | einds, | |
loc, | |||
params | |||
) |
function performing a local to global coordinate change of vectors of coordinate pairs.
If the three vertices of a triangle are v1,v2,v3
, then the global coordinate of a single point is
glob = v1 + loc(:,1).*(v2-v1) + loc(:,2).*(v3-v1);
einds | vector of cell indices ![]() ![]() |
loc | matrix of size ![]() ![]() ![]() |
params | params |
glob | global coordinate pairs [X, Y] with vectors X and Y of length ![]() |
Definition at line 2 of file local2global.m.
function micro2macro = triagrid.micro2macro_map | ( | microgrid, | |
macrogrid | |||
) | [static] |
function defining a vector micro2macro containing the information which triangle of the microgrid lies in which triangle of the macrogrid, defined in the model micro2macro(5) = 7 means that micro-triangle nr 5 lies in macro-triangle nr 7
microgrid and macrogrid must be triagrid
Oliver Zeeb, 01.02.11
microgrid | microgrid |
macrogrid | macrogrid |
micro2macro | micro2macro |
nelements —
nelements X —
X Y —
Y nvertices —
nvertices VI —
VIX —
X Y —
Y VI —
VI nelements —
nelements Definition at line 2 of file micro2macro_map.m.
function p = triagrid.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 scale params | params |
p | p |
function gridbase grid = triagrid.set_nbi | ( | nbind, | |
values | |||
) |