@@ -116,7 +116,7 @@ function find_bonds!(bonds::Vector{Bond}, nhs::PointNeighbors.GridNeighborhoodSe
116116end
117117
118118@inline function check_point_duplicates (L:: Float64 , i:: Int , j:: Int )
119- if L == 0
119+ if L < eps ()
120120 msg = " point duplicate found!\n "
121121 msg *= " Point #$(i) has a duplicate #$(j) which will lead to `NaN`s!\n "
122122 error (msg)
@@ -232,18 +232,18 @@ end
232232function break_bonds! (storage:: AbstractStorage , system:: AbstractBondSystem ,
233233 set_a:: Vector{Int} , set_b:: Vector{Int} )
234234 storage. n_active_bonds .= 0
235- for point_id in each_point_idx (system)
236- for bond_id in each_bond_idx (system, point_id )
235+ for i in each_point_idx (system)
236+ for bond_id in each_bond_idx (system, i )
237237 bond = system. bonds[bond_id]
238238 neighbor_id = bond. neighbor
239- point_in_a = in (point_id , set_a)
240- point_in_b = in (point_id , set_b)
239+ point_in_a = in (i , set_a)
240+ point_in_b = in (i , set_b)
241241 neigh_in_a = in (neighbor_id, set_a)
242242 neigh_in_b = in (neighbor_id, set_b)
243243 if (point_in_a && neigh_in_b) || (point_in_b && neigh_in_a)
244244 storage. bond_active[bond_id] = false
245245 end
246- storage. n_active_bonds[point_id ] += storage. bond_active[bond_id]
246+ storage. n_active_bonds[i ] += storage. bond_active[bond_id]
247247 end
248248 end
249249 return nothing
@@ -264,12 +264,22 @@ function calc_force_density!(chunk::AbstractBodyChunk{<:AbstractBondSystem}, t,
264264 (; dmgmodel) = mat
265265 storage. b_int .= 0
266266 storage. n_active_bonds .= 0
267- for point_id in each_point_idx (chunk)
268- calc_failure! (storage, system, mat, dmgmodel, paramsetup, point_id )
269- calc_damage! (storage, system, mat, dmgmodel, paramsetup, point_id )
270- force_density_point! (storage, system, mat, paramsetup, t, Δt, point_id )
267+ for i in each_point_idx (chunk)
268+ calc_failure! (storage, system, mat, dmgmodel, paramsetup, i )
269+ calc_damage! (storage, system, mat, dmgmodel, paramsetup, i )
270+ force_density_point! (storage, system, mat, paramsetup, t, Δt, i )
271271 end
272- nancheck (chunk, t)
272+ nancheck (chunk, t, Δt)
273+ return nothing
274+ end
275+
276+ # a placeholder function for all force density calculations with multiple parameters that
277+ # are not specifially handled by the material
278+ function force_density_point! (storage:: AbstractStorage , system:: AbstractBondSystem ,
279+ mat:: AbstractBondSystemMaterial ,
280+ paramhandler:: AbstractParameterHandler , t, Δt, i)
281+ params = get_params (paramhandler, i)
282+ force_density_point! (storage, system, mat, params, t, Δt, i)
273283 return nothing
274284end
275285
@@ -393,7 +403,9 @@ function log_material_property(::Val{:kernel}, mat::AbstractBondSystemMaterial;
393403 return msg
394404end
395405
396- function log_material (mat:: M ; indentation:: Int = 2 ) where {M<: AbstractCorrespondenceMaterial }
406+ function log_material (mat:: M ;
407+ indentation:: Int = 2 ) where {M<: Union {AbstractCorrespondenceMaterial,
408+ AbstractRKCMaterial}}
397409 msg = msg_qty (" material type" , nameof (M); indentation)
398410 for prop in fieldnames (M)
399411 msg *= log_material_property (Val (prop), mat; indentation)
0 commit comments