|March 20, 2009, 11:36||
Multiple inheritance, function pointers or?
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,641Rep Power: 25
I have moved into an area of the C++ programming, where I do not feel on solid ground anymore, thus I hope to get some advice/ideas from the more experienced of you.
I am making a new template class derived from mixedFvPatchField<Type>. From this template class I am going to derive certain wave-boundary conditions, such as Stokes First Order Theory, Stokes Second Order Theory, and whatever theory you would like.
This is the straight forward part.
Further I am working on a class, which I call geometricIntersections. This class take an expression for an interface (water surface in this case) and returns an object describing how much of the face is wet, the center of the wet part, etc. I am going to use this class elsewhere, thus I do not want to implement it directly into the template class.
The description of the interface is naturally placed in the derived boundary classes.
I have been looking into different litterature/googled the possibilities and I have come up with two approaches.
1. Inherite the geometric class. This requires multiple inheritance, and there seems to be many pro and cons in this regard. The one I am especially worried about is the fact, that the this-pointer is only pointer at one of the base-classes. Is there a standard, which says at which base class it is pointing, e.g. the first one in the inheritance declaration?
Here the description of the interface is given as a virtual function.
2. The other possibility is to use function pointers, but as I see it, it is kind of messy to make the interface in such a way.
I am greatful for any suggestions or advice.
Have a nice weekend,
|Thread||Thread Starter||Forum||Replies||Last Post|
|Compile problem||ivanyao||OpenFOAM Running, Solving & CFD||1||October 12, 2012 09:31|
|BlockMesh FOAM warning||gaottino||OpenFOAM Native Meshers: blockMesh||7||July 19, 2010 14:11|
|Error with Wmake||skabilan||OpenFOAM Installation||3||July 28, 2009 00:35|
|Problem with compile the setParabolicInlet||ivanyao||OpenFOAM Running, Solving & CFD||6||September 5, 2008 20:50|
|Axisymmetrical mesh||Rasmus Gjesing (Gjesing)||OpenFOAM Native Meshers: blockMesh||10||April 2, 2007 14:00|