Hi Bruno, I expected that materials in Ip2_... would be already ordered, but they are not. I didn't have time to study why. Most likely there is some better way to do it, I just gave a working solution for Behzad's urgent question..
I checked goReverse some days ago and if I remember correctly, it is used only in Ig2 functors. Behzad's situation (combining two different materials) is not very common in Yade. I used something for combining FrictMat and CpmMat into FrictPhys, but CpmMat is considered there as its base, FrictMat, so as a result two FrictMats are combined. Maybe it would be good to investigate the problem more in detail and at least for future occurrences propose more clean way. cheers Jan 2015-02-21 14:15 GMT+01:00 Bruno Chareyre <bruno.chare...@3sr-grenoble.fr>: > Hi Jan, > Do you think that goReverse cannot solve the problem? I would expect that > your typechecking is already done by dispatcher. Is goReverse called in one > of the cases? > I'm asking that because I'm not really sure if goReverse works as > expected. If not we better remove it. > Cheers. > Bruno > > On Saturday, February 21, 2015 00:21 CET, Jan Stránský < > question261...@answers.launchpad.net> wrote: > > > Question #261724 on Yade changed: > > https://answers.launchpad.net/yade/+question/261724 > > > > Jan Stránský proposed the following answer: > > > > > > > > > Look, I don't get what you're doing by: > > > > > > > > > if 0: # works for both 0 and 1 > > > s1=utils.sphere([0.0,0.0,0.0],0.01,fixed=True,material=Mat2) > > > > s2=utils.sphere([0.0,0.0,2.0e-2],0.01,fixed=False,material=Mat1) > > > else: > > > s1=utils.sphere([0.0,0.0,0.0],0.01,fixed=True,material=Mat1) > > > > s2=utils.sphere([0.0,0.0,2.0e-2],0.01,fixed=False,material=Mat2) > > > > > > > > > But if you run the file with > > > > > > s1=utils.sphere([0.0,0.0,0.0],0.01,fixed=True,material=Mat2) > > > > s2=utils.sphere([0.0,0.0,2.0e-2],0.01,fixed=False,material=Mat1) > > > > > > > > > it works! > > > And if you change it to: > > > > > > s1=utils.sphere([0.0,0.0,0.0],0.01,fixed=True,material=Mat1) > > > > s2=utils.sphere([0.0,0.0,2.0e-2],0.01,fixed=False,material=Mat2) > > > > > > It does not! > > > > > > > my if else is just putting your two version of s1= s2= to one file for > easy > > change of them > > > > sorry, it does not work for your original files, I tried some > modifications > > and it was the effect of undo/redo that I had the impression. > > > > I you modify your .cpp file, specifically > > > > FrictMat* mat1 = YADE_CAST<FrictMat*>(b1.get()); > > CohBurgersMat* mat2 = YADE_CAST<CohBurgersMat*>(b2.get()); > > > > to > > > > int i1 = b1->getClassIndex(); // get actual material index of b1 > > > int i2 = b2->getClassIndex(); // get actual material index of b2 > > > int cbmi = CohBurgersMat::getClassIndexStatic(); // get index of > > CohBurgersMat > > FrictMat* mat1; > > CohBurgersMat* mat2; > > if (i2 == cbmi) { // b2 is CohburgersMat and b1 is FrictMat > > mat1 = dynamic_cast<FrictMat*>(b1.get()); > > mat2 = dynamic_cast<CohBurgersMat*>(b2.get()); > > } else if (i1 == cbmi) { // b1 is CohburgersMat and b2 is FrictMat > > mat1 = dynamic_cast<FrictMat*>(b2.get()); > > mat2 = dynamic_cast<CohBurgersMat*>(b1.get()); > > } else { // should not happen, but to be sure.. > > LOG_FATAL("TODO"); > > } > > > > it should work. If not, let me know. > > Basically you check the types of material instances and switch materials > if > > needed > > Cheers > > Jan > > > > -- > > You received this question notification because you are a member of > > yade-users, which is an answer contact for Yade. > > > > _______________________________________________ > > Mailing list: https://launchpad.net/~yade-users > > Post to : yade-us...@lists.launchpad.net > > Unsubscribe : https://launchpad.net/~yade-users > > More help : https://help.launchpad.net/ListHelp > > > > > > > > > _______________________________________________ > Mailing list: https://launchpad.net/~yade-dev > Post to : yade-dev@lists.launchpad.net > Unsubscribe : https://launchpad.net/~yade-dev > More help : https://help.launchpad.net/ListHelp >
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp