mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: relocate duplicate versions of unionEqOp to ListOps
This commit is contained in:
@ -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
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user