mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make expressions::FieldAssociation a common enum
- use FACE_DATA (was SURFACE_DATA) for similarity with polySurface ENH: add expression value enumerations and traits - simple enumeration of standard types (bool, label, scalar, vector) that can be used as a value type-code for internal bookkeeping. GIT: relocate pTraits into general traits/ directory
This commit is contained in:
79
applications/test/exprTraits/Test-exprTraits.C
Normal file
79
applications/test/exprTraits/Test-exprTraits.C
Normal file
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
|
||||
Description
|
||||
Basic tests of expression traits
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstreams.H"
|
||||
#include "ITstream.H"
|
||||
#include "exprTraits.H"
|
||||
#include "uLabel.H"
|
||||
#include "error.H"
|
||||
#include "stringList.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
void printTraits()
|
||||
{
|
||||
const auto typeCode = exprTypeTraits<T>::value;
|
||||
|
||||
Info<< "type " << pTraits<T>::typeName
|
||||
<< " code:" << int(typeCode)
|
||||
<< " name:" << exprTypeTraits<T>::name;
|
||||
|
||||
if (pTraits<T>::typeName != word(exprTypeTraits<T>::name))
|
||||
{
|
||||
Info<< " (UNSUPPORTED)";
|
||||
}
|
||||
|
||||
Info << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main()
|
||||
{
|
||||
Info<< nl << "Traits:" << nl;
|
||||
|
||||
printTraits<word>();
|
||||
printTraits<string>();
|
||||
printTraits<bool>();
|
||||
printTraits<label>();
|
||||
printTraits<scalar>();
|
||||
printTraits<vector>();
|
||||
printTraits<tensor>();
|
||||
printTraits<symmTensor>();
|
||||
printTraits<sphericalTensor>();
|
||||
|
||||
const auto getName = nameOp<expressions::valueTypeCode>();
|
||||
|
||||
Info<< nl;
|
||||
|
||||
Info<< "Name of typeCode: "
|
||||
<< Foam::name(expressions::valueTypeCode::type_scalar) << nl;
|
||||
|
||||
Info<< "Name of typeCode: "
|
||||
<< getName(expressions::valueTypeCode::type_bool) << nl;
|
||||
|
||||
|
||||
Info<< nl << "Done" << nl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user