|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Duncan van der Heul
Join Date: Apr 2023
Posts: 6
Rep Power: 4 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Duncan van der Heul
Join Date: Apr 2023
Posts: 6
Rep Power: 4 ![]() |
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 | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PIMPLE Stability | CallumG | OpenFOAM Running, Solving & CFD | 3 | July 16, 2022 04:17 |
[Commercial meshers] Using starToFoam | clo | OpenFOAM Meshing & Mesh Conversion | 33 | September 26, 2012 04:04 |
Cyclic Boundary Condition | Luiz Eduardo Bittencourt Sampaio (Sampaio) | OpenFOAM Running, Solving & CFD | 36 | July 2, 2012 12:23 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 06:51 |
[Gmsh] Import gmsh msh to Foam | adorean | OpenFOAM Meshing & Mesh Conversion | 24 | April 27, 2005 08:19 |