xref: /libCEED/julia/LibCEED.jl/src/ElemRestriction.jl (revision 3843268474bcba268b350aef47098b12729490a9)
144554ea0SWill Paznerabstract type AbstractElemRestriction end
244554ea0SWill Pazner
344554ea0SWill Pazner"""
444554ea0SWill Pazner    ElemRestrictionNone()
544554ea0SWill Pazner
644554ea0SWill PaznerReturns the singleton object corresponding to libCEED's `CEED_ELEMRESTRICTION_NONE`
744554ea0SWill Pazner"""
844554ea0SWill Paznerstruct ElemRestrictionNone <: AbstractElemRestriction end
944554ea0SWill PaznerBase.getindex(::ElemRestrictionNone) = C.CEED_ELEMRESTRICTION_NONE[]
1044554ea0SWill Pazner
1144554ea0SWill Pazner"""
1244554ea0SWill Pazner    ElemRestriction
1344554ea0SWill Pazner
1444554ea0SWill PaznerWraps a `CeedElemRestriction` object, representing the restriction from local vectors to
1544554ea0SWill Paznerelements. An `ElemRestriction` object can be created using [`create_elem_restriction`](@ref)
1644554ea0SWill Pazneror [`create_elem_restriction_strided`](@ref).
1744554ea0SWill Pazner"""
1844554ea0SWill Paznermutable struct ElemRestriction <: AbstractElemRestriction
1944554ea0SWill Pazner    ref::RefValue{C.CeedElemRestriction}
2044554ea0SWill Pazner    function ElemRestriction(ref)
2144554ea0SWill Pazner        obj = new(ref)
2244554ea0SWill Pazner        finalizer(obj) do x
2344554ea0SWill Pazner            # ccall(:jl_safe_printf, Cvoid, (Cstring, Cstring), "Finalizing %s.\n", repr(x))
2444554ea0SWill Pazner            destroy(x)
2544554ea0SWill Pazner        end
2644554ea0SWill Pazner        return obj
2744554ea0SWill Pazner    end
2844554ea0SWill Paznerend
2944554ea0SWill Paznerdestroy(r::ElemRestriction) = C.CeedElemRestrictionDestroy(r.ref) # COV_EXCL_LINE
3044554ea0SWill PaznerBase.getindex(r::ElemRestriction) = r.ref[]
3144554ea0SWill PaznerBase.show(io::IO, ::MIME"text/plain", e::ElemRestriction) =
3244554ea0SWill Pazner    ceed_show(io, e, C.CeedElemRestrictionView)
3344554ea0SWill Pazner
3444554ea0SWill Pazner@doc raw"""
3544554ea0SWill Pazner    create_elem_restriction(
3644554ea0SWill Pazner        ceed::Ceed,
3744554ea0SWill Pazner        nelem,
3844554ea0SWill Pazner        elemsize,
3944554ea0SWill Pazner        ncomp,
4044554ea0SWill Pazner        compstride,
4144554ea0SWill Pazner        lsize,
4244554ea0SWill Pazner        offsets::AbstractArray{CeedInt},
4344554ea0SWill Pazner        mtype::MemType=MEM_HOST,
4444554ea0SWill Pazner        cmode::CopyMode=COPY_VALUES,
4544554ea0SWill Pazner    )
4644554ea0SWill Pazner
4744554ea0SWill PaznerCreate a `CeedElemRestriction`.
4844554ea0SWill Pazner
4944554ea0SWill Pazner!!! warning "Zero-based indexing"
5044554ea0SWill Pazner    In the below notation, we are using **0-based indexing**. libCEED expects the offset
5144554ea0SWill Pazner    indices to be 0-based.
5244554ea0SWill Pazner
5344554ea0SWill Pazner# Arguments:
5444554ea0SWill Pazner- `ceed`:       The [`Ceed`](@ref) object
5544554ea0SWill Pazner- `nelem`:      Number of elements described in the `offsets` array
5644554ea0SWill Pazner- `elemsize`:   Size (number of "nodes") per element
5744554ea0SWill Pazner- `ncomp`:      Number of field components per interpolation node (1 for scalar fields)
5844554ea0SWill Pazner- `compstride`: Stride between components for the same L-vector "node". Data for node $i$,
5944554ea0SWill Pazner                component $j$, element $k$ can be found in the L-vector at index `offsets[i
6044554ea0SWill Pazner                + k*elemsize] + j*compstride`.
6144554ea0SWill Pazner- `lsize`:      The size of the L-vector. This vector may be larger than the elements and
6244554ea0SWill Pazner                fields given by this restriction.
6344554ea0SWill Pazner- `offsets`:    Array of shape `(elemsize, nelem)`. Column $i$ holds the ordered list of the
6444554ea0SWill Pazner                offsets (into the input [`CeedVector`](@ref)) for the unknowns corresponding
6544554ea0SWill Pazner                to element $i$, where $0 \leq i < \textit{nelem}$. All offsets must be in
6644554ea0SWill Pazner                the range $[0, \textit{lsize} - 1]$.
6744554ea0SWill Pazner- `mtype`:      Memory type of the `offsets` array, see [`MemType`](@ref)
6844554ea0SWill Pazner- `cmode`:      Copy mode for the `offsets` array, see [`CopyMode`](@ref)
6944554ea0SWill Pazner"""
7044554ea0SWill Paznerfunction create_elem_restriction(
7144554ea0SWill Pazner    c::Ceed,
7244554ea0SWill Pazner    nelem,
7344554ea0SWill Pazner    elemsize,
7444554ea0SWill Pazner    ncomp,
7544554ea0SWill Pazner    compstride,
7644554ea0SWill Pazner    lsize,
7744554ea0SWill Pazner    offsets::AbstractArray{CeedInt};
7844554ea0SWill Pazner    mtype::MemType=MEM_HOST,
7944554ea0SWill Pazner    cmode::CopyMode=COPY_VALUES,
8044554ea0SWill Pazner)
8144554ea0SWill Pazner    ref = Ref{C.CeedElemRestriction}()
8244554ea0SWill Pazner    C.CeedElemRestrictionCreate(
8344554ea0SWill Pazner        c[],
8444554ea0SWill Pazner        nelem,
8544554ea0SWill Pazner        elemsize,
8644554ea0SWill Pazner        ncomp,
8744554ea0SWill Pazner        compstride,
8844554ea0SWill Pazner        lsize,
8944554ea0SWill Pazner        mtype,
9044554ea0SWill Pazner        cmode,
9144554ea0SWill Pazner        offsets,
9244554ea0SWill Pazner        ref,
9344554ea0SWill Pazner    )
9444554ea0SWill Pazner    ElemRestriction(ref)
9544554ea0SWill Paznerend
9644554ea0SWill Pazner
9744554ea0SWill Pazner@doc raw"""
98*709403c1SSebastian Grimberg    create_elem_restriction_oriented(
99*709403c1SSebastian Grimberg        ceed::Ceed,
100*709403c1SSebastian Grimberg        nelem,
101*709403c1SSebastian Grimberg        elemsize,
102*709403c1SSebastian Grimberg        ncomp,
103*709403c1SSebastian Grimberg        compstride,
104*709403c1SSebastian Grimberg        lsize,
105*709403c1SSebastian Grimberg        offsets::AbstractArray{CeedInt},
106*709403c1SSebastian Grimberg        orients::AbstractArray{Bool},
107*709403c1SSebastian Grimberg        mtype::MemType=MEM_HOST,
108*709403c1SSebastian Grimberg        cmode::CopyMode=COPY_VALUES,
109*709403c1SSebastian Grimberg    )
110*709403c1SSebastian Grimberg
111*709403c1SSebastian GrimbergCreate an oriented `CeedElemRestriction`.
112*709403c1SSebastian Grimberg
113*709403c1SSebastian Grimberg!!! warning "Zero-based indexing"
114*709403c1SSebastian Grimberg    In the below notation, we are using **0-based indexing**. libCEED expects the offset
115*709403c1SSebastian Grimberg    indices to be 0-based.
116*709403c1SSebastian Grimberg
117*709403c1SSebastian Grimberg# Arguments:
118*709403c1SSebastian Grimberg- `ceed`:       The [`Ceed`](@ref) object
119*709403c1SSebastian Grimberg- `nelem`:      Number of elements described in the `offsets` array
120*709403c1SSebastian Grimberg- `elemsize`:   Size (number of "nodes") per element
121*709403c1SSebastian Grimberg- `ncomp`:      Number of field components per interpolation node (1 for scalar fields)
122*709403c1SSebastian Grimberg- `compstride`: Stride between components for the same L-vector "node". Data for node $i$,
123*709403c1SSebastian Grimberg                component $j$, element $k$ can be found in the L-vector at index `offsets[i
124*709403c1SSebastian Grimberg                + k*elemsize] + j*compstride`.
125*709403c1SSebastian Grimberg- `lsize`:      The size of the L-vector. This vector may be larger than the elements and
126*709403c1SSebastian Grimberg                fields given by this restriction.
127*709403c1SSebastian Grimberg- `offsets`:    Array of shape `(elemsize, nelem)`. Column $i$ holds the ordered list of the
128*709403c1SSebastian Grimberg                offsets (into the input [`CeedVector`](@ref)) for the unknowns corresponding
129*709403c1SSebastian Grimberg                to element $i$, where $0 \leq i < \textit{nelem}$. All offsets must be in
130*709403c1SSebastian Grimberg                the range $[0, \textit{lsize} - 1]$.
131*709403c1SSebastian Grimberg- `orients`:    Array of shape `(elemsize, nelem)` with bool false for positively oriented
132*709403c1SSebastian Grimberg                and true to flip the orientation.
133*709403c1SSebastian Grimberg- `mtype`:      Memory type of the `offsets` array, see [`MemType`](@ref)
134*709403c1SSebastian Grimberg- `cmode`:      Copy mode for the `offsets` array, see [`CopyMode`](@ref)
135*709403c1SSebastian Grimberg"""
136*709403c1SSebastian Grimbergfunction create_elem_restriction_oriented(
137*709403c1SSebastian Grimberg    c::Ceed,
138*709403c1SSebastian Grimberg    nelem,
139*709403c1SSebastian Grimberg    elemsize,
140*709403c1SSebastian Grimberg    ncomp,
141*709403c1SSebastian Grimberg    compstride,
142*709403c1SSebastian Grimberg    lsize,
143*709403c1SSebastian Grimberg    offsets::AbstractArray{CeedInt},
144*709403c1SSebastian Grimberg    orients::AbstractArray{Bool};
145*709403c1SSebastian Grimberg    mtype::MemType=MEM_HOST,
146*709403c1SSebastian Grimberg    cmode::CopyMode=COPY_VALUES,
147*709403c1SSebastian Grimberg)
148*709403c1SSebastian Grimberg    ref = Ref{C.CeedElemRestriction}()
149*709403c1SSebastian Grimberg    C.CeedElemRestrictionCreateOriented(
150*709403c1SSebastian Grimberg        c[],
151*709403c1SSebastian Grimberg        nelem,
152*709403c1SSebastian Grimberg        elemsize,
153*709403c1SSebastian Grimberg        ncomp,
154*709403c1SSebastian Grimberg        compstride,
155*709403c1SSebastian Grimberg        lsize,
156*709403c1SSebastian Grimberg        mtype,
157*709403c1SSebastian Grimberg        cmode,
158*709403c1SSebastian Grimberg        offsets,
159*709403c1SSebastian Grimberg        orients,
160*709403c1SSebastian Grimberg        ref,
161*709403c1SSebastian Grimberg    )
162*709403c1SSebastian Grimberg    ElemRestriction(ref)
163*709403c1SSebastian Grimbergend
164*709403c1SSebastian Grimberg
165*709403c1SSebastian Grimberg@doc raw"""
166*709403c1SSebastian Grimberg    create_elem_restriction_curl_oriented(
167*709403c1SSebastian Grimberg        ceed::Ceed,
168*709403c1SSebastian Grimberg        nelem,
169*709403c1SSebastian Grimberg        elemsize,
170*709403c1SSebastian Grimberg        ncomp,
171*709403c1SSebastian Grimberg        compstride,
172*709403c1SSebastian Grimberg        lsize,
173*709403c1SSebastian Grimberg        offsets::AbstractArray{CeedInt},
174*709403c1SSebastian Grimberg        curlorients::AbstractArray{CeedInt},
175*709403c1SSebastian Grimberg        mtype::MemType=MEM_HOST,
176*709403c1SSebastian Grimberg        cmode::CopyMode=COPY_VALUES,
177*709403c1SSebastian Grimberg    )
178*709403c1SSebastian Grimberg
179*709403c1SSebastian GrimbergCreate an curl-oriented `CeedElemRestriction`.
180*709403c1SSebastian Grimberg
181*709403c1SSebastian Grimberg!!! warning "Zero-based indexing"
182*709403c1SSebastian Grimberg    In the below notation, we are using **0-based indexing**. libCEED expects the offset
183*709403c1SSebastian Grimberg    indices to be 0-based.
184*709403c1SSebastian Grimberg
185*709403c1SSebastian Grimberg# Arguments:
186*709403c1SSebastian Grimberg- `ceed`:        The [`Ceed`](@ref) object
187*709403c1SSebastian Grimberg- `nelem`:       Number of elements described in the `offsets` array
188*709403c1SSebastian Grimberg- `elemsize`:    Size (number of "nodes") per element
189*709403c1SSebastian Grimberg- `ncomp`:       Number of field components per interpolation node (1 for scalar fields)
190*709403c1SSebastian Grimberg- `compstride`:  Stride between components for the same L-vector "node". Data for node $i$,
191*709403c1SSebastian Grimberg                 component $j$, element $k$ can be found in the L-vector at index `offsets[i
192*709403c1SSebastian Grimberg                 + k*elemsize] + j*compstride`.
193*709403c1SSebastian Grimberg- `lsize`:       The size of the L-vector. This vector may be larger than the elements and
194*709403c1SSebastian Grimberg                 fields given by this restriction.
195*709403c1SSebastian Grimberg- `offsets`:     Array of shape `(elemsize, nelem)`. Column $i$ holds the ordered list of
196*709403c1SSebastian Grimberg                 the offsets (into the input [`CeedVector`](@ref)) for the unknowns
197*709403c1SSebastian Grimberg                 corresponding to element $i$, where $0 \leq i < \textit{nelem}$. All
198*709403c1SSebastian Grimberg                 offsets must be in the range $[0, \textit{lsize} - 1]$.
199*709403c1SSebastian Grimberg- `curlorients`: Array of shape `(3 * elemsize, nelem)` representing a row-major tridiagonal
200*709403c1SSebastian Grimberg                 matrix (`curlorients[0, i] = curlorients[3 * elemsize - 1, i] = 0`, where
201*709403c1SSebastian Grimberg                 $0 \leq i < \textit{nelem}$) which is applied to the element unknowns upon
202*709403c1SSebastian Grimberg                 restriction.
203*709403c1SSebastian Grimberg- `mtype`:       Memory type of the `offsets` array, see [`MemType`](@ref)
204*709403c1SSebastian Grimberg- `cmode`:       Copy mode for the `offsets` array, see [`CopyMode`](@ref)
205*709403c1SSebastian Grimberg"""
206*709403c1SSebastian Grimbergfunction create_elem_restriction_curl_oriented(
207*709403c1SSebastian Grimberg    c::Ceed,
208*709403c1SSebastian Grimberg    nelem,
209*709403c1SSebastian Grimberg    elemsize,
210*709403c1SSebastian Grimberg    ncomp,
211*709403c1SSebastian Grimberg    compstride,
212*709403c1SSebastian Grimberg    lsize,
213*709403c1SSebastian Grimberg    offsets::AbstractArray{CeedInt},
214*709403c1SSebastian Grimberg    curlorients::AbstractArray{CeedInt8};
215*709403c1SSebastian Grimberg    mtype::MemType=MEM_HOST,
216*709403c1SSebastian Grimberg    cmode::CopyMode=COPY_VALUES,
217*709403c1SSebastian Grimberg)
218*709403c1SSebastian Grimberg    ref = Ref{C.CeedElemRestriction}()
219*709403c1SSebastian Grimberg    C.CeedElemRestrictionCreateCurlOriented(
220*709403c1SSebastian Grimberg        c[],
221*709403c1SSebastian Grimberg        nelem,
222*709403c1SSebastian Grimberg        elemsize,
223*709403c1SSebastian Grimberg        ncomp,
224*709403c1SSebastian Grimberg        compstride,
225*709403c1SSebastian Grimberg        lsize,
226*709403c1SSebastian Grimberg        mtype,
227*709403c1SSebastian Grimberg        cmode,
228*709403c1SSebastian Grimberg        offsets,
229*709403c1SSebastian Grimberg        curlorients,
230*709403c1SSebastian Grimberg        ref,
231*709403c1SSebastian Grimberg    )
232*709403c1SSebastian Grimberg    ElemRestriction(ref)
233*709403c1SSebastian Grimbergend
234*709403c1SSebastian Grimberg
235*709403c1SSebastian Grimberg@doc raw"""
23644554ea0SWill Pazner    create_elem_restriction_strided(ceed::Ceed, nelem, elemsize, ncomp, lsize, strides)
23744554ea0SWill Pazner
23844554ea0SWill PaznerCreate a strided `CeedElemRestriction`.
23944554ea0SWill Pazner
24044554ea0SWill Pazner!!! warning "Zero-based indexing"
24144554ea0SWill Pazner    In the below notation, we are using **0-based indexing**. libCEED expects the offset
24244554ea0SWill Pazner    indices to be 0-based.
24344554ea0SWill Pazner
24444554ea0SWill Pazner# Arguments:
24544554ea0SWill Pazner- `ceed`:     The [`Ceed`](@ref) object
24644554ea0SWill Pazner- `nelem`:    Number of elements described by the restriction
24744554ea0SWill Pazner- `elemsize`: Size (number of "nodes") per element
24844554ea0SWill Pazner- `ncomp`:    Number of field components per interpolation node (1 for scalar fields)
24944554ea0SWill Pazner- `lsize`:    The size of the L-vector. This vector may be larger than the elements and
25044554ea0SWill Pazner              fields given by this restriction.
25144554ea0SWill Pazner- `strides`:  Array for strides between [nodes, components, elements]. Data for node $i$,
25244554ea0SWill Pazner              component $j$, element $k$ can be found in the L-vector at index `i*strides[0]
25344554ea0SWill Pazner              + j*strides[1] + k*strides[2]`. [`STRIDES_BACKEND`](@ref) may be used with
25444554ea0SWill Pazner              vectors created by a Ceed backend.
25544554ea0SWill Pazner"""
25644554ea0SWill Paznerfunction create_elem_restriction_strided(c::Ceed, nelem, elemsize, ncomp, lsize, strides)
25744554ea0SWill Pazner    ref = Ref{C.CeedElemRestriction}()
25844554ea0SWill Pazner    C.CeedElemRestrictionCreateStrided(c[], nelem, elemsize, ncomp, lsize, strides, ref)
25944554ea0SWill Pazner    ElemRestriction(ref)
26044554ea0SWill Paznerend
26144554ea0SWill Pazner
26244554ea0SWill Pazner"""
26344554ea0SWill Pazner    apply!(
26444554ea0SWill Pazner        r::ElemRestriction,
26544554ea0SWill Pazner        u::CeedVector,
26644554ea0SWill Pazner        ru::CeedVector;
26744554ea0SWill Pazner        tmode=NOTRANSPOSE,
26844554ea0SWill Pazner        request=RequestImmediate(),
26944554ea0SWill Pazner    )
27044554ea0SWill Pazner
27144554ea0SWill PaznerUse the [`ElemRestriction`](@ref) to convert from L-vector to an E-vector (or apply the
27244554ea0SWill Paznertranpose operation). The input [`CeedVector`](@ref) is `u` and the result stored in `ru`.
27344554ea0SWill Pazner
27444554ea0SWill PaznerIf `tmode` is `TRANSPOSE`, then the result is added to `ru`. If `tmode` is `NOTRANSPOSE`,
27544554ea0SWill Paznerthen `ru` is overwritten with the result.
27644554ea0SWill Pazner"""
27744554ea0SWill Paznerfunction apply!(
27844554ea0SWill Pazner    r::ElemRestriction,
27944554ea0SWill Pazner    u::CeedVector,
28044554ea0SWill Pazner    ru::CeedVector;
28144554ea0SWill Pazner    tmode=NOTRANSPOSE,
28244554ea0SWill Pazner    request=RequestImmediate(),
28344554ea0SWill Pazner)
28444554ea0SWill Pazner    C.CeedElemRestrictionApply(r[], tmode, u[], ru[], request[])
28544554ea0SWill Paznerend
28644554ea0SWill Pazner
28744554ea0SWill Pazner"""
28844554ea0SWill Pazner    apply(r::ElemRestriction, u::AbstractVector; tmode=NOTRANSPOSE)
28944554ea0SWill Pazner
29044554ea0SWill PaznerUse the [`ElemRestriction`](@ref) to convert from L-vector to an E-vector (or apply the
29144554ea0SWill Paznertranpose operation). The input is given by `u`, and the result is returned as an array of
29244554ea0SWill Paznertype `Vector{CeedScalar}`.
29344554ea0SWill Pazner"""
29444554ea0SWill Paznerfunction apply(r::ElemRestriction, u::AbstractVector; tmode=NOTRANSPOSE)
29544554ea0SWill Pazner    ceed_ref = Ref{C.Ceed}()
29644554ea0SWill Pazner    ccall(
29744554ea0SWill Pazner        (:CeedElemRestrictionGetCeed, C.libceed),
29844554ea0SWill Pazner        Cint,
29944554ea0SWill Pazner        (C.CeedElemRestriction, Ptr{C.Ceed}),
30044554ea0SWill Pazner        r[],
30144554ea0SWill Pazner        ceed_ref,
30244554ea0SWill Pazner    )
30344554ea0SWill Pazner    c = Ceed(ceed_ref)
30444554ea0SWill Pazner    uv = CeedVector(c, u)
30544554ea0SWill Pazner    if tmode == NOTRANSPOSE
30644554ea0SWill Pazner        ruv = create_evector(r)
30744554ea0SWill Pazner    else
30844554ea0SWill Pazner        ruv = create_lvector(r)
30944554ea0SWill Pazner    end
3109c774eddSJeremy L Thompson    ruv[] = 0.0
31144554ea0SWill Pazner    apply!(r, uv, ruv; tmode=tmode)
31244554ea0SWill Pazner    Vector(ruv)
31344554ea0SWill Paznerend
31444554ea0SWill Pazner
31544554ea0SWill Pazner"""
31644554ea0SWill Pazner    create_evector(r::ElemRestriction)
31744554ea0SWill Pazner
31844554ea0SWill PaznerReturn a new [`CeedVector`](@ref) E-vector.
31944554ea0SWill Pazner"""
32044554ea0SWill Paznerfunction create_evector(r::ElemRestriction)
32144554ea0SWill Pazner    ref = Ref{C.CeedVector}()
32244554ea0SWill Pazner    C.CeedElemRestrictionCreateVector(r[], C_NULL, ref)
32344554ea0SWill Pazner    CeedVector(ref)
32444554ea0SWill Paznerend
32544554ea0SWill Pazner
32644554ea0SWill Pazner"""
32744554ea0SWill Pazner    create_lvector(r::ElemRestriction)
32844554ea0SWill Pazner
32944554ea0SWill PaznerReturn a new [`CeedVector`](@ref) L-vector.
33044554ea0SWill Pazner"""
33144554ea0SWill Paznerfunction create_lvector(r::ElemRestriction)
33244554ea0SWill Pazner    ref = Ref{C.CeedVector}()
33344554ea0SWill Pazner    C.CeedElemRestrictionCreateVector(r[], ref, C_NULL)
33444554ea0SWill Pazner    CeedVector(ref)
33544554ea0SWill Paznerend
33644554ea0SWill Pazner
33744554ea0SWill Pazner"""
33844554ea0SWill Pazner    create_vectors(r::ElemRestriction)
33944554ea0SWill Pazner
34044554ea0SWill PaznerReturn an (L-vector, E-vector) pair.
34144554ea0SWill Pazner"""
34244554ea0SWill Paznerfunction create_vectors(r::ElemRestriction)
34344554ea0SWill Pazner    l_ref = Ref{C.CeedVector}()
34444554ea0SWill Pazner    e_ref = Ref{C.CeedVector}()
34544554ea0SWill Pazner    C.CeedElemRestrictionCreateVector(r[], l_ref, e_ref)
34644554ea0SWill Pazner    CeedVector(l_ref), CeedVector(e_ref)
34744554ea0SWill Paznerend
34844554ea0SWill Pazner
34944554ea0SWill Pazner"""
35044554ea0SWill Pazner    getcompstride(r::ElemRestriction)
35144554ea0SWill Pazner
35244554ea0SWill PaznerGet the L-vector component stride.
35344554ea0SWill Pazner"""
35444554ea0SWill Paznerfunction getcompstride(r::ElemRestriction)
35544554ea0SWill Pazner    lsize = Ref{CeedInt}()
35644554ea0SWill Pazner    C.CeedElemRestrictionGetCompStride(r[], lsize)
35744554ea0SWill Pazner    lsize[]
35844554ea0SWill Paznerend
35944554ea0SWill Pazner
36044554ea0SWill Pazner"""
36144554ea0SWill Pazner    getnumelements(r::ElemRestriction)
36244554ea0SWill Pazner
36344554ea0SWill PaznerGet the total number of elements in the range of an [`ElemRestriction`](@ref).
36444554ea0SWill Pazner"""
36544554ea0SWill Paznerfunction getnumelements(r::ElemRestriction)
36644554ea0SWill Pazner    result = Ref{CeedInt}()
36744554ea0SWill Pazner    C.CeedElemRestrictionGetNumElements(r[], result)
36844554ea0SWill Pazner    result[]
36944554ea0SWill Paznerend
37044554ea0SWill Pazner
37144554ea0SWill Pazner"""
37244554ea0SWill Pazner    getelementsize(r::ElemRestriction)
37344554ea0SWill Pazner
37444554ea0SWill PaznerGet the size of elements in the given [`ElemRestriction`](@ref).
37544554ea0SWill Pazner"""
37644554ea0SWill Paznerfunction getelementsize(r::ElemRestriction)
37744554ea0SWill Pazner    result = Ref{CeedInt}()
37844554ea0SWill Pazner    C.CeedElemRestrictionGetElementSize(r[], result)
37944554ea0SWill Pazner    result[]
38044554ea0SWill Paznerend
38144554ea0SWill Pazner
38244554ea0SWill Pazner"""
38344554ea0SWill Pazner    getlvectorsize(r::ElemRestriction)
38444554ea0SWill Pazner
38544554ea0SWill PaznerGet the size of an L-vector for the given [`ElemRestriction`](@ref).
38644554ea0SWill Pazner"""
38744554ea0SWill Paznerfunction getlvectorsize(r::ElemRestriction)
3880057404bSWill Pazner    result = Ref{CeedSize}()
38944554ea0SWill Pazner    C.CeedElemRestrictionGetLVectorSize(r[], result)
39044554ea0SWill Pazner    result[]
39144554ea0SWill Paznerend
39244554ea0SWill Pazner
39344554ea0SWill Pazner"""
39444554ea0SWill Pazner    getnumcomponents(r::ElemRestriction)
39544554ea0SWill Pazner
39644554ea0SWill PaznerGet the number of components in the elements of an [`ElemRestriction`](@ref).
39744554ea0SWill Pazner"""
39844554ea0SWill Paznerfunction getnumcomponents(r::ElemRestriction)
39944554ea0SWill Pazner    result = Ref{CeedInt}()
40044554ea0SWill Pazner    C.CeedElemRestrictionGetNumComponents(r[], result)
40144554ea0SWill Pazner    result[]
40244554ea0SWill Paznerend
40344554ea0SWill Pazner
40444554ea0SWill Pazner"""
40544554ea0SWill Pazner    getmultiplicity!(r::ElemRestriction, v::AbstractCeedVector)
40644554ea0SWill Pazner
40744554ea0SWill PaznerGet the multiplicity of nodes in an [`ElemRestriction`](@ref). The [`CeedVector`](@ref) `v`
40844554ea0SWill Paznershould be an L-vector (i.e. `length(v) == getlvectorsize(r)`, see [`create_lvector`](@ref)).
40944554ea0SWill Pazner"""
41044554ea0SWill Paznerfunction getmultiplicity!(r::ElemRestriction, v::AbstractCeedVector)
41144554ea0SWill Pazner    @assert length(v) == getlvectorsize(r)
41244554ea0SWill Pazner    C.CeedElemRestrictionGetMultiplicity(r[], v[])
41344554ea0SWill Paznerend
41444554ea0SWill Pazner
41544554ea0SWill Pazner"""
41644554ea0SWill Pazner    getmultiplicity(r::ElemRestriction)
41744554ea0SWill Pazner
41844554ea0SWill PaznerConvenience function to get the multiplicity of nodes in the [`ElemRestriction`](@ref),
41944554ea0SWill Paznerwhere the result is returned in a newly allocated Julia `Vector{CeedScalar}` (see also
42044554ea0SWill Pazner[`getmultiplicity!`](@ref)).
42144554ea0SWill Pazner"""
42244554ea0SWill Paznerfunction getmultiplicity(r::ElemRestriction)
42344554ea0SWill Pazner    v = create_lvector(r)
42444554ea0SWill Pazner    getmultiplicity!(r, v)
42544554ea0SWill Pazner    Vector(v)
42644554ea0SWill Paznerend
427