Grid

Types and Constants

VoronoiFVM.TokenStreamType
mutable struct TokenStream

Tokenstream allows to read tokenized data from file without keeping the file ocntent in memory.

  • input::IOStream

    Input stream

  • tokens::Array{SubString{String},1}

    Array of current tokens kept in memory.

  • itoken::Int64

    Position of actual token in tokens array

  • lineno::Int64

    Line number in IOStream

  • comment::Char

    Comment character

  • dlm::Function

    Function telling if given character is a delimiter.

source
VoronoiFVM.TokenStreamMethod
TokenStream(filename::String; comment, dlm) -> TokenStream

Create Tokenstream with file name argument.

source
VoronoiFVM.GridMethod
Grid(#temp#::Type{#s79} where #s79<:IOStream; file, format) -> VoronoiFVM.Grid{Float64,Int32}
Read grid from file.
source
VoronoiFVM.CircularSymmetric1DType
struct CircularSymmetric1D

Type for dispatching formfactor calculations. Intepret 1D coordinates as radial coordinate r assuming circular symmetry around origin 0.

source
VoronoiFVM.CircularSymmetric2DType
struct CircularSymmetric2D

Type for dispatching formfactor calculations. Intepret 2D coordinates as radial coordinate r and eight coordinate z assuming circular symmetry around axis r=0.

source
VoronoiFVM.GridType
mutable struct Grid{Tc, Ti} <: VoronoiFVM.AbstractGrid

Structure holding grid data. It is parametrised by the type Tc of coordinates.

  • coord::Array{Tc,2} where Tc

    2D Array of node coordinates

  • cellnodes::Array{Ti,2} where Ti

    2D Array of node indices per grid cell

  • celledges::Array{Ti,2} where Ti

    Array of edge indices per grid cell. Instatiated with prepare_edges!(grid)

  • edgecells::Array{Ti,2} where Ti

    Array of cell indices per grid edge. The number of these indices may be less than the number of columns in this array. Nonexisting indices are set to 0 Instatiated with prepare_edges!(grid)

  • edgenodes::Array{Ti,2} where Ti

    Array of node indices per grid edge. Instatiated with prepare_edges!(grid)

  • cellregions::Array{Ti,1} where Ti

    Array of cell region numbers

  • bfacenodes::Array{Ti,2} where Ti

    2D Array of node indices per boundary face

  • bfaceregions::Array{Ti,1} where Ti

    Array of boundary face region numbers

  • num_cellregions::Any

    Maximum inner cell region number

  • num_bfaceregions::Any

    Maximum boundary region number

  • local_celledgenodes::Array{Ti,2} where Ti

    2D Array describing local scheme of distributions nodes per cell edge.

  • coord_type::DataType

    Type of coordinate system

source
VoronoiFVM.GridMethod
Grid(coord, cellnodes, cellregions, bfacenodes, bfaceregions)

Main constructor for general grid from basic incidence information

source
VoronoiFVM.SphericalSymmetric1DType
struct SphericalSymmetric1D

Type for dispatching formfactor calculations. Intepret 1D coordinates as radial coordinate r assuming spehrical symmetry around point r=0.

source
VoronoiFVM.SubGridType
struct SubGrid{Tc} <: VoronoiFVM.AbstractGrid

Subgrid of parent grid (mainly for visualization purposes). Intended to hold support of species which are not defined everywhere.

  • parent::VoronoiFVM.Grid

    Parent Grid

  • node_in_parent::Array{Int32,1}

    Incidence between subgrid node numbers and node numbers in parent.

  • coord::Array{Tc,2} where Tc

    2D Array of coordinates per grid node

  • cellnodes::Array{Int32,2}

    2D Array of node numbers per grid cell

source
VoronoiFVM.GridMethod
Grid(X)

Constructor for 1D grid.

Construct 1D grid from an array of node cordinates. It creates two boundary regions with index 1 at the left end and index 2 at the right end.

Primal grid holding unknowns: marked by o, dual grid marking control volumes: marked by |.

 o-----o-----o-----o-----o-----o-----o-----o-----o
 |--|-----|-----|-----|-----|-----|-----|-----|--|
source
VoronoiFVM.GridMethod
Grid(X, Y)

Constructor for 2D grid from coordinate arrays. Boundary region numbers count counterclockwise:

locationnumber
south1
east2
north3
west4
source
VoronoiFVM.GridMethod
Grid(triangle_switches::String, tio_in::Triangulate.TriangulateIO) -> VoronoiFVM.Grid{Float64,Int32}

Create Grid from Triangle input data.

source
VoronoiFVM.GridMethod
Grid(; flags, points, bfaces, bfaceregions, regionpoints, regionnumbers, regionvolumes) -> VoronoiFVM.Grid{Float64,Int32}

Create Grid from a number of input arrays. The 2D input arrays are transposed if necessary and converted to the proper data types for Triangulate.

This conversion is not performed if the data types are thos indicated in the defaults and the leading dimension of 2D arrays corresponds to the space dimension.

source
VoronoiFVM.UnexpectedTokenErrorType
struct UnexpectedTokenError <: Exception

Error thrown when the token expected in expect! is not there.

  • found::String

  • expected::String

  • lineno::Int64

source

Methods

VoronoiFVM.cellnodeMethod
cellnode(grid::VoronoiFVM.Grid, inode::Any, icell::Any) -> Any

Return index of i-th local node in cell icell

source
VoronoiFVM.nodecoordMethod
nodecoord(grid::VoronoiFVM.Grid, inode::Any) -> SubArray

Return view of coordinates of node inode.

source
VoronoiFVM.tridataMethod
tridata(g::Any) -> Tuple{Any,Any,Any}

Provide information for PyPlot triangulation data for plotting. Needs to be splatted. Use it e.g. like

    PyPlot.trisurf(tridata(g)...,U)
source
VoronoiFVM.bfacemask!Method
bfacemask!(grid::VoronoiFVM.Grid, maskmin::AbstractArray, maskmax::AbstractArray, ireg::Int64; tol) -> VoronoiFVM.Grid

Edit region numbers of grid boundary facets via rectangular mask. Currently, only for 1D grids, inner boundaries can be added.

source
VoronoiFVM.cellmask!Method
cellmask!(grid::VoronoiFVM.Grid, maskmin::AbstractArray, maskmax::AbstractArray, ireg::Int64; tol) -> Any

Edit region numbers of grid cells via rectangular mask.

source
VoronoiFVM.cellnodeMethod
cellnode(grid::VoronoiFVM.SubGrid, inode::Any, icell::Any) -> Any

Return index of i-th local node in cell icell

source
VoronoiFVM.nodecoordMethod
nodecoord(grid::VoronoiFVM.SubGrid, inode::Any) -> SubArray

Return view of coordinates of node inode.

source
VoronoiFVM.subgridMethod
subgrid(parent::VoronoiFVM.Grid, subregions::AbstractArray; transform, boundary) -> VoronoiFVM.SubGrid{_1} where _1

Create subgrid of list of regions.

source
VoronoiFVM.geomspaceMethod
geomspace(a, b, ha, hb; tol)

(Try to) create a subdivision of interval (a,b) stored in the returned array X such that

  • X[1]==a, X[end]==b
  • (X[2]-X[1])<=ha+tol*(b-a)
  • (X[end]-X[end-1])<=hb+tol*(b-a)
  • There is a number q such that X[i+1]-X[i] == q*(X[i]-X[i-1])
  • X is the array with the minimal possible number of points with the above property

Caveat: the algorithm behind this is well tested but unproven.

Returns an Array containing the points of the subdivision.

source
VoronoiFVM.glueMethod
glue(a, b; tol)

Glue together two vectors a and b resulting in a vector c. They last element of a shall be equal (up to tol) to the first element of b. The result fulfills length(c)=length(a)+length(b)-1

source
VoronoiFVM.expecttokenMethod
expecttoken(tks::TokenStream, expected::String) -> Bool

Expect keyword token.

If token is missing, an UnexpectedTokenError is thrown If the token has been found, reading will continue at the position after the token found.

source
VoronoiFVM.gettokenMethod
gettoken(tks::TokenStream) -> Union{Nothing, SubString{String}}

Get next token from tokenstream.

source
VoronoiFVM.trytokenMethod
trytoken(tks::TokenStream, expected::String) -> Bool

Try for keyword token.

It token is missing, the token read is put back into stream, a value of false is returned and the next try/gettoken command continues at the same position,

Otherwise, true is returned, and reading continues after the token found.

source
VoronoiFVM.cellfactors!Method
cellfactors!(grid, icell, nodefac, edgefac)

Calculate node volume and voronoi surface contributions for cell.

source
Base.eltypeMethod
eltype(grid::VoronoiFVM.Grid) -> Any

Return element type of grid coordinates.

source
VoronoiFVM.mapMethod
map(f::Function, grid::VoronoiFVM.Grid)

Map a function onto grid coordinates.

source
Base.eltypeMethod
eltype(grid::VoronoiFVM.SubGrid) -> Any

Return element type of grid coordinates.

source
Base.eofMethod
eof(tks::TokenStream) -> Bool

Check if all tokens have been consumed.

source
VoronoiFVM.tricircumcenter!Method
tricircumcenter!(circumcenter, a, b, c)

Find the circumcenter of a triangle.

Created from C source of Jonathan R Shewchuk <jrs@cs.cmu.edu>

Modified to return absolute coordinates.

source