|
[Sponsors] |
June 22, 2024, 15:04 |
patch constructor for non templated class
|
#1 |
New Member
Duncan van der Heul
Join Date: Apr 2023
Posts: 5
Rep Power: 3 |
Dear All,
I am implementing a gradient scheme that will only be defined for scalar fields. Now I have to define the patch constructor to add this new scheme to the hash tables. All other gradient schemes are templates, for both scalars and vectors. Their patch constructor looks like this: Code:
#define makeFvGradTypeScheme(SS, Type) \ defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \ \ namespace Foam \ { \ namespace fv \ { \ gradScheme<Type>::addIstreamConstructorToTable<SS<Type>> \ add##SS##Type##IstreamConstructorToTable_; \ } \ } #define makeFvGradScheme(SS) \ \ makeFvGradTypeScheme(SS, scalar) \ makeFvGradTypeScheme(SS, vector) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Code:
makeFvGradTypeScheme(SS, vector) Code:
defineNamedTemplateTypeNameAndDebug Code:
// Add the patch constructor functions to the hash tables #define makeScalarGradTypeScheme(SS) \ defineTypeNameAndDebug(Foam::fv::SS, 0); \ \ namespace Foam \ { \ namespace fv \ { \ gradScheme<scalar>::addIstreamConstructorToTable<SS> \ add##SS##IstreamConstructorToTable_; \ } \ } #define makeScalarGradScheme(SS) \ makeScalarGradTypeScheme(SS) This part of the coding seems to be the most challenging :-) Thanks in advance for your help. |
|
June 22, 2024, 16:43 |
|
#2 |
New Member
Duncan van der Heul
Join Date: Apr 2023
Posts: 5
Rep Power: 3 |
Ok I found it.
Code:
namespace Foam { namespace fv { defineTypeNameAndDebug(myGaussGrad, 0); } } namespace Foam { namespace fv { gradScheme<scalar>::addIstreamConstructorToTable<myGaussGrad> addmyGaussGradIstreamConstructorToTable_; } } |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PIMPLE Stability | CallumG | OpenFOAM Running, Solving & CFD | 3 | July 16, 2022 05:17 |
[Commercial meshers] Using starToFoam | clo | OpenFOAM Meshing & Mesh Conversion | 33 | September 26, 2012 05:04 |
Cyclic Boundary Condition | Luiz Eduardo Bittencourt Sampaio (Sampaio) | OpenFOAM Running, Solving & CFD | 36 | July 2, 2012 13:23 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |
[Gmsh] Import gmsh msh to Foam | adorean | OpenFOAM Meshing & Mesh Conversion | 24 | April 27, 2005 09:19 |