Ok, but unfortunately I can not get the issue rising from this difference...
If the cast towards CapillaryPhys or MindlinCapillaryPhys is executed directly (with the lines I proposed) in the right way (thanks to hertzOn that already exists), what role could have the difference in mother classes ? Le Vendredi 19 Septembre 2014 10:45 CEST, Bruno Chareyre <[email protected]> a écrit: > Good point Jerôme. > The solution is not easy though. The diff you attached shows a huge > difference: one type inherits from MindlinPhys, the other inherits from > FrictPhys. > One solution would be to use double inheritance, maybe. Not sure how > boost::python would handle that. > Bruno > > > On 19/09/14 00:38, Jérome Duriez wrote: > > Hi, > > > > I'm reading for the first time capillary code > > (Law2_ScGeom_CapillaryPhys_Capillarity::action). Depending on the contact > > law used in the simulation, two different interaction physics are handled : > > > - either "cundallContactPhysics" (CapillaryPhys type) > > - or "mindlinContactPhysics" (MindlinCapillaryPhys type) > > > > And, in the whole code, "herzOn" bool variable is checked, to know if > > cundallContactPhysics, or mindlinContactPhysics has to be accessed. I have > > the feeling that, in the end, we always access variables with same name and > > meaning (give a look at the attached diff, comparing the attributes list of > > these two classes), either from cundallContactPhysics, or > > mindlinContactPhysics. E.g. hertzOn? mindlinContactPhysics->meniscus : > > cundallContactPhysics->meniscus... > > > > My question is : could we get rid of these two different variables, use > > only one variable "contactPhys", defined once for all with : > > > > if !hertzOn > > contactPhysics = static_cast<CapillaryPhys*>(interaction->phys.get()); > > else > > contactPhysics = > > static_cast<MindlinCapillaryPhys*>(interaction->phys.get()) > > > > And, after that, use only contactPhysics->meniscus > > > > A second question would be "is it worth ?', but I could do the task without > > answering this question... > > > > Jerome > > > > > > _______________________________________________ > > Mailing list: https://launchpad.net/~yade-dev > > Post to : [email protected] > > Unsubscribe : https://launchpad.net/~yade-dev > > More help : https://help.launchpad.net/ListHelp > > > > > > > > > -- _______________ > Bruno Chareyre > Associate Professor > ENSE³ - Grenoble INP > Lab. 3SR > BP 53 > 38041 Grenoble cedex 9 > Tél : +33 4 56 52 86 21 > Fax : +33 4 76 82 70 43 > ________________ > > > _______________________________________________ > Mailing list: https://launchpad.net/~yade-dev > Post to : [email protected] > Unsubscribe : https://launchpad.net/~yade-dev > More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp

