Function1,Function2: Updated run-time selection table construction to add to foamToC

With this change foamToC now includes Function1 and Function2 entries, thus

    foamToC -table Function1

prints

    Tables of type Function1
        avTypeFunction1
        labelFunction1
        scalarFunction1
        sphericalTensorFunction1
        symmTensorFunction1
        tensorFunction1
        trvTypeFunction1
        vectorFunction1

and

    foamToC -table scalarFunction1

prints

    Contents of table scalarFunction1, base type Function1:
        NSRDS0                                  libspecie.so
        NSRDS1                                  libspecie.so
        NSRDS14                                 libspecie.so
        NSRDS2                                  libspecie.so
        NSRDS3                                  libspecie.so
        NSRDS4                                  libspecie.so
        NSRDS5                                  libspecie.so
        NSRDS6                                  libspecie.so
        NSRDS7                                  libspecie.so
        coded                                   libOpenFOAM.so
        constant                                libOpenFOAM.so
        exponentialSqrRamp                      libOpenFOAM.so
        halfCosineRamp                          libOpenFOAM.so
        integratedNonUniformTable               libspecie.so
        laminarBL                               libfiniteVolume.so
        linearRamp                              libOpenFOAM.so
        nonUniformTable                         libOpenFOAM.so
        none                                    libOpenFOAM.so
        one                                     libOpenFOAM.so
        polynomial                              libOpenFOAM.so
        quadraticRamp                           libOpenFOAM.so
        quarterCosineRamp                       libOpenFOAM.so
        quarterSineRamp                         libOpenFOAM.so
        reverseRamp                             libOpenFOAM.so
        scale                                   libOpenFOAM.so
        sine                                    libOpenFOAM.so
        square                                  libOpenFOAM.so
        squarePulse                             libOpenFOAM.so
        table                                   libOpenFOAM.so
        tableFile                               libOpenFOAM.so
        turbulentBL                             libfiniteVolume.so
        uniform                                 libOpenFOAM.so
        uniformTable                            libOpenFOAM.so
        zero                                    libOpenFOAM.so
