mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: identityOp as equivalent to std::identity (C++20)
- similar to how noOp was defined, but with perfect forwarding STYLE: combine Swap into stdFoam STYLE: capitalize FileOp, NegateOp template parameters
This commit is contained in:
@ -33,7 +33,7 @@ License
|
|||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
#include "StringStream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "flipOp.H"
|
#include "StringListOps.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ int main()
|
|||||||
(
|
(
|
||||||
table1.keys().begin(),
|
table1.keys().begin(),
|
||||||
table1.keys().end(),
|
table1.keys().end(),
|
||||||
noOp{}
|
identityOp{}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
sort(sortKeys);
|
sort(sortKeys);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Description
|
|||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "ITstream.H"
|
#include "ITstream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "flipOp.H"
|
#include "StringListOps.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
stringInput.cbegin(),
|
stringInput.cbegin(),
|
||||||
stringInput.cend(),
|
stringInput.cend(),
|
||||||
Foam::noOp{}
|
Foam::identityOp{}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const mapDistribute& faceMap = map.faceMap();
|
const mapDistribute& faceMap = map.faceMap();
|
||||||
pointField fc(mesh.faceCentres());
|
pointField fc(mesh.faceCentres());
|
||||||
faceMap.distribute(fc, noOp());
|
faceMap.distribute(fc, identityOp());
|
||||||
Pout<< "Construct size:" << faceMap.constructSize() << endl;
|
Pout<< "Construct size:" << faceMap.constructSize() << endl;
|
||||||
forAll(distributedMesh.faceCentres(), facei)
|
forAll(distributedMesh.faceCentres(), facei)
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const mapDistribute& cellMap = map.cellMap();
|
const mapDistribute& cellMap = map.cellMap();
|
||||||
pointField cc(mesh.cellCentres());
|
pointField cc(mesh.cellCentres());
|
||||||
cellMap.distribute(cc, noOp());
|
cellMap.distribute(cc, identityOp());
|
||||||
Pout<< "Construct size:" << cellMap.constructSize() << endl;
|
Pout<< "Construct size:" << cellMap.constructSize() << endl;
|
||||||
forAll(distributedMesh.cellCentres(), celli)
|
forAll(distributedMesh.cellCentres(), celli)
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const mapDistribute& pointMap = map.pointMap();
|
const mapDistribute& pointMap = map.pointMap();
|
||||||
pointField pc(mesh.points());
|
pointField pc(mesh.points());
|
||||||
pointMap.distribute(pc, noOp());
|
pointMap.distribute(pc, identityOp());
|
||||||
Pout<< "Construct size:" << pointMap.constructSize() << endl;
|
Pout<< "Construct size:" << pointMap.constructSize() << endl;
|
||||||
forAll(distributedMesh.points(), pointi)
|
forAll(distributedMesh.points(), pointi)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -614,7 +614,7 @@ void testEdgeFlip2(const polyMesh& mesh, Random& rndGen)
|
|||||||
edgePointCombineOp(),
|
edgePointCombineOp(),
|
||||||
PointPair(point::max, point::max),
|
PointPair(point::max, point::max),
|
||||||
edgePointTransformOp(),
|
edgePointTransformOp(),
|
||||||
noOp()
|
identityOp()
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(fld, edgeI)
|
forAll(fld, edgeI)
|
||||||
|
|||||||
@ -51,7 +51,6 @@ Description
|
|||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
#include "symmetryPolyPatch.H"
|
#include "symmetryPolyPatch.H"
|
||||||
#include "oldCyclicPolyPatch.H"
|
#include "oldCyclicPolyPatch.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "readHexLabel.H"
|
#include "readHexLabel.H"
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,6 @@ SourceFiles
|
|||||||
#include "List.H"
|
#include "List.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "InfoProxy.H"
|
#include "InfoProxy.H"
|
||||||
#include "tetCell.H"
|
#include "tetCell.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
|
|||||||
@ -45,9 +45,9 @@ SourceFiles
|
|||||||
#include "uLabel.H"
|
#include "uLabel.H"
|
||||||
#include "zero.H"
|
#include "zero.H"
|
||||||
#include "contiguous.H"
|
#include "contiguous.H"
|
||||||
|
#include "stdFoam.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "Hash.H"
|
#include "Hash.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "SLListFwd.H"
|
#include "SLListFwd.H"
|
||||||
#include "ListPolicy.H"
|
#include "ListPolicy.H"
|
||||||
|
|
||||||
|
|||||||
@ -42,8 +42,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef UList_H
|
#ifndef Foam_UList_H
|
||||||
#define UList_H
|
#define Foam_UList_H
|
||||||
|
|
||||||
#include "bool.H"
|
#include "bool.H"
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
@ -51,10 +51,9 @@ SourceFiles
|
|||||||
#include "zero.H"
|
#include "zero.H"
|
||||||
#include "one.H"
|
#include "one.H"
|
||||||
#include "contiguous.H"
|
#include "contiguous.H"
|
||||||
#include "nullObject.H"
|
|
||||||
#include "stdFoam.H"
|
#include "stdFoam.H"
|
||||||
|
#include "nullObject.H"
|
||||||
#include "Hash.H"
|
#include "Hash.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "ListPolicy.H"
|
#include "ListPolicy.H"
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|||||||
@ -346,7 +346,7 @@ void Foam::Field<Type>::map
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
distMap.distribute(newMapF, noOp());
|
distMap.distribute(newMapF, identityOp());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapper.direct() && notNull(mapper.directAddressing()))
|
if (mapper.direct() && notNull(mapper.directAddressing()))
|
||||||
@ -417,7 +417,7 @@ void Foam::Field<Type>::autoMap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
distMap.distribute(fCpy, noOp());
|
distMap.distribute(fCpy, identityOp());
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
if
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,8 +34,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef FieldOps_H
|
#ifndef Foam_FieldOps_H
|
||||||
#define FieldOps_H
|
#define Foam_FieldOps_H
|
||||||
|
|
||||||
#include "flipOp.H"
|
#include "flipOp.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
@ -127,7 +127,7 @@ void ternary
|
|||||||
//- depending on the conditional.
|
//- depending on the conditional.
|
||||||
//
|
//
|
||||||
// The meaning of the conditional is adjusted by the flip operation,
|
// The meaning of the conditional is adjusted by the flip operation,
|
||||||
// which is typically Foam::noOp() or Foam::flipBoolOp()
|
// which is typically Foam::identityOp() or Foam::flipBoolOp()
|
||||||
//
|
//
|
||||||
// Similar parameter requirements as Foam::subset()
|
// Similar parameter requirements as Foam::subset()
|
||||||
//
|
//
|
||||||
@ -150,7 +150,7 @@ void ternarySelect
|
|||||||
//- depending on the conditional.
|
//- depending on the conditional.
|
||||||
//
|
//
|
||||||
// The meaning of the conditional is adjusted by the flip operation,
|
// The meaning of the conditional is adjusted by the flip operation,
|
||||||
// which is typically Foam::noOp() or Foam::flipBoolOp()
|
// which is typically Foam::identityOp() or Foam::flipBoolOp()
|
||||||
template<class T, class FlipOp>
|
template<class T, class FlipOp>
|
||||||
void ternarySelect
|
void ternarySelect
|
||||||
(
|
(
|
||||||
@ -172,7 +172,7 @@ void ternarySelect
|
|||||||
const Field<T>& b
|
const Field<T>& b
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ternarySelect(result, cond, a, b, noOp());
|
ternarySelect(result, cond, a, b, identityOp{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ void ternarySelect
|
|||||||
const Field<T>& b
|
const Field<T>& b
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ternarySelect(result, cond, a, b, noOp());
|
ternarySelect(result, cond, a, b, identityOp{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "cyclicPointPatchField.H"
|
#include "cyclicPointPatchField.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "transformField.H"
|
#include "transformField.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
|
|
||||||
|
|||||||
@ -386,21 +386,21 @@ protected:
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Type scatterList(const UList<Type>&, const int, const label comm) const;
|
Type scatterList(const UList<Type>&, const int, const label comm) const;
|
||||||
|
|
||||||
template<class Type, class fileOp>
|
template<class Type, class FileOp>
|
||||||
Type masterOp
|
Type masterOp
|
||||||
(
|
(
|
||||||
const fileName& fName,
|
const fileName& fName,
|
||||||
const fileOp& fop,
|
const FileOp& fop,
|
||||||
const int tag,
|
const int tag,
|
||||||
const label comm
|
const label comm
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
template<class Type, class fileOp>
|
template<class Type, class FileOp>
|
||||||
Type masterOp
|
Type masterOp
|
||||||
(
|
(
|
||||||
const fileName& src,
|
const fileName& src,
|
||||||
const fileName& dest,
|
const fileName& dest,
|
||||||
const fileOp& fop,
|
const FileOp& fop,
|
||||||
const int tag,
|
const int tag,
|
||||||
const label comm
|
const label comm
|
||||||
) const;
|
) const;
|
||||||
|
|||||||
@ -66,11 +66,11 @@ Type Foam::fileOperations::masterUncollatedFileOperation::scatterList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, class fileOp>
|
template<class Type, class FileOp>
|
||||||
Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
||||||
(
|
(
|
||||||
const fileName& fName,
|
const fileName& fName,
|
||||||
const fileOp& fop,
|
const FileOp& fop,
|
||||||
const int tag,
|
const int tag,
|
||||||
const label comm
|
const label comm
|
||||||
) const
|
) const
|
||||||
@ -78,7 +78,7 @@ Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
|||||||
if (IFstream::debug)
|
if (IFstream::debug)
|
||||||
{
|
{
|
||||||
Pout<< "masterUncollatedFileOperation::masterOp : Operation "
|
Pout<< "masterUncollatedFileOperation::masterOp : Operation "
|
||||||
<< typeid(fileOp).name()
|
<< typeid(FileOp).name()
|
||||||
<< " on " << fName << endl;
|
<< " on " << fName << endl;
|
||||||
}
|
}
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
@ -109,12 +109,12 @@ Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, class fileOp>
|
template<class Type, class FileOp>
|
||||||
Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
||||||
(
|
(
|
||||||
const fileName& src,
|
const fileName& src,
|
||||||
const fileName& dest,
|
const fileName& dest,
|
||||||
const fileOp& fop,
|
const FileOp& fop,
|
||||||
const int tag,
|
const int tag,
|
||||||
const label comm
|
const label comm
|
||||||
) const
|
) const
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -23,28 +23,14 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Namespace
|
|
||||||
stdFoam
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Global macros and templates used by OpenFOAM and some standard
|
Includes some standard C++ headers, defines global macros and templates
|
||||||
C++ headers.
|
used in multiple places by OpenFOAM.
|
||||||
|
|
||||||
Some of the templates defined here correspond to useful
|
|
||||||
std templates that are part of future C++ standards, or that
|
|
||||||
are in a state of change. Defining them here provides some additional
|
|
||||||
control over which definitions are used within the OpenFOAM code-base.
|
|
||||||
|
|
||||||
SeeAlso
|
|
||||||
- http://en.cppreference.com/w/cpp/iterator/begin
|
|
||||||
- http://en.cppreference.com/w/cpp/iterator/end
|
|
||||||
- http://en.cppreference.com/w/cpp/iterator/rbegin
|
|
||||||
- http://en.cppreference.com/w/cpp/iterator/rend
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef stdFoam_H
|
#ifndef Foam_stdFoam_H
|
||||||
#define stdFoam_H
|
#define Foam_stdFoam_H
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -71,19 +57,70 @@ SeeAlso
|
|||||||
//- Namespace for OpenFOAM
|
//- Namespace for OpenFOAM
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
//- Implementation details for various OpenFOAM classes
|
|
||||||
namespace Detail {}
|
|
||||||
|
|
||||||
//- Additional OpenFOAM modules
|
//- Implementation details for various OpenFOAM classes
|
||||||
namespace Module {}
|
namespace Detail {}
|
||||||
|
|
||||||
// Standard items
|
//- Additional OpenFOAM modules
|
||||||
|
namespace Module {}
|
||||||
|
|
||||||
//- Allow use of std::unique_ptr directly as Foam::unique_ptr
|
// Standard items
|
||||||
using std::unique_ptr;
|
|
||||||
|
//- Allow use of std::unique_ptr directly as Foam::unique_ptr
|
||||||
|
using std::unique_ptr;
|
||||||
|
|
||||||
|
|
||||||
|
//- A functor that returns its argument unchanged (cf. C++20 std::identity)
|
||||||
|
//- Should \em never be specialized.
|
||||||
|
struct identityOp
|
||||||
|
{
|
||||||
|
using is_transparent = void;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
constexpr T&& operator()(T&& val) const noexcept
|
||||||
|
{
|
||||||
|
return std::forward<T>(val);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Swap non-array types as per std::swap, but in Foam namespace.
|
||||||
|
// \sa http://www.cplusplus.com/reference/utility/swap/
|
||||||
|
//
|
||||||
|
// \note For complex structures, it is usual to provide a swap() member
|
||||||
|
// function and specialize Swap()
|
||||||
|
template<class T>
|
||||||
|
void Swap(T& a, T& b)
|
||||||
|
{
|
||||||
|
std::swap(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Swap array types as per std::swap example, but in Foam namespace.
|
||||||
|
// \sa http://www.cplusplus.com/reference/utility/swap/
|
||||||
|
template<class T, size_t N>
|
||||||
|
void Swap(T (&a)[N], T (&b)[N])
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < N; ++i)
|
||||||
|
{
|
||||||
|
Foam::Swap(a[i], b[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Namespace for std templates that are are part of future C++ standards
|
||||||
|
//- or that are in a state of change.
|
||||||
|
//
|
||||||
|
// SeeAlso
|
||||||
|
// - http://en.cppreference.com/w/cpp/iterator/begin
|
||||||
|
// - http://en.cppreference.com/w/cpp/iterator/end
|
||||||
|
// - http://en.cppreference.com/w/cpp/iterator/rbegin
|
||||||
|
// - http://en.cppreference.com/w/cpp/iterator/rend
|
||||||
|
|
||||||
namespace stdFoam
|
namespace stdFoam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "scalarMatrices.H"
|
#include "scalarMatrices.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -487,11 +487,11 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Distribute data using default commsType.
|
//- Distribute data using default commsType.
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
void distribute
|
void distribute
|
||||||
(
|
(
|
||||||
List<T>& fld,
|
List<T>& fld,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const bool dummyTransform = true,
|
const bool dummyTransform = true,
|
||||||
const int tag = UPstream::msgType()
|
const int tag = UPstream::msgType()
|
||||||
) const;
|
) const;
|
||||||
|
|||||||
@ -961,7 +961,7 @@ void Foam::mapDistributeBase::compact
|
|||||||
elemIsUsed,
|
elemIsUsed,
|
||||||
map[i],
|
map[i],
|
||||||
constructHasFlip_,
|
constructHasFlip_,
|
||||||
noOp() // do not flip elemIsUsed value
|
identityOp() // Do not flip elemIsUsed value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,7 +992,7 @@ void Foam::mapDistributeBase::compact
|
|||||||
elemIsUsed,
|
elemIsUsed,
|
||||||
map[i],
|
map[i],
|
||||||
constructHasFlip_,
|
constructHasFlip_,
|
||||||
noOp() // do not flip elemIsUsed value
|
identityOp() // Do not flip elemIsUsed value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,24 +172,24 @@ protected:
|
|||||||
labelList& compactStart
|
labelList& compactStart
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class T, class CombineOp, class negateOp>
|
template<class T, class CombineOp, class NegateOp>
|
||||||
static void flipAndCombine
|
static void flipAndCombine
|
||||||
(
|
(
|
||||||
const labelUList& map,
|
const labelUList& map,
|
||||||
const bool hasFlip,
|
const bool hasFlip,
|
||||||
const UList<T>& rhs,
|
const UList<T>& rhs,
|
||||||
const CombineOp& cop,
|
const CombineOp& cop,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
List<T>& lhs
|
List<T>& lhs
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
static T accessAndFlip
|
static T accessAndFlip
|
||||||
(
|
(
|
||||||
const UList<T>& fld,
|
const UList<T>& fld,
|
||||||
const label index,
|
const label index,
|
||||||
const bool hasFlip,
|
const bool hasFlip,
|
||||||
const negateOp& negOp
|
const NegateOp& negOp
|
||||||
);
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -390,7 +390,7 @@ public:
|
|||||||
//- Distribute data. Note:schedule only used for
|
//- Distribute data. Note:schedule only used for
|
||||||
// Pstream::commsTypes::scheduled for now, all others just use
|
// Pstream::commsTypes::scheduled for now, all others just use
|
||||||
// send-to-all, receive-from-all.
|
// send-to-all, receive-from-all.
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
static void distribute
|
static void distribute
|
||||||
(
|
(
|
||||||
const Pstream::commsTypes commsType,
|
const Pstream::commsTypes commsType,
|
||||||
@ -401,14 +401,14 @@ public:
|
|||||||
const labelListList& constructMap,
|
const labelListList& constructMap,
|
||||||
const bool constructHasFlip,
|
const bool constructHasFlip,
|
||||||
List<T>&,
|
List<T>&,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const label comm = UPstream::worldComm
|
const label comm = UPstream::worldComm
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Distribute data. If multiple processors writing to same
|
//- Distribute data. If multiple processors writing to same
|
||||||
// position adds contributions using cop.
|
// position adds contributions using cop.
|
||||||
template<class T, class CombineOp, class negateOp>
|
template<class T, class CombineOp, class NegateOp>
|
||||||
static void distribute
|
static void distribute
|
||||||
(
|
(
|
||||||
const Pstream::commsTypes commsType,
|
const Pstream::commsTypes commsType,
|
||||||
@ -421,7 +421,7 @@ public:
|
|||||||
List<T>&,
|
List<T>&,
|
||||||
const T& nullValue,
|
const T& nullValue,
|
||||||
const CombineOp& cop,
|
const CombineOp& cop,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const label comm = UPstream::worldComm
|
const label comm = UPstream::worldComm
|
||||||
);
|
);
|
||||||
@ -435,11 +435,11 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Distribute data using default commsType.
|
//- Distribute data using default commsType.
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
void distribute
|
void distribute
|
||||||
(
|
(
|
||||||
List<T>& fld,
|
List<T>& fld,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const int tag = UPstream::msgType()
|
const int tag = UPstream::msgType()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|||||||
@ -33,14 +33,14 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T, class CombineOp, class negateOp>
|
template<class T, class CombineOp, class NegateOp>
|
||||||
void Foam::mapDistributeBase::flipAndCombine
|
void Foam::mapDistributeBase::flipAndCombine
|
||||||
(
|
(
|
||||||
const labelUList& map,
|
const labelUList& map,
|
||||||
const bool hasFlip,
|
const bool hasFlip,
|
||||||
const UList<T>& rhs,
|
const UList<T>& rhs,
|
||||||
const CombineOp& cop,
|
const CombineOp& cop,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
List<T>& lhs
|
List<T>& lhs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -78,13 +78,13 @@ void Foam::mapDistributeBase::flipAndCombine
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
T Foam::mapDistributeBase::accessAndFlip
|
T Foam::mapDistributeBase::accessAndFlip
|
||||||
(
|
(
|
||||||
const UList<T>& fld,
|
const UList<T>& fld,
|
||||||
const label index,
|
const label index,
|
||||||
const bool hasFlip,
|
const bool hasFlip,
|
||||||
const negateOp& negOp
|
const NegateOp& negOp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
T t;
|
T t;
|
||||||
@ -117,7 +117,7 @@ T Foam::mapDistributeBase::accessAndFlip
|
|||||||
|
|
||||||
|
|
||||||
// Distribute list.
|
// Distribute list.
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
void Foam::mapDistributeBase::distribute
|
void Foam::mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
const Pstream::commsTypes commsType,
|
const Pstream::commsTypes commsType,
|
||||||
@ -128,7 +128,7 @@ void Foam::mapDistributeBase::distribute
|
|||||||
const labelListList& constructMap,
|
const labelListList& constructMap,
|
||||||
const bool constructHasFlip,
|
const bool constructHasFlip,
|
||||||
List<T>& field,
|
List<T>& field,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const int tag,
|
const int tag,
|
||||||
const label comm
|
const label comm
|
||||||
)
|
)
|
||||||
@ -649,7 +649,7 @@ void Foam::mapDistributeBase::distribute
|
|||||||
|
|
||||||
|
|
||||||
// Distribute list.
|
// Distribute list.
|
||||||
template<class T, class CombineOp, class negateOp>
|
template<class T, class CombineOp, class NegateOp>
|
||||||
void Foam::mapDistributeBase::distribute
|
void Foam::mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
const Pstream::commsTypes commsType,
|
const Pstream::commsTypes commsType,
|
||||||
@ -662,7 +662,7 @@ void Foam::mapDistributeBase::distribute
|
|||||||
List<T>& field,
|
List<T>& field,
|
||||||
const T& nullValue,
|
const T& nullValue,
|
||||||
const CombineOp& cop,
|
const CombineOp& cop,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const int tag,
|
const int tag,
|
||||||
const label comm
|
const label comm
|
||||||
)
|
)
|
||||||
@ -1246,11 +1246,11 @@ const
|
|||||||
|
|
||||||
|
|
||||||
//- Distribute data using default commsType.
|
//- Distribute data using default commsType.
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
void Foam::mapDistributeBase::distribute
|
void Foam::mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
List<T>& fld,
|
List<T>& fld,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const int tag
|
const int tag
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -127,11 +127,11 @@ void Foam::mapDistribute::applyInverseTransforms
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class negateOp>
|
template<class T, class NegateOp>
|
||||||
void Foam::mapDistribute::distribute
|
void Foam::mapDistribute::distribute
|
||||||
(
|
(
|
||||||
List<T>& fld,
|
List<T>& fld,
|
||||||
const negateOp& negOp,
|
const NegateOp& negOp,
|
||||||
const bool dummyTransform,
|
const bool dummyTransform,
|
||||||
const int tag
|
const int tag
|
||||||
) const
|
) const
|
||||||
|
|||||||
@ -280,7 +280,7 @@ public:
|
|||||||
cop,
|
cop,
|
||||||
nullValue,
|
nullValue,
|
||||||
mapDistribute::transform(),
|
mapDistribute::transform(),
|
||||||
noOp()
|
identityOp() // No flipping
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ public:
|
|||||||
cop,
|
cop,
|
||||||
nullValue,
|
nullValue,
|
||||||
mapDistribute::transformPosition(),
|
mapDistribute::transformPosition(),
|
||||||
noOp()
|
identityOp() // No flipping
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ public:
|
|||||||
cop,
|
cop,
|
||||||
nullValue,
|
nullValue,
|
||||||
mapDistribute::transform(),
|
mapDistribute::transform(),
|
||||||
noOp()
|
identityOp() // No flipping
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ public:
|
|||||||
cop,
|
cop,
|
||||||
nullValue,
|
nullValue,
|
||||||
mapDistribute::transformPosition(),
|
mapDistribute::transformPosition(),
|
||||||
noOp()
|
identityOp() // No flipping
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,9 +64,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
uniformOp()
|
uniformOp() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
//- Construct from data
|
//- Construct from data
|
||||||
uniformOp(Type data)
|
uniformOp(Type data)
|
||||||
@ -75,7 +74,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
//- Access the data
|
//- Access the data
|
||||||
Type data() const
|
Type data() const
|
||||||
@ -103,9 +102,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
noOp()
|
noOp() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
//- Construct from base
|
//- Construct from base
|
||||||
noOp(const uniformOp<zero::null>& op)
|
noOp(const uniformOp<zero::null>& op)
|
||||||
@ -114,7 +112,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Operate on nothing
|
//- Operate on nothing
|
||||||
result operator()() const
|
result operator()() const
|
||||||
@ -149,9 +147,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
areaOp()
|
areaOp() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
//- Construct from base
|
//- Construct from base
|
||||||
areaOp(const uniformOp<zero::null>& op)
|
areaOp(const uniformOp<zero::null>& op)
|
||||||
@ -160,7 +157,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Operate on nothing
|
//- Operate on nothing
|
||||||
result operator()() const
|
result operator()() const
|
||||||
@ -194,9 +191,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
volumeOp()
|
volumeOp() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
//- Construct from base
|
//- Construct from base
|
||||||
volumeOp(const uniformOp<zero::null>& op)
|
volumeOp(const uniformOp<zero::null>& op)
|
||||||
@ -205,7 +201,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Operate on nothing
|
//- Operate on nothing
|
||||||
result operator()() const
|
result operator()() const
|
||||||
@ -247,7 +243,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Operate on nothing
|
//- Operate on nothing
|
||||||
result operator()() const
|
result operator()() const
|
||||||
@ -290,7 +286,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Operate on nothing
|
//- Operate on nothing
|
||||||
result operator()() const
|
result operator()() const
|
||||||
@ -336,7 +332,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Add together two lists
|
//- Add together two lists
|
||||||
result operator+(const result& x) const
|
result operator+(const result& x) const
|
||||||
@ -350,9 +346,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
listOp()
|
listOp() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
//- Construct from base
|
//- Construct from base
|
||||||
listOp(const uniformOp<zero::null>& op)
|
listOp(const uniformOp<zero::null>& op)
|
||||||
@ -361,7 +356,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Operate on nothing
|
//- Operate on nothing
|
||||||
result operator()() const
|
result operator()() const
|
||||||
@ -413,7 +408,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
//- Operate on nothing
|
//- Operate on nothing
|
||||||
result operator()() const
|
result operator()() const
|
||||||
|
|||||||
@ -1,75 +1,9 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include. For v2112 and earlier
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
#ifndef FoamCompat_Swap_H
|
||||||
under the terms of the GNU General Public License as published by
|
#define FoamCompat_Swap_H
|
||||||
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
|
#include "stdFoam.H"
|
||||||
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/>.
|
|
||||||
|
|
||||||
InNamespace
|
|
||||||
Foam
|
|
||||||
|
|
||||||
Description
|
|
||||||
Swap arguments as per std::swap, but in Foam namespace.
|
|
||||||
|
|
||||||
For complex structures, it is usual to provide a member swap() method
|
|
||||||
and a function specialization for Swap().
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef Swap_H
|
|
||||||
#define Swap_H
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
//- Swap non-array types as per std::swap, but in Foam namespace.
|
|
||||||
// \sa http://www.cplusplus.com/reference/utility/swap/
|
|
||||||
template<class T>
|
|
||||||
void Swap(T& a, T& b)
|
|
||||||
{
|
|
||||||
std::swap(a, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Swap array types as per std::swap example, but in Foam namespace.
|
|
||||||
// \sa http://www.cplusplus.com/reference/utility/swap/
|
|
||||||
template<class T, size_t N>
|
|
||||||
void Swap(T (&a)[N], T (&b)[N])
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < N; ++i)
|
|
||||||
{
|
|
||||||
Foam::Swap(a[i], b[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Compatibility include
|
// Compatibility include. For v2112 and earlier
|
||||||
|
|
||||||
#ifndef doubleVector_H
|
#ifndef FoamCompat_doubleVector_H
|
||||||
#define doubleVector_H
|
#define FoamCompat_doubleVector_H
|
||||||
|
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Compatibility include
|
// Compatibility include. For v2112 and earlier
|
||||||
|
|
||||||
#ifndef floatVector_H
|
#ifndef FoamCompat_floatVector_H
|
||||||
#define floatVector_H
|
#define FoamCompat_floatVector_H
|
||||||
|
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,49 +30,23 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<> Foam::scalar Foam::flipOp::operator()(const scalar& v) const
|
#undef defineNegateOp
|
||||||
{
|
#define defineNegateOp(Type) \
|
||||||
return -v;
|
\
|
||||||
}
|
template<> Type Foam::flipOp::operator()(const Type& val) const \
|
||||||
|
{ \
|
||||||
|
return -val; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<> Foam::vector Foam::flipOp::operator()(const vector& v) const
|
defineNegateOp(Foam::scalar);
|
||||||
{
|
defineNegateOp(Foam::vector);
|
||||||
return -v;
|
defineNegateOp(Foam::sphericalTensor);
|
||||||
}
|
defineNegateOp(Foam::symmTensor);
|
||||||
|
defineNegateOp(Foam::tensor);
|
||||||
|
defineNegateOp(Foam::triad);
|
||||||
|
|
||||||
|
#undef defineNegateOp
|
||||||
template<> Foam::sphericalTensor Foam::flipOp::operator()
|
|
||||||
(
|
|
||||||
const sphericalTensor& v
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return -v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<> Foam::symmTensor Foam::flipOp::operator()
|
|
||||||
(
|
|
||||||
const symmTensor& v
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return -v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<> Foam::tensor Foam::flipOp::operator()(const tensor& v) const
|
|
||||||
{
|
|
||||||
return -v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<> Foam::triad Foam::flipOp::operator()
|
|
||||||
(
|
|
||||||
const triad& v
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return -v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef flipOp_H
|
#ifndef Foam_flipOp_H
|
||||||
#define flipOp_H
|
#define Foam_flipOp_H
|
||||||
|
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
@ -47,6 +47,21 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class noOp Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//- Same as Foam::identityOp. Should \em never be specialized.
|
||||||
|
struct noOp
|
||||||
|
{
|
||||||
|
template<class T>
|
||||||
|
const T& operator()(const T& val) const noexcept
|
||||||
|
{
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class flipOp Declaration
|
Class flipOp Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -61,21 +76,10 @@ struct flipOp
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Pass through value. Should never be specialized.
|
|
||||||
struct noOp
|
|
||||||
{
|
|
||||||
template<class T>
|
|
||||||
const T& operator()(const T& val) const noexcept
|
|
||||||
{
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//- Invert boolean value
|
//- Invert boolean value
|
||||||
struct flipBoolOp
|
struct flipBoolOp
|
||||||
{
|
{
|
||||||
bool operator()(const bool& val) const noexcept
|
bool operator()(const bool val) const noexcept
|
||||||
{
|
{
|
||||||
return !val;
|
return !val;
|
||||||
}
|
}
|
||||||
@ -85,7 +89,7 @@ struct flipBoolOp
|
|||||||
//- Negate integer values
|
//- Negate integer values
|
||||||
struct flipLabelOp
|
struct flipLabelOp
|
||||||
{
|
{
|
||||||
label operator()(const label& val) const
|
label operator()(const label val) const
|
||||||
{
|
{
|
||||||
return -val;
|
return -val;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef ops_H
|
#ifndef Foam_ops_H
|
||||||
#define ops_H
|
#define Foam_ops_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -47,7 +47,7 @@ SourceFiles
|
|||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "stringList.H"
|
#include "stringList.H"
|
||||||
#include "wordRes.H"
|
#include "wordRes.H"
|
||||||
#include "flipOp.H"
|
#include "ops.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -362,12 +362,12 @@ struct foundOp
|
|||||||
// The filter predicate is a combination of allow and deny lists
|
// The filter predicate is a combination of allow and deny lists
|
||||||
//
|
//
|
||||||
// \return List indices for matches
|
// \return List indices for matches
|
||||||
template<class StringListType, class AccessOp = noOp>
|
template<class StringListType, class AccessOp = identityOp>
|
||||||
labelList findMatching
|
labelList findMatching
|
||||||
(
|
(
|
||||||
const StringListType& input,
|
const StringListType& input,
|
||||||
const wordRes::filter& pred,
|
const wordRes::filter& pred,
|
||||||
AccessOp aop = noOp()
|
AccessOp aop = identityOp()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return ids for items with matching names.
|
//- Return ids for items with matching names.
|
||||||
@ -387,13 +387,13 @@ labelList findMatching
|
|||||||
// \endverbatim
|
// \endverbatim
|
||||||
//
|
//
|
||||||
// \return List indices for matches
|
// \return List indices for matches
|
||||||
template<class StringListType, class AccessOp = noOp>
|
template<class StringListType, class AccessOp = identityOp>
|
||||||
labelList findMatching
|
labelList findMatching
|
||||||
(
|
(
|
||||||
const StringListType& input,
|
const StringListType& input,
|
||||||
const wordRes& allow,
|
const wordRes& allow,
|
||||||
const wordRes& deny = wordRes::null(),
|
const wordRes& deny = wordRes::null(),
|
||||||
AccessOp aop = noOp()
|
AccessOp aop = identityOp()
|
||||||
);
|
);
|
||||||
|
|
||||||
} // End namespace stringListOps
|
} // End namespace stringListOps
|
||||||
|
|||||||
@ -1,25 +1,7 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include. For v1612 and earlier.
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
|
||||||
|
|
||||||
Typedef
|
#ifndef FoamCompat_wordReListMatcher_H
|
||||||
Foam::wordReListMatcher
|
#define FoamCompat_wordReListMatcher_H
|
||||||
|
|
||||||
Description
|
|
||||||
Compatibility name. Superseded (MAY-2017) by Foam::wordRes
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef wordReListMatcher_H
|
|
||||||
#define wordReListMatcher_H
|
|
||||||
|
|
||||||
#include "wordRes.H"
|
#include "wordRes.H"
|
||||||
|
|
||||||
@ -27,7 +9,11 @@ Description
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef wordRes wordReListMatcher;
|
|
||||||
|
//- Superseded (MAY-2017) by Foam::wordRes
|
||||||
|
// \deprecated(2017-05) - use Foam::wordRes instead
|
||||||
|
typedef wordRes wordReListMatcher;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -25,8 +25,6 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "Swap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@ -1,22 +1,17 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include. Superseded (MAY-2017) by Foam::zero::null
|
||||||
Compatibility include
|
|
||||||
|
|
||||||
Typedef
|
#ifndef FoamCompat_nil_H
|
||||||
Foam::nil
|
#define FoamCompat_nil_H
|
||||||
|
|
||||||
Description
|
|
||||||
The older name for Foam::zero::null.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef nil_H
|
|
||||||
#define nil_H
|
|
||||||
|
|
||||||
#include "zero.H"
|
#include "zero.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef zero::null nil;
|
|
||||||
|
//- Superseded (MAY-2017) by Foam::zero::null
|
||||||
|
// \deprecated(2017-05) - use Foam::zero::null instead
|
||||||
|
typedef zero::null nil;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2882,7 +2882,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures
|
|||||||
listPlusEqOp<point>(),
|
listPlusEqOp<point>(),
|
||||||
List<point>(),
|
List<point>(),
|
||||||
mapDistribute::transform(),
|
mapDistribute::transform(),
|
||||||
noOp()
|
identityOp() // No flipping
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -193,7 +193,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::nearestFaceAMI::calcDistributed
|
|||||||
mapDistributeBase::distribute
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::commsTypes::nonBlocking,
|
Pstream::commsTypes::nonBlocking,
|
||||||
List<labelPair>(0),
|
List<labelPair>(),
|
||||||
src.size(),
|
src.size(),
|
||||||
map.constructMap(),
|
map.constructMap(),
|
||||||
map.constructHasFlip(),
|
map.constructHasFlip(),
|
||||||
@ -202,7 +202,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::nearestFaceAMI::calcDistributed
|
|||||||
remoteInfo,
|
remoteInfo,
|
||||||
nearestZero,
|
nearestZero,
|
||||||
nearestEqOp(),
|
nearestEqOp(),
|
||||||
noOp() // no flipping
|
identityOp() // No flipping
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "cyclicACMIPointPatchField.H"
|
#include "cyclicACMIPointPatchField.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "transformField.H"
|
#include "transformField.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "cyclicAMIPointPatchField.H"
|
#include "cyclicAMIPointPatchField.H"
|
||||||
#include "Swap.H"
|
|
||||||
#include "transformField.H"
|
#include "transformField.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
|
|
||||||
|
|||||||
@ -1554,7 +1554,7 @@ void Foam::cellCellStencils::inverseDistance::createStencil
|
|||||||
samples,
|
samples,
|
||||||
greatPoint, // nullValue
|
greatPoint, // nullValue
|
||||||
minMagSqrEqOp<point>(),
|
minMagSqrEqOp<point>(),
|
||||||
flipOp(), // negateOp
|
flipOp(), // NegateOp
|
||||||
UPstream::msgType(),
|
UPstream::msgType(),
|
||||||
cellInterpolationMap().comm()
|
cellInterpolationMap().comm()
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1385,7 +1385,7 @@ void Foam::distributedTriSurfaceMesh::surfaceSide
|
|||||||
mapDistributeBase::distribute
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::commsTypes::nonBlocking,
|
Pstream::commsTypes::nonBlocking,
|
||||||
List<labelPair>(0),
|
List<labelPair>(),
|
||||||
nearestInfo.size(),
|
nearestInfo.size(),
|
||||||
map.constructMap(),
|
map.constructMap(),
|
||||||
map.constructHasFlip(),
|
map.constructHasFlip(),
|
||||||
@ -1394,7 +1394,7 @@ void Foam::distributedTriSurfaceMesh::surfaceSide
|
|||||||
volType,
|
volType,
|
||||||
zero,
|
zero,
|
||||||
volumeCombineOp(),
|
volumeCombineOp(),
|
||||||
noOp(), // no flipping
|
identityOp(), // No flipping
|
||||||
UPstream::msgType(),
|
UPstream::msgType(),
|
||||||
map.comm()
|
map.comm()
|
||||||
);
|
);
|
||||||
@ -3197,7 +3197,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
|||||||
mapDistributeBase::distribute
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::commsTypes::nonBlocking,
|
Pstream::commsTypes::nonBlocking,
|
||||||
List<labelPair>(0),
|
List<labelPair>(),
|
||||||
samples.size(),
|
samples.size(),
|
||||||
map1.constructMap(),
|
map1.constructMap(),
|
||||||
map1.constructHasFlip(),
|
map1.constructHasFlip(),
|
||||||
@ -3206,7 +3206,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
|||||||
nearestInfo,
|
nearestInfo,
|
||||||
nearestZero,
|
nearestZero,
|
||||||
nearestEqOp(),
|
nearestEqOp(),
|
||||||
noOp(), // no flipping
|
identityOp(), // No flipping
|
||||||
UPstream::msgType(),
|
UPstream::msgType(),
|
||||||
map1.comm()
|
map1.comm()
|
||||||
);
|
);
|
||||||
@ -3357,7 +3357,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
|||||||
mapDistributeBase::distribute
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::commsTypes::nonBlocking,
|
Pstream::commsTypes::nonBlocking,
|
||||||
List<labelPair>(0),
|
List<labelPair>(),
|
||||||
samples.size(),
|
samples.size(),
|
||||||
map2.constructMap(),
|
map2.constructMap(),
|
||||||
map2.constructHasFlip(),
|
map2.constructHasFlip(),
|
||||||
@ -3366,7 +3366,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
|||||||
localBest,
|
localBest,
|
||||||
nearestZero,
|
nearestZero,
|
||||||
nearestEqOp(),
|
nearestEqOp(),
|
||||||
noOp(), // no flipping
|
identityOp(), // No flipping
|
||||||
UPstream::msgType(),
|
UPstream::msgType(),
|
||||||
map2.comm()
|
map2.comm()
|
||||||
);
|
);
|
||||||
@ -4191,7 +4191,7 @@ void Foam::distributedTriSurfaceMesh::getVolumeType
|
|||||||
mapDistributeBase::distribute
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::commsTypes::nonBlocking,
|
Pstream::commsTypes::nonBlocking,
|
||||||
List<labelPair>(0),
|
List<labelPair>(),
|
||||||
samples.size(),
|
samples.size(),
|
||||||
map.constructMap(),
|
map.constructMap(),
|
||||||
map.constructHasFlip(),
|
map.constructHasFlip(),
|
||||||
@ -4200,7 +4200,7 @@ void Foam::distributedTriSurfaceMesh::getVolumeType
|
|||||||
volType,
|
volType,
|
||||||
zero,
|
zero,
|
||||||
volumeCombineOp(),
|
volumeCombineOp(),
|
||||||
noOp(), // no flipping
|
identityOp(), // No flipping
|
||||||
UPstream::msgType(),
|
UPstream::msgType(),
|
||||||
map.comm()
|
map.comm()
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user