diff --git a/applications/test/exprTraits/Test-exprTraits.C b/applications/test/exprTraits/Test-exprTraits.C index f6a835871d..ab4bc40d15 100644 --- a/applications/test/exprTraits/Test-exprTraits.C +++ b/applications/test/exprTraits/Test-exprTraits.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -17,8 +17,9 @@ Description #include "IOstreams.H" #include "ITstream.H" -#include "exprTraits.H" #include "uLabel.H" + +#include "exprTraits.H" #include "error.H" #include "stringList.H" #include "exprScanToken.H" @@ -27,16 +28,18 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template +template void printTraits() { - const auto typeCode = exprTypeTraits::value; + const auto typeCode = exprTypeTraits::value; - Info<< "type " << pTraits::typeName - << " code:" << int(typeCode) - << " name:" << exprTypeTraits::name; + Info<< "Type '" << pTraits::typeName + << "' = code:" << int(typeCode) + << " rank:" << exprTypeTraits::rank + << " cmpt:" << exprTypeTraits::nComponents + << " name:" << exprTypeTraits::name; - if (pTraits::typeName != word(exprTypeTraits::name)) + if (pTraits::typeName != word(exprTypeTraits::name)) { Info<< " (UNSUPPORTED)"; } @@ -45,6 +48,17 @@ void printTraits() } +void print(const expressions::scanToken& tok) +{ + Info<< " type:" << int(tok.type_); + if (tok.is_pointer()) + { + Info<< " ptr:" << Foam::name(tok.name_); + } + Info<< nl; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main() @@ -56,6 +70,7 @@ int main() printTraits(); printTraits