This commit is contained in:
Henry Weller
2023-06-15 20:59:10 +01:00
parent 1ceae1c889
commit cafe173bf7
21 changed files with 157 additions and 141 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -98,43 +98,6 @@ namespace Foam
(#baseType, baseType::typeName_(), thisType::typeName, STR(LIB_NAME))
//- Add to hash-table of functions with 'lookup' as the key
#define addRemovableNamedToRunTimeSelectionTable\
(baseType,thisType,argNames,lookup) \
\
/* Add the thisType constructor function to the table, find by lookup */ \
baseType::addRemovable##argNames##ConstructorToTable<thisType> \
addRemovable_##lookup##_##thisType##argNames##ConstructorTo \
##baseType##Table_(#lookup); \
\
bool addRemovable_##lookup##_##thisType##argNames##To##baseType##ToC_ = \
addToRunTimeSelectionTableToC \
(#baseType, baseType::typeName_(), #lookup, STR(LIB_NAME))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Add to hash-table of functions with typename as the key.
// Use when baseType doesn't need a template argument (eg, is a typedef)
#define addTemplateToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames) \
\
/* Add the thisType constructor function to the table */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
//- Add to hash-table of functions with 'lookup' as the key.
// Use when baseType doesn't need a template argument (eg, is a typedef)
#define addNamedTemplateToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames,lookup) \
\
/* Add the thisType constructor function to the table, find by lookup */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType \
##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Add to hash-table of functions with typename as the key.
@ -144,7 +107,16 @@ namespace Foam
\
/* Add the thisType constructor function to the table */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_; \
\
bool add##thisType##Targ##argNames##To##baseType##Targ##ToC_ = \
addToRunTimeSelectionTableToC \
( \
#baseType, \
baseType<Targ>::typeName_(), \
thisType<Targ>::typeName, \
STR(LIB_NAME) \
)
//- Add to hash-table of functions with 'lookup' as the key.
@ -155,7 +127,11 @@ namespace Foam
/* Add the thisType constructor function to the table, find by lookup */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType## \
Targ##Table_(#lookup)
Targ##Table_(#lookup); \
\
bool add_##lookup##_##thisType##Targ##argNames##To##baseType##Targ##ToC_ = \
addToRunTimeSelectionTableToC \
(#baseType, baseType<Targ>::typeName_(), #lookup, STR(LIB_NAME))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ SourceFiles
#include "tmp.H"
#include "typeInfo.H"
#include "Field.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -216,33 +217,43 @@ public:
#define makeFunction1(Type) \
\
defineNamedTemplateTypeNameAndDebug(Function1<Type>, 0); \
\
defineTemplateRunTimeSelectionTable(Function1<Type>, dictionary);
#define makeFunction1Type(SS, Type) \
\
defineNamedTemplateTypeNameAndDebug(Function1s::SS<Type>, 0); \
\
Function1<Type>::adddictionaryConstructorToTable<Function1s::SS<Type>> \
addFunction1##SS##Type##ConstructorToTable_;
defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
typedef Function1<Type> Type##Function1; \
typedef SS<Type> Type##SS##Function1; \
addToRunTimeSelectionTable \
( \
Type##Function1, \
Type##SS##Function1, \
dictionary \
)
#define makeNamedFunction1Type(SS, Type, Name) \
\
Function1<Type>::adddictionaryConstructorToTable<Function1s::SS<Type>> \
addFunction1##Name##Type##ConstructorToTable_(#Name);
typedef Function1<Type> Type##Function1; \
typedef SS<Type> Type##SS##Function1; \
addNamedToRunTimeSelectionTable \
( \
Type##Function1, \
Type##SS##Function1, \
dictionary, \
Name \
)
#define makeScalarFunction1(SS) \
\
defineTypeNameAndDebug(SS, 0); \
\
Function1<scalar>::adddictionaryConstructorToTable<SS> \
addFunction1##SS##ConstructorToTable_;
typedef Function1<scalar> scalarFunction1; \
addToRunTimeSelectionTable(scalarFunction1, SS, dictionary)
#define makeFunction1s(Type) \
#define makeFunction1s(Type, nullArg) \
\
template<> \
const char* const Foam::Tuple2<Foam::scalar, Type>::typeName \
@ -251,20 +262,24 @@ public:
); \
\
makeFunction1(Type); \
makeFunction1Type(None, Type); \
makeFunction1Type(Constant, Type); \
makeFunction1Type(Uniform, Type); \
makeFunction1Type(ZeroConstant, Type); \
makeFunction1Type(OneConstant, Type); \
makeFunction1Type(Polynomial, Type); \
makeFunction1Type(Sine, Type); \
makeFunction1Type(Square, Type); \
makeFunction1Type(Table, Type); \
makeFunction1Type(UniformTable, Type); \
makeFunction1Type(NonUniformTable, Type); \
makeNamedFunction1Type(Table, Type, tableFile); \
makeFunction1Type(Scale, Type); \
makeFunction1Type(Coded, Type);
\
namespace Function1s \
{ \
makeFunction1Type(None, Type); \
makeFunction1Type(Constant, Type); \
makeFunction1Type(Uniform, Type); \
makeFunction1Type(ZeroConstant, Type); \
makeFunction1Type(OneConstant, Type); \
makeFunction1Type(Polynomial, Type); \
makeFunction1Type(Sine, Type); \
makeFunction1Type(Square, Type); \
makeFunction1Type(Table, Type); \
makeFunction1Type(UniformTable, Type); \
makeFunction1Type(NonUniformTable, Type); \
makeNamedFunction1Type(Table, Type, tableFile); \
makeFunction1Type(Scale, Type); \
makeFunction1Type(Coded, Type); \
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,7 @@ SourceFiles
#define TableReader_H
#include "dictionary.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -122,14 +123,17 @@ public:
\
defineNamedTemplateTypeNameAndDebug(TableReaders::SS<Type>, 0); \
\
TableReader<Type>::adddictionaryConstructorToTable<TableReaders::SS<Type>> \
add##SS##Type##ConstructorToTable_;
addTemplatedToRunTimeSelectionTable(TableReader, SS, Type, dictionary)
#define makeTableReaders(Type) \
defineTableReader(Type); \
makeTableReader(Embedded, Type); \
makeTableReader(Foam, Type); \
makeTableReader(Csv, Type)
\
namespace TableReaders \
{ \
makeTableReader(Embedded, Type); \
makeTableReader(Foam, Type); \
makeTableReader(Csv, Type); \
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,14 +45,14 @@ License
namespace Foam
{
makeFunction1(label);
makeFunction1Type(None, label);
makeFunction1Type(Constant, label);
makeFunction1s(scalar);
makeFunction1s(vector);
makeFunction1s(sphericalTensor);
makeFunction1s(symmTensor);
makeFunction1s(tensor);
namespace Function1s
{
makeFunction1Type(None, label);
makeFunction1Type(Constant, label);
}
FOR_ALL_FIELD_TYPES(makeFunction1s);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ SourceFiles
#include "tmp.H"
#include "typeInfo.H"
#include "Field.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -204,24 +205,27 @@ public:
#define makeFunction2(Type) \
\
defineNamedTemplateTypeNameAndDebug(Function2<Type>, 0); \
\
defineTemplateRunTimeSelectionTable(Function2<Type>, dictionary);
#define makeFunction2Type(SS, Type) \
\
defineNamedTemplateTypeNameAndDebug(Function2s::SS<Type>, 0); \
\
Function2<Type>::adddictionaryConstructorToTable<Function2s::SS<Type>> \
addFunction2##SS##Type##ConstructorToTable_;
defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
typedef Function2<Type> Type##Function2; \
typedef SS<Type> Type##SS##Function2; \
addToRunTimeSelectionTable \
( \
Type##Function2, \
Type##SS##Function2, \
dictionary \
)
#define makeScalarFunction2(SS) \
\
defineTypeNameAndDebug(SS, 0); \
\
Function2<scalar>::adddictionaryConstructorToTable<SS> \
addFunction2##SS##ConstructorToTable_;
typedef Function2<scalar> scalarFunction2; \
addToRunTimeSelectionTable(scalarFunction2, SS, dictionary)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,27 +35,32 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeFunction2s(Type) \
#define makeFunction2s(Type, nullArg) \
\
makeFunction2(Type); \
makeFunction2Type(None, Type); \
makeFunction2Type(Constant, Type); \
makeFunction2Type(ZeroConstant, Type); \
makeFunction2Type(OneConstant, Type); \
makeFunction2Type(Scale, Type); \
makeFunction2Type(UniformTable, Type); \
makeFunction2Type(Coded, Type);
\
namespace Function2s \
{ \
makeFunction2Type(None, Type); \
makeFunction2Type(Constant, Type); \
makeFunction2Type(ZeroConstant, Type); \
makeFunction2Type(OneConstant, Type); \
makeFunction2Type(Scale, Type); \
makeFunction2Type(UniformTable, Type); \
makeFunction2Type(Coded, Type); \
}
namespace Foam
{
makeFunction2(label);
makeFunction2Type(None, label);
makeFunction2Type(Constant, label);
makeFunction2s(scalar);
makeFunction2s(vector);
makeFunction2s(sphericalTensor);
makeFunction2s(symmTensor);
makeFunction2s(tensor);
namespace Function2s
{
makeFunction2Type(None, label);
makeFunction2Type(Constant, label);
}
FOR_ALL_FIELD_TYPES(makeFunction2s);
}