-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An alloc collision #102
An alloc collision #102
Conversation
src/Composition/dynamicCollision.jl
Outdated
for (pairID::Int64, pair::ContactPair{F}) in ch.contactDict | ||
obj1::Composition.Object3D{F} = pair.obj1 | ||
obj2::Composition.Object3D{F} = pair.obj2 | ||
rContact::SVector{3,F} = (pair.contactPoint1 + pair.contactPoint2)/F(2.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are type definitions in assignments really necessary?
@@ -48,10 +48,10 @@ function dealWithContacts!(sim::Modia.SimulationModel{F, T}, scene::Scene{F}, ch | |||
t2::SVector{3,F}=Modia3D.ZeroVector3D(F) | |||
|
|||
for (pairID::Int64, pair::ContactPair{F}) in ch.contactDict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you read a dictionary, the types are unknown. We figured out assigning types there, works out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Now the type of pair
is known and the other type assignments are no longer needed
I_child = massProperties_child.I | ||
m_child::F = massProperties_child.m | ||
rCM_child::SVector{3,F} = massProperties_child.rCM | ||
I_child::SMatrix{3,3,F,9} = massProperties_child.I |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type definition is not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not definitely sure, if line 78 is enough. Therefore I'd need to re-run it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type definitions aren't needed, massProperties_child::Shapes.MassProperties{F} = solid.massProperties
is sufficient
function elasticContactPairCoefficients(obj1::Object3D{F}, obj2::Object3D{F}) where F <: Modia3D.VarFloatType | ||
solid1::Shapes.Solid{F} = obj1.feature | ||
solid2::Shapes.Solid{F} = obj2.feature | ||
mu_r_geo::F = F(0.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type definition is not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'd need to re-run this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my understanding, these type definitions are needed, e.g. obj.feature is an abstract type, therefore ::Shapes.Solid{F} is needed. mu_r_geo::F is also needed, because F(0.0) converts 0.0 to F, but the returned type of the conversion function is an Any type, as I understand, and then mu_r_geo::F is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it out: mu_r_geo = F(0.0)
is fine
No description provided.