Skip to content

Commit

Permalink
KG_3_1/types: add copy, similar and zero methods
Browse files Browse the repository at this point in the history
analogous to the commit a8d6962]
in the AdS folder
  • Loading branch information
mzilhao committed Aug 2, 2023
1 parent d82d8bd commit 26a5066
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/KG_3_1/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ function Base.similar(ff::BulkEvolved{T}) where {T}
x = (phi=phi,)
BulkEvolved{T,eltype(x),typeof(x)}(x)
end
function Base.copy(ff::BulkEvolved{T}) where {T}
phi = copy(getphi(ff))
x = (phi=phi,)
BulkEvolved{T,eltype(x),typeof(x)}(x)
end
function Base.zero(ff::BulkEvolved{T}) where {T}
phi = zero(getphi(ff))
x = (phi=phi,)
BulkEvolved{T,eltype(x),typeof(x)}(x)
end


struct BulkConstrained{T,A,S} <: FlattenedVector{T,3,A}
Expand Down Expand Up @@ -157,6 +167,8 @@ struct BulkPartition{N,A} <: AbstractPartition{N,A}
end
BulkPartition(x...) = BulkPartition(tuple(x...))

Base.similar(bulks::BulkPartition{N,A}) where {N,A} = BulkPartition{N,A}(similar.(bulks.x))


function BulkEvolved(bulks::BulkPartition{N}) where{N}
f = ntuple(i -> BulkEvolved(bulks[i]), N)
Expand All @@ -175,6 +187,9 @@ end
EvolVars(x::NTuple{N,A}) where {N,A} = EvolVars{eltype(A),N,A}(x)

Base.similar(ff::EvolVars{T,N,S}) where {T,N,S} = EvolVars{T,N,S}(similar.(ff.x))
Base.copy(ff::EvolVars{T,N,S}) where {T,N,S} = EvolVars{T,N,S}(copy.(ff.x))
Base.zero(ff::EvolVars{T,N,S}) where {T,N,S} = EvolVars{T,N,S}(zero.(ff.x))


"""
EvolVars(boundary::Boundary, gauge::Gauge, bulkevols::NTuple)
Expand Down

0 comments on commit 26a5066

Please sign in to comment.