← Back to team overview

yade-dev team mailing list archive

Re: contact logic (again)

 

Another attempt to summarize contact logic (to be added to the wiki when we agree on one logic) :
(Janek, please, have a look at the end of this message : question for you)
______________________
1. Collider :

LOOP1 :
   if (isReal) isNew=false else isNew=true;

LOOP2 :
   if (BBoverlap && !found) insert;
   else if (!overlap && found && !isReal) delete;

2. Geometry Dispatcher

This dispatcher is setting
isReal = {
   if (there is a geometrical interaction || isReal)
       if (!interactionGeometry) intG = new();
       if (isNew) initialise geometry;
       update geometry; //(always)
       return true;
   else return false;
}

3. Physics dispatching

if (isReal) {
   if (!iPhysics) iPhysics = new();
   if (isNew) initialise physics;
   update physics;//(always)

4. Constitutive law

if (isReal || any other criterion)
{
   compute actions;
   isReal = true;
}
else isReal = false;

_______________________________
This is the logic behind the "haveDistant" approach. It is still only partly implemented currently.

Pointing a few problems I just spotted :

A. In ISphere2ISphere4Geometry.cpp, we have (correct) :

if (penetrationDepthSq>0 || c->isReal){
       shared_ptr<SpheresContactGeometry> scm;
if(c->interactionGeometry) scm=YADE_PTR_CAST<SpheresContactGeometry>(c->interactionGeometry); else { scm=shared_ptr<SpheresContactGeometry>(new SpheresContactGeometry()); c->interactionGeometry=scm; }


but in IBox2ISphere4Geometry.cpp, we have (WRONG!) :

shared_ptr<SpheresContactGeometry> scm;
if (c->isNew) scm = shared_ptr<SpheresContactGeometry>(new SpheresContactGeometry()); else scm = YADE_PTR_CAST<SpheresContactGeometry>(c->interactionGeometry);


Here, isNew means "has memory allocated", it should be replaced with if(c->interactionGeometry).

B. Currently, if "haveDistant" is activated, it seems isNew will not be set true by the collider even if !isReal. This is surprising for me, and may be due to successive changes that I didn't notice.

Janek was using a "wasReal" bool before, to check if a contact was new in the physical sense (touch/detach/touch using the same pointer - you need to reset initialOrientation and such).

The proper way to do this, with the logic above, is to test isNew, provided isNew is set true when !isReal (be it in the collider or in the constitutice law).

The problem (and the question for Janek) : currently the snow preprocessor is using DistantSAPCollider, which does not turn isNew true when !isReal (the distant option in SAPCollider does not either, consistantly), and the "wasReal" flag disappeared. So, how does it work when the same pointer is used for two different (time wise) interactions?

Bruno



--

_______________
Chareyre Bruno
Maitre de conference

Grenoble INP
Laboratoire 3SR - bureau E145
BP 53 - 38041, Grenoble cedex 9 - France
Tél : 33 4 56 52 86 21
Fax : 33 4 76 82 70 43
________________




Follow ups

References