mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: additional contiguous traits (#1378)
- change contiguous from a series of global functions to separate
templated traits classes:
- is_contiguous
- is_contiguous_label
- is_contiguous_scalar
The static constexpr 'value' and a constexpr conversion operator
allow use in template expressions. The change also makes it much
easier to define general traits and to inherit from them.
The is_contiguous_label and is_contiguous_scalar are special traits
for handling data of homogeneous components of the respective types.
This commit is contained in:
committed by
Andrew Heather
parent
3c07a1bb6f
commit
1d79c0452c
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -64,16 +64,14 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
class primitiveMesh;
|
||||
class edge;
|
||||
class face;
|
||||
class polyMesh;
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class directionInfo;
|
||||
|
||||
Istream& operator>>(Istream&, directionInfo&);
|
||||
@ -86,7 +84,7 @@ Ostream& operator<<(Ostream&, const directionInfo&);
|
||||
|
||||
class directionInfo
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
// Either mesh edge or face point
|
||||
label index_;
|
||||
@ -262,12 +260,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with directionInfo type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<directionInfo>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for directionInfo
|
||||
template<> struct is_contiguous<directionInfo> : std::true_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -49,13 +49,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class wallNormalInfo;
|
||||
|
||||
Istream& operator>>(Istream&, wallNormalInfo&);
|
||||
@ -202,12 +198,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with wallNormalInfo type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<wallNormalInfo>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for wallNormalInfo
|
||||
template<> struct is_contiguous<wallNormalInfo> : std::true_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -46,7 +46,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
class pointEdgeStructuredWalk;
|
||||
@ -236,12 +236,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with pointEdgeStructuredWalk type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<pointEdgeStructuredWalk>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for pointEdgeStructuredWalk
|
||||
template<> struct is_contiguous<pointEdgeStructuredWalk> : std::true_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
@ -47,13 +47,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class externalPointEdgePoint;
|
||||
|
||||
Istream& operator>>(Istream&, externalPointEdgePoint&);
|
||||
@ -251,12 +247,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with externalPointEdgePoint type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<externalPointEdgePoint>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for externalPointEdgePoint
|
||||
template<> struct is_contiguous<externalPointEdgePoint> : std::true_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
@ -46,13 +46,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class pointEdgeCollapse;
|
||||
|
||||
Istream& operator>>(Istream&, pointEdgeCollapse&);
|
||||
@ -221,12 +217,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with pointEdgeCollapse type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<pointEdgeCollapse>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for pointEdgeCollapse
|
||||
template<> struct is_contiguous<pointEdgeCollapse> : std::true_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -47,12 +47,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class refinementData;
|
||||
|
||||
Istream& operator>>(Istream&, refinementData&);
|
||||
@ -219,12 +216,13 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with refinementData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<refinementData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for refinementData
|
||||
template<> struct is_contiguous<refinementData> : std::true_type {};
|
||||
|
||||
//- Contiguous label data for refinementData
|
||||
template<> struct is_contiguous_label<refinementData> : std::true_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -47,12 +47,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class refinementDistanceData;
|
||||
|
||||
Istream& operator>>(Istream&, refinementDistanceData&);
|
||||
@ -65,7 +62,6 @@ Ostream& operator<<(Ostream&, const refinementDistanceData&);
|
||||
|
||||
class refinementDistanceData
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Unrefined (level0) buffer size (nBufferLayers*level0Size)
|
||||
@ -253,12 +249,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with refinementDistanceData type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<refinementDistanceData>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for refinementDistanceData
|
||||
template<> struct is_contiguous<refinementDistanceData> : std::true_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Reference in New Issue
Block a user