Skip to content
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

Merged
merged 10 commits into from
Mar 4, 2022
Merged

An alloc collision #102

merged 10 commits into from
Mar 4, 2022

Conversation

AndreaNeumayr
Copy link
Member

No description provided.

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)
Copy link
Collaborator

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
Copy link
Member Author

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.

Copy link
Member Author

@AndreaNeumayr AndreaNeumayr Mar 4, 2022

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
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Member Author

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)
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Member

@MartinOtter MartinOtter Mar 4, 2022

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.

Copy link
Member Author

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

@GerhardHippmann GerhardHippmann merged commit c0b3795 into main Mar 4, 2022
@AndreaNeumayr AndreaNeumayr deleted the an_allocCollision branch May 6, 2022 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants