Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/PeriHub/PeriLab.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
CWillberg committed Nov 11, 2024
2 parents b03e7ee + 3e78f47 commit acb7cb4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/Core/data_manager.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
module Data_manager
using MPI
using DataStructures: OrderedDict
include("../Support/helpers.jl")
using .Helpers: fill_in_place!, copy_in_place!

export add_active_model
export create_bond_field
Expand Down Expand Up @@ -1572,8 +1574,8 @@ end

function switch_nodes!(field_N, field_NP1, NP1)
if field_NP1[1] isa AbstractVector
copyto!.(field_N, field_NP1)
fill!.(field_NP1, data["field_types"][NP1](0))
copy_in_place!(field_N, field_NP1)
fill_in_place!(field_NP1, data["field_types"][NP1](0))
else
copyto!(field_N, field_NP1)
fill!(field_NP1, data["field_types"][NP1](0))
Expand Down
4 changes: 3 additions & 1 deletion src/Models/Additive/simple_additive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ function compute_model(
if time - dt <= activation_time[iID] < time
active[iID] = true
flux[iID] = -printTemperature * heat_capacity[iID] * density[iID] ./ dt
nlist_temp = nlist[iID]

for (jID, neighborID) in enumerate(nlist[iID])
for jID in eachindex(nlist_temp)
@views neighborID = nlist_temp[jID]
if activation_time[neighborID] <= time && bond_damage[iID][jID] == 0
bond_damage[iID][jID] = 1.0
if haskey(inverse_nlist[neighborID], iID)
Expand Down
15 changes: 13 additions & 2 deletions src/Support/helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export rotate
export sub_in_place!
export add_in_place!
export div_in_place!
export fill_in_place!
export fastdot
export fast_mul!
export mat_mul!
Expand Down Expand Up @@ -189,8 +190,18 @@ function fastdot(a, b, absolute = false)
end
c
end


function fill_in_place!(A::Vector{Vector{T}}, value::T) where {T<:Number}
@inbounds for i eachindex(A)
A[i] .= value
end
end
function copy_in_place!(A::Vector{Vector{T}}, B::Vector{Vector{T}}) where {T<:Number}
@inbounds for i eachindex(A)
A[i] .= B[i]
# @info A[i]
# @info B[i]
end
end
function fourth_order_times_second_order_tensor(C, s1, s2, s3, dof)

@inbounds @simd for i = 1:dof
Expand Down

0 comments on commit acb7cb4

Please sign in to comment.