mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add convenience fieldTypes tests for volume/area etc fields
This commit is contained in:
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef primitiveFieldsFwd_H
|
||||
#define primitiveFieldsFwd_H
|
||||
#ifndef Foam_primitiveFieldsFwd_H
|
||||
#define Foam_primitiveFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user