Commit fc5895f1 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: rename toLabel, toLabelRange classes -> labelOp, labelRangeOp

- make purpose as functors _slightly_ clearer.

- base definition removed for stricter enforcement of the specialization
  requirement.
parent 97dc9f40
......@@ -426,7 +426,7 @@ int main(int argc, char *argv[])
auto output = ListOps::create<label>
(
input,
toLabel<int64_t>()
labelOp<int64_t>()
);
Info<< "label (from int64): " << flatOutput(output) << endl;
}
......@@ -438,7 +438,7 @@ int main(int argc, char *argv[])
auto output = ListOps::create<label>
(
input,
toLabel<int32_t>()
labelOp<int32_t>()
);
Info<< "label (from int32): " << flatOutput(output) << endl;
}
......
......@@ -1010,7 +1010,7 @@ Foam::label Foam::checkGeometry
ListOps::create<label>
(
UPstream::procID(UPstream::worldComm),
toLabel<int>() // int -> label
labelOp<int>() // int -> label
),
ami.srcWeightsSum(),
mergedWeights
......@@ -1064,7 +1064,7 @@ Foam::label Foam::checkGeometry
ListOps::create<label>
(
UPstream::procID(UPstream::worldComm),
toLabel<int>() // int -> label
labelOp<int>() // int -> label
),
ami.tgtWeightsSum(),
mergedWeights
......
......@@ -87,7 +87,7 @@ void writeWeights
ListOps::create<label>
(
UPstream::procID(UPstream::worldComm),
toLabel<int>() // int -> label
labelOp<int>() // int -> label
),
wghtSum,
mergedWeights
......
......@@ -478,7 +478,7 @@ void setValue
// auto labels = ListOps::create<label>
// (
// ints,
// toLabel<int>()
// labelOp<int>()
// );
//
// auto vectors = ListOps::create<vector>
......
......@@ -426,9 +426,9 @@ public:
// Global Functions
//- Get the labelRange for a polyPatch
//- The labelRange of a polyPatch
template<>
struct toLabelRange<polyPatch>
struct labelRangeOp<polyPatch>
{
labelRange operator()(const polyPatch& pp) const
{
......
......@@ -122,15 +122,16 @@ inline label component(const label l, const direction)
/*---------------------------------------------------------------------------*\
Struct toLabel Declaration
Struct labelOp Declaration
\*---------------------------------------------------------------------------*/
//- Conversion to label structure
template<class Type> struct toLabel {};
//- Conversion/extraction to label operation
// Specialization of this shall provide a corresponding \c operator().
template<class> struct labelOp;
//- Convert (likely promote) from int32_t to label
template<>
struct toLabel<int32_t>
struct labelOp<int32_t>
{
constexpr label operator()(const int32_t& val) const noexcept
{
......@@ -141,7 +142,7 @@ struct toLabel<int32_t>
//- Convert (possibly truncate) from int64_t to label
template<>
struct toLabel<int64_t>
struct labelOp<int64_t>
{
constexpr label operator()(const int64_t& val) const noexcept
{
......
......@@ -25,7 +25,7 @@ Class
Foam::labelRange
Description
A range of labels defined by a start and a size.
An range or interval of labels defined by a start and a size.
SourceFiles
labelRange.C
......@@ -248,14 +248,14 @@ public:
public:
// Constructors
// Constructors
//- Construct from range at given local index.
// If the local index is out of range (eg, negaative),
// this creates the 'end' iterator
inline const_iterator(const labelRange* range, const label i=0);
// Member operators
// Member Operators
//- Return the current (global) value
inline label operator*() const;
......@@ -293,8 +293,20 @@ public:
// Global Functions
//- Conversion to labelRange operations
template<class Type> struct toLabelRange {};
//- Conversion/extraction to labelRange operation (functor).
// Specializations shall provide a corresponding \c operator().
// For example,
// \code
// template<>
// struct labelRangeOp<polyPatch>
// {
// labelRange operator()(const polyPatch& pp) const
// {
// return labelRange(pp.start(), pp.size());
// }
// };
// \endcode
template<class> struct labelRangeOp;
// Global Operators
......
......@@ -183,9 +183,9 @@ public:
// Global Functions
//- Get the labelRange for a surfZone
//- The labelRange of a surfZone
template<>
struct toLabelRange<surfZone>
struct labelRangeOp<surfZone>
{
labelRange operator()(const surfZone& zone) const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment