mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: renamed attachedToCell to haloToCell and fix parallel consistency
- was added for #1394
This commit is contained in:
committed by
Andrew Heather
parent
188f4bd184
commit
09e3441440
@ -152,7 +152,6 @@ sets/topoSetSource/topoSetSource.C
|
|||||||
|
|
||||||
cellSources = sets/cellSources
|
cellSources = sets/cellSources
|
||||||
$(cellSources)/topoSetCellSource/topoSetCellSource.C
|
$(cellSources)/topoSetCellSource/topoSetCellSource.C
|
||||||
$(cellSources)/attachedToCell/attachedToCell.C
|
|
||||||
$(cellSources)/boundaryToCell/boundaryToCell.C
|
$(cellSources)/boundaryToCell/boundaryToCell.C
|
||||||
$(cellSources)/boxToCell/boxToCell.C
|
$(cellSources)/boxToCell/boxToCell.C
|
||||||
$(cellSources)/cellToCell/cellToCell.C
|
$(cellSources)/cellToCell/cellToCell.C
|
||||||
@ -161,6 +160,7 @@ $(cellSources)/cylinderToCell/cylinderToCell.C
|
|||||||
$(cellSources)/faceToCell/faceToCell.C
|
$(cellSources)/faceToCell/faceToCell.C
|
||||||
$(cellSources)/faceZoneToCell/faceZoneToCell.C
|
$(cellSources)/faceZoneToCell/faceZoneToCell.C
|
||||||
$(cellSources)/fieldToCell/fieldToCell.C
|
$(cellSources)/fieldToCell/fieldToCell.C
|
||||||
|
$(cellSources)/haloToCell/haloToCell.C
|
||||||
$(cellSources)/labelToCell/labelToCell.C
|
$(cellSources)/labelToCell/labelToCell.C
|
||||||
$(cellSources)/nbrToCell/nbrToCell.C
|
$(cellSources)/nbrToCell/nbrToCell.C
|
||||||
$(cellSources)/nearestToCell/nearestToCell.C
|
$(cellSources)/nearestToCell/nearestToCell.C
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "attachedToCell.H"
|
#include "haloToCell.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
@ -33,60 +33,44 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(attachedToCell, 0);
|
defineTypeNameAndDebug(haloToCell, 0);
|
||||||
addToRunTimeSelectionTable(topoSetSource, attachedToCell, word);
|
addToRunTimeSelectionTable(topoSetSource, haloToCell, word);
|
||||||
addToRunTimeSelectionTable(topoSetSource, attachedToCell, istream);
|
addToRunTimeSelectionTable(topoSetSource, haloToCell, istream);
|
||||||
addToRunTimeSelectionTable(topoSetCellSource, attachedToCell, word);
|
addToRunTimeSelectionTable(topoSetCellSource, haloToCell, word);
|
||||||
addToRunTimeSelectionTable(topoSetCellSource, attachedToCell, istream);
|
addToRunTimeSelectionTable(topoSetCellSource, haloToCell, istream);
|
||||||
addNamedToRunTimeSelectionTable
|
addNamedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
topoSetCellSource,
|
topoSetCellSource,
|
||||||
attachedToCell,
|
haloToCell,
|
||||||
word,
|
word,
|
||||||
attached
|
halo
|
||||||
);
|
);
|
||||||
addNamedToRunTimeSelectionTable
|
addNamedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
topoSetCellSource,
|
topoSetCellSource,
|
||||||
attachedToCell,
|
haloToCell,
|
||||||
istream,
|
istream,
|
||||||
attached
|
halo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::topoSetSource::addToUsageTable Foam::attachedToCell::usage_
|
Foam::topoSetSource::addToUsageTable Foam::haloToCell::usage_
|
||||||
(
|
(
|
||||||
attachedToCell::typeName,
|
haloToCell::typeName,
|
||||||
"\n Usage: attachedToCell\n\n"
|
"\n Usage: haloToCell\n\n"
|
||||||
" Select attached cells\n\n"
|
" Select halo cells\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::attachedToCell::combine(topoSet& set, const bool add) const
|
void Foam::haloToCell::combine(topoSet& set, const bool add) const
|
||||||
{
|
{
|
||||||
const cellList& cells = mesh_.cells();
|
const cellList& cells = mesh_.cells();
|
||||||
const labelList& faceOwn = mesh_.faceOwner();
|
const labelList& faceOwn = mesh_.faceOwner();
|
||||||
const labelList& faceNei = mesh_.faceNeighbour();
|
const labelList& faceNei = mesh_.faceNeighbour();
|
||||||
const label nIntFaces = mesh_.nInternalFaces();
|
|
||||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
|
||||||
|
|
||||||
boolList isCoupled(mesh_.nBoundaryFaces(), false);
|
|
||||||
|
|
||||||
for (const polyPatch& pp : patches)
|
|
||||||
{
|
|
||||||
if (pp.coupled())
|
|
||||||
{
|
|
||||||
label facei = pp.start();
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
isCoupled[facei-nIntFaces] = true;
|
|
||||||
++facei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The starting set of cells
|
// The starting set of cells
|
||||||
bitSet current(cells.size());
|
bitSet current(cells.size());
|
||||||
@ -97,19 +81,16 @@ void Foam::attachedToCell::combine(topoSet& set, const bool add) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The perimeter faces of the cell set
|
// The perimeter faces of the cell set
|
||||||
bitSet outsideFaces(mesh().nFaces());
|
bitSet outsideFaces(mesh_.nFaces());
|
||||||
|
|
||||||
// Get coupled cell status
|
bitSet updates(cells.size());
|
||||||
boolList neiInSet(mesh_.nFaces()-nIntFaces, false);
|
|
||||||
|
|
||||||
bitSet updates(current);
|
|
||||||
|
|
||||||
for (label stepi = 0; stepi < steps_; ++stepi)
|
for (label stepi = 0; stepi < steps_; ++stepi)
|
||||||
{
|
{
|
||||||
// Mark up all perimeter faces
|
// Mark up perimeter faces. Each mesh face is attached exactly
|
||||||
|
// (0,1,2) times to a cell in the set. Using flip() each time means
|
||||||
// Don't attempt extra efficiency with caching old values,
|
// the only 'on' bits correspond to faces that are attached once to
|
||||||
// this make the parallel transfer too troublesome
|
// the cell set - ie, faces on the perimeter of the set.
|
||||||
|
|
||||||
outsideFaces.reset();
|
outsideFaces.reset();
|
||||||
for (const label celli : current)
|
for (const label celli : current)
|
||||||
@ -120,36 +101,18 @@ void Foam::attachedToCell::combine(topoSet& set, const bool add) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Coupled faces
|
// Use xor to eliminate perimeter faces that are actually attached
|
||||||
neiInSet = false;
|
// on both sides of the interface.
|
||||||
|
|
||||||
for
|
syncTools::syncFaceList
|
||||||
(
|
(
|
||||||
bitSet::const_iterator iter = outsideFaces.cbegin(nIntFaces);
|
mesh_,
|
||||||
iter != outsideFaces.cend();
|
outsideFaces,
|
||||||
++iter
|
bitXorEqOp<unsigned int>()
|
||||||
)
|
);
|
||||||
{
|
|
||||||
const label facei = *iter;
|
|
||||||
|
|
||||||
if (isCoupled[facei-nIntFaces])
|
|
||||||
{
|
|
||||||
neiInSet[facei-nIntFaces] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
syncTools::swapBoundaryFaceList(mesh_, neiInSet);
|
|
||||||
|
|
||||||
forAll(neiInSet, bfacei)
|
|
||||||
{
|
|
||||||
if (neiInSet[bfacei])
|
|
||||||
{
|
|
||||||
outsideFaces.flip(bfacei+nIntFaces);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Select all cells attached to the perimeter faces.
|
||||||
updates.reset();
|
updates.reset();
|
||||||
|
|
||||||
for (const label facei : outsideFaces)
|
for (const label facei : outsideFaces)
|
||||||
{
|
{
|
||||||
updates.set(faceOwn[facei]);
|
updates.set(faceOwn[facei]);
|
||||||
@ -161,9 +124,7 @@ void Foam::attachedToCell::combine(topoSet& set, const bool add) const
|
|||||||
|
|
||||||
if (add)
|
if (add)
|
||||||
{
|
{
|
||||||
// Face information retained for next loop
|
// Restrict to cells not already in the current set
|
||||||
|
|
||||||
// Changed cells
|
|
||||||
updates -= current;
|
updates -= current;
|
||||||
|
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
@ -172,11 +133,12 @@ void Foam::attachedToCell::combine(topoSet& set, const bool add) const
|
|||||||
<< " by " << updates.count() << endl;
|
<< " by " << updates.count() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add to current set for the next loop
|
||||||
current |= updates;
|
current |= updates;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Changed cells
|
// Restrict to cells already in the current set
|
||||||
updates &= current;
|
updates &= current;
|
||||||
|
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
@ -185,25 +147,23 @@ void Foam::attachedToCell::combine(topoSet& set, const bool add) const
|
|||||||
<< " by " << updates.count() << endl;
|
<< " by " << updates.count() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove from current set for the next loop
|
||||||
current -= updates;
|
current -= updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const label celli: updates)
|
|
||||||
{
|
|
||||||
addOrDelete(set, celli, add);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updates.none())
|
if (updates.none())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addOrDelete(set, updates, add);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::attachedToCell::attachedToCell
|
Foam::haloToCell::haloToCell
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const label steps
|
const label steps
|
||||||
@ -214,29 +174,29 @@ Foam::attachedToCell::attachedToCell
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::attachedToCell::attachedToCell
|
Foam::haloToCell::haloToCell
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
attachedToCell(mesh, dict.getOrDefault<label>("steps", 1))
|
haloToCell(mesh, dict.getOrDefault<label>("steps", 1))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::attachedToCell::attachedToCell
|
Foam::haloToCell::haloToCell
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
Istream& is
|
Istream& is
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
attachedToCell(mesh, 1)
|
haloToCell(mesh, 1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::attachedToCell::applyToSet
|
void Foam::haloToCell::applyToSet
|
||||||
(
|
(
|
||||||
const topoSetSource::setAction action,
|
const topoSetSource::setAction action,
|
||||||
topoSet& set
|
topoSet& set
|
||||||
@ -246,7 +206,8 @@ void Foam::attachedToCell::applyToSet
|
|||||||
{
|
{
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
{
|
{
|
||||||
Info<< " Cannot create new of attached" << endl;
|
Info<< " Cannot create new of halo (needs a starting set)"
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
set.clear();
|
set.clear();
|
||||||
@ -255,7 +216,7 @@ void Foam::attachedToCell::applyToSet
|
|||||||
{
|
{
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
{
|
{
|
||||||
Info<< " Adding cells attached to current set, using "
|
Info<< " Adding halo cells to the current set, using "
|
||||||
<< steps_ << " step ..." << endl;
|
<< steps_ << " step ..." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +226,7 @@ void Foam::attachedToCell::applyToSet
|
|||||||
{
|
{
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
{
|
{
|
||||||
Info<< " Removing external cells of current set, using "
|
Info<< " Removing cells on the perimeter of current set, using "
|
||||||
<< steps_ << " step ..." << endl;
|
<< steps_ << " step ..." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,10 +22,13 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::attachedToCell
|
Foam::haloToCell
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A topoSetCellSource to add/remove cells attached to the current cellSet
|
A topoSetCellSource to add/remove halo cells (cells attached to
|
||||||
|
the outside of the current cellSet).
|
||||||
|
When removing halo cells, this strips off any cells on the boundary
|
||||||
|
of the set.
|
||||||
|
|
||||||
\heading Dictionary parameters
|
\heading Dictionary parameters
|
||||||
\table
|
\table
|
||||||
@ -34,12 +37,12 @@ Description
|
|||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
attachedToCell.C
|
haloToCell.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef attachedToCell_H
|
#ifndef haloToCell_H
|
||||||
#define attachedToCell_H
|
#define haloToCell_H
|
||||||
|
|
||||||
#include "topoSetCellSource.H"
|
#include "topoSetCellSource.H"
|
||||||
|
|
||||||
@ -49,10 +52,10 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class attachedToCell Declaration
|
Class haloToCell Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class attachedToCell
|
class haloToCell
|
||||||
:
|
:
|
||||||
public topoSetCellSource
|
public topoSetCellSource
|
||||||
{
|
{
|
||||||
@ -74,23 +77,23 @@ class attachedToCell
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("attachedToCell");
|
TypeName("haloToCell");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
explicit attachedToCell(const polyMesh& mesh, const label steps=1);
|
explicit haloToCell(const polyMesh& mesh, const label steps=1);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
attachedToCell(const polyMesh& mesh, const dictionary& dict);
|
haloToCell(const polyMesh& mesh, const dictionary& dict);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
attachedToCell(const polyMesh& mesh, Istream& is);
|
haloToCell(const polyMesh& mesh, Istream& is);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~attachedToCell() = default;
|
virtual ~haloToCell() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
Reference in New Issue
Block a user