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

STYLE: relocate duplicate versions of unionEqOp to ListOps

parent 071d979e
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -27,6 +27,7 @@ License
\*---------------------------------------------------------------------------*/
#include "ListOps.H"
#include "HashSet.H"
#include <numeric>
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
......@@ -205,4 +206,26 @@ void Foam::ListOps::identity(labelUList& map, label start)
}
void Foam::ListOps::unionEqOp::operator()
(
labelList& x,
const labelList& y
) const
{
if (y.size())
{
if (x.size())
{
labelHashSet set(x);
set.insert(y);
x = set.toc();
}
else
{
x = y;
}
}
}
// ************************************************************************* //
......@@ -579,6 +579,12 @@ struct uniqueEqOp
void operator()(List<T>& x, const List<T>& y) const;
};
//- List helper to add y unique elements to x
struct unionEqOp
{
void operator()(labelList& x, const labelList& y) const;
};
// Public classes
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -58,7 +59,13 @@ void Foam::CECCellToCellStencil::calcEdgeBoundaryData
);
}
syncTools::syncEdgeMap(mesh(), neiGlobal, unionEqOp(), dummyTransform());
syncTools::syncEdgeMap
(
mesh(),
neiGlobal,
ListOps::unionEqOp(),
dummyTransform()
);
}
......
......@@ -62,7 +62,7 @@ void Foam::CPCCellToCellStencil::calcPointBoundaryData
(
mesh(),
neiGlobal,
unionEqOp(),
ListOps::unionEqOp(),
Foam::dummyTransform() // dummy transformation
);
}
......
......@@ -230,28 +230,6 @@ Foam::cellToCellStencil::allCoupledFacesPatch() const
}
void Foam::cellToCellStencil::unionEqOp::operator()
(
labelList& x,
const labelList& y
) const
{
if (y.size())
{
if (x.empty())
{
x = y;
}
else
{
labelHashSet set(x);
set.insert(y);
x = set.toc();
}
}
}
void Foam::cellToCellStencil::insertFaceCells
(
const label exclude0,
......
......@@ -92,13 +92,6 @@ protected:
//- Return patch of all coupled faces.
autoPtr<indirectPrimitivePatch> allCoupledFacesPatch() const;
//- Combine operator for labelLists
class unionEqOp
{
public:
void operator()(labelList& x, const labelList& y) const;
};
//- Collect cell neighbours of faces in global numbering
void insertFaceCells
(
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -58,7 +58,13 @@ void Foam::FECCellToFaceStencil::calcEdgeBoundaryData
);
}
syncTools::syncEdgeMap(mesh(), neiGlobal, unionEqOp(), dummyTransform());
syncTools::syncEdgeMap
(
mesh(),
neiGlobal,
ListOps::unionEqOp(),
dummyTransform()
);
}
......
......@@ -231,28 +231,6 @@ Foam::cellToFaceStencil::allCoupledFacesPatch() const
}
void Foam::cellToFaceStencil::unionEqOp::operator()
(
labelList& x,
const labelList& y
) const
{
if (y.size())
{
if (x.empty())
{
x = y;
}
else
{
labelHashSet set(x);
set.insert(y);
x = set.toc();
}
}
}
void Foam::cellToFaceStencil::insertFaceCells
(
const label exclude0,
......
......@@ -92,13 +92,6 @@ protected:
//- Return patch of all coupled faces.
autoPtr<indirectPrimitivePatch> allCoupledFacesPatch() const;
//- Combine operator for labelLists
class unionEqOp
{
public:
void operator()( labelList& x, const labelList& y ) const;
};
//- Collect cell neighbours of faces in global numbering
void insertFaceCells
(
......
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