diff --git a/applications/test/exprTraits/Make/files b/applications/test/exprTraits/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..6ae37c355d8aa17b01fe175d796509e61c7c32cf --- /dev/null +++ b/applications/test/exprTraits/Make/files @@ -0,0 +1,3 @@ +Test-exprTraits.C + +EXE = $(FOAM_USER_APPBIN)/Test-exprTraits diff --git a/applications/test/exprTraits/Make/options b/applications/test/exprTraits/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..18e6fe47afacb902cddccf82632772447704fd88 --- /dev/null +++ b/applications/test/exprTraits/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = */ +/* EXE_LIBS = */ diff --git a/applications/test/exprTraits/Test-exprTraits.C b/applications/test/exprTraits/Test-exprTraits.C new file mode 100644 index 0000000000000000000000000000000000000000..3dee3b436ffb46177c25a6784527d011fa0be93a --- /dev/null +++ b/applications/test/exprTraits/Test-exprTraits.C @@ -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; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/setExprFields/setExprFields.C b/applications/utilities/preProcessing/setExprFields/setExprFields.C index 673767fe0863262870c47e7cb269552b1d194a52..402b6679f5cbf6707c2648ec2d50eb2d9d2b31a3 100644 --- a/applications/utilities/preProcessing/setExprFields/setExprFields.C +++ b/applications/utilities/preProcessing/setExprFields/setExprFields.C @@ -53,15 +53,15 @@ Note using namespace Foam; -using FieldAssociation = expressions::volumeExpr::FieldAssociation; +using FieldAssociation = expressions::FieldAssociation; word fieldGeoType(const FieldAssociation geoType) { switch (geoType) { - case FieldAssociation::VOLUME_DATA : return "cells"; break; - case FieldAssociation::SURFACE_DATA : return "faces"; break; case FieldAssociation::POINT_DATA : return "points"; break; + case FieldAssociation::FACE_DATA : return "faces"; break; + case FieldAssociation::VOLUME_DATA : return "cells"; break; default: break; } @@ -356,6 +356,7 @@ void evaluate if (ptr) { conditionField = ptr->internalField(); + // VOLUME_DATA break; } } @@ -366,7 +367,7 @@ void evaluate if (ptr) { conditionField = ptr->internalField(); - conditionDataType = FieldAssociation::SURFACE_DATA; + conditionDataType = FieldAssociation::FACE_DATA; break; } } diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 6b2f61460749b8e32defdec5ddb506d1aa96f1ac..7e4850fc44cf728624678b475aa304e335437540 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -163,6 +163,8 @@ $(expr)/exprResult/exprResultStoredStack.C $(expr)/exprString/exprString.C $(expr)/exprTools/exprTools.C +$(expr)/traits/exprTraits.C + $(expr)/exprDriver/exprDriver.C $(expr)/exprDriver/exprDriverFields.C $(expr)/exprDriver/exprDriverIO.C diff --git a/src/OpenFOAM/expressions/exprDriver/exprDriver.H b/src/OpenFOAM/expressions/exprDriver/exprDriver.H index 72dcb73e52e1b0371b57a169cf22a060f79e9d94..408c0f7fb6d4a6e45f272fd10cfd10402b4e93d6 100644 --- a/src/OpenFOAM/expressions/exprDriver/exprDriver.H +++ b/src/OpenFOAM/expressions/exprDriver/exprDriver.H @@ -59,10 +59,12 @@ SourceFiles #ifndef expressions_exprDriver_H #define expressions_exprDriver_H -#include "exprString.H" #include "exprResult.H" +#include "exprString.H" +#include "exprTraits.H" #include "pointField.H" #include "primitiveFields.H" +#include "objectRegistry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/expressions/exprResult/exprResult.H b/src/OpenFOAM/expressions/exprResult/exprResult.H index 90083ae906447301ed2d9f2cb8cb10762e1a5646..3e9d19f6bc8a36b743f82d026fedf0af01bb6dec 100644 --- a/src/OpenFOAM/expressions/exprResult/exprResult.H +++ b/src/OpenFOAM/expressions/exprResult/exprResult.H @@ -57,12 +57,8 @@ SourceFiles #ifndef expressions_exprResult_H #define expressions_exprResult_H -#include "vector.H" -#include "tensor.H" -#include "sphericalTensor.H" -#include "symmTensor.H" +#include "exprTraits.H" #include "dimensionedType.H" -#include "IOField.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/expressions/traits/exprFieldAssociation.H b/src/OpenFOAM/expressions/traits/exprFieldAssociation.H new file mode 100644 index 0000000000000000000000000000000000000000..f7970973e11206d78d04951dce8475e33d50c323 --- /dev/null +++ b/src/OpenFOAM/expressions/traits/exprFieldAssociation.H @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019-2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::expressions::FieldAssociation + +Description + The field association for mesh (patch/volume) values. + +\*---------------------------------------------------------------------------*/ + +#ifndef expressions_FieldAssociation_H +#define expressions_FieldAssociation_H + +namespace Foam +{ +namespace expressions +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +enum FieldAssociation : unsigned char +{ + NO_DATA = 0, //!< No data + POINT_DATA = 1, //!< Point data + FACE_DATA = 2, //!< Face data + VOLUME_DATA = 4 //!< Volume data +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace expressions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/expressions/traits/exprTraits.C b/src/OpenFOAM/expressions/traits/exprTraits.C new file mode 100644 index 0000000000000000000000000000000000000000..2f4dda37a4dce7f90235812872f9e50c309f6b78 --- /dev/null +++ b/src/OpenFOAM/expressions/traits/exprTraits.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "exprTraits.H" + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +Foam::expressions::valueTypeCode +Foam::expressions::valueTypeCodeOf(const word& dataTypeName) +{ + #undef stringToTypeCode + #define stringToTypeCode(Type) \ + \ + if (dataTypeName == exprTypeTraits<Type>::name) \ + { \ + return expressions::valueTypeCode::type_##Type; \ + } + + if (!dataTypeName.empty()) + { + stringToTypeCode(bool); + stringToTypeCode(label); + stringToTypeCode(scalar); + stringToTypeCode(vector); + stringToTypeCode(tensor); + stringToTypeCode(sphericalTensor); + stringToTypeCode(symmTensor); + } + #undef stringToTypeCode + + return expressions::valueTypeCode::INVALID; +} + + +Foam::word Foam::name(const expressions::valueTypeCode typeCode) +{ + #undef case_typeCodeToString + #define case_typeCodeToString(Type) \ + \ + case expressions::valueTypeCode::type_##Type : \ + { \ + return exprTypeTraits<Type>::name; \ + } + + switch (typeCode) + { + case expressions::valueTypeCode::NONE : + { + return "none"; + } + + case expressions::valueTypeCode::INVALID : + { + // ie, "" + break; + } + + case_typeCodeToString(bool); + case_typeCodeToString(label); + case_typeCodeToString(scalar); + case_typeCodeToString(vector); + case_typeCodeToString(tensor); + case_typeCodeToString(sphericalTensor); + case_typeCodeToString(symmTensor); + } + #undef case_typeCodeToString + + return word(); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/expressions/traits/exprTraits.H b/src/OpenFOAM/expressions/traits/exprTraits.H new file mode 100644 index 0000000000000000000000000000000000000000..6c2173eea87bf9c46aa073095f8dbdc6e3af1a29 --- /dev/null +++ b/src/OpenFOAM/expressions/traits/exprTraits.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::exprTypeTraits + +Description + Simple type identifiers for polymorphic expression values. + + The definitions are similar to std::integral_constant in that they + provide value, value_type (and name). + +\*---------------------------------------------------------------------------*/ + +#ifndef expressions_exprTraits_H +#define expressions_exprTraits_H + +// Regular field types +#include "label.H" +#include "scalar.H" +#include "vector.H" +#include "sphericalTensor.H" +#include "symmTensor.H" +#include "tensor.H" +#include "word.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace expressions +{ + +//- An enumeration of known and expected expression value types. +// Do not rely on the enumeration values for any direct coding. +// +// \note NONE use used when initializing types, whereas INVALID is used +// for unsupported types (never as a stored type). +// This avoids false positives when testing. +// +// Except NONE and INVALID, the enumerations will mostly not be used +// directly, but through exprTypeTraits :: value + +enum class valueTypeCode : unsigned char +{ + NONE = 0, //!< No type, or default initialized type + INVALID, //!< Invalid/unknown/error type + + // Rank 0 types + type_bool, //!< Type is 'bool' + type_label, //!< Type is 'label' + type_scalar, //!< Type is 'scalar' + + // Rank 1 types + type_vector, //!< Type is 'vector' + + // Rank 2 types + type_sphericalTensor, //!< Type is 'sphericalTensor' + type_symmTensor, //!< Type is 'symmTensor' + type_tensor //!< Type is 'tensor' +}; + + +// Global Functions + +//- From string to valueTypeCode (if any) +valueTypeCode valueTypeCodeOf(const word& dataTypeName); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace expressions + + +/*---------------------------------------------------------------------------*\ + Class exprTypeTraits Declaration +\*---------------------------------------------------------------------------*/ + +// Generic enumerated traits is INVALID (unknown) +template<class Type> +struct exprTypeTraits +{ + typedef Type value_type; + static constexpr const char* const name = ""; + static constexpr + ::Foam::expressions::valueTypeCode value = + ::Foam::expressions::valueTypeCode::INVALID; +}; + + +#undef defineExprTypeTraits +#define defineExprTypeTraits(Type, Name) \ + template<> \ + struct exprTypeTraits<Type> \ + { \ + typedef Type value_type; \ + static constexpr const char* const name = #Name; \ + static constexpr \ + ::Foam::expressions::valueTypeCode value = \ + ::Foam::expressions::valueTypeCode::type_##Name; \ + }; + + +// Define with "name" to match regular pTraits typeName +defineExprTypeTraits(bool, bool); +defineExprTypeTraits(::Foam::label, label); +defineExprTypeTraits(::Foam::scalar, scalar); +defineExprTypeTraits(::Foam::vector, vector); +defineExprTypeTraits(::Foam::tensor, tensor); +defineExprTypeTraits(::Foam::sphericalTensor, sphericalTensor); +defineExprTypeTraits(::Foam::symmTensor, symmTensor); + +#undef defineExprTypeTraits + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- A word representation of a valueTypeCode. Empty for INVALID +word name(const expressions::valueTypeCode typeCode); + + +//- A word representation of a valueTypeCode. Empty for INVALID +template<> +struct nameOp<expressions::valueTypeCode> +{ + word operator()(const expressions::valueTypeCode typeCode) const + { + return Foam::name(typeCode); + } +}; + +// No IOstream Operators for valueTypeCode at the moment (Nov 2021) + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/pTraits/pTraits.H b/src/OpenFOAM/primitives/traits/pTraits.H similarity index 100% rename from src/OpenFOAM/primitives/pTraits/pTraits.H rename to src/OpenFOAM/primitives/traits/pTraits.H diff --git a/src/finiteVolume/expressions/patch/patchExprDriver.H b/src/finiteVolume/expressions/patch/patchExprDriver.H index 55a907ffa3bae22bf4b96e8063cab9f01861b733..25ab0469d329539dcabca8388450183b10482dfe 100644 --- a/src/finiteVolume/expressions/patch/patchExprDriver.H +++ b/src/finiteVolume/expressions/patch/patchExprDriver.H @@ -67,6 +67,7 @@ SourceFiles #include "patchExprFwd.H" #include "fvExprDriver.H" +#include "exprFieldAssociation.H" #include "Enum.H" #include "volFields.H" #include "surfaceFields.H" diff --git a/src/finiteVolume/expressions/patch/patchExprDriverI.H b/src/finiteVolume/expressions/patch/patchExprDriverI.H index b4ae95c4ea0162912e1eea94275b249383d301ce..aed253621ff2b9d14ec730b178e4c1ff9ba12e78 100644 --- a/src/finiteVolume/expressions/patch/patchExprDriverI.H +++ b/src/finiteVolume/expressions/patch/patchExprDriverI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,10 +36,10 @@ inline Foam::label Foam::expressions::patchExpr::parseDriver::size { case FieldAssociation::POINT_DATA : return patch_.patch().nPoints(); - break; - case FieldAssociation::SURFACE_DATA : + + case FieldAssociation::FACE_DATA : return patch_.patch().size(); - break; + default: break; } diff --git a/src/finiteVolume/expressions/patch/patchExprFwd.H b/src/finiteVolume/expressions/patch/patchExprFwd.H index 5682b896fbf6286a68bb8cb68f845ac174d283b1..cd04bcbf6cabdc16ff105904ef7691646f427e64 100644 --- a/src/finiteVolume/expressions/patch/patchExprFwd.H +++ b/src/finiteVolume/expressions/patch/patchExprFwd.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -52,16 +52,6 @@ union scanToken; //- Static debugging option extern int debug; - -//- The field association for patch expressions (mutually exclusive) -enum FieldAssociation : unsigned char -{ - NO_DATA = 0, //!< No data - POINT_DATA = 1, //!< Point data - SURFACE_DATA = 2 //!< Surface data -}; - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace patchExpr @@ -73,6 +63,7 @@ typedef patchExpr::parseDriver patchExprDriver; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace expressions } // End namespace Foam diff --git a/src/finiteVolume/expressions/volume/volumeExprDriver.H b/src/finiteVolume/expressions/volume/volumeExprDriver.H index 5237a38853aac7f16ac96840f98a3fe511cfad57..985b3f27e27dd7235a7f0f62fe1032c3c357df6a 100644 --- a/src/finiteVolume/expressions/volume/volumeExprDriver.H +++ b/src/finiteVolume/expressions/volume/volumeExprDriver.H @@ -84,6 +84,7 @@ SourceFiles #include "volumeExprFwd.H" #include "fvExprDriver.H" +#include "exprFieldAssociation.H" #include "volFields.H" #include "surfaceFields.H" #include "pointFields.H" @@ -126,7 +127,7 @@ protected: bool isLogical_; //- A volume/surface/point field - enum FieldAssociation fieldGeoType_; + expressions::FieldAssociation fieldGeoType_; //- The result dimensions dimensionSet resultDimension_; @@ -259,37 +260,37 @@ public: //- The result type-name. // Normally volScalarField, surfaceVectorField etc, // but Scalar is modified for logical as volScalarField etc - const word& resultType() const + const word& resultType() const noexcept { return resultType_; } //- The geometric field association - FieldAssociation fieldAssociation() const + FieldAssociation fieldAssociation() const noexcept { return fieldGeoType_; } //- A logical (bool-like) field. Actually stored as a scalar. - bool isLogical() const + bool isLogical() const noexcept { return isLogical_; } //- A volume field - bool isVolumeData() const + bool isVolumeData() const noexcept { return fieldGeoType_ == FieldAssociation::VOLUME_DATA; } //- A surface field - bool isSurfaceData() const + bool isFaceData() const noexcept { - return fieldGeoType_ == FieldAssociation::SURFACE_DATA; + return fieldGeoType_ == FieldAssociation::FACE_DATA; } //- A point field - bool isPointData() const + bool isPointData() const noexcept { return fieldGeoType_ == FieldAssociation::POINT_DATA; } diff --git a/src/finiteVolume/expressions/volume/volumeExprDriverI.H b/src/finiteVolume/expressions/volume/volumeExprDriverI.H index 2863f0ba1e8b900bb5dc0c425a1ace255932231a..8c6d00bb50bb8aa038850c1f4e070e25d72ec9f7 100644 --- a/src/finiteVolume/expressions/volume/volumeExprDriverI.H +++ b/src/finiteVolume/expressions/volume/volumeExprDriverI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,13 +36,13 @@ inline Foam::label Foam::expressions::volumeExpr::parseDriver::size { case FieldAssociation::POINT_DATA : return mesh_.nPoints(); - break; - case FieldAssociation::SURFACE_DATA : + + case FieldAssociation::FACE_DATA : return mesh_.nInternalFaces(); - break; + case FieldAssociation::VOLUME_DATA : return mesh_.nCells(); - break; + default: break; } diff --git a/src/finiteVolume/expressions/volume/volumeExprDriverTemplates.C b/src/finiteVolume/expressions/volume/volumeExprDriverTemplates.C index d16a946d358d851654d30ad23be17c1858c2e6d6..60c54f2d40d0e77083c0ee8e0cd7e989818fa14c 100644 --- a/src/finiteVolume/expressions/volume/volumeExprDriverTemplates.C +++ b/src/finiteVolume/expressions/volume/volumeExprDriverTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -102,7 +102,7 @@ void Foam::expressions::volumeExpr::parseDriver::setResult // Characteristics resultType_ = pTraits<fieldType>::typeName; isLogical_ = logical; - fieldGeoType_ = SURFACE_DATA; + fieldGeoType_ = FACE_DATA; // Always strip out dimensions? if (!resultDimension_.dimensionless()) diff --git a/src/finiteVolume/expressions/volume/volumeExprFwd.H b/src/finiteVolume/expressions/volume/volumeExprFwd.H index 1a5df406c4bb7c02c2634980a815796d8cf581a4..bff30718d10a6be74e54f0e596f8948e4e884bc6 100644 --- a/src/finiteVolume/expressions/volume/volumeExprFwd.H +++ b/src/finiteVolume/expressions/volume/volumeExprFwd.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,6 +40,7 @@ namespace expressions { namespace volumeExpr { + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Forward Declarations @@ -51,16 +52,6 @@ union scanToken; //- Static debugging option extern int debug; -//- The field association for volume expressions (mutually exclusive) -enum FieldAssociation : unsigned char -{ - NO_DATA = 0, //!< No data - POINT_DATA = 1, //!< Point data - SURFACE_DATA = 2, //!< Surface data - VOLUME_DATA = 3 //!< Volume data -}; - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace volumeExpr diff --git a/src/surfMesh/polySurface/polySurface.H b/src/surfMesh/polySurface/polySurface.H index 9fb5479b8011e598245098a74ba563da5c87653d..45cdff160fdf7c12a6a75c5c39731860ab61e14c 100644 --- a/src/surfMesh/polySurface/polySurface.H +++ b/src/surfMesh/polySurface/polySurface.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -77,9 +77,9 @@ public: enum FieldAssociation { NO_DATA = 0, //!< No associated data - FACE_DATA = 0x1, //!< Data associated with faces - POINT_DATA = 0x2, //!< Data associated with points - FACE_POINT_DATA = 0x3 //!< Data associated with faces and points + FACE_DATA = 1, //!< Data associated with faces + POINT_DATA = 2, //!< Data associated with points + FACE_OR_POINT_DATA = 3 //!< Data associated with faces or points };