Skip to content

Commit 308aa5a

Browse files
committed
set mpr_tol_rel in scene
1 parent 0ea0e04 commit 308aa5a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Composition/scene.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Defines global properties of the system, such as the gravity field. Exactly one
308308
| `gravityField` | [`UniformGravityField`](@ref)`()` |
309309
| `useOptimizedStructure` | true |
310310
| `enableContactDetection` | true |
311-
| `contactDetection` | [`ContactDetectionMPR_handler`](@ref)`()`|
311+
| `mpr_tol_rel` | 1.0e-20 |
312312
| `elasticContactReductionFactor` | 1.0 |
313313
| `enableVisualization` | true |
314314
| `animationFile` | nothing |
@@ -338,7 +338,7 @@ Defines global properties of the system, such as the gravity field. Exactly one
338338
339339
- `enableContactDetection::Bool`: = true, if contact detection is enable, see [Collision Handling](@ref).
340340
341-
- `contactDetection::Modia3D.AbstractContactDetection`: Handler used for contact detection e.g., to determine the smallest distance between two objects.
341+
- `mpr_tol_rel::1.0e-20`: Local tolerance used for terminating the mpr algorithm. Changing this value might improve speed.
342342
343343
- `elasticContactReductionFactor::Float64`: (> 0.0)
344344
- ``usedContactCompliance = contactCompliance * elasticContactReductionFactor``
@@ -421,7 +421,7 @@ mutable struct Scene <: Modia3D.AbstractScene
421421
function Scene(;gravityField = UniformGravityField(),
422422
useOptimizedStructure = true,
423423
enableContactDetection = true,
424-
contactDetection = ContactDetectionMPR_handler(),
424+
mpr_tol_rel = 1.0e-7,
425425
elasticContactReductionFactor = 1.0,
426426
gap = 0.001,
427427
enableVisualization = true,
@@ -443,7 +443,7 @@ mutable struct Scene <: Modia3D.AbstractScene
443443

444444
sceneOptions = SceneOptions(gravityField = gravityField,
445445
useOptimizedStructure = useOptimizedStructure,
446-
contactDetection = contactDetection,
446+
contactDetection = ContactDetectionMPR_handler(tol_rel = mpr_tol_rel),
447447
nVisualContSupPoints = nVisualContSupPoints,
448448
gap = gap,
449449
enableContactDetection = enableContactDetection,

src/contactDetection/ContactDetectionMPR/ContactDetectionMPR_handler.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ mutable struct ContactDetectionMPR_handler{T} <: Modia3D.AbstractContactDetectio
123123
visualizeSupportPoints::Bool
124124
defaultContactSphereDiameter::Float64
125125

126-
function ContactDetectionMPR_handler{T}(;tol_rel = 1.0e-7,
126+
function ContactDetectionMPR_handler{T}(;tol_rel = 1.0e-20,
127127
niter_max = 100) where {T}
128128
@assert(tol_rel > 0.0)
129129
@assert(niter_max > 0)
130130
new(false, Dict{PairID,ContactPair}(), Dict{PairID,ContactPair}(), 42.0, tol_rel, niter_max)
131131
end
132132
end
133-
ContactDetectionMPR_handler() = ContactDetectionMPR_handler{Modia3D.MPRFloatType}()
133+
ContactDetectionMPR_handler(; kwargs...) = ContactDetectionMPR_handler{Modia3D.MPRFloatType}(; kwargs...)

0 commit comments

Comments
 (0)