diff --git a/src/OpenFOAM/fields/Fields/fieldTypes.C b/src/OpenFOAM/fields/Fields/fieldTypes.C index 79ff2e60d9..c7160c859d 100644 --- a/src/OpenFOAM/fields/Fields/fieldTypes.C +++ b/src/OpenFOAM/fields/Fields/fieldTypes.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -70,4 +70,16 @@ const Foam::word Foam::fieldTypes::zeroGradientType ); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +bool Foam::fieldTypes::is_basic(const word& clsName) +{ + return + ( + clsName.ends_with("Field") + && fieldTypes::basic.contains(clsName) + ); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/fieldTypes.H b/src/OpenFOAM/fields/Fields/fieldTypes.H index 55d8e62942..d890277926 100644 --- a/src/OpenFOAM/fields/Fields/fieldTypes.H +++ b/src/OpenFOAM/fields/Fields/fieldTypes.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -81,6 +81,9 @@ namespace fieldTypes // These also correspond to cloud output fields. extern const wordList basic; +//- Test if the class name appears to be a basic field +bool is_basic(const word& clsName); + // Commonly used patch field types diff --git a/src/OpenFOAM/fields/Fields/primitiveFieldsFwd.H b/src/OpenFOAM/fields/Fields/primitiveFieldsFwd.H index 1c84b8a9cb..8098f859d9 100644 --- a/src/OpenFOAM/fields/Fields/primitiveFieldsFwd.H +++ b/src/OpenFOAM/fields/Fields/primitiveFieldsFwd.H @@ -33,8 +33,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef primitiveFieldsFwd_H -#define primitiveFieldsFwd_H +#ifndef Foam_primitiveFieldsFwd_H +#define Foam_primitiveFieldsFwd_H #include "fieldTypes.H" diff --git a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C index dc017832b4..bf2e6660a8 100644 --- a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C +++ b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -95,4 +96,16 @@ const Foam::wordList Foam::fieldTypes::point }); +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +bool Foam::fieldTypes::is_point(const word& clsName) +{ + return + ( + clsName.starts_with("point") // && clsName.ends_with("Field") + && fieldTypes::point.contains(clsName) + ); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H index 5cfb851386..14f5559e30 100644 --- a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H +++ b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -96,12 +96,15 @@ typedef namespace fieldTypes { - //- Standard point field types (scalar, vector, tensor, etc) - extern const wordList point; + +//- Standard point field types (scalar, vector, tensor, etc) +extern const wordList point; + +//- Test if the class name appears to be a point field +bool is_point(const word& clsName); } // End namespace fieldTypes - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteArea/fields/areaFields/areaFields.C b/src/finiteArea/fields/areaFields/areaFields.C index b1f4e7f853..51f28878cd 100644 --- a/src/finiteArea/fields/areaFields/areaFields.C +++ b/src/finiteArea/fields/areaFields/areaFields.C @@ -156,4 +156,16 @@ const Foam::wordList Foam::fieldTypes::area_internal }); +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +bool Foam::fieldTypes::is_area(const word& clsName) +{ + return + ( + clsName.starts_with("area") // && clsName.ends_with("Field") + && fieldTypes::area.contains(clsName) + ); +} + + // ************************************************************************* // diff --git a/src/finiteArea/fields/areaFields/areaFieldsFwd.H b/src/finiteArea/fields/areaFields/areaFieldsFwd.H index 382bb0bba9..653270daf8 100644 --- a/src/finiteArea/fields/areaFields/areaFieldsFwd.H +++ b/src/finiteArea/fields/areaFields/areaFieldsFwd.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -92,15 +92,18 @@ typedef namespace fieldTypes { - //- Standard area field types (scalar, vector, tensor, etc) - extern const wordList area; - //- Standard dimensioned field types (scalar, vector, tensor, etc) - extern const wordList area_internal; +//- Standard area field types (scalar, vector, tensor, etc) +extern const wordList area; + +//- Standard dimensioned field types (scalar, vector, tensor, etc) +extern const wordList area_internal; + +//- Test if the class name appears to be an area field +bool is_area(const word& clsName); } // End namespace fieldTypes - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/fields/surfaceFields/surfaceFields.C b/src/finiteVolume/fields/surfaceFields/surfaceFields.C index a8c900d660..3ea687217c 100644 --- a/src/finiteVolume/fields/surfaceFields/surfaceFields.C +++ b/src/finiteVolume/fields/surfaceFields/surfaceFields.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,4 +94,16 @@ const Foam::wordList Foam::fieldTypes::surface }); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +bool Foam::fieldTypes::is_surface(const word& clsName) +{ + return + ( + clsName.starts_with("surface") // && clsName.ends_with("Field") + && fieldTypes::surface.contains(clsName) + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/surfaceFields/surfaceFieldsFwd.H b/src/finiteVolume/fields/surfaceFields/surfaceFieldsFwd.H index d0caef925e..49ad2a2c42 100644 --- a/src/finiteVolume/fields/surfaceFields/surfaceFieldsFwd.H +++ b/src/finiteVolume/fields/surfaceFields/surfaceFieldsFwd.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,8 +86,12 @@ typedef namespace fieldTypes { - //- Standard surface field types (scalar, vector, tensor, etc) - extern const wordList surface; + +//- Standard surface field types (scalar, vector, tensor, etc) +extern const wordList surface; + +//- Test if the class name appears to be an surface field +bool is_surface(const word& clsName); } // End namespace fieldTypes diff --git a/src/finiteVolume/fields/volFields/volFields.C b/src/finiteVolume/fields/volFields/volFields.C index 25895c46a7..3f5a337336 100644 --- a/src/finiteVolume/fields/volFields/volFields.C +++ b/src/finiteVolume/fields/volFields/volFields.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018,2023 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -157,4 +157,16 @@ const Foam::wordList Foam::fieldTypes::volume }); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +bool Foam::fieldTypes::is_volume(const word& clsName) +{ + return + ( + clsName.starts_with("vol") // && clsName.ends_with("Field") + && fieldTypes::volume.contains(clsName) + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/volFields/volFieldsFwd.H b/src/finiteVolume/fields/volFields/volFieldsFwd.H index 32bb8d658e..8e0b91533e 100644 --- a/src/finiteVolume/fields/volFields/volFieldsFwd.H +++ b/src/finiteVolume/fields/volFields/volFieldsFwd.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -92,11 +92,15 @@ typedef namespace fieldTypes { - //- Standard dimensioned field types (scalar, vector, tensor, etc) - extern const wordList internal; - //- Standard volume field types (scalar, vector, tensor, etc) - extern const wordList volume; +//- Standard dimensioned field types (scalar, vector, tensor, etc) +extern const wordList internal; + +//- Standard volume field types (scalar, vector, tensor, etc) +extern const wordList volume; + +//- Test if the class name appears to be a volume field +bool is_volume(const word& clsName); } // End namespace fieldTypes