yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #01782
Re: dispatch, inheritance, virtual functions
Janek, ping?
I was debugging that and I get the following:
ConstitutiveLawDispatcher::locateMultivirtualFunctor2D is called with
those arguments:
1. Dem3DofGeom_FacetSphere, class index 2 (for InteractionGeometry)
2. ElasticContactInteraction, class index 2 (for InteractionPhysics)
Now there is only 1 entry in the dispatch matrix:
1+2 -> Law2_Dem3Dof_Elastic_Elastic
(where index 1 is Dem3DofGeom).
Since it is not the direct hit, I would expect that we will crawl up the
base class indices, until a match is found. However, reading the code:
int depth1=1, depth2=1;
int index1_tmp=base1->getBaseClassIndex(depth1),index2_tmp = base2->getBaseClassIndex(depth2);
if(index1_tmp==-1){ /* loop over index2_tmp up, until a match index1,index2_tmp is found, then return */ }
if(index2_tmp==-1){ /* loop over index1_tmp up, until a match index1_tmp,index2 is found, then return */ }
/* here index1_tmp=-1 && index2_tmp=-1 */
throw;
What is the logic there??? I get exception, even though the dispatch is neither ambiguous nor undefined.
V.
Follow ups
References