Skip to content

Commit 55ed24d

Browse files
committed
fix formatting
1 parent a3e4530 commit 55ed24d

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

src/auxiliary/containers.jl

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
348348
end
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)
360361
end
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)
365368
end
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)
369374
end
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)
373379
end
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
379386
end # @muladd

src/solvers/dgsem/basis_lobatto_legendre.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Adapt.adapt_structure(to, basis::LobattoLegendreBasis)
4444
boundary_interpolation = adapt(to, basis.boundary_interpolation)
4545
derivative_matrix = adapt(to, basis.derivative_matrix)
4646
derivative_split = adapt(to, basis.derivative_split)
47-
derivative_split_transpose = adapt(to,basis.derivative_split_transpose)
47+
derivative_split_transpose = adapt(to, basis.derivative_split_transpose)
4848
derivative_dhat = adapt(to, basis.derivative_dhat)
4949
return LobattoLegendreBasis{RealT, nnodes(basis), typeof(nodes),
5050
typeof(inverse_vandermonde_legendre),
@@ -186,7 +186,8 @@ function Adapt.adapt_structure(to, mortar::LobattoLegendreMortarL2)
186186
forward_lower = adapt(to, mortar.forward_lower)
187187
reverse_upper = adapt(to, mortar.reverse_upper)
188188
reverse_lower = adapt(to, mortar.reverse_lower)
189-
return LobattoLegendreMortarL2{eltype(forward_upper), nnodes(mortar), typeof(forward_upper),
189+
return LobattoLegendreMortarL2{eltype(forward_upper), nnodes(mortar),
190+
typeof(forward_upper),
190191
typeof(reverse_upper)}(forward_upper, forward_lower,
191192
reverse_upper, reverse_lower)
192193
end

src/solvers/dgsem_p4est/containers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ function Adapt.adapt_structure(to, boundaries::P4estBoundaryContainer)
446446
return P4estBoundaryContainer{NDIMS, eltype(_u), NDIMS + 1, typeof(u),
447447
typeof(neighbor_ids), typeof(node_indices),
448448
typeof(_u), to}(u, neighbor_ids, node_indices,
449-
name, _u)
449+
name, _u)
450450
end
451451

452452
# Container data structure (structure-of-arrays style) for DG L2 mortars

0 commit comments

Comments
 (0)