@@ -339,11 +339,11 @@ end
339339# However, since zero length arrays are not used in calculations,
340340# it should be okay if the underlying storage vectors and wrapped arrays
341341# are not the same as long as they are properly wrapped when `resize!`d etc.
342- function unsafe_wrap_or_alloc (to, vec , size)
343- if length (vec ) == 0
344- return similar (vec , size)
342+ function unsafe_wrap_or_alloc (to, vector , size)
343+ if length (vector ) == 0
344+ return similar (vector , size)
345345 else
346- return unsafe_wrap (to, pointer (vec ), size)
346+ return unsafe_wrap (to, pointer (vector ), size)
347347 end
348348end
349349
@@ -355,25 +355,32 @@ end
355355
356356# Custom rules
357357# 1. handling of StaticArrays
358- function Adapt. adapt_storage (:: TrixiAdaptor{<:Any, Real} , x:: StaticArrays.StaticArray{S, T, N} ) where {Real,S,T,N}
358+ function Adapt. adapt_storage (:: TrixiAdaptor{<:Any, Real} ,
359+ x:: StaticArrays.StaticArray{S, T, N} ) where {Real, S, T, N}
359360 StaticArrays. similar_type (x, Real)(x)
360361end
361362
362363# 2. Handling of Arrays
363- function Adapt. adapt_storage (:: TrixiAdaptor{Storage, Real} , x:: AbstractArray{T} ) where {Storage, Real, T<: AbstractFloat }
364+ function Adapt. adapt_storage (:: TrixiAdaptor{Storage, Real} ,
365+ x:: AbstractArray{T} ) where {Storage, Real,
366+ T <: AbstractFloat }
364367 adapt (Storage{Real}, x)
365368end
366369
367- function Adapt. adapt_storage (:: TrixiAdaptor{Storage, Real} , x:: AbstractArray{T} ) where {Storage, Real,T<: StaticArrays.StaticArray }
368- adapt (Storage{StaticArrays. similar_type (T, Real)},x)
370+ function Adapt. adapt_storage (:: TrixiAdaptor{Storage, Real} ,
371+ x:: AbstractArray{T} ) where {Storage, Real,
372+ T <: StaticArrays.StaticArray }
373+ adapt (Storage{StaticArrays. similar_type (T, Real)}, x)
369374end
370375
371- function Adapt. adapt_storage (:: TrixiAdaptor{Storage, Real} , x:: AbstractArray ) where {Storage, Real}
376+ function Adapt. adapt_storage (:: TrixiAdaptor{Storage, Real} ,
377+ x:: AbstractArray ) where {Storage, Real}
372378 adapt (Storage, x)
373379end
374380
375381# 3. TODO : Should we have a fallback? But that would imply implementing things for NamedTuple again
376382
377- unsafe_wrap_or_alloc (:: TrixiAdaptor{Storage} , vec, size) where {Storage} = unsafe_wrap_or_alloc (Storage, vec, size)
378-
383+ function unsafe_wrap_or_alloc (:: TrixiAdaptor{Storage} , vec, size) where {Storage}
384+ return unsafe_wrap_or_alloc (Storage, vec, size)
385+ end
379386end # @muladd
0 commit comments