Thanks Dennis!
 
In general virtual inheritance is the proper tool for the problem I've run in 
(its called "diamond problem") . But for my case it seams not to work, since 
the static_cast in the FVProblem, which I've mentioned in my first mail fails 
again. Now the static_cast fails not, because the base is ambiguous, but it 
fails because the base is virtual:
 
dumux/dumux/common/fvproblem.hh:596:15: error: cannot convert from pointer to 
base class 'Dumux::FVProblem<Dumux::Properties::TTag::MyTTag>' to pointer to 
derived class 'Dumux::MyProblem<Dumux::Properties::TTag::MyTTag>' because the 
base is virtual
596 | { return *static_cast<const Implementation *>(this); }
 
Best,
Martin

> Dennis Gläser <[email protected]> hat am 22.12.2022 13:49 
> CET geschrieben:
>  
>  
> Hi Martin,
>  
> you can try with virtual inheritance (not in the sense of dynamic 
> polymorphism). I just found this: 
> https://isocpp.org/wiki/faq/multiple-inheritance#virtual-inheritance-where
>  
> This may help, I hope it does!
>  
> Best,
> Dennis
>  
> 
> 
> 
> > On 22. Dec 2022, at 13:40, Martin Utz <[email protected] 
> > mailto:[email protected]> wrote:
> > Dear dumux community,
> >  
> > is it possible for a problem to inherit from two other problems?
> >  
> > In general, this seems to work, since Cpp supports several base classes. 
> > But I am running into trouble since both parent problems inherit from the 
> > FVProblem. Therefore the functions of the FVproblem (e.g. girdGeometry() ) 
> > are ambiguous. I tried to solve this issue with using 
> > ParentType1::gridGeometry. Since both base classes use FVProblem,  it 
> > should not matter if I use ParentType1 or ParentType2.
> >  
> > But then I run into the next error, which I could not solve:
> >  
> > dumux/dumux/common/fvproblem.hh:596:15: error: 
> > 'Dumux::FVProblem<Dumux::Properties::TTag::MyTTag>' is an ambiguous base of 
> > 'Dumux::MyProblem<Dumux::Properties::TTag::MyTTag>'
> > 596 | { return *static_cast<const Implementation *>(this); }
> >  
> > This seams to me to be a quite basic error, therefore I was wondering if it 
> > is in general possible for a problem to inherit from two other problems.
> >  
> > Is there a way to fix the inheritance? Or is this use of inheritance not 
> > meant to be in dumux?
> >  
> > Best,
> > Martin
> >  
> > 
> > Im Auftrag
> > 
> > Martin Utz
> > 
> > --
> > Referat Numerische Verfahren im Wasserbau
> > Abteilung Wasserbau im Binnenbereich
> > 
> > Bundesanstalt für Wasserbau
> > Federal Waterways Engineering and Research Institute
> > Kußmaulstraße 17 | 76187 Karlsruhe
> > E-Mail: [email protected] mailto:[email protected]
> > 
> > Tel.: +49 721 9726-3575
> > Fax: +49 721 9726-4540
> > https://www.baw.de
> > 
> > 
> > _______________________________________________
> > DuMux mailing list
> > [email protected] mailto:[email protected]
> > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
> > 
> 
 

Im Auftrag

Martin Utz

--
Referat Numerische Verfahren im Wasserbau
Abteilung Wasserbau im Binnenbereich

Bundesanstalt für Wasserbau
Federal Waterways Engineering and Research Institute
Kußmaulstraße 17 | 76187 Karlsruhe
E-Mail: [email protected]

Tel.: +49 721 9726-3575
Fax: +49 721 9726-4540
https://www.baw.de


_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to