diff --git a/src/Core/data_manager.jl b/src/Core/data_manager.jl index d3b3273d..843ab158 100644 --- a/src/Core/data_manager.jl +++ b/src/Core/data_manager.jl @@ -1513,7 +1513,10 @@ Sets the damage models globally. - `value`: The value to set as the damage models. """ function set_damage_models(value) - global damage_models = value + global damage_models + if !(value in damage_models) + push!(damage_models, value) + end end """ @@ -1525,7 +1528,10 @@ Sets the material models globally. - `value`: The value to set as the material models. """ function set_material_models(value) - global material_models = value + global material_models + if !(value in material_models) + push!(material_models, value) + end end """ diff --git a/src/MPI_communication/MPI_communication.jl b/src/MPI_communication/MPI_communication.jl index db06221e..6c0df11d 100644 --- a/src/MPI_communication/MPI_communication.jl +++ b/src/MPI_communication/MPI_communication.jl @@ -314,9 +314,7 @@ function synch_controller_bonds_to_responder_flattened( continue end if !isempty(overlapnodes[rank+1][jcore]["Controller"]) - send_indices = overlapnodes[rank+1][jcore]["Controller"] - # send_msg = array[overlapnodes[rank+1][jcore]["Controller"]] - # send_msg = vcat(send_msg...) + @views send_indices = overlapnodes[rank+1][jcore]["Controller"] # @debug "Sending $rank -> $(jcore-1)" MPI.Isend( vcat([reshape(array[i], :, 1) for i in send_indices]...), @@ -326,25 +324,13 @@ function synch_controller_bonds_to_responder_flattened( ) end if !isempty(overlapnodes[rank+1][jcore]["Responder"]) - recv_indices = overlapnodes[rank+1][jcore]["Responder"] + @views recv_indices = overlapnodes[rank+1][jcore]["Responder"] row_nums = [length(subarr) for subarr in array[recv_indices]] - recv_msg = zeros(sum(row_nums)) + @views recv_msg = zeros(sum(row_nums)) # @debug "Receiving $(jcore-1) -> $rank" MPI.Recv!(recv_msg, comm; source = jcore - 1, tag = 0) recv_msg = split_vector(recv_msg, row_nums, dof) array[recv_indices] .= recv_msg - # if dof == 1 - # array[recv_indices] .= recv_msg - # else - # array[recv_indices] .= recv_msg - # end - # recv_msg = similar(array[recv_indices]) - # row_starts = cumsum([size(array[i], 1) for i in recv_indices]) - # row_starts = [0; row_starts[1:end-1]] - # MPI.Recv!(recv_msg, comm, source=jcore - 1, tag=0) - # for (i, idx) in enumerate(recv_indices) - # array[idx] .= recv_msg[row_starts[i]+1:row_starts[i]+size(array[idx], 1), :] - # end end end return array diff --git a/src/Models/Damage/Damage_Factory.jl b/src/Models/Damage/Damage_Factory.jl index 78469f94..dafc13c8 100644 --- a/src/Models/Damage/Damage_Factory.jl +++ b/src/Models/Damage/Damage_Factory.jl @@ -301,6 +301,7 @@ function init_damage_model( end datamanager.set_model_module(model_param["Damage Model"], mod) datamanager = mod.init_damage_model(datamanager, nodes, model_param, block) + datamanager.set_damage_models(model_param["Damage Model"]) datamanager = Damage.init_interface_crit_values(datamanager, model_param, block) datamanager = Damage.init_aniso_crit_values(datamanager, model_param, block) return datamanager diff --git a/src/Models/Material/Material_Factory.jl b/src/Models/Material/Material_Factory.jl index c681be4c..dbb9bd65 100644 --- a/src/Models/Material/Material_Factory.jl +++ b/src/Models/Material/Material_Factory.jl @@ -92,6 +92,7 @@ function init_material_model( end datamanager.set_model_module(material_model, mod) datamanager = mod.init_material_model(datamanager, nodes, model_param) + datamanager.set_material_models(material_model) end #TODO in extra function # nlist = datamanager.get_nlist() diff --git a/src/Models/Model_Factory.jl b/src/Models/Model_Factory.jl index ae9fab92..2196457d 100644 --- a/src/Models/Model_Factory.jl +++ b/src/Models/Model_Factory.jl @@ -392,18 +392,12 @@ function init_models( @info "Init damage models" @timeit to "damage_model_fields" datamanager = Damage.init_damage_model_fields(datamanager, params) - damage_models = [] for block in eachindex(block_nodes) if datamanager.check_property(block, "Damage Model") - push!( - damage_models, - datamanager.get_property(block, "Damage Model", "Damage Model"), - ) @timeit to "init damage model" datamanager = Damage.init_damage_model(datamanager, block_nodes[block], block) end end - datamanager.set_damage_models(unique(damage_models)) end if solver_options["Material Models"] @info "Init material models" @@ -412,15 +406,10 @@ function init_models( material_models = [] for block in eachindex(block_nodes) if datamanager.check_property(block, "Material Model") - push!( - material_models, - datamanager.get_property(block, "Material Model", "Material Model"), - ) @timeit to "init material" datamanager = Material.init_material_model(datamanager, block_nodes[block], block) end end - datamanager.set_material_models(unique(material_models)) end if solver_options["Calculate Cauchy"] | solver_options["Calculate von Mises"] datamanager.create_node_field("Cauchy Stress", Float64, "Matrix", dof)