swap failure in InteractionLoop

Asked by behzad

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

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Anton Gladky (gladky-anton) said :
#1

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 <email address hidden>:

> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
behzad (behzad-majidi) said :
#2

Hi Anton,

Can you please clarify the approach you're proposing?

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

And I don't get what's wrong with my code? It's checking the index of bodies material and and that of CohBurgersMat and then compares them.

Revision history for this message
Jan Stránský (honzik) said :
#3

Hi Behzad,

please provide also a Python script (even if we can't run it). Do you use
more particle shapes?

See also the source code (InteractionLoop.cpp, line 116). If you use
different shapes, the interaction may be swapped (ok and intended
behavior). Then if you use also different materials, the interaction might
want to swap again, which results in this error.

This happens only in unlucky situation, I used spheres-CpmMat,
facets-FrictMat combination. But (by luck) the definition of Ig2 is
Facet-Sphere and Ip2 is FrictMat-CpmMat (the same order)

The code is unchanged since 2010, but probably nobody needed this
combination (different shapes AND different materials AND different order
in definitions) :-)

I see some possible solutions:
1) define both Ip2_Mat1_Mat2 and Ip2_Mat2_Mat1 (to save code, one of them
calling the other).
2) change InteractionLoop slightly (replace this assert with some other
code, probably would need general discussion among devs)
3) change InteractionLoop completely (nobody would want to do that :-)

In my point of view, 1) is ok, 2) maybe.. So for now you can go 1)
direction :-)

cheers
Jan

2015-07-17 21:11 GMT+02:00 behzad <email address hidden>:

