|
[Sponsors] |
December 27, 2018, 11:05 |
Multiple inheritance paradigms in OpenFOAM
|
#1 |
Member
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7 |
Merry Christmas everyone,
from time to time, by going through the OF code (v16.12), I see some crazy (to me) inheritance hierarchies combined with multiple inheritance. One example is the class template reactingMixture (src/thermophysicalModels/reactionThermo/mixtures/reactingMixture): Code:
template<class ThermoType> class reactingMixture : public speciesTable, public autoPtr<chemistryReader<ThermoType>>, public multiComponentMixture<ThermoType>, public PtrList<Reaction<ThermoType>> { // ... // declarations // ... }; My question: Is there a reason for that (some kind of paradigm I do not know about)? What are the advantages of such design? I thought that usually this kind of problem would be solved through composition. Am I just not seeing the big picture? Thanks for your answers RP |
|
December 30, 2018, 06:18 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
You are probably right that the reader could/should be a member composition instead of inheritance (although I don't have the code in front of me at the moment). Please open a gitlab issue to track and discuss this.
Thanks, /mark |
|
January 1, 2019, 12:20 |
|
#3 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
||
January 4, 2019, 09:16 |
|
#4 |
Member
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7 |
Thanks Mark
|
|
Tags |
c++, oop, openfoam, software design, thermo library |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Map of the OpenFOAM Forum - Understanding where to post your questions! | wyldckat | OpenFOAM | 10 | September 2, 2021 06:29 |
Multiple outlet treatment in OpenFoam | hooman.4028 | OpenFOAM Running, Solving & CFD | 1 | July 19, 2017 01:38 |
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin | CFDFoundation | OpenFOAM Announcements from Other Sources | 0 | January 4, 2017 07:15 |
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 | cfd.direct | OpenFOAM Announcements from Other Sources | 2 | August 31, 2015 14:36 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13:21 |