API reference

Raven.GridArrayType
GridArray{T,N,A,G,F,L,C,D,W} <: AbstractArray{T,N}

N-dimensional array of values of type T for each grid point using a struct-of-arrays like format that is GPU friendly. Type T is assumed to be a hierarchical struct that can be flattened into an NTuple{L,E<:Real}.

The backing data array will be of type A{E} and will have the fields of T indexed via index F.

GridArray also stores values for the ghost cells of the grid which are accessible if G==true.

source
Raven.GridArrayMethod
GridArray{T}(undef, grid::Grid)

Create an array containing elements of type T for each point in the grid (including the ghost cells). The dimensions of the array is (size(referencecell(grid))..., length(grid)) as the ghost cells are hidden by default.

The type T is assumed to be able to be interpreted into an NTuple{M,L}. Some example types (some using StructArrays) are:

  • T = NamedTuple{(:E,:B),Tuple{SVector{3,ComplexF64},SVector{3,ComplexF64}}}
  • T = NTuple{5,Int64}
  • T = SVector{5,Int64}
  • T = ComplexF32
  • T = Float32

Instead of using an array-of-struct style storage, a GPU efficient struct-of-arrays like storage is used. For example, instead of storing data like

julia> T = Tuple{Int,Int};
julia> data = Array{T}(undef, 3, 4, 2); a .= Ref((1,2))
3×4 Matrix{Tuple{Int64, Int64}}:
 (1, 2)  (1, 2)  (1, 2)  (1, 2)
 (1, 2)  (1, 2)  (1, 2)  (1, 2)
 (1, 2)  (1, 2)  (1, 2)  (1, 2)

the data would be stored in the order

julia> permutedims(reinterpret(reshape, Int, data), (2,3,1,4))
3×4×2×2 Array{Int64, 4}:
[:, :, 1, 1] =
 1  1  1  1
 1  1  1  1
 1  1  1  1

[:, :, 2, 1] =
 2  2  2  2
 2  2  2  2
 2  2  2  2

[:, :, 1, 2] =
 1  1  1  1
 1  1  1  1
 1  1  1  1

[:, :, 2, 2] =
 2  2  2  2
 2  2  2  2
 2  2  2  2

For a GridArray the indices before the ones associated with T (the first two in the example above) are associated with the degrees-of-freedoms of the cells. The one after is associated with the number of cells.

source
Raven.abaqusmeshimportMethod
function AbaqusMeshImport(filename::String)
This function will parse an abaqus (.inp) file of 2D or 3D mesh data.
Such meshes are generated with HOHQMesh.jl.
source
Raven.arraytypeMethod
arraytype(A::GridArray) -> DataType

Returns the DataType used to store the data, e.g., Array or CuArray.

source
Raven.commMethod
comm(A::GridArray) -> MPI.Comm

MPI communicator used by A.

source
Raven.componentsMethod
components(A::GridArray{T})

Splits A into a tuple of GridArrays where there is one for each component of T.

Note, the data for the components is shared with the original array.

For example, if A isa GridArray{SVector{3, Float64}} then a tuple of type NTuple{3, GridArray{Float64}} would be returned.

source
Raven.constructorofFunction
constructorof(T::Type) -> constructor

Return an object constructor that can be used to construct objects of type T from their field values. Typically, constructor will be the type T with all parameters removed:

julia> struct T{A,B}
           a::A
           b::B
       end

julia> Raven.constructorof(T{Int,Int})
T

The returned constructor is used to unflatten objects hierarchical types from a list of their values. For example, in this case T(1,2) constructs an object where T.a==1 an T.b==2.

The method constructorof should be defined for types that are not constructed from a tuple of their values.

source
Raven.cubeshell2dgridMethod
function cubeshell2dgrid(R::Real)

This function will construct the CoarseGrid of a cube shell of radius R. 
A cube shell is a 2D connectivity.
source
Raven.expandMethod
expand(pattern::CommPattern, factor, offset)

Create a new CommPattern where the recvindices and sendindices are expanded in size by factor entries and offset by offset.

For example, to expand a nodecommpattern to communicate all fields of an array that is indexed via (node, field, element) use expand(nodecommpattern(grid), nfields, nnodes).

source
Raven.fieldindexMethod
fieldindex(A::GridArray{T})

Returns the index used in A.data to store the fields of T.

source
Raven.flattenMethod
flatten(obj, use=Real)

Flattens a hierarchical type to a tuple with elements of type use.

Examples

julia> flatten((a=(Complex(1, 2), 3), b=4))
(1, 2, 3, 4)

To convert the tuple to a vector, simply use [flatten(x)...], or using static arrays to avoid allocations: SVector(flatten(x)).

source
Raven.get_backendMethod
get_backend(::Type{T}) -> Type

Returns the KernelAbstractions backend to use with kernels where A is an argument.

source
Raven.get_backendMethod
get_backend(A::GridArray) -> KernelAbstractions.Backend

Returns the KernelAbstractions.Backend used to launch kernels interacting with A.

source
Raven.numbercontiguousMethod
numbercontiguous(T, A; by = identity)

Renumbers A contiguously in an Array{T} and returns it. The function by is a mapping for the elements of A used during element comparison, similar to sort.

Examples

julia> Raven.numbercontiguous(Int32, [13, 4, 5, 1, 5])
5-element Vector{Int32}:
 4
 2
 3
 1
 3

julia> Raven.numbercontiguous(Int32, [13, 4, 5, 1, 5]; by = x->-x)
5-element Vector{Int32}:
 1
 3
 2
 4
 2
source
Raven.pinMethod
pin(T::Type, A::Array)

Pins the host array A for copying to arrays of type T
source
Raven.showingghostsMethod
showingghosts(A::GridArray) -> Bool

Predicate indicating if the ghost layer is accessible to A.

source
Raven.sizewithghostsMethod
sizewithghosts(A::GridArray)

Return a tuple containing the dimensions of A including the ghost cells.

source
Raven.unflattenFunction
unflatten(T::Type, data, use::Type=Real)

Construct an object from Tuple or Vector data and a Type T. The data should be at least as long as the queried fields (of type use) in T.

Examples

julia> unflatten(Tuple{Tuple{Int,Int},Complex{Int,Int}}, (1, 2, 3, 4))
((1, 2), 3 + 4im)
source
Raven.viewwithghostsMethod
viewwithghosts(A::GridArray)

Return a GridArray with the same data as A but with the ghost cells accessible.

source
Raven.viewwithoutghostsMethod
viewwithoutghosts(A::GridArray)

Return a GridArray with the same data as A but with the ghost cells inaccessible.

source