> Question #269315 on Yade changed:
> https://answers.launchpad.net/yade/+question/269315
>
> Status: Answered => Open
>
> behzad is still having a problem:
> Hi Anton,
>
> Can you please clarify the approach you're proposing?
>
> CohFrictMat* mat_fm=dynamic_cast<CohFrictMat*>(b1->get());
> if (mat_fm) {.....
>
>
> And I don't get what's wrong with my code? It's checking the index of
> bodies material and and that of CohBurgersMat and then compares them.
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
behzad (behzad-majidi) said :
#4

well, I tried the first method. But, the problem is still there.

When I define the Ip2 functors in the engines, the one which is defined first is the active one!

I mean, I have defined two separate Ip2 functors:

Ip2_CohBurgersMat_CohFrictMat_CohBurgersPhys()

Ip2_CohFrictMat_CohBurgersMat_CohBurgersPhys()

In my simulation, I define the engines as:

O.engines=[
ForceResetter(),
ForceEngine(force=(0,0,2e1),ids=[1],label='fEngine'),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
[Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys(setCohesionNow=True, setCohesionOnNewContacts=True),
Ip2_CohBurgersMat_CohFrictMatMat_CohBurgersPhys(setCohesionNow=True, setCohesionOnNewContacts=True),
Ip2_CohFrictMat_CohBurgersMat_CohBurgersPhys(setCohesionNow=True, setCohesionOnNewContacts=True)],
[Law2_ScGeom6D_CohBurgersPhys_CohesiveBurgers(),Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(damping=0.7,gravity=[0,0,0]),
PyRunner(command="fEngine.force=(0,0,0)", iterPeriod=5000000),
PyRunner(command='AutoData()',iterPeriod=150000)
]

In the case above, Ip2_CohBurgersMat_CohFrictMatMat... is defined first. Now, if O.bodies[0] is CohBurgersMat and O.bodies[1] is CohFrictMat, it works but not the reverse.

Now, if I define first Ip2_CohFrictMat_CohBurgersMat..., if O.bodies[0] is CohFrictMat and O.bodies[1] is CohBurgersMat, it works but not the reverse.

That's strange (for me). This shouldn't happen.
And but "not working" I mean, I again get the error of
" python: /home/bemaj3/yade-trunk/trunk/pkg/common/InteractionLoop.cpp:116: virtual void InteractionLoop::action(): Assertion `!swap' failed.
Aborted (core dumped)"

Regards,
Behzad

Revision history for this message
Jan Stránský (honzik) said :
#5

Hi Behzad,

just to confirm we are discussing the same problem, I'll repeat my two
requests from #3:

please provide also a Python script (even if we can't run it). Do you use
> more particle shapes?

furhtermore, please attach also the .hpp and .cpp files with your
implementation so we can see or compile it and try, the problem might be
also there (e.g. forgotten switch of FUNCTOR2D arguments)

I thought this approach should have worked, sorry it does not. To solve it,
somebody should dive deeply inside the code and find out what is going on
for these combinations of shapes and materials.. I opened a bug [1], but
currently I don't have time capacities to solve it myself..

cheers
Jan

[1] https://bugs.launchpad.net/yade/+bug/1475844

2015-07-22 22:56 GMT+02:00 behzad <email address hidden>:

> Question #269315 on Yade changed:
> https://answers.launchpad.net/yade/+question/269315
>
> Status: Answered => Open
>
> behzad is still having a problem:
> well, I tried the first method. But, the problem is still there.
>
> When I define the Ip2 functors in the engines, the one which is defined
> first is the active one!
>
> I mean, I have defined two separate Ip2 functors:
>
> Ip2_CohBurgersMat_CohFrictMat_CohBurgersPhys()
>
> Ip2_CohFrictMat_CohBurgersMat_CohBurgersPhys()
>
>
> In my simulation, I define the engines as:
>
> O.engines=[
> ForceResetter(),
> ForceEngine(force=(0,0,2e1),ids=[1],label='fEngine'),
> InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
> InteractionLoop(
> [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
> [Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys(setCohesionNow=True,
> setCohesionOnNewContacts=True),
> Ip2_CohBurgersMat_CohFrictMatMat_CohBurgersPhys(setCohesionNow=True,
> setCohesionOnNewContacts=True),
> Ip2_CohFrictMat_CohBurgersMat_CohBurgersPhys(setCohesionNow=True,
> setCohesionOnNewContacts=True)],
>
> [Law2_ScGeom6D_CohBurgersPhys_CohesiveBurgers(),Law2_ScGeom_FrictPhys_CundallStrack()]
> ),
> NewtonIntegrator(damping=0.7,gravity=[0,0,0]),
> PyRunner(command="fEngine.force=(0,0,0)", iterPeriod=5000000),
> PyRunner(command='AutoData()',iterPeriod=150000)
> ]
>
>
> In the case above, Ip2_CohBurgersMat_CohFrictMatMat... is defined first.
> Now, if O.bodies[0] is CohBurgersMat and O.bodies[1] is CohFrictMat, it
> works but not the reverse.
>
> Now, if I define first Ip2_CohFrictMat_CohBurgersMat..., if O.bodies[0]
> is CohFrictMat and O.bodies[1] is CohBurgersMat, it works but not the
> reverse.
>
> That's strange (for me). This shouldn't happen.
> And but "not working" I mean, I again get the error of
> " python:
> /home/bemaj3/yade-trunk/trunk/pkg/common/InteractionLoop.cpp:116: virtual
> void InteractionLoop::action(): Assertion `!swap' failed.
> Aborted (core dumped)"
>
> Regards,
> Behzad
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
behzad (behzad-majidi) said :
#6

Hi Jan,

This is the link to the codes:

https://www.dropbox.com/sh/vkqpimkrjr56yic/AADDihKwYjo7MQ0MFAZzZac5a?dl=0

and my Python script is:

=====================================
=====================================

O.reset()
from yade import utils, plot
from yade import pack, qt

id_Mat1=O.materials.append(CohBurgersMat(kmn=2.0e8,kkn=1.0e8,cmn=3e8,ckn=3e8,
kms=2.0e8,kks=1.0e8,cms=3e8,cks=3e8,normalCohesion= 1e25, shearCohesion= 1e23, isCohesive= True, young=2e8,
density=2600, poisson=0.3, frictionAngle= 0.4))
Mat1=O.materials[id_Mat1]

id_Mat3=O.materials.append(CohFBMat(kmn=2.0e8,kkn=1.0e8,cmn=3e8,ckn=3e8,
kms=2.0e8,kks=1.0e8,cms=3e8,cks=3e8,normalCohesion= 1e25, shearCohesion= 1e23, isCohesive= True, young=2e8,
density=2600, poisson=0.3, frictionAngle= 0.4))
Mat3=O.materials[id_Mat3]

id_Mat2=O.materials.append(CohFrictMat(young=2.0e8,poisson=0.3,density=1000,frictionAngle=1,isCohesive= True,
normalCohesion= 1e25, shearCohesion= 1e23))
Mat2=O.materials[id_Mat2]

s1=utils.sphere([0.0,0.0,0.0],0.01,fixed=True,material=Mat3)
s2=utils.sphere([0.0,0.0,2.0e-2],0.01,fixed=False,material=Mat1)

O.bodies.append(s1)
O.bodies.append(s2)

O.engines=[
ForceResetter(),
ForceEngine(force=(0,0,2e1),ids=[1],label='fEngine'),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
[Ip2_CohFBMat_CohBurgersMat_CohBurgersPhys(setCohesionNow=True, setCohesionOnNewContacts=True),
Ip2_CohBurgersMat_CohFBMat_CohBurgersPhys(setCohesionNow=True, setCohesionOnNewContacts=True)],
[Law2_ScGeom6D_CohBurgersPhys_CohesiveBurgers(),Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(damping=0.7,gravity=[0,0,0]),
PyRunner(command="fEngine.force=(0,0,0)", iterPeriod=5000000),
PyRunner(command='AutoData()',iterPeriod=150000)
]

def AutoData():
 f_app=2e1
 t_loading=5
 cmn=6e6
# kmn=4.0e6
 kmn=2.0e6 # in case of CohFrictMat-CohBurgersMat in series
 kkn=2.0e6
 ckn=6e6
 j1= 1/kmn
 j2= 1/kkn
 j3= kkn/ckn
 j4= 1/cmn
 a1= cmn/kmn+cmn*(1.0/kmn+1/kmn)
 a2=cmn*cmn/(kmn*kmn)
 b1= cmn
 b2=cmn*cmn/kmn
 z1=(-a1+sqrt(a1*a1-4.0*a2))/(2.0*a2)
 z2=(-a1-sqrt(a1*a1-4.0*a2))/(2.0*a2)
 aa1=(b2*z1+b1)/a2/(z1-z2)
 aa2=(b2*z2+b1)/a2/(z2-z1)
 if O.time < t_loading:
  displacement=f_app*(j1+j2*(1-exp(-(O.time)*j3))+(O.time)*j4)
 else:
  displacement=f_app*((t_loading/cmn)+j2*(exp(-(O.time)*j3))*(exp((t_loading)*j3)-1));

        plot.addData(t=O.time,d_numerical=-(0.02-(O.bodies[s2.id].state.pos[2])),d_analytical=displacement)

plot.plots={'t':(('d_numerical',('d_analytical','^:'),))}
plot.plot()

O.dt=1e-6

qt.View()

===================================
===================================

as for "forgotten switch of FUNCTOR2D arguments", I didn't put any kind of switch!

Regards,

Thanks for the comments.

Revision history for this message
Jan Stránský (honzik) said :
#7

Hi Behzad,

thanks for the files. According to your script, the answer to my question "Do
you use more particle shapes?" form #3 is no. All my comments were for the
"yes" case :-)

So the problem is quite opposite, two materials for the same shape. The
problem is somewhere in the core implementation. Unluckily for you, nobody
used/needed this case so far :-) Just now I have no idea how (and time) to
solve it..

cheers
Jan

2015-07-22 23:26 GMT+02:00 behzad <email address hidden>:

> Question #269315 on Yade changed:
> https://answers.launchpad.net/yade/+question/269315
>
> Status: Answered => Open
>
> behzad is still having a problem:
>
> Hi Jan,
>
> This is the link to the codes:
>
> https://www.dropbox.com/sh/vkqpimkrjr56yic/AADDihKwYjo7MQ0MFAZzZac5a?dl=0
>
>
> and my Python script is:
>
> =====================================
> =====================================
>
> O.reset()
> from yade import utils, plot
> from yade import pack, qt
>
>
>
> id_Mat1=O.materials.append(CohBurgersMat(kmn=2.0e8,kkn=1.0e8,cmn=3e8,ckn=3e8,
> kms=2.0e8,kks=1.0e8,cms=3e8,cks=3e8,normalCohesion= 1e25, shearCohesion=
> 1e23, isCohesive= True, young=2e8,
> density=2600, poisson=0.3, frictionAngle= 0.4))
> Mat1=O.materials[id_Mat1]
>
>
> id_Mat3=O.materials.append(CohFBMat(kmn=2.0e8,kkn=1.0e8,cmn=3e8,ckn=3e8,
> kms=2.0e8,kks=1.0e8,cms=3e8,cks=3e8,normalCohesion= 1e25, shearCohesion=
> 1e23, isCohesive= True, young=2e8,
> density=2600, poisson=0.3, frictionAngle= 0.4))
> Mat3=O.materials[id_Mat3]
>
>
> id_Mat2=O.materials.append(CohFrictMat(young=2.0e8,poisson=0.3,density=1000,frictionAngle=1,isCohesive=
> True,
> normalCohesion= 1e25, shearCohesion= 1e23))
> Mat2=O.materials[id_Mat2]
>
>
> s1=utils.sphere([0.0,0.0,0.0],0.01,fixed=True,material=Mat3)
> s2=utils.sphere([0.0,0.0,2.0e-2],0.01,fixed=False,material=Mat1)
>
> O.bodies.append(s1)
> O.bodies.append(s2)
>
>
> O.engines=[
> ForceResetter(),
> ForceEngine(force=(0,0,2e1),ids=[1],label='fEngine'),
> InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
> InteractionLoop(
> [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
> [Ip2_CohFBMat_CohBurgersMat_CohBurgersPhys(setCohesionNow=True,
> setCohesionOnNewContacts=True),
> Ip2_CohBurgersMat_CohFBMat_CohBurgersPhys(setCohesionNow=True,
> setCohesionOnNewContacts=True)],
>
> [Law2_ScGeom6D_CohBurgersPhys_CohesiveBurgers(),Law2_ScGeom_FrictPhys_CundallStrack()]
> ),
> NewtonIntegrator(damping=0.7,gravity=[0,0,0]),
> PyRunner(command="fEngine.force=(0,0,0)", iterPeriod=5000000),
> PyRunner(command='AutoData()',iterPeriod=150000)
> ]
>
>
> def AutoData():
> f_app=2e1
> t_loading=5
> cmn=6e6
> # kmn=4.0e6
> kmn=2.0e6 # in case of CohFrictMat-CohBurgersMat in series
> kkn=2.0e6
> ckn=6e6
> j1= 1/kmn
> j2= 1/kkn
> j3= kkn/ckn
> j4= 1/cmn
> a1= cmn/kmn+cmn*(1.0/kmn+1/kmn)
> a2=cmn*cmn/(kmn*kmn)
> b1= cmn
> b2=cmn*cmn/kmn
> z1=(-a1+sqrt(a1*a1-4.0*a2))/(2.0*a2)
> z2=(-a1-sqrt(a1*a1-4.0*a2))/(2.0*a2)
> aa1=(b2*z1+b1)/a2/(z1-z2)
> aa2=(b2*z2+b1)/a2/(z2-z1)
> if O.time < t_loading:
>
> displacement=f_app*(j1+j2*(1-exp(-(O.time)*j3))+(O.time)*j4)
> else:
>
> displacement=f_app*((t_loading/cmn)+j2*(exp(-(O.time)*j3))*(exp((t_loading)*j3)-1));
>
> plot.addData(t=O.time,d_numerical=-(0.02-(O.bodies[s2.id
> ].state.pos[2])),d_analytical=displacement)
>
>
> plot.plots={'t':(('d_numerical',('d_analytical','^:'),))}
> plot.plot()
>
> O.dt=1e-6
>
> qt.View()
>
> ===================================
> ===================================
>
>
> as for "forgotten switch of FUNCTOR2D arguments", I didn't put any kind of
> switch!
>
> Regards,
>
>
> Thanks for the comments.
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
behzad (behzad-majidi) said :
#8

hmm, I see.

But, something has been recently changed and made this thing not working. Check it out:

https://answers.launchpad.net/yade/+question/261724

You and I had a talk about this few months ago. Finally, we got a solution by defining only one Ip2_mat1_mat2... functor, but checking the orders inside the functor.

This method was working till I updated to latest trunk version, last week.

Anyway, thanks again.

Cheers,
Behzad

Revision history for this message
Jérôme Duriez (jduriez) said :
#9

Maybe (I'm more or less speculating, as a small piece of help), there has been some changes making your material class index verification now inefficient.

Basically, I think Anton proposed you in #1 another way checking who is CohBurger and who is CohFrict. If I remember well (it is maybe worth for you to check) the dynamic cast should return true if things go well, i.e. if b1 is of CohFrictMat type (regarding Anton's code example). And false otherwise.

Then, it is a way that could replace your index verifications and solve your problem (if the problem is indeed at the index level ????)

Revision history for this message
behzad (behzad-majidi) said :
#10

Hi Jerome,

I think the problem is at the index level but surprisingly tried the following and it doesn't work:

  CohFrictMat* check1;
  check1 = dynamic_cast<CohFrictMat*>(b1.get());

  CohFrictMat* mat1;
  CohBurgersMat* mat2;

  if (check1) {
  mat1 = dynamic_cast<CohFrictMat*>(b1.get());
  mat2 = dynamic_cast<CohBurgersMat*>(b2.get());
  } else { // b1 is CohburgersMat and b2 is CohFrictMat
  mat1 = dynamic_cast<CohFrictMat*>(b2.get());
  mat2 = dynamic_cast<CohBurgersMat*>(b1.get());
  }

Can you help with this problem?

Provide an answer of your own, or ask behzad for more information if necessary.

To post a message you must log in.