Hello, This could be a gene
This could be a general programming question, and similar to the one asked by Sergio Ferraris (Feb.27, 2008), but left without an elegant solution.
Similar to his question, I have added virtual functions to classes and unlike his case, I don't mind dirtying the original OpenFOAM code. However, upgrading to a new release would require going to all the .H and .C files and copy/pasting them in the new release files, which would've been fine if I only had a handful of functions.
As an example, I have defined the virtual function probeL() in LESmodel, and later defined it GenEddyVisc and GenSGSStress. In the main code an instance of compressible::LESmodel is created and called "turbulence". Now I can easily do turbulence->probeL() to access my function.
Please note that if I had created a subclass of LESmodel (call it LESmodel2) and added my function there, it won't be seen by GenEddyVisc, GenSGSStress or their subclasses, unless I had created their subclasses, inheriting from LESmodel2.
I appreciate any ideas.
|All times are GMT -4. The time now is 03:29.|