Skip to content

Commit efb7401

Browse files
committed
changed error message
1 parent a0e51f4 commit efb7401

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/Composition/contactPairs.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ mutable struct ContactPairs
4949
nextSuperObj = superObjs[js].superObjCollision.superObj
5050
for j = 1:length(nextSuperObj)
5151
nextObj = nextSuperObj[j]
52-
name1 = actObj.feature.contactMaterial
53-
name2 = nextObj.feature.contactMaterial
54-
Shapes.getContactPairMaterial(name1, name2)
52+
Shapes.getContactPairMaterial(actObj, nextObj)
5553
end
5654
end
5755
end

src/Composition/responseCalculation.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ Return a response material object at contact start.
2424
"""
2525
function contactStart(obj1::Object3D, obj2::Object3D, rContact::SVector{3,Float64},
2626
contactNormal::SVector{3,Float64}, elasticContactReductionFactor::Float64)
27-
name1 = obj1.feature.contactMaterial
28-
name2 = obj2.feature.contactMaterial
29-
material = Shapes.getContactPairMaterial(name1, name2)
27+
material = Shapes.getContactPairMaterial(obj1, obj2)
3028
return contactStart(material, obj1, obj2, rContact, contactNormal, elasticContactReductionFactor)
3129
end
3230

src/Shapes/contactPairMaterials.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,15 @@ contactPairMaterialPalette = readContactPairMaterialFromJSON( joinpath(Modia3D.p
141141

142142

143143
"""
144-
material = getContactPairMaterial(name1, name2)
144+
material = getContactPairMaterial(obj1, obj2)
145145
146146
Return a contact pair material object of the materials with the
147147
names `name1` and `name2` from dictionary `Modia3D.contactPairMaterialPalette`.
148148
"""
149-
function getContactPairMaterial(name1::AbstractString, name2::AbstractString )::Modia3D.AbstractContactPairMaterial
149+
function getContactPairMaterial(obj1, obj2)::Modia3D.AbstractContactPairMaterial
150+
name1 = obj1.feature.contactMaterial
151+
name2 = obj2.feature.contactMaterial
152+
150153
value = get(contactPairMaterialPalette, TwoNamesKey(name1,name2), NoContactPairMaterial())
151154
if typeof(value) == NoContactPairMaterial
152155
# Combination name1,name2 is not present
@@ -155,7 +158,7 @@ function getContactPairMaterial(name1::AbstractString, name2::AbstractString )::
155158
if typeof(value1) != NoContactPairMaterial && typeof(value2) != NoContactPairMaterial
156159
return combineContactPairMaterials(value1, value2)
157160
else
158-
error("No contact pair material (\"$name1\",\"$name2\") is defined in Modia3D.contactPairMaterialPalette dictionary. Therefore, (\"$name1\",\"$name1\") and (\"$name2\",\"$name2\") are merged, at least one of these pairings is not defined as well.")
161+
error("For contact between \"", Modia3D.fullName(obj1), "\" and \"", Modia3D.fullName(obj2), "\" pairing of the contact materials \"", name1, "\" and \"", name2, "\" is required. But this combination is not available in $Modia3D.path/palettes/contactPairMaterials.json.")
159162
end
160163
end
161164
return value

0 commit comments

Comments
 (0)