← Back to team overview

yade-users team mailing list archive

Re: [Question #269315]: swap failure in InteractionLoop

 

Question #269315 on Yade changed:
https://answers.launchpad.net/yade/+question/269315

    Status: Open => Answered

Anton Gladky proposed the following answer:
Hi,

the crashing line in interactionloop is in the code since 2010 unchanged.
I think this part of your code should be rewritten. Try something like this:

CohFrictMat* mat_fm=dynamic_cast<CohFrictMat*>(b1->get());
if (mat_fm) {.....

But it should be checked. I would also recommend you to commit
your model into the main trunk, cover it with unit/check tests
to provide the continuous integration.

Cheers


Anton

2015-07-17 0:46 GMT+03:00 behzad <question269315@xxxxxxxxxxxxxxxxxxxxx>:

> New question #269315 on Yade:
> https://answers.launchpad.net/yade/+question/269315
>
> Hey guys,
>
> I have an Ip like:
>
> Ip2_CohFrictMat_CohBurgersMat_CohBurgersPhys
>
> which makes a CohBurgersPhy (viscoelastic Burgers model) from an
> interaction of CohFrictMat and CohBurgersMat.
>
> Since two types of material are in contact we need to determine the order
> of bodies with iffrent materials in contact and swap the order, if
> necessary.  I was using the following:
>
> #=================
>
> void Ip2_CohFrictMat_CohBurgersMat_CohBurgersPhys::go(const
> shared_ptr<Material>& b1, const shared_ptr<Material>& b2, const
> shared_ptr<Interaction>& interaction)
> {
>
>   if(interaction->phys) return;
>   shared_ptr<CohBurgersPhys> phys (new CohBurgersPhys());
>
>
>   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
>   CohFrictMat* mat1;
>   CohBurgersMat* mat2;
>   if (i2 == cbmi) { // b2 is CohburgersMat and b1 is CohFrictMat
>   mat1 = dynamic_cast<CohFrictMat*>(b1.get());
>   mat2 = dynamic_cast<CohBurgersMat*>(b2.get());
>   } else if (i1 == cbmi) { // b1 is CohburgersMat and b2 is CohFrictMat
>   mat1 = dynamic_cast<CohFrictMat*>(b2.get());
>   mat2 = dynamic_cast<CohBurgersMat*>(b1.get());
>   } else { // should not happen, but to be sure..
>   LOG_FATAL("TODO");
>   }
>
>   ScGeom6D* geom= YADE_CAST<ScGeom6D*>(interaction->geom.get());
> .
> .
> .
> #=============
>
> This was working well with any order of materials in contact. However, I
> upgraded from Ubuntu 12.04 to Ubuntu 14.04 yesterday and I got an updated
> Yade trunk. Compilation of my Burger's model files went through. But,
> swapping function is not working now!
>
> I'm getting the following error now:
>
>
> python: /home/bemaj3/yade-trunk/trunk/pkg/common/InteractionLoop.cpp:116:
> virtual void InteractionLoop::action(): Assertion `!swap' failed.
> Aborted (core dumped)
>
>
>
> Is there any new change in InteractionLoop which causes this problem?
> Thanks
>
> --
> 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-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.