mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-topoSet-improvements' into 'develop'
Feature topo set improvements (issue #1060) See merge request Development/OpenFOAM-plus!216
This commit is contained in:
@ -132,9 +132,9 @@ void printHelp(Ostream& os)
|
||||
<< " clear - clears the set" << nl
|
||||
<< " invert - inverts the set" << nl
|
||||
<< " remove - remove the set" << nl
|
||||
<< " new <source> - sets to set to the source set" << nl
|
||||
<< " new <source> - use all elements from the source set" << nl
|
||||
<< " add <source> - adds all elements from the source set" << nl
|
||||
<< " delete <source> - deletes ,," << nl
|
||||
<< " subtract <source> - subtract the source set elements" << nl
|
||||
<< " subset <source> - combines current set with the source set"
|
||||
<< nl
|
||||
<< nl
|
||||
|
||||
@ -247,8 +247,8 @@ int main(int argc, char *argv[])
|
||||
autoPtr<topoSet> currentSet;
|
||||
if
|
||||
(
|
||||
(action == topoSetSource::NEW)
|
||||
|| (action == topoSetSource::CLEAR)
|
||||
action == topoSetSource::NEW
|
||||
|| action == topoSetSource::CLEAR
|
||||
)
|
||||
{
|
||||
currentSet = topoSet::New(setType, mesh, setName, 10000);
|
||||
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
case topoSetSource::NEW:
|
||||
case topoSetSource::ADD:
|
||||
case topoSetSource::DELETE:
|
||||
case topoSetSource::SUBTRACT:
|
||||
{
|
||||
const word sourceName(dict.get<word>("source"));
|
||||
|
||||
|
||||
@ -63,7 +63,9 @@ FoamFile
|
||||
// source faceZoneToCell;
|
||||
// sourceInfo
|
||||
// {
|
||||
// name ".*Zone"; // Name of faceZone, regular expressions allowed
|
||||
// zones (".*Zone"); // Name of faceZone, regular expressions allowed
|
||||
// // OR zone ".*Zone"; // Name of faceZone, regular expressions allowed
|
||||
// // OR name ".*Zone"; // Name of faceZone, regular expressions allowed
|
||||
// option master; // master/slave
|
||||
// }
|
||||
//
|
||||
@ -127,7 +129,7 @@ FoamFile
|
||||
// source sphereToCell;
|
||||
// sourceInfo
|
||||
// {
|
||||
// centre (0.2 0.2 -10);
|
||||
// origin (0.2 0.2 -10);
|
||||
// radius 5.0;
|
||||
// }
|
||||
//
|
||||
@ -392,7 +394,7 @@ FoamFile
|
||||
// sourceInfo
|
||||
// {
|
||||
// surface searchableSphere;
|
||||
// centre (0.05 0.05 0.005);
|
||||
// origin (0.05 0.05 0.005);
|
||||
// radius 0.025;
|
||||
// //name sphere.stl; // Optional name if surface triSurfaceMesh
|
||||
// }
|
||||
|
||||
@ -97,7 +97,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
shapeSelector::shapeTypeNames.get("type", dict)
|
||||
);
|
||||
const vector centre(dict.get<vector>("centre"));
|
||||
const vector origin(dict.getCompat<vector>("origin", {{"centre", 1806}}));
|
||||
const word fieldName(dict.get<word>("field"));
|
||||
|
||||
Info<< "Reading field " << fieldName << "\n" << endl;
|
||||
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
|
||||
mesh
|
||||
);
|
||||
|
||||
scalar f0 = 0.0;
|
||||
scalar f0 = 0;
|
||||
scalarField f(mesh.points().size());
|
||||
|
||||
Info<< "Processing type '" << shapeSelector::shapeTypeNames[surfType]
|
||||
@ -126,15 +126,15 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const vector direction(dict.get<vector>("direction"));
|
||||
|
||||
f = -(mesh.points() - centre) & (direction/mag(direction));
|
||||
f0 = 0.0;
|
||||
f = -(mesh.points() - origin) & (direction/mag(direction));
|
||||
f0 = 0;
|
||||
break;
|
||||
}
|
||||
case shapeSelector::shapeType::SPHERE:
|
||||
{
|
||||
const scalar radius(dict.get<scalar>("radius"));
|
||||
|
||||
f = -mag(mesh.points() - centre);
|
||||
f = -mag(mesh.points() - origin);
|
||||
f0 = -radius;
|
||||
break;
|
||||
}
|
||||
@ -145,8 +145,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
f = -sqrt
|
||||
(
|
||||
sqr(mag(mesh.points() - centre))
|
||||
- sqr(mag((mesh.points() - centre) & direction))
|
||||
sqr(mag(mesh.points() - origin))
|
||||
- sqr(mag((mesh.points() - origin) & direction))
|
||||
);
|
||||
f0 = -radius;
|
||||
break;
|
||||
@ -160,9 +160,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
const scalarField xx
|
||||
(
|
||||
(mesh.points() - centre) & direction/mag(direction)
|
||||
(mesh.points() - origin) & direction/mag(direction)
|
||||
);
|
||||
const scalarField zz((mesh.points() - centre) & up/mag(up));
|
||||
const scalarField zz((mesh.points() - origin) & up/mag(up));
|
||||
|
||||
f = amplitude*Foam::sin(2*mathematical::pi*xx/period) - zz;
|
||||
f0 = 0;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,13 +33,25 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(badQualityToCell, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, istream);
|
||||
|
||||
defineTypeNameAndDebug(badQualityToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
badQualityToCell,
|
||||
word,
|
||||
badQuality
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
badQualityToCell,
|
||||
istream,
|
||||
badQuality
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -59,9 +71,8 @@ void Foam::badQualityToCell::combine(topoSet& set, const bool add) const
|
||||
motionSmoother::checkMesh(false, mesh_, dict_, faces);
|
||||
faces.sync(mesh_);
|
||||
|
||||
forAllConstIter(faceSet, faces, iter)
|
||||
for (const label facei : faces)
|
||||
{
|
||||
label facei = iter.key();
|
||||
addOrDelete(set, mesh_.faceOwner()[facei], add);
|
||||
if (mesh_.isInternalFace(facei))
|
||||
{
|
||||
@ -73,36 +84,28 @@ void Foam::badQualityToCell::combine(topoSet& set, const bool add) const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::badQualityToCell::badQualityToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
dict_(dict)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::badQualityToCell::badQualityToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
dict_(is)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::badQualityToCell::~badQualityToCell()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::badQualityToCell::applyToSet
|
||||
@ -111,14 +114,22 @@ void Foam::badQualityToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding bad-quality cells" << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding bad-quality cells" << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing bad-quality cells" << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing bad-quality cells" << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,7 +35,7 @@ SourceFiles
|
||||
#ifndef badQualityToCell_H
|
||||
#define badQualityToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "bitSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -49,7 +49,7 @@ namespace Foam
|
||||
|
||||
class badQualityToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -74,35 +74,22 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
badQualityToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
badQualityToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
|
||||
//- Construct from Istream
|
||||
badQualityToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
);
|
||||
badQualityToCell(const polyMesh& mesh, Istream& is);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~badQualityToCell();
|
||||
virtual ~badQualityToCell() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
topoSet& set
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,13 +33,25 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(badQualityToFace, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, istream);
|
||||
|
||||
defineTypeNameAndDebug(badQualityToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, badQualityToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, badQualityToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, badQualityToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
badQualityToFace,
|
||||
word,
|
||||
badQuality
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
badQualityToFace,
|
||||
istream,
|
||||
badQuality
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -59,9 +71,8 @@ void Foam::badQualityToFace::combine(topoSet& set, const bool add) const
|
||||
motionSmoother::checkMesh(false, mesh_, dict_, faces);
|
||||
faces.sync(mesh_);
|
||||
|
||||
forAllConstIter(faceSet, faces, iter)
|
||||
for (const label facei : faces)
|
||||
{
|
||||
label facei = iter.key();
|
||||
addOrDelete(set, facei, add);
|
||||
}
|
||||
}
|
||||
@ -69,36 +80,28 @@ void Foam::badQualityToFace::combine(topoSet& set, const bool add) const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::badQualityToFace::badQualityToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
dict_(dict)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::badQualityToFace::badQualityToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
dict_(is)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::badQualityToFace::~badQualityToFace()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::badQualityToFace::applyToSet
|
||||
@ -107,14 +110,22 @@ void Foam::badQualityToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding bad-quality faces" << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding bad-quality faces" << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing bad-quality faces" << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing bad-quality faces" << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,7 +35,7 @@ SourceFiles
|
||||
#ifndef badQualityToFace_H
|
||||
#define badQualityToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "bitSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -49,7 +49,7 @@ namespace Foam
|
||||
|
||||
class badQualityToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -89,20 +89,15 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~badQualityToFace();
|
||||
virtual ~badQualityToFace() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
topoSet& set
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ cylindricalInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
origin_(dict.lookupCompat("origin", {{"centre", 1712}})),
|
||||
origin_(dict.getCompat<vector>("origin", {{"centre", 1712}})),
|
||||
axis_(dict.lookup("axis")),
|
||||
axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
|
||||
radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
|
||||
|
||||
@ -84,13 +84,11 @@ SourceFiles
|
||||
#ifndef directionalPressureGradientExplicitSource_H
|
||||
#define directionalPressureGradientExplicitSource_H
|
||||
|
||||
#include "cellSetOption.H"
|
||||
#include "autoPtr.H"
|
||||
#include "topoSetSource.H"
|
||||
#include "cellSet.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "fvOption.H"
|
||||
#include "cellSetOption.H"
|
||||
#include "interpolationTable.H"
|
||||
|
||||
|
||||
|
||||
@ -51,8 +51,6 @@ SourceFiles
|
||||
#define meanVelocityForce_H
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "topoSetSource.H"
|
||||
#include "cellSet.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "cellSetOption.H"
|
||||
|
||||
@ -134,6 +134,7 @@ searchableSurfaces/subTriSurfaceMesh/subTriSurfaceMesh.C
|
||||
searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C
|
||||
|
||||
topoSets = sets/topoSets
|
||||
$(topoSets)/cellBitSet.C
|
||||
$(topoSets)/cellSet.C
|
||||
$(topoSets)/topoSet.C
|
||||
$(topoSets)/faceSet.C
|
||||
@ -144,49 +145,56 @@ $(topoSets)/pointZoneSet.C
|
||||
|
||||
sets/topoSetSource/topoSetSource.C
|
||||
|
||||
cellSources = sets/cellSources
|
||||
$(cellSources)/faceToCell/faceToCell.C
|
||||
$(cellSources)/fieldToCell/fieldToCell.C
|
||||
$(cellSources)/pointToCell/pointToCell.C
|
||||
$(cellSources)/shapeToCell/shapeToCell.C
|
||||
cellSources = sets/cellSources
|
||||
$(cellSources)/topoSetCellSource/topoSetCellSource.C
|
||||
$(cellSources)/boxToCell/boxToCell.C
|
||||
$(cellSources)/cellToCell/cellToCell.C
|
||||
$(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C
|
||||
$(cellSources)/cylinderToCell/cylinderToCell.C
|
||||
$(cellSources)/faceToCell/faceToCell.C
|
||||
$(cellSources)/faceZoneToCell/faceZoneToCell.C
|
||||
$(cellSources)/fieldToCell/fieldToCell.C
|
||||
$(cellSources)/labelToCell/labelToCell.C
|
||||
$(cellSources)/nbrToCell/nbrToCell.C
|
||||
$(cellSources)/nearestToCell/nearestToCell.C
|
||||
$(cellSources)/noneToCell/noneToCell.C
|
||||
$(cellSources)/pointToCell/pointToCell.C
|
||||
$(cellSources)/regionToCell/regionToCell.C
|
||||
$(cellSources)/rotatedBoxToCell/rotatedBoxToCell.C
|
||||
$(cellSources)/labelToCell/labelToCell.C
|
||||
$(cellSources)/surfaceToCell/surfaceToCell.C
|
||||
$(cellSources)/cellToCell/cellToCell.C
|
||||
$(cellSources)/nearestToCell/nearestToCell.C
|
||||
$(cellSources)/nbrToCell/nbrToCell.C
|
||||
$(cellSources)/zoneToCell/zoneToCell.C
|
||||
$(cellSources)/shapeToCell/shapeToCell.C
|
||||
$(cellSources)/searchableSurfaceToCell/searchableSurfaceToCell.C
|
||||
$(cellSources)/sphereToCell/sphereToCell.C
|
||||
$(cellSources)/cylinderToCell/cylinderToCell.C
|
||||
$(cellSources)/faceZoneToCell/faceZoneToCell.C
|
||||
$(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C
|
||||
$(cellSources)/surfaceToCell/surfaceToCell.C
|
||||
$(cellSources)/targetVolumeToCell/targetVolumeToCell.C
|
||||
$(cellSources)/zoneToCell/zoneToCell.C
|
||||
|
||||
faceSources = sets/faceSources
|
||||
$(faceSources)/topoSetFaceSource/topoSetFaceSource.C
|
||||
$(faceSources)/boundaryToFace/boundaryToFace.C
|
||||
$(faceSources)/boxToFace/boxToFace.C
|
||||
$(faceSources)/cellToFace/cellToFace.C
|
||||
$(faceSources)/cylinderAnnulusToFace/cylinderAnnulusToFace.C
|
||||
$(faceSources)/cylinderToFace/cylinderToFace.C
|
||||
$(faceSources)/faceToFace/faceToFace.C
|
||||
$(faceSources)/labelToFace/labelToFace.C
|
||||
$(faceSources)/cellToFace/cellToFace.C
|
||||
$(faceSources)/noneToFace/noneToFace.C
|
||||
$(faceSources)/normalToFace/normalToFace.C
|
||||
$(faceSources)/pointToFace/pointToFace.C
|
||||
$(faceSources)/patchToFace/patchToFace.C
|
||||
$(faceSources)/boundaryToFace/boundaryToFace.C
|
||||
$(faceSources)/zoneToFace/zoneToFace.C
|
||||
$(faceSources)/boxToFace/boxToFace.C
|
||||
$(faceSources)/pointToFace/pointToFace.C
|
||||
$(faceSources)/regionToFace/regionToFace.C
|
||||
$(faceSources)/cylinderToFace/cylinderToFace.C
|
||||
$(faceSources)/cylinderAnnulusToFace/cylinderAnnulusToFace.C
|
||||
$(faceSources)/zoneToFace/zoneToFace.C
|
||||
|
||||
pointSources = sets/pointSources
|
||||
$(pointSources)/labelToPoint/labelToPoint.C
|
||||
$(pointSources)/pointToPoint/pointToPoint.C
|
||||
$(pointSources)/topoSetPointSource/topoSetPointSource.C
|
||||
$(pointSources)/boxToPoint/boxToPoint.C
|
||||
$(pointSources)/cellToPoint/cellToPoint.C
|
||||
$(pointSources)/faceToPoint/faceToPoint.C
|
||||
$(pointSources)/boxToPoint/boxToPoint.C
|
||||
$(pointSources)/labelToPoint/labelToPoint.C
|
||||
$(pointSources)/nearestToPoint/nearestToPoint.C
|
||||
$(pointSources)/noneToPoint/noneToPoint.C
|
||||
$(pointSources)/pointToPoint/pointToPoint.C
|
||||
$(pointSources)/surfaceToPoint/surfaceToPoint.C
|
||||
$(pointSources)/zoneToPoint/zoneToPoint.C
|
||||
$(pointSources)/nearestToPoint/nearestToPoint.C
|
||||
|
||||
faceZoneSources = sets/faceZoneSources
|
||||
$(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C
|
||||
|
||||
@ -57,18 +57,18 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest
|
||||
{
|
||||
pointIndexHit info(false, sample, -1);
|
||||
|
||||
const vector n(sample - centre_);
|
||||
const vector n(sample - origin_);
|
||||
scalar magN = mag(n);
|
||||
|
||||
if (nearestDistSqr >= sqr(magN - radius_))
|
||||
{
|
||||
if (magN < ROOTVSMALL)
|
||||
{
|
||||
info.rawPoint() = centre_ + vector(1,0,0)*radius_;
|
||||
info.rawPoint() = origin_ + vector(1,0,0)*radius_;
|
||||
}
|
||||
else
|
||||
{
|
||||
info.rawPoint() = centre_ + n/magN*radius_;
|
||||
info.rawPoint() = origin_ + n/magN*radius_;
|
||||
}
|
||||
info.setHit();
|
||||
info.setIndex(0);
|
||||
@ -95,7 +95,7 @@ void Foam::searchableSphere::findLineAll
|
||||
|
||||
if (magSqrDir > ROOTVSMALL)
|
||||
{
|
||||
const vector toCentre(centre_-start);
|
||||
const vector toCentre(origin_ - start);
|
||||
scalar magSqrToCentre = magSqr(toCentre);
|
||||
|
||||
dir /= Foam::sqrt(magSqrDir);
|
||||
@ -135,18 +135,18 @@ void Foam::searchableSphere::findLineAll
|
||||
Foam::searchableSphere::searchableSphere
|
||||
(
|
||||
const IOobject& io,
|
||||
const point& centre,
|
||||
const point& origin,
|
||||
const scalar radius
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
centre_(centre),
|
||||
origin_(origin),
|
||||
radius_(radius)
|
||||
{
|
||||
bounds() = boundBox
|
||||
(
|
||||
centre_ - radius_*vector::one,
|
||||
centre_ + radius_*vector::one
|
||||
origin_ - radius_*vector::one,
|
||||
origin_ + radius_*vector::one
|
||||
);
|
||||
}
|
||||
|
||||
@ -157,23 +157,20 @@ Foam::searchableSphere::searchableSphere
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
centre_(dict.get<point>("centre")),
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
{
|
||||
bounds() = boundBox
|
||||
searchableSphere
|
||||
(
|
||||
centre_ - radius_*vector::one,
|
||||
centre_ + radius_*vector::one
|
||||
);
|
||||
}
|
||||
io,
|
||||
dict.getCompat<vector>("origin", {{"centre", -1806}}),
|
||||
dict.get<scalar>("radius")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::searchableSphere::overlaps(const boundBox& bb) const
|
||||
{
|
||||
return bb.overlaps(centre_, sqr(radius_));
|
||||
return bb.overlaps(origin_, sqr(radius_));
|
||||
}
|
||||
|
||||
|
||||
@ -181,8 +178,8 @@ const Foam::wordList& Foam::searchableSphere::regions() const
|
||||
{
|
||||
if (regions_.empty())
|
||||
{
|
||||
regions_.setSize(1);
|
||||
regions_[0] = "region0";
|
||||
regions_.resize(1);
|
||||
regions_.first() = "region0";
|
||||
}
|
||||
return regions_;
|
||||
}
|
||||
@ -195,10 +192,10 @@ void Foam::searchableSphere::boundingSpheres
|
||||
scalarField& radiusSqr
|
||||
) const
|
||||
{
|
||||
centres.setSize(1);
|
||||
centres[0] = centre_;
|
||||
centres.resize(1);
|
||||
centres[0] = origin_;
|
||||
|
||||
radiusSqr.setSize(1);
|
||||
radiusSqr.resize(1);
|
||||
radiusSqr[0] = Foam::sqr(radius_);
|
||||
|
||||
// Add a bit to make sure all points are tested inside
|
||||
@ -336,7 +333,7 @@ void Foam::searchableSphere::getNormal
|
||||
{
|
||||
if (info[i].hit())
|
||||
{
|
||||
normal[i] = normalised(info[i].hitPoint() - centre_);
|
||||
normal[i] = normalised(info[i].hitPoint() - origin_);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -362,7 +359,7 @@ void Foam::searchableSphere::getVolumeType
|
||||
|
||||
volType[pointi] =
|
||||
(
|
||||
(magSqr(pt - centre_) <= rad2)
|
||||
(magSqr(pt - origin_) <= rad2)
|
||||
? volumeType::INSIDE : volumeType::OUTSIDE
|
||||
);
|
||||
}
|
||||
|
||||
@ -29,10 +29,11 @@ Description
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | sphere / searchableSphere | selector |
|
||||
centre | The sphere centre | yes |
|
||||
radius | The (outside) radius of sphere | yes |
|
||||
Property | Description | Required | Default
|
||||
type | sphere / searchableSphere | selector |
|
||||
origin | The origin (centre) of the sphere | yes |
|
||||
radius | The (outside) radius of sphere | yes |
|
||||
centre | Alternative for 'origin' | no |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
@ -64,7 +65,7 @@ private:
|
||||
// Private Member Data
|
||||
|
||||
//- Centre point of the sphere
|
||||
const point centre_;
|
||||
const point origin_;
|
||||
|
||||
//- The outer radius of the sphere
|
||||
const scalar radius_;
|
||||
@ -151,7 +152,7 @@ public:
|
||||
// Usually the element centres (should be of length size()).
|
||||
virtual tmp<pointField> coordinates() const
|
||||
{
|
||||
return tmp<pointField>::New(1, centre_);
|
||||
return tmp<pointField>::New(1, origin_);
|
||||
}
|
||||
|
||||
//- Get bounding spheres (centre and radius squared), one per element.
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(boxToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, boxToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, boxToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, boxToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, boxToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
boxToCell,
|
||||
word,
|
||||
box
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
boxToCell,
|
||||
istream,
|
||||
box
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -73,29 +89,37 @@ Foam::boxToCell::boxToCell
|
||||
const treeBoundBoxList& bbs
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
bbs_(bbs)
|
||||
{}
|
||||
|
||||
|
||||
Foam::boxToCell::boxToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
treeBoundBoxList&& bbs
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
bbs_(std::move(bbs))
|
||||
{}
|
||||
|
||||
|
||||
Foam::boxToCell::boxToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
bbs_()
|
||||
{
|
||||
if (dict.found("box"))
|
||||
// Look for 'boxes' or 'box'
|
||||
if (!dict.readIfPresent("boxes", bbs_))
|
||||
{
|
||||
bbs_.resize(1);
|
||||
dict.readEntry("box", bbs_.first());
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.readEntry("boxes", bbs_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,8 +129,8 @@ Foam::boxToCell::boxToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
bbs_(1, treeBoundBox(checkIs(is)))
|
||||
topoSetCellSource(mesh),
|
||||
bbs_(one(), treeBoundBox(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
@ -118,15 +142,23 @@ void Foam::boxToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells with center within boxes " << bbs_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells with centre within boxes "
|
||||
<< bbs_ << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells with center within boxes " << bbs_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells with centre within boxes "
|
||||
<< bbs_ << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,17 +25,18 @@ Class
|
||||
Foam::boxToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cell centres inside box(es).
|
||||
A topoSetCellSource to select cells based on cell centres inside box(es).
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
box | A single bounding box | partly |
|
||||
boxes | Multiple bounding boxes | partly |
|
||||
Property | Description | Required | Default
|
||||
box | A single bounding box | partly |
|
||||
boxes | Multiple bounding boxes | partly |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Must specify either "box" or "boxes"
|
||||
Must specify either "box" or "boxes".
|
||||
The selection of multiple boxes has precedence.
|
||||
|
||||
SourceFiles
|
||||
boxToCell.C
|
||||
@ -45,7 +46,7 @@ SourceFiles
|
||||
#ifndef boxToCell_H
|
||||
#define boxToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "treeBoundBoxList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -59,7 +60,7 @@ namespace Foam
|
||||
|
||||
class boxToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -82,12 +83,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
boxToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const treeBoundBoxList& bbs
|
||||
);
|
||||
//- Construct from components, copying bounding boxes
|
||||
boxToCell(const polyMesh& mesh, const treeBoundBoxList& bbs);
|
||||
|
||||
//- Construct from components, moving bounding boxes
|
||||
boxToCell(const polyMesh& mesh, treeBoundBoxList&& bbs);
|
||||
|
||||
//- Construct from dictionary
|
||||
boxToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -102,11 +102,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(cellToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, cellToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, cellToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, cellToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, cellToCell, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +56,7 @@ Foam::cellToCell::cellToCell
|
||||
const word& setName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(setName)
|
||||
{}
|
||||
|
||||
@ -65,8 +67,11 @@ Foam::cellToCell::cellToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set"))
|
||||
cellToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -76,7 +81,7 @@ Foam::cellToCell::cellToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(checkIs(is))
|
||||
{}
|
||||
|
||||
@ -89,25 +94,31 @@ void Foam::cellToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::ADD) || (action == topoSetSource::NEW))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all elements of cellSet " << setName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all elements of cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
cellSet loadedSet(mesh_, setName_);
|
||||
|
||||
set.addSet(loadedSet);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all elements of cellSet " << setName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all elements of cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
cellSet loadedSet(mesh_, setName_);
|
||||
|
||||
set.deleteSet(loadedSet);
|
||||
set.subtractSet(loadedSet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cellToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select the cells from another cellSet.
|
||||
A topoSetCellSource to select the cells from another cellSet.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -41,7 +41,7 @@ SourceFiles
|
||||
#ifndef cellToCell_H
|
||||
#define cellToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Foam
|
||||
|
||||
class cellToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -72,11 +72,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
cellToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
);
|
||||
cellToCell(const polyMesh& mesh, const word& setName);
|
||||
|
||||
//- Construct from dictionary
|
||||
cellToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -91,11 +87,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,32 @@ namespace Foam
|
||||
defineTypeNameAndDebug(cylinderAnnulusToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, istream);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
cylinderAnnulusToCell,
|
||||
word
|
||||
);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
cylinderAnnulusToCell,
|
||||
istream
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
cylinderAnnulusToCell,
|
||||
word,
|
||||
cylinderAnnulus
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
cylinderAnnulusToCell,
|
||||
istream,
|
||||
cylinderAnnulus
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +111,7 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
|
||||
const scalar innerRadius
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
point1_(point1),
|
||||
point2_(point2),
|
||||
outerRadius_(outerRadius),
|
||||
@ -99,11 +125,14 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
point1_(dict.get<point>("p1")),
|
||||
point2_(dict.get<point>("p2")),
|
||||
outerRadius_(dict.get<scalar>("outerRadius")),
|
||||
innerRadius_(dict.get<scalar>("innerRadius"))
|
||||
cylinderAnnulusToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<point>("p1"),
|
||||
dict.get<point>("p2"),
|
||||
dict.get<scalar>("outerRadius"),
|
||||
dict.get<scalar>("innerRadius")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -113,7 +142,7 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
point1_(checkIs(is)),
|
||||
point2_(checkIs(is)),
|
||||
outerRadius_(readScalar(checkIs(is))),
|
||||
@ -129,23 +158,29 @@ void Foam::cylinderAnnulusToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells with centre within cylinder annulus,"
|
||||
<< " with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells with centre within cylinder annulus,"
|
||||
<< " with p1 = " << point1_ << ", p2 = " << point2_
|
||||
<< ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells with centre within cylinder annulus,"
|
||||
<< " with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells with centre within cylinder annulus,"
|
||||
<< " with p1 = " << point1_ << ", p2 = " << point2_
|
||||
<< ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cylinderAnnulusToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cell centres inside a
|
||||
A topoSetCellSource to select cells based on cell centres inside a
|
||||
cylinder annulus.
|
||||
|
||||
\heading Dictionary parameters
|
||||
@ -45,7 +45,7 @@ SourceFiles
|
||||
#ifndef cylinderAnnulusToCell_H
|
||||
#define cylinderAnnulusToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Foam
|
||||
|
||||
class cylinderAnnulusToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -99,7 +99,7 @@ public:
|
||||
const point& point1,
|
||||
const point& point2,
|
||||
const scalar outerRadius,
|
||||
const scalar innerRadius
|
||||
const scalar innerRadius = 0
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -115,11 +115,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(cylinderToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, cylinderToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, cylinderToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
cylinderToCell,
|
||||
word,
|
||||
cylinder
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
cylinderToCell,
|
||||
istream,
|
||||
cylinder
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +98,7 @@ Foam::cylinderToCell::cylinderToCell
|
||||
const scalar radius
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
point1_(point1),
|
||||
point2_(point2),
|
||||
radius_(radius)
|
||||
@ -95,10 +111,13 @@ Foam::cylinderToCell::cylinderToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
point1_(dict.get<point>("p1")),
|
||||
point2_(dict.get<point>("p2")),
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
cylinderToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<point>("p1"),
|
||||
dict.get<point>("p2"),
|
||||
dict.get<scalar>("radius")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -108,7 +127,7 @@ Foam::cylinderToCell::cylinderToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
point1_(checkIs(is)),
|
||||
point2_(checkIs(is)),
|
||||
radius_(readScalar(checkIs(is)))
|
||||
@ -123,19 +142,25 @@ void Foam::cylinderToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cylinderToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cell centres inside a cylinder.
|
||||
A topoSetCellSource to select cells with their centres inside a cylinder.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#ifndef cylinderToCell_H
|
||||
#define cylinderToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -56,7 +56,7 @@ namespace Foam
|
||||
|
||||
class cylinderToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -109,11 +109,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(faceToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, faceToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, faceToCell, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +135,7 @@ Foam::faceToCell::faceToCell
|
||||
const faceAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(setName),
|
||||
option_(option)
|
||||
{}
|
||||
@ -145,9 +147,12 @@ Foam::faceToCell::faceToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set")),
|
||||
option_(faceActionNames_.get("option", dict))
|
||||
faceToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set"),
|
||||
faceActionNames_.get("option", dict)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -157,7 +162,7 @@ Foam::faceToCell::faceToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
option_(faceActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
@ -171,17 +176,23 @@ void Foam::faceToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells according to faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells according to faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells according to faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells according to faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::faceToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on usage in a face set.
|
||||
A topoSetCellSource to select cells based on usage in a face set.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef faceToCell_H
|
||||
#define faceToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,7 +56,7 @@ namespace Foam
|
||||
|
||||
class faceToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
public:
|
||||
//- Enumeration defining the valid options
|
||||
@ -118,11 +118,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(faceZoneToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, faceZoneToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, faceZoneToCell, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +67,7 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
||||
|
||||
for (const faceZone& zone : mesh_.faceZones())
|
||||
{
|
||||
if (zoneName_.match(zone.name()))
|
||||
if (selectedZones_.match(zone.name()))
|
||||
{
|
||||
hasMatched = true;
|
||||
|
||||
@ -76,9 +78,12 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
||||
: zone.slaveCells()
|
||||
);
|
||||
|
||||
Info<< " Found matching zone " << zone.name()
|
||||
<< " with " << cellLabels.size() << " cells on selected side."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Found matching zone " << zone.name()
|
||||
<< " with " << cellLabels.size() << " cells on "
|
||||
<< faceActionNames_[option_] << " side" << endl;
|
||||
}
|
||||
|
||||
for (const label celli : cellLabels)
|
||||
{
|
||||
@ -94,7 +99,8 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
||||
if (!hasMatched)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find any faceZone named " << zoneName_ << nl
|
||||
<< "Cannot find any faceZone matching "
|
||||
<< flatOutput(selectedZones_) << nl
|
||||
<< "Valid names: " << flatOutput(mesh_.faceZones().names())
|
||||
<< endl;
|
||||
}
|
||||
@ -106,12 +112,12 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
||||
Foam::faceZoneToCell::faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName,
|
||||
const wordRe& zoneName,
|
||||
const faceAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(zoneName),
|
||||
topoSetCellSource(mesh),
|
||||
selectedZones_(one(), zoneName),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
@ -122,10 +128,18 @@ Foam::faceZoneToCell::faceZoneToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(dict.get<wordRe>("name")),
|
||||
topoSetCellSource(mesh),
|
||||
selectedZones_(),
|
||||
option_(faceActionNames_.get("option", dict))
|
||||
{}
|
||||
{
|
||||
// Look for 'zones' and 'zone', but accept 'name' as well
|
||||
if (!dict.readIfPresent("zones", selectedZones_))
|
||||
{
|
||||
selectedZones_.resize(1);
|
||||
selectedZones_.first() =
|
||||
dict.getCompat<wordRe>("zone", {{"name", 1806}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::faceZoneToCell::faceZoneToCell
|
||||
@ -134,8 +148,8 @@ Foam::faceZoneToCell::faceZoneToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(checkIs(is)),
|
||||
topoSetCellSource(mesh),
|
||||
selectedZones_(one(), wordRe(checkIs(is))),
|
||||
option_(faceActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -148,17 +162,25 @@ void Foam::faceZoneToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all " << faceActionNames_[option_]
|
||||
<< " cells of faceZone " << zoneName_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all " << faceActionNames_[option_]
|
||||
<< " cells of face zones "
|
||||
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all " << faceActionNames_[option_]
|
||||
<< " cells of faceZone " << zoneName_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all " << faceActionNames_[option_]
|
||||
<< " cells of face zones "
|
||||
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,15 +25,20 @@ Class
|
||||
Foam::faceZoneToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on side of faceZone.
|
||||
A topoSetCellSource to select cells based on side of faceZone.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
name | The face zone name or regex | yes |
|
||||
option | Selection type (master / slave) | yes |
|
||||
Property | Description | Required | Default
|
||||
option | Selection type (master / slave) | yes |
|
||||
zone | The face zone name or regex | possibly |
|
||||
zones | The face zone names or regexs | possibly |
|
||||
name | Older specification for 'zone' | no |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Selection of multiple zones has precedence.
|
||||
|
||||
SourceFiles
|
||||
faceZoneToCell.C
|
||||
|
||||
@ -42,8 +47,8 @@ SourceFiles
|
||||
#ifndef faceZoneToCell_H
|
||||
#define faceZoneToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "wordRe.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -56,7 +61,7 @@ namespace Foam
|
||||
|
||||
class faceZoneToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
public:
|
||||
//- Enumeration defining the valid options
|
||||
@ -75,8 +80,8 @@ private:
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name/regular expression of faceZone
|
||||
wordRe zoneName_;
|
||||
//- Matcher for face zones
|
||||
wordRes selectedZones_;
|
||||
|
||||
//- Option
|
||||
faceAction option_;
|
||||
@ -98,7 +103,7 @@ public:
|
||||
faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName,
|
||||
const wordRe& zoneName,
|
||||
const faceAction option
|
||||
);
|
||||
|
||||
@ -115,11 +120,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -38,6 +38,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(fieldToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, fieldToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, fieldToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, fieldToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, fieldToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
fieldToCell,
|
||||
word,
|
||||
field
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
fieldToCell,
|
||||
istream,
|
||||
field
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -58,32 +74,40 @@ void Foam::fieldToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
Info<< " Field min:" << min(field)
|
||||
<< " max:" << max(field) << endl;
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all cells with value of field " << fieldName_
|
||||
<< " within range " << min_ << ".." << max_ << endl;
|
||||
Info << " Field min:" << min(field) << " max:" << max(field) << nl;
|
||||
}
|
||||
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all cells with value of field " << fieldName_
|
||||
<< " within range " << min_ << ".." << max_ << endl;
|
||||
}
|
||||
|
||||
forAll(field, celli)
|
||||
{
|
||||
if (field[celli] >= min_ && field[celli] <= max_)
|
||||
{
|
||||
set.insert(celli);
|
||||
set.set(celli);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all cells with value of field " << fieldName_
|
||||
<< " within range " << min_ << ".." << max_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all cells with value of field " << fieldName_
|
||||
<< " within range " << min_ << ".." << max_ << endl;
|
||||
}
|
||||
|
||||
forAll(field, celli)
|
||||
{
|
||||
if (field[celli] >= min_ && field[celli] <= max_)
|
||||
{
|
||||
set.erase(celli);
|
||||
set.unset(celli);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,7 +124,7 @@ Foam::fieldToCell::fieldToCell
|
||||
const scalar max
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
fieldName_(fieldName),
|
||||
min_(min),
|
||||
max_(max)
|
||||
@ -113,10 +137,13 @@ Foam::fieldToCell::fieldToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
fieldName_(dict.get<word>("field")),
|
||||
min_(dict.get<scalar>("min")),
|
||||
max_(dict.get<scalar>("max"))
|
||||
fieldToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("field"),
|
||||
dict.get<scalar>("min"),
|
||||
dict.get<scalar>("max")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -126,7 +153,7 @@ Foam::fieldToCell::fieldToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
fieldName_(checkIs(is)),
|
||||
min_(readScalar(checkIs(is))),
|
||||
max_(readScalar(checkIs(is)))
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::fieldToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on field values.
|
||||
A topoSetCellSource to select cells based on field values.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#ifndef fieldToCell_H
|
||||
#define fieldToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "scalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -57,7 +57,7 @@ namespace Foam
|
||||
|
||||
class fieldToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -115,11 +115,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(labelToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, labelToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, labelToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, labelToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, labelToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
labelToCell,
|
||||
word,
|
||||
label
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
labelToCell,
|
||||
istream,
|
||||
label
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -53,19 +69,29 @@ Foam::labelToCell::labelToCell
|
||||
const labelList& labels
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
labels_(labels)
|
||||
{}
|
||||
|
||||
|
||||
Foam::labelToCell::labelToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
labelList&& labels
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
labels_(std::move(labels))
|
||||
{}
|
||||
|
||||
|
||||
Foam::labelToCell::labelToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
labels_(dict.get<labelList>("value"))
|
||||
labelToCell(mesh, dict.get<labelList>("value"))
|
||||
{}
|
||||
|
||||
|
||||
@ -75,7 +101,7 @@ Foam::labelToCell::labelToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
labels_(checkIs(is))
|
||||
{
|
||||
check(labels_, mesh.nCells());
|
||||
@ -90,15 +116,23 @@ void Foam::labelToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells mentioned in dictionary" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells mentioned in dictionary"
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
addOrDelete(set, labels_, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells mentioned in dictionary" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells mentioned in dictionary"
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
addOrDelete(set, labels_, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::labelToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on explicitly given labels.
|
||||
A topoSetCellSource to select cells based on explicitly given labels.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -41,7 +41,7 @@ SourceFiles
|
||||
#ifndef labelToCell_H
|
||||
#define labelToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Foam
|
||||
|
||||
class labelToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -73,12 +73,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
labelToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& labels
|
||||
);
|
||||
//- Construct from components, copying labels
|
||||
labelToCell(const polyMesh& mesh, const labelList& labels);
|
||||
|
||||
//- Construct from components, moving labels
|
||||
labelToCell(const polyMesh& mesh, labelList&& labels);
|
||||
|
||||
//- Construct from dictionary
|
||||
labelToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -93,11 +92,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(nbrToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, nbrToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, nbrToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, nbrToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, nbrToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
nbrToCell,
|
||||
word,
|
||||
nbr
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
nbrToCell,
|
||||
istream,
|
||||
nbr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +117,7 @@ Foam::nbrToCell::nbrToCell
|
||||
const label minNbrs
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
minNbrs_(minNbrs)
|
||||
{}
|
||||
|
||||
@ -112,8 +128,7 @@ Foam::nbrToCell::nbrToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
minNbrs_(dict.get<label>("neighbours"))
|
||||
nbrToCell(mesh, dict.get<label>("neighbours"))
|
||||
{}
|
||||
|
||||
|
||||
@ -123,7 +138,7 @@ Foam::nbrToCell::nbrToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
minNbrs_(readLabel(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -136,17 +151,23 @@ void Foam::nbrToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells with only " << minNbrs_ << " or less"
|
||||
" neighbouring cells" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells with only " << minNbrs_
|
||||
<< " or fewer neighbouring cells" << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells with only " << minNbrs_ << " or less"
|
||||
" neighbouring cells" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells with only " << minNbrs_
|
||||
<< " or fewer neighbouring cells" << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::nbrToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on number of neighbouring cells
|
||||
A topoSetCellSource to select cells based on number of neighbouring cells
|
||||
(i.e. number of internal or coupled faces)
|
||||
|
||||
\heading Dictionary parameters
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef nbrToCell_H
|
||||
#define nbrToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +55,7 @@ namespace Foam
|
||||
|
||||
class nbrToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -81,11 +81,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
nbrToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label minNbrs
|
||||
);
|
||||
nbrToCell(const polyMesh& mesh, const label minNbrs);
|
||||
|
||||
//- Construct from dictionary
|
||||
nbrToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -100,11 +96,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(nearestToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, nearestToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, nearestToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, nearestToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, nearestToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
nearestToCell,
|
||||
word,
|
||||
nearest
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
nearestToCell,
|
||||
istream,
|
||||
nearest
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -87,19 +103,33 @@ Foam::nearestToCell::nearestToCell
|
||||
const pointField& points
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
points_(points)
|
||||
{}
|
||||
|
||||
|
||||
Foam::nearestToCell::nearestToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
pointField&& points
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
points_(std::move(points))
|
||||
{}
|
||||
|
||||
|
||||
Foam::nearestToCell::nearestToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
points_(dict.get<pointField>("points"))
|
||||
nearestToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<pointField>("points")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -109,7 +139,7 @@ Foam::nearestToCell::nearestToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
points_(checkIs(is))
|
||||
{}
|
||||
|
||||
@ -122,15 +152,21 @@ void Foam::nearestToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells nearest to " << points_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells nearest to " << points_ << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells nearest to " << points_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells nearest to " << points_ << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::nearestToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells nearest to points.
|
||||
A topoSetCellSource to select cells nearest to points.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -41,7 +41,7 @@ SourceFiles
|
||||
#ifndef nearestToCell_H
|
||||
#define nearestToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Foam
|
||||
|
||||
class nearestToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -78,12 +78,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
nearestToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const pointField& points
|
||||
);
|
||||
//- Construct from components, copying points
|
||||
nearestToCell(const polyMesh& mesh, const pointField& points);
|
||||
|
||||
//- Construct from components, moving points
|
||||
nearestToCell(const polyMesh& mesh, pointField&& points);
|
||||
|
||||
//- Construct from dictionary
|
||||
nearestToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -98,11 +97,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(pointToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, pointToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, pointToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, pointToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, pointToCell, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +118,7 @@ Foam::pointToCell::pointToCell
|
||||
const pointAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(setName),
|
||||
option_(option)
|
||||
{}
|
||||
@ -128,9 +130,12 @@ Foam::pointToCell::pointToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set")),
|
||||
option_(pointActionNames_.get("option", dict))
|
||||
pointToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set"),
|
||||
pointActionNames_.get("option", dict)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -140,7 +145,7 @@ Foam::pointToCell::pointToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
option_(pointActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
@ -154,17 +159,23 @@ void Foam::pointToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::pointToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on usage of points.
|
||||
A topoSetCellSource to select cells based on usage of points.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef pointToCell_H
|
||||
#define pointToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,7 +56,7 @@ namespace Foam
|
||||
|
||||
class pointToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
public:
|
||||
//- Enumeration defining the valid options
|
||||
@ -115,11 +115,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -37,6 +37,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(regionToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, regionToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, regionToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, regionToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, regionToCell, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -155,7 +157,7 @@ void Foam::regionToCell::unselectOutsideRegions
|
||||
regionSplit cellRegion(mesh_, blockedFace);
|
||||
|
||||
// Determine regions containing insidePoints_
|
||||
boolList keepRegion(findRegions(true, cellRegion));
|
||||
boolList keepRegion(findRegions(verbose_, cellRegion));
|
||||
|
||||
// Go back to bool per cell
|
||||
forAll(cellRegion, celli)
|
||||
@ -266,7 +268,7 @@ void Foam::regionToCell::erode
|
||||
regionSplit cellRegion(mesh_, blockedFace);
|
||||
|
||||
// Determine regions containing insidePoints
|
||||
boolList keepRegion(findRegions(true, cellRegion));
|
||||
boolList keepRegion(findRegions(verbose_, cellRegion));
|
||||
|
||||
|
||||
// Extract cells in regions that are not to be kept.
|
||||
@ -386,7 +388,7 @@ Foam::regionToCell::regionToCell
|
||||
const label nErode
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(setName),
|
||||
insidePoints_(insidePoints),
|
||||
nErode_(nErode)
|
||||
@ -399,7 +401,7 @@ Foam::regionToCell::regionToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(dict.lookupOrDefault<word>("set", "none")),
|
||||
insidePoints_
|
||||
(
|
||||
@ -415,7 +417,7 @@ Foam::regionToCell::regionToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
insidePoints_(checkIs(is)),
|
||||
nErode_(readLabel(checkIs(is)))
|
||||
@ -430,17 +432,25 @@ void Foam::regionToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all cells of connected region containing points "
|
||||
<< insidePoints_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all cells of connected region "
|
||||
<< "containing points "
|
||||
<< insidePoints_ << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all cells of connected region containing points "
|
||||
<< insidePoints_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all cells of connected region "
|
||||
<< "containing points "
|
||||
<< insidePoints_ << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,8 +25,8 @@ Class
|
||||
Foam::regionToCell
|
||||
|
||||
Description
|
||||
TopoSetSource. Select cells belonging to topological connected region
|
||||
(that contains given points)
|
||||
A topoSetCellSource to select cells belonging to a topological connected
|
||||
region (that contains given points)
|
||||
|
||||
In dictionary input:
|
||||
\verbatim
|
||||
@ -43,10 +43,10 @@ Description
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
insidePoints | Points inside regions | yes |
|
||||
nErode | Cell layers to erode to detect holes | no | 0
|
||||
set | Restrict to named cellSet | no | ''
|
||||
Property | Description | Required | Default
|
||||
insidePoints | Points inside regions | yes |
|
||||
nErode | Cell layers to erode to detect holes | no | 0
|
||||
set | Restrict to named cellSet | no | ""
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
@ -57,7 +57,7 @@ SourceFiles
|
||||
#ifndef regionToCell_H
|
||||
#define regionToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "boolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -73,7 +73,7 @@ class regionSplit;
|
||||
|
||||
class regionToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -146,11 +146,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(rotatedBoxToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, rotatedBoxToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, rotatedBoxToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, rotatedBoxToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
rotatedBoxToCell,
|
||||
word,
|
||||
rotatedBox
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
rotatedBoxToCell,
|
||||
istream,
|
||||
rotatedBox
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +133,7 @@ Foam::rotatedBoxToCell::rotatedBoxToCell
|
||||
const vector& k
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
origin_(origin),
|
||||
i_(i),
|
||||
j_(j),
|
||||
@ -131,17 +147,20 @@ Foam::rotatedBoxToCell::rotatedBoxToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
origin_(dict.get<point>("origin")),
|
||||
i_(dict.get<vector>("i")),
|
||||
j_(dict.get<vector>("j")),
|
||||
k_(dict.get<vector>("k"))
|
||||
rotatedBoxToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<point>("origin"),
|
||||
dict.get<vector>("i"),
|
||||
dict.get<vector>("j"),
|
||||
dict.get<vector>("k")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
Foam::rotatedBoxToCell::rotatedBoxToCell(const polyMesh& mesh, Istream& is)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
origin_(is),
|
||||
i_(is),
|
||||
j_(is),
|
||||
@ -157,15 +176,23 @@ void Foam::rotatedBoxToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells with center within rotated box " << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells with centre within rotated box"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells with center within rotated box " << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells with centre within rotated box"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::rotatedBoxToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cell centres inside
|
||||
A topoSetCellSource to select cells based on cell centres inside
|
||||
rotated/skewed box (parallelopiped?).
|
||||
|
||||
Box defined as origin and i,j,k vectors.
|
||||
@ -55,7 +55,7 @@ SourceFiles
|
||||
#ifndef rotatedBoxToCell_H
|
||||
#define rotatedBoxToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "treeBoundBox.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -69,7 +69,7 @@ namespace Foam
|
||||
|
||||
class rotatedBoxToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -120,11 +120,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -0,0 +1,187 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
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
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "searchableSurfaceToCell.H"
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(searchableSurfaceToCell, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
topoSetSource,
|
||||
searchableSurfaceToCell,
|
||||
word
|
||||
);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
searchableSurfaceToCell,
|
||||
word
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetSource,
|
||||
searchableSurfaceToCell,
|
||||
word,
|
||||
surface
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::searchableSurfaceToCell::usage_
|
||||
(
|
||||
searchableSurfaceToCell::typeName,
|
||||
"\n Usage: searchableSurfaceToCell surface\n\n"
|
||||
" Select cells with centre enclosed by the surface"
|
||||
"\n"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::searchableSurfaceToCell::combine(topoSet& set, const bool add) const
|
||||
{
|
||||
if (!surf_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const searchableSurface& s = *surf_;
|
||||
|
||||
// Add cells within the enclosing volumes
|
||||
|
||||
const label len = mesh_.nCells();
|
||||
|
||||
List<volumeType> volTypes;
|
||||
|
||||
s.getVolumeType(mesh_.cellCentres(), volTypes);
|
||||
|
||||
for (label celli=0; celli < len; ++celli)
|
||||
{
|
||||
if (volTypes[celli] == volumeType::INSIDE)
|
||||
{
|
||||
addOrDelete(set, celli, add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableSurfaceToCell::searchableSurfaceToCell
|
||||
(
|
||||
const word& surfaceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetCellSource(mesh),
|
||||
surf_
|
||||
(
|
||||
searchableSurface::New
|
||||
(
|
||||
surfaceType,
|
||||
IOobject
|
||||
(
|
||||
dict.lookupOrDefault("name", mesh.objectRegistry::db().name()),
|
||||
mesh.time().constant(), // Instance
|
||||
"triSurface", // Local
|
||||
mesh.time(), // Registry
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dict
|
||||
)
|
||||
)
|
||||
{
|
||||
// Check/warn for non-enclosed
|
||||
if (surf_ && !surf_->hasVolumeType())
|
||||
{
|
||||
WarningInFunction
|
||||
<< nl << "The surface '" << surf_->name() << "' of type '"
|
||||
<< surf_->type() << "' appears to be unclosed ... ignoring"
|
||||
<< nl << endl;
|
||||
|
||||
surf_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::searchableSurfaceToCell::searchableSurfaceToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
searchableSurfaceToCell
|
||||
(
|
||||
dict.get<word>("surface"),
|
||||
mesh,
|
||||
dict
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::searchableSurfaceToCell::applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if (!surf_ || !surf_->hasVolumeType())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells enclosed by searchableSurface"
|
||||
<< "..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells enclosed by searchableSurface"
|
||||
<< "..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
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
|
||||
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/>.
|
||||
|
||||
Class
|
||||
Foam::searchableSurfaceToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cell centres within a
|
||||
searchableSurface.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
surface | The searchable surface type | yes |
|
||||
name | Name for the IOobject | no | mesh-name
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
searchableSurfaceToCell.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef searchableSurfaceToCell_H
|
||||
#define searchableSurfaceToCell_H
|
||||
|
||||
#include "topoSetCellSource.H"
|
||||
#include "searchableSurface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchableSurfaceToCell Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class searchableSurfaceToCell
|
||||
:
|
||||
public topoSetCellSource
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- The searchableSurface
|
||||
autoPtr<searchableSurface> surf_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void combine(topoSet& set, const bool add) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("searchableSurfaceToCell");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct surface-type from dictionary
|
||||
searchableSurfaceToCell
|
||||
(
|
||||
const word& surfaceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
searchableSurfaceToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~searchableSurfaceToCell() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -37,6 +37,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(shapeToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, shapeToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, shapeToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, shapeToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, shapeToCell, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +96,7 @@ Foam::shapeToCell::shapeToCell
|
||||
const word& shapeName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
type_(shapeName)
|
||||
{
|
||||
if (!cellModel::ptr(type_) && type_ != "splitHex")
|
||||
@ -111,15 +113,8 @@ Foam::shapeToCell::shapeToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
type_(dict.get<word>("type"))
|
||||
{
|
||||
if (!cellModel::ptr(type_) && type_ != "splitHex")
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal cell type " << type_ << exit(FatalError);
|
||||
}
|
||||
}
|
||||
shapeToCell(mesh, dict.get<word>("type"))
|
||||
{}
|
||||
|
||||
|
||||
Foam::shapeToCell::shapeToCell
|
||||
@ -128,7 +123,7 @@ Foam::shapeToCell::shapeToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
type_(checkIs(is))
|
||||
{
|
||||
if (!cellModel::ptr(type_) && type_ != "splitHex")
|
||||
@ -147,15 +142,23 @@ void Foam::shapeToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all cells of type " << type_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all cells of type " << type_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all cells of type " << type_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all cells of type " << type_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::shapeToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cell shape.
|
||||
A topoSetCellSource to select cells based on cell shape.
|
||||
|
||||
Handles all known ones from static collection in cellModel
|
||||
and splitHex with 10 degrees feature angle.
|
||||
@ -44,7 +44,7 @@ SourceFiles
|
||||
#ifndef shapeToCell_H
|
||||
#define shapeToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -57,7 +57,7 @@ namespace Foam
|
||||
|
||||
class shapeToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -90,11 +90,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
shapeToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& shapeName
|
||||
);
|
||||
shapeToCell(const polyMesh& mesh, const word& shapeName);
|
||||
|
||||
//- Construct from dictionary
|
||||
shapeToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -109,11 +105,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(sphereToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, sphereToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, sphereToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, sphereToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, sphereToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
sphereToCell,
|
||||
word,
|
||||
sphere
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
sphereToCell,
|
||||
istream,
|
||||
sphere
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +71,7 @@ void Foam::sphereToCell::combine(topoSet& set, const bool add) const
|
||||
|
||||
forAll(ctrs, celli)
|
||||
{
|
||||
if (magSqr(ctrs[celli] - centre_) <= rad2)
|
||||
if (magSqr(ctrs[celli] - origin_) <= rad2)
|
||||
{
|
||||
addOrDelete(set, celli, add);
|
||||
}
|
||||
@ -68,12 +84,12 @@ void Foam::sphereToCell::combine(topoSet& set, const bool add) const
|
||||
Foam::sphereToCell::sphereToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const point& centre,
|
||||
const point& origin,
|
||||
const scalar radius
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
centre_(centre),
|
||||
topoSetCellSource(mesh),
|
||||
origin_(origin),
|
||||
radius_(radius)
|
||||
{}
|
||||
|
||||
@ -84,9 +100,12 @@ Foam::sphereToCell::sphereToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
centre_(dict.get<point>("centre")),
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
sphereToCell
|
||||
(
|
||||
mesh,
|
||||
dict.getCompat<vector>("origin", {{"centre", -1806}}),
|
||||
dict.get<scalar>("radius")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -96,8 +115,8 @@ Foam::sphereToCell::sphereToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
centre_(checkIs(is)),
|
||||
topoSetCellSource(mesh),
|
||||
origin_(checkIs(is)),
|
||||
radius_(readScalar(checkIs(is)))
|
||||
{}
|
||||
|
||||
@ -110,17 +129,23 @@ void Foam::sphereToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells with centre within sphere, with centre = "
|
||||
<< centre_ << " and radius = " << radius_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells within a sphere with centre = "
|
||||
<< origin_ << " and radius = " << radius_ << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells with centre within sphere, with centre = "
|
||||
<< centre_ << " and radius = " << radius_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells within a sphere with centre = "
|
||||
<< origin_ << " and radius = " << radius_ << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,13 +25,14 @@ Class
|
||||
Foam::sphereToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cell centres inside sphere.
|
||||
A topoSetCellSource to select cells based on cell centres inside sphere.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
centre | The sphere centre | yes |
|
||||
radius | The (outside) radius of sphere | yes |
|
||||
Property | Description | Required | Default
|
||||
origin | The origin (centre) of the sphere | yes |
|
||||
radius | The (outside) radius of sphere | yes |
|
||||
centre | Alternative for 'origin' | no |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
@ -42,7 +43,7 @@ SourceFiles
|
||||
#ifndef sphereToCell_H
|
||||
#define sphereToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +56,7 @@ namespace Foam
|
||||
|
||||
class sphereToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -64,7 +65,7 @@ class sphereToCell
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Centre point of the sphere
|
||||
point centre_;
|
||||
point origin_;
|
||||
|
||||
//- The outer radius of the sphere
|
||||
scalar radius_;
|
||||
@ -87,7 +88,7 @@ public:
|
||||
sphereToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const point& centre,
|
||||
const point& origin,
|
||||
const scalar radius
|
||||
);
|
||||
|
||||
@ -104,11 +105,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -40,6 +40,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(surfaceToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, surfaceToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, surfaceToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, surfaceToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, surfaceToCell, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -72,25 +74,22 @@ Foam::label Foam::surfaceToCell::getNearest
|
||||
Map<label>& cache
|
||||
)
|
||||
{
|
||||
Map<label>::const_iterator iter = cache.find(pointi);
|
||||
const auto iter = cache.cfind(pointi);
|
||||
|
||||
if (iter != cache.end())
|
||||
if (iter.found())
|
||||
{
|
||||
// Found cached answer
|
||||
return iter();
|
||||
return *iter; // Return cached value
|
||||
}
|
||||
else
|
||||
{
|
||||
pointIndexHit inter = querySurf.nearest(pt, span);
|
||||
|
||||
// Triangle label (can be -1)
|
||||
label triI = inter.index();
|
||||
pointIndexHit inter = querySurf.nearest(pt, span);
|
||||
|
||||
// Store triangle on point
|
||||
cache.insert(pointi, triI);
|
||||
// Triangle label (can be -1)
|
||||
const label trii = inter.index();
|
||||
|
||||
return triI;
|
||||
}
|
||||
// Store triangle on point
|
||||
cache.insert(pointi, trii);
|
||||
|
||||
return trii;
|
||||
}
|
||||
|
||||
|
||||
@ -148,7 +147,6 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
|
||||
{
|
||||
cpuTime timer;
|
||||
|
||||
|
||||
if (useSurfaceOrientation_ && (includeInside_ || includeOutside_))
|
||||
{
|
||||
const meshSearch queryMesh(mesh_);
|
||||
@ -156,8 +154,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
|
||||
//- Calculate for each searchPoint inside/outside status.
|
||||
boolList isInside(querySurf().calcInside(mesh_.cellCentres()));
|
||||
|
||||
Info<< " Marked inside/outside using surface orientation in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << endl << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Marked inside/outside using surface orientation in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << nl << endl;
|
||||
}
|
||||
|
||||
forAll(isInside, celli)
|
||||
{
|
||||
@ -208,8 +209,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
|
||||
);
|
||||
|
||||
|
||||
Info<< " Marked inside/outside using surface intersection in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << endl << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Marked inside/outside using surface intersection in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << nl << endl;
|
||||
}
|
||||
|
||||
//- Add/remove cells using set
|
||||
forAll(cellType, celli)
|
||||
@ -252,8 +256,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
|
||||
|
||||
if (curvature_ < -1)
|
||||
{
|
||||
Info<< " Selecting cells with cellCentre closer than "
|
||||
<< nearDist_ << " to surface" << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Selecting cells with cellCentre closer than "
|
||||
<< nearDist_ << " to surface" << endl;
|
||||
}
|
||||
|
||||
// No need to test curvature. Insert near cells into set.
|
||||
|
||||
@ -269,17 +276,22 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " Determined nearest surface point in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << endl << endl;
|
||||
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Determined nearest surface point in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << nl << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Test near cells for curvature
|
||||
|
||||
Info<< " Selecting cells with cellCentre closer than "
|
||||
<< nearDist_ << " to surface and curvature factor"
|
||||
<< " less than " << curvature_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Selecting cells with cellCentre closer than "
|
||||
<< nearDist_ << " to surface and curvature factor"
|
||||
<< " less than " << curvature_ << endl;
|
||||
}
|
||||
|
||||
// Cache for nearest surface triangle for a point
|
||||
Map<label> pointToNearest(mesh_.nCells()/10);
|
||||
@ -309,8 +321,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " Determined nearest surface point in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << endl << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Determined nearest surface point in = "
|
||||
<< timer.cpuTimeIncrement() << " s" << nl << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -364,7 +379,7 @@ Foam::surfaceToCell::surfaceToCell
|
||||
const scalar curvature
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
surfName_(surfName),
|
||||
outsidePoints_(outsidePoints),
|
||||
includeCut_(includeCut),
|
||||
@ -396,7 +411,7 @@ Foam::surfaceToCell::surfaceToCell
|
||||
const scalar curvature
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
surfName_(surfName),
|
||||
outsidePoints_(outsidePoints),
|
||||
includeCut_(includeCut),
|
||||
@ -419,7 +434,7 @@ Foam::surfaceToCell::surfaceToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
surfName_(dict.get<fileName>("file").expand()),
|
||||
outsidePoints_(dict.get<pointField>("outsidePoints")),
|
||||
includeCut_(dict.get<bool>("includeCut")),
|
||||
@ -452,7 +467,7 @@ Foam::surfaceToCell::surfaceToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
surfName_(checkIs(is)),
|
||||
outsidePoints_(checkIs(is)),
|
||||
includeCut_(readBool(checkIs(is))),
|
||||
@ -489,17 +504,23 @@ void Foam::surfaceToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells in relation to surface " << surfName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells in relation to surface " << surfName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells in relation to surface " << surfName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells in relation to surface " << surfName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::surfaceToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on relation to surface.
|
||||
A topoSetCellSource to select cells based on relation to surface.
|
||||
|
||||
Selects:
|
||||
- all cells inside/outside/cut by surface
|
||||
@ -58,7 +58,7 @@ SourceFiles
|
||||
#ifndef surfaceToCell_H
|
||||
#define surfaceToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "Map.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -74,7 +74,7 @@ class triSurface;
|
||||
|
||||
class surfaceToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -209,11 +209,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -38,6 +38,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(targetVolumeToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, targetVolumeToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, targetVolumeToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
targetVolumeToCell,
|
||||
word,
|
||||
targetVolume
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
targetVolumeToCell,
|
||||
istream,
|
||||
targetVolume
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -103,14 +119,16 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bitSet maskSet(mesh_.nCells(), true);
|
||||
label nTotCells = mesh_.globalData().nTotalCells();
|
||||
if (maskSetName_.size())
|
||||
{
|
||||
// Read cellSet
|
||||
Info<< " Operating on subset defined by cellSet " << maskSetName_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Operating on subset defined by cellSet "
|
||||
<< maskSetName_ << endl;
|
||||
}
|
||||
|
||||
maskSet = false;
|
||||
cellSet subset(mesh_, maskSetName_);
|
||||
@ -138,7 +156,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
|
||||
label maxPointi = -1;
|
||||
forAll(points, pointi)
|
||||
{
|
||||
scalar c = (points[pointi] & normal_);
|
||||
const scalar c = (points[pointi] & normal_);
|
||||
if (c > maxComp)
|
||||
{
|
||||
maxComp = c;
|
||||
@ -247,9 +265,11 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
|
||||
}
|
||||
|
||||
|
||||
Info<< " Selected " << nSelected << " with actual volume "
|
||||
<< selectedVol << endl;
|
||||
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Selected " << nSelected << " with actual volume "
|
||||
<< selectedVol << endl;
|
||||
}
|
||||
|
||||
// Loop over selected cells only
|
||||
for (const label celli : selected)
|
||||
@ -265,12 +285,14 @@ Foam::targetVolumeToCell::targetVolumeToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const scalar vol,
|
||||
const vector& normal
|
||||
const vector& normal,
|
||||
const word& maskSetName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
vol_(vol),
|
||||
normal_(normal)
|
||||
normal_(normal),
|
||||
maskSetName_(maskSetName)
|
||||
{}
|
||||
|
||||
|
||||
@ -280,10 +302,13 @@ Foam::targetVolumeToCell::targetVolumeToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
vol_(dict.get<scalar>("volume")),
|
||||
normal_(dict.get<vector>("normal")),
|
||||
maskSetName_(dict.lookupOrDefault<word>("set", ""))
|
||||
targetVolumeToCell
|
||||
(
|
||||
mesh,
|
||||
dict.get<scalar>("volume"),
|
||||
dict.get<vector>("normal"),
|
||||
dict.lookupOrDefault<word>("set", "")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -293,7 +318,7 @@ Foam::targetVolumeToCell::targetVolumeToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetCellSource(mesh),
|
||||
vol_(readScalar(checkIs(is))),
|
||||
normal_(checkIs(is))
|
||||
{}
|
||||
@ -307,17 +332,25 @@ void Foam::targetVolumeToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding cells up to target volume " << vol_
|
||||
<< " out of total volume " << gSum(mesh_.cellVolumes()) << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding cells up to target volume " << vol_
|
||||
<< " out of total volume "
|
||||
<< gSum(mesh_.cellVolumes()) << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing cells up to target volume " << vol_
|
||||
<< " out of total volume " << gSum(mesh_.cellVolumes()) << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing cells up to target volume " << vol_
|
||||
<< " out of total volume "
|
||||
<< gSum(mesh_.cellVolumes()) << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::targetVolumeToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on the wanted volume of selected
|
||||
A topoSetCellSource to select cells based on the wanted volume of selected
|
||||
cells. Adapts a plane until it has enough.
|
||||
|
||||
\heading Dictionary parameters
|
||||
@ -44,7 +44,7 @@ SourceFiles
|
||||
#ifndef targetVolumeToCell_H
|
||||
#define targetVolumeToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetCellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -60,7 +60,7 @@ class bitSet;
|
||||
|
||||
class targetVolumeToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -105,7 +105,8 @@ public:
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const scalar vol,
|
||||
const vector& normal
|
||||
const vector& normal,
|
||||
const word& maskSetName = ""
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -121,11 +122,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
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
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "topoSetCellSource.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(topoSetCellSource, 0);
|
||||
defineRunTimeSelectionTable(topoSetCellSource, word);
|
||||
defineRunTimeSelectionTable(topoSetCellSource, istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::topoSetCellSource::topoSetCellSource(const polyMesh& mesh)
|
||||
:
|
||||
topoSetSource(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown topoSetCellSource type "
|
||||
<< sourceType << nl << nl
|
||||
<< "Valid types :" << endl
|
||||
<< wordConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<topoSetCellSource>(cstrIter()(mesh, dict));
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::topoSetCellSource> Foam::topoSetCellSource::New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown topoSetCellSource type "
|
||||
<< sourceType << nl << nl
|
||||
<< "Valid types :" << endl
|
||||
<< istreamConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<topoSetCellSource>(cstrIter()(mesh, is));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
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
|
||||
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/>.
|
||||
|
||||
Class
|
||||
Foam::topoSetCellSource
|
||||
|
||||
Description
|
||||
Base class of a topoSet source for selecting cells.
|
||||
|
||||
SourceFiles
|
||||
topoSetCellSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef topoSetCellSource_H
|
||||
#define topoSetCellSource_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class topoSetCellSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class topoSetCellSource
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("topoSetCellSource");
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
// For the dictionary constructor
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
topoSetCellSource,
|
||||
word,
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
),
|
||||
(mesh, dict)
|
||||
);
|
||||
|
||||
// For the Istream constructor
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
topoSetCellSource,
|
||||
istream,
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
),
|
||||
(mesh, is)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
explicit topoSetCellSource(const polyMesh& mesh);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected source type
|
||||
static autoPtr<topoSetCellSource> New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Return a reference to the selected source type
|
||||
static autoPtr<topoSetCellSource> New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~topoSetCellSource() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual topoSetSource::sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(zoneToCell, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, zoneToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, zoneToCell, istream);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, zoneToCell, word);
|
||||
addToRunTimeSelectionTable(topoSetCellSource, zoneToCell, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
zoneToCell,
|
||||
word,
|
||||
zone
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetCellSource,
|
||||
zoneToCell,
|
||||
istream,
|
||||
zone
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -54,14 +70,17 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
|
||||
|
||||
for (const cellZone& zone : mesh_.cellZones())
|
||||
{
|
||||
if (zoneName_.match(zone.name()))
|
||||
if (selectedZones_.match(zone.name()))
|
||||
{
|
||||
hasMatched = true;
|
||||
|
||||
const labelList& cellLabels = zone;
|
||||
|
||||
Info<< " Found matching zone " << zone.name()
|
||||
<< " with " << cellLabels.size() << " cells." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Found matching zone " << zone.name()
|
||||
<< " with " << cellLabels.size() << " cells." << endl;
|
||||
}
|
||||
|
||||
for (const label celli : cellLabels)
|
||||
{
|
||||
@ -77,7 +96,8 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
|
||||
if (!hasMatched)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find any cellZone named " << zoneName_ << nl
|
||||
<< "Cannot find any cellZone matching "
|
||||
<< flatOutput(selectedZones_) << nl
|
||||
<< "Valid names: " << flatOutput(mesh_.cellZones().names())
|
||||
<< endl;
|
||||
}
|
||||
@ -89,11 +109,11 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
|
||||
Foam::zoneToCell::zoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName
|
||||
const wordRe& zoneName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(zoneName)
|
||||
topoSetCellSource(mesh),
|
||||
selectedZones_(one(), zoneName)
|
||||
{}
|
||||
|
||||
|
||||
@ -103,9 +123,17 @@ Foam::zoneToCell::zoneToCell
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(dict.get<wordRe>("name"))
|
||||
{}
|
||||
topoSetCellSource(mesh),
|
||||
selectedZones_()
|
||||
{
|
||||
// Look for 'zones' and 'zone', but accept 'name' as well
|
||||
if (!dict.readIfPresent("zones", selectedZones_))
|
||||
{
|
||||
selectedZones_.resize(1);
|
||||
selectedZones_.first() =
|
||||
dict.getCompat<wordRe>("zone", {{"name", 1806}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::zoneToCell::zoneToCell
|
||||
@ -114,8 +142,8 @@ Foam::zoneToCell::zoneToCell
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(checkIs(is))
|
||||
topoSetCellSource(mesh),
|
||||
selectedZones_(one(), wordRe(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
@ -127,17 +155,23 @@ void Foam::zoneToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all cells of cellZone " << zoneName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all cells of cell zones "
|
||||
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all cells of cellZone " << zoneName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all cells of cell zones "
|
||||
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,14 +25,19 @@ Class
|
||||
Foam::zoneToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on cellZone.
|
||||
A topoSetCellSource to select cells based on one or more cellZones.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
name | The cell zone name or regex | yes |
|
||||
Property | Description | Required | Default
|
||||
zone | The cell zone name or regex | possibly |
|
||||
zones | The cell zone names or regexs | possibly |
|
||||
name | Older specification for 'zone' | no |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Selection of multiple zones has precedence.
|
||||
|
||||
SourceFiles
|
||||
zoneToCell.C
|
||||
|
||||
@ -41,8 +46,8 @@ SourceFiles
|
||||
#ifndef zoneToCell_H
|
||||
#define zoneToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "wordRe.H"
|
||||
#include "topoSetCellSource.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,12 +55,12 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class zoneToCell Declaration
|
||||
Class zoneToCell Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class zoneToCell
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetCellSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -63,8 +68,8 @@ class zoneToCell
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name/regular expression of cellZone
|
||||
wordRe zoneName_;
|
||||
//- Matcher for zones
|
||||
wordRes selectedZones_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -80,11 +85,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
zoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName
|
||||
);
|
||||
zoneToCell(const polyMesh& mesh, const wordRe& zoneName);
|
||||
|
||||
//- Construct from dictionary
|
||||
zoneToCell(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -99,11 +100,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -96,52 +96,56 @@ void Foam::setToCellZone::applyToSet
|
||||
}
|
||||
else
|
||||
{
|
||||
cellZoneSet& fzSet = refCast<cellZoneSet>(set);
|
||||
cellZoneSet& zoneSet = refCast<cellZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all cells from cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all cells from cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the sets
|
||||
cellSet fSet(mesh_, setName_);
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||
|
||||
forAllConstIter(cellSet, fSet, iter)
|
||||
for (const label celli : fSet)
|
||||
{
|
||||
label celli = iter.key();
|
||||
|
||||
if (!fzSet.found(celli))
|
||||
if (!zoneSet.found(celli))
|
||||
{
|
||||
newAddressing.append(celli);
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all cells from cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all cells from cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
cellSet loadedSet(mesh_, setName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
forAll(zoneSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
if (!loadedSet.found(zoneSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
newAddressing.append(zoneSet.addressing()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,17 +72,13 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
setToCellZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
);
|
||||
setToCellZone(const polyMesh& mesh, const word& setName);
|
||||
|
||||
//- Construct from dictionary
|
||||
setToCellZone(const polyMesh& mesh, const dictionary& dict);
|
||||
|
||||
//- Construct from Istream
|
||||
setToCellZone(const polyMesh& mesh, Istream& is );
|
||||
setToCellZone(const polyMesh& mesh, Istream& is);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(boundaryToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, boundaryToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, boundaryToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
boundaryToFace,
|
||||
word,
|
||||
boundary
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
boundaryToFace,
|
||||
istream,
|
||||
boundary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +81,7 @@ void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
|
||||
|
||||
Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh)
|
||||
:
|
||||
topoSetSource(mesh)
|
||||
topoSetFaceSource(mesh)
|
||||
{}
|
||||
|
||||
|
||||
@ -75,7 +91,7 @@ Foam::boundaryToFace::boundaryToFace
|
||||
const dictionary&
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh)
|
||||
topoSetFaceSource(mesh)
|
||||
{}
|
||||
|
||||
|
||||
@ -85,7 +101,7 @@ Foam::boundaryToFace::boundaryToFace
|
||||
Istream&
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh)
|
||||
topoSetFaceSource(mesh)
|
||||
{}
|
||||
|
||||
|
||||
@ -97,15 +113,21 @@ void Foam::boundaryToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all boundary faces ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all boundary faces ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all boundary faces ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all boundary faces ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::boundaryToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select all external (boundary) faces.
|
||||
A topoSetFaceSource to select all external (boundary) faces.
|
||||
|
||||
\heading Dictionary parameters
|
||||
None
|
||||
@ -38,7 +38,7 @@ SourceFiles
|
||||
#ifndef boundaryToFace_H
|
||||
#define boundaryToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Foam
|
||||
|
||||
class boundaryToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -87,11 +87,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(boxToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, boxToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, boxToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, boxToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, boxToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
boxToFace,
|
||||
word,
|
||||
box
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
boxToFace,
|
||||
istream,
|
||||
box
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -73,29 +89,37 @@ Foam::boxToFace::boxToFace
|
||||
const treeBoundBoxList& bbs
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
bbs_(bbs)
|
||||
{}
|
||||
|
||||
|
||||
Foam::boxToFace::boxToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
treeBoundBoxList&& bbs
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
bbs_(std::move(bbs))
|
||||
{}
|
||||
|
||||
|
||||
Foam::boxToFace::boxToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
bbs_()
|
||||
{
|
||||
if (dict.found("box"))
|
||||
// Look for 'boxes' or 'box'
|
||||
if (!dict.readIfPresent("boxes", bbs_))
|
||||
{
|
||||
bbs_.resize(1);
|
||||
dict.readEntry("box", bbs_.first());
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.readEntry("boxes", bbs_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,8 +129,8 @@ Foam::boxToFace::boxToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
bbs_(1, treeBoundBox(checkIs(is)))
|
||||
topoSetFaceSource(mesh),
|
||||
bbs_(one(), treeBoundBox(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
@ -118,15 +142,23 @@ void Foam::boxToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding faces with centre within boxes " << bbs_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces with centre within boxes "
|
||||
<< bbs_ << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing faces with centre within boxes " << bbs_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces with centre within boxes "
|
||||
<< bbs_ << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,17 +25,18 @@ Class
|
||||
Foam::boxToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on face centres inside box.
|
||||
A topoSetFaceSource to select faces based on face centres inside box.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
box | A single bounding box | partly |
|
||||
boxes | Multiple bounding boxes | partly |
|
||||
Property | Description | Required | Default
|
||||
box | A single bounding box | partly |
|
||||
boxes | Multiple bounding boxes | partly |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Must specify either "box" or "boxes"
|
||||
Must specify either "box" or "boxes".
|
||||
The selection of multiple boxes has precedence.
|
||||
|
||||
SourceFiles
|
||||
boxToFace.C
|
||||
@ -45,7 +46,7 @@ SourceFiles
|
||||
#ifndef boxToFace_H
|
||||
#define boxToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "treeBoundBoxList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -59,7 +60,7 @@ namespace Foam
|
||||
|
||||
class boxToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -82,12 +83,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
boxToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const treeBoundBoxList& bbs
|
||||
);
|
||||
//- Construct from components, copying bounding boxes
|
||||
boxToFace(const polyMesh& mesh, const treeBoundBoxList& bbs);
|
||||
|
||||
//- Construct from components, moving bounding boxes
|
||||
boxToFace(const polyMesh& mesh, treeBoundBoxList&& bbs);
|
||||
|
||||
//- Construct from dictionary
|
||||
boxToFace(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -102,11 +102,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -37,6 +37,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(cellToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, cellToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, cellToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, cellToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, cellToFace, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +155,7 @@ Foam::cellToFace::cellToFace
|
||||
const cellAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(setName),
|
||||
option_(option)
|
||||
{}
|
||||
@ -165,9 +167,12 @@ Foam::cellToFace::cellToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set")),
|
||||
option_(cellActionNames_.get("option", dict))
|
||||
cellToFace
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set"),
|
||||
cellActionNames_.get("option", dict)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -177,7 +182,7 @@ Foam::cellToFace::cellToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
option_(cellActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
@ -191,17 +196,23 @@ void Foam::cellToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding faces according to cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces according to cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing faces according to cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces according to cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cellToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select a faceSet from cells.
|
||||
A topoSetFaceSource to select a faceSet from a cellSet.
|
||||
|
||||
Either use 'all' cell faces, or only faces that have cells
|
||||
on 'both' sides.
|
||||
@ -48,7 +48,7 @@ SourceFiles
|
||||
#ifndef cellToFace_H
|
||||
#define cellToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -62,7 +62,7 @@ namespace Foam
|
||||
|
||||
class cellToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
public:
|
||||
//- Enumeration defining the valid options
|
||||
@ -121,11 +121,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,32 @@ namespace Foam
|
||||
defineTypeNameAndDebug(cylinderAnnulusToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToFace, istream);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
cylinderAnnulusToFace,
|
||||
word
|
||||
);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
cylinderAnnulusToFace,
|
||||
istream
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
cylinderAnnulusToFace,
|
||||
word,
|
||||
cylinderAnnulus
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
cylinderAnnulusToFace,
|
||||
istream,
|
||||
cylinderAnnulus
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +111,7 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
|
||||
const scalar innerRadius
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
point1_(point1),
|
||||
point2_(point2),
|
||||
outerRadius_(outerRadius),
|
||||
@ -99,11 +125,14 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
point1_(dict.get<point>("p1")),
|
||||
point2_(dict.get<point>("p2")),
|
||||
outerRadius_(dict.get<scalar>("outerRadius")),
|
||||
innerRadius_(dict.get<scalar>("innerRadius"))
|
||||
cylinderAnnulusToFace
|
||||
(
|
||||
mesh,
|
||||
dict.get<point>("p1"),
|
||||
dict.get<point>("p2"),
|
||||
dict.get<scalar>("outerRadius"),
|
||||
dict.get<scalar>("innerRadius")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -113,7 +142,7 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
point1_(checkIs(is)),
|
||||
point2_(checkIs(is)),
|
||||
outerRadius_(readScalar(checkIs(is))),
|
||||
@ -129,23 +158,31 @@ void Foam::cylinderAnnulusToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding faces with centre within cylinder annulus,"
|
||||
<< " with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces with centre within cylinder annulus,"
|
||||
<< " with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_
|
||||
<< ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing faces with centre within cylinder annulus,"
|
||||
<< " with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces with centre within cylinder annulus,"
|
||||
<< " with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_
|
||||
<< ", radius = " << outerRadius_
|
||||
<< ", inner radius = " << innerRadius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cylinderAnnulusToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on face centres inside a
|
||||
A topoSetFaceSource to select faces based on face centres inside a
|
||||
cylinder annulus.
|
||||
|
||||
\heading Dictionary parameters
|
||||
@ -45,7 +45,7 @@ SourceFiles
|
||||
#ifndef cylinderAnnulusToFace_H
|
||||
#define cylinderAnnulusToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Foam
|
||||
|
||||
class cylinderAnnulusToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -115,11 +115,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(cylinderToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, cylinderToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, cylinderToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, cylinderToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
cylinderToFace,
|
||||
word,
|
||||
cylinder
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
cylinderToFace,
|
||||
istream,
|
||||
cylinder
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +98,7 @@ Foam::cylinderToFace::cylinderToFace
|
||||
const scalar radius
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
point1_(point1),
|
||||
point2_(point2),
|
||||
radius_(radius)
|
||||
@ -95,10 +111,13 @@ Foam::cylinderToFace::cylinderToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
point1_(dict.get<point>("p1")),
|
||||
point2_(dict.get<point>("p2")),
|
||||
radius_(dict.get<scalar>("radius"))
|
||||
cylinderToFace
|
||||
(
|
||||
mesh,
|
||||
dict.get<point>("p1"),
|
||||
dict.get<point>("p2"),
|
||||
dict.get<scalar>("radius")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -108,7 +127,7 @@ Foam::cylinderToFace::cylinderToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
point1_(checkIs(is)),
|
||||
point2_(checkIs(is)),
|
||||
radius_(readScalar(checkIs(is)))
|
||||
@ -123,19 +142,25 @@ void Foam::cylinderToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding faces with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing faces with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces with centre within cylinder, with p1 = "
|
||||
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cylinderToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on face centres inside a cylinder.
|
||||
A topoSetFaceSource to select faces based on face centres inside a cylinder.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#ifndef cylinderToFace_H
|
||||
#define cylinderToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -56,7 +56,7 @@ namespace Foam
|
||||
|
||||
class cylinderToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -109,11 +109,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return CELLSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(faceToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, faceToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, faceToFace, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +56,7 @@ Foam::faceToFace::faceToFace
|
||||
const word& setName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(setName)
|
||||
{}
|
||||
|
||||
@ -65,8 +67,11 @@ Foam::faceToFace::faceToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set"))
|
||||
faceToFace
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -76,7 +81,7 @@ Foam::faceToFace::faceToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(checkIs(is))
|
||||
{}
|
||||
|
||||
@ -89,25 +94,31 @@ void Foam::faceToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << setName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName_);
|
||||
|
||||
set.addSet(loadedSet);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << setName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName_);
|
||||
|
||||
set.deleteSet(loadedSet);
|
||||
set.subtractSet(loadedSet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::faceToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on usage in another faceSet.
|
||||
A topoSetFaceSource to select faces based on usage in another faceSet.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -41,7 +41,7 @@ SourceFiles
|
||||
#ifndef faceToFace_H
|
||||
#define faceToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Foam
|
||||
|
||||
class faceToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -72,11 +72,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faceToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
);
|
||||
faceToFace(const polyMesh& mesh, const word& setName);
|
||||
|
||||
//- Construct from dictionary
|
||||
faceToFace(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -91,11 +87,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(labelToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, labelToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, labelToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, labelToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, labelToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
labelToFace,
|
||||
word,
|
||||
label
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
labelToFace,
|
||||
istream,
|
||||
label
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -53,19 +69,33 @@ Foam::labelToFace::labelToFace
|
||||
const labelList& labels
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
labels_(labels)
|
||||
{}
|
||||
|
||||
|
||||
Foam::labelToFace::labelToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
labelList&& labels
|
||||
)
|
||||
:
|
||||
topoSetFaceSource(mesh),
|
||||
labels_(std::move(labels))
|
||||
{}
|
||||
|
||||
|
||||
Foam::labelToFace::labelToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
labels_(dict.get<labelList>("value"))
|
||||
labelToFace
|
||||
(
|
||||
mesh,
|
||||
dict.get<labelList>("value")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -75,7 +105,7 @@ Foam::labelToFace::labelToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
labels_(checkIs(is))
|
||||
{
|
||||
check(labels_, mesh.nFaces());
|
||||
@ -90,15 +120,23 @@ void Foam::labelToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding faces mentioned in dictionary" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces mentioned in dictionary"
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
addOrDelete(set, labels_, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing faces mentioned dictionary" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces mentioned dictionary"
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
addOrDelete(set, labels_, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::labelToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces given explicitly provided face labels.
|
||||
A topoSetFaceSource to select faces given explicitly provided face labels.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef labelToFace_H
|
||||
#define labelToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +55,7 @@ namespace Foam
|
||||
|
||||
class labelToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -74,12 +74,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
labelToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& labels
|
||||
);
|
||||
//- Construct from components, copying labels
|
||||
labelToFace(const polyMesh& mesh, const labelList& labels);
|
||||
|
||||
//- Construct from components, moving labels
|
||||
labelToFace(const polyMesh& mesh, labelList&& labels);
|
||||
|
||||
//- Construct from dictionary
|
||||
labelToFace(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -94,11 +93,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(normalToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, normalToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, normalToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, normalToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, normalToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
normalToFace,
|
||||
word,
|
||||
normal
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
normalToFace,
|
||||
istream,
|
||||
normal
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -53,8 +69,6 @@ void Foam::normalToFace::setNormal()
|
||||
{
|
||||
normal_.normalise();
|
||||
|
||||
Info<< " normalToFace : Normalized vector to " << normal_ << endl;
|
||||
|
||||
if (tol_ < -1 || tol_ > 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -73,7 +87,7 @@ Foam::normalToFace::normalToFace
|
||||
const scalar tol
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
normal_(normal),
|
||||
tol_(tol)
|
||||
{
|
||||
@ -83,9 +97,12 @@ Foam::normalToFace::normalToFace
|
||||
|
||||
Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
normal_(dict.get<vector>("normal")),
|
||||
tol_(dict.get<scalar>("cos"))
|
||||
normalToFace
|
||||
(
|
||||
mesh,
|
||||
dict.get<vector>("normal"),
|
||||
dict.get<scalar>("cos")
|
||||
)
|
||||
{
|
||||
setNormal();
|
||||
}
|
||||
@ -93,7 +110,7 @@ Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
|
||||
|
||||
Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
normal_(checkIs(is)),
|
||||
tol_(readScalar(checkIs(is)))
|
||||
{
|
||||
@ -109,10 +126,13 @@ void Foam::normalToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding faces according to normal being aligned with "
|
||||
<< normal_ << " (to within " << tol_ << ") ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces according to normal being aligned with "
|
||||
<< normal_ << " (to within " << tol_ << ") ..." << endl;
|
||||
}
|
||||
|
||||
forAll(mesh_.faceAreas(), facei)
|
||||
{
|
||||
@ -120,21 +140,22 @@ void Foam::normalToFace::applyToSet
|
||||
|
||||
if (mag(1 - (n & normal_)) < tol_)
|
||||
{
|
||||
set.insert(facei);
|
||||
set.set(facei);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing faces according to normal being aligned with "
|
||||
<< normal_ << " (to within " << tol_ << ") ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces according to normal being aligned with "
|
||||
<< normal_ << " (to within " << tol_ << ") ..." << endl;
|
||||
}
|
||||
|
||||
DynamicList<label> toBeRemoved(set.size()/10);
|
||||
|
||||
forAllConstIter(topoSet, set, iter)
|
||||
for (const label facei : static_cast<const labelHashSet&>(set))
|
||||
{
|
||||
const label facei = iter.key();
|
||||
|
||||
const vector n = normalised(mesh_.faceAreas()[facei]);
|
||||
|
||||
if (mag(1 - (n & normal_)) < tol_)
|
||||
@ -143,7 +164,7 @@ void Foam::normalToFace::applyToSet
|
||||
}
|
||||
}
|
||||
|
||||
set.erase(toBeRemoved);
|
||||
set.unset(toBeRemoved);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::normalToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on normal.
|
||||
A topoSetFaceSource to select faces based on normal.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef normalToFace_H
|
||||
#define normalToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +55,7 @@ namespace Foam
|
||||
|
||||
class normalToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
private:
|
||||
@ -104,11 +104,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(patchToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, patchToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, patchToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, patchToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, patchToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
patchToFace,
|
||||
word,
|
||||
patch
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
patchToFace,
|
||||
istream,
|
||||
patch
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +67,7 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
||||
{
|
||||
labelHashSet patchIDs = mesh_.boundaryMesh().patchSet
|
||||
(
|
||||
List<wordRe>(1, patchName_),
|
||||
selectedPatches_,
|
||||
true, // warn if not found
|
||||
true // use patch groups if available
|
||||
);
|
||||
@ -60,8 +76,11 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
||||
{
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
|
||||
|
||||
Info<< " Found matching patch " << pp.name()
|
||||
<< " with " << pp.size() << " faces." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Found matching patch " << pp.name()
|
||||
<< " with " << pp.size() << " faces." << endl;
|
||||
}
|
||||
|
||||
for
|
||||
(
|
||||
@ -77,8 +96,10 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
||||
if (patchIDs.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find any patch named " << patchName_ << endl
|
||||
<< "Valid names are " << mesh_.boundaryMesh().names() << endl;
|
||||
<< "Cannot find any patches matching "
|
||||
<< flatOutput(selectedPatches_) << nl
|
||||
<< "Valid names are " << flatOutput(mesh_.boundaryMesh().names())
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,11 +109,11 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
||||
Foam::patchToFace::patchToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& patchName
|
||||
const wordRe& patchName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
patchName_(patchName)
|
||||
topoSetFaceSource(mesh),
|
||||
selectedPatches_(one(), patchName)
|
||||
{}
|
||||
|
||||
|
||||
@ -102,9 +123,17 @@ Foam::patchToFace::patchToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
patchName_(dict.get<wordRe>("name"))
|
||||
{}
|
||||
topoSetFaceSource(mesh),
|
||||
selectedPatches_()
|
||||
{
|
||||
// Look for 'patches' and 'patch', but accept 'name' as well
|
||||
if (!dict.readIfPresent("patches", selectedPatches_))
|
||||
{
|
||||
selectedPatches_.resize(1);
|
||||
selectedPatches_.first() =
|
||||
dict.getCompat<wordRe>("patch", {{"name", 1806}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::patchToFace::patchToFace
|
||||
@ -113,8 +142,8 @@ Foam::patchToFace::patchToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
patchName_(checkIs(is))
|
||||
topoSetFaceSource(mesh),
|
||||
selectedPatches_(one(), wordRe(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
@ -126,16 +155,23 @@ void Foam::patchToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces of patch " << patchName_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces of patches "
|
||||
<< flatOutput(selectedPatches_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces of patch " << patchName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces of patches "
|
||||
<< flatOutput(selectedPatches_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,14 +25,19 @@ Class
|
||||
Foam::patchToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on usage in patches.
|
||||
A topoSetFaceSource to select faces based on usage in patches.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
name | Patch name or regex to select | yes |
|
||||
Property | Description | Required | Default
|
||||
patch | The face zone name or regex | possibly |
|
||||
patches | The face zone names or regexs | possibly |
|
||||
name | Older specification for 'patch' | no |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Selection of multiple patches has precedence.
|
||||
|
||||
SourceFiles
|
||||
patchToFace.C
|
||||
|
||||
@ -41,8 +46,8 @@ SourceFiles
|
||||
#ifndef patchToFace_H
|
||||
#define patchToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "wordRe.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +60,7 @@ namespace Foam
|
||||
|
||||
class patchToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -63,8 +68,8 @@ class patchToFace
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name/regular expression of patch
|
||||
wordRe patchName_;
|
||||
//- Matcher for patches
|
||||
wordRes selectedPatches_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -80,11 +85,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
patchToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& patchName
|
||||
);
|
||||
patchToFace(const polyMesh& mesh, const wordRe& patchName);
|
||||
|
||||
//- Construct from dictionary
|
||||
patchToFace(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -99,11 +100,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(pointToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, pointToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, pointToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, pointToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, pointToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
pointToFace,
|
||||
word,
|
||||
point
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
pointToFace,
|
||||
istream,
|
||||
point
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +163,7 @@ Foam::pointToFace::pointToFace
|
||||
const pointAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(setName),
|
||||
option_(option)
|
||||
{}
|
||||
@ -159,9 +175,12 @@ Foam::pointToFace::pointToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set")),
|
||||
option_(pointActionNames_.get("option", dict))
|
||||
pointToFace
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set"),
|
||||
pointActionNames_.get("option", dict)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -171,7 +190,7 @@ Foam::pointToFace::pointToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
option_(pointActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
@ -185,17 +204,23 @@ void Foam::pointToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding faces according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding faces according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing faces according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing faces according to pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::pointToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on use of points.
|
||||
A topoSetFaceSource to select faces based on use of points.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef pointToFace_H
|
||||
#define pointToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,7 +56,7 @@ namespace Foam
|
||||
|
||||
class pointToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
public:
|
||||
@ -118,11 +118,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -40,6 +40,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(regionToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, regionToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, regionToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, regionToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, regionToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
regionToFace,
|
||||
word,
|
||||
region
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
regionToFace,
|
||||
istream,
|
||||
region
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -108,8 +124,11 @@ void Foam::regionToFace::markZone
|
||||
|
||||
void Foam::regionToFace::combine(topoSet& set, const bool add) const
|
||||
{
|
||||
Info<< " Loading subset " << setName_
|
||||
<< " to delimit search region." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Loading subset " << setName_
|
||||
<< " to delimit search region." << endl;
|
||||
}
|
||||
|
||||
faceSet subSet(mesh_, setName_);
|
||||
|
||||
@ -146,10 +165,13 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const
|
||||
// Globally reduce
|
||||
combineReduce(ni, mappedPatchBase::nearestEqOp());
|
||||
|
||||
Info<< " Found nearest face at " << ni.first().rawPoint()
|
||||
<< " on processor " << ni.second().second()
|
||||
<< " face " << ni.first().index()
|
||||
<< " distance " << Foam::sqrt(ni.second().first()) << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Found nearest face at " << ni.first().rawPoint()
|
||||
<< " on processor " << ni.second().second()
|
||||
<< " face " << ni.first().index()
|
||||
<< " distance " << Foam::sqrt(ni.second().first()) << endl;
|
||||
}
|
||||
|
||||
labelList faceRegion(patch.size(), -1);
|
||||
markZone
|
||||
@ -180,7 +202,7 @@ Foam::regionToFace::regionToFace
|
||||
const point& nearPoint
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(setName),
|
||||
nearPoint_(nearPoint)
|
||||
{}
|
||||
@ -192,7 +214,7 @@ Foam::regionToFace::regionToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(dict.get<word>("set")),
|
||||
nearPoint_(dict.get<point>("nearPoint"))
|
||||
{}
|
||||
@ -204,7 +226,7 @@ Foam::regionToFace::regionToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetFaceSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
nearPoint_(checkIs(is))
|
||||
{}
|
||||
@ -218,21 +240,25 @@ void Foam::regionToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces of connected region of set "
|
||||
<< setName_
|
||||
<< " starting from point "
|
||||
<< nearPoint_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces of connected region of set "
|
||||
<< setName_ << " starting from point " << nearPoint_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all cells of connected region of set "
|
||||
<< setName_
|
||||
<< " starting from point "
|
||||
<< nearPoint_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all cells of connected region of set "
|
||||
<< setName_ << " starting from point " << nearPoint_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,8 +25,8 @@ Class
|
||||
Foam::regionToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces belonging to topological connected region
|
||||
(that contains given point)
|
||||
A topoSetFaceSource to select faces belonging to a topological connected
|
||||
region (that contains given point)
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#ifndef regionToFace_H
|
||||
#define regionToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -57,7 +57,7 @@ namespace Foam
|
||||
|
||||
class regionToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -113,11 +113,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
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
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(topoSetFaceSource, 0);
|
||||
defineRunTimeSelectionTable(topoSetFaceSource, word);
|
||||
defineRunTimeSelectionTable(topoSetFaceSource, istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::topoSetFaceSource::topoSetFaceSource(const polyMesh& mesh)
|
||||
:
|
||||
topoSetSource(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(sourceType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown topoSetFaceSource type "
|
||||
<< sourceType << nl << nl
|
||||
<< "Valid types :" << endl
|
||||
<< wordConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<topoSetFaceSource>(cstrIter()(mesh, dict));
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::topoSetFaceSource> Foam::topoSetFaceSource::New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
auto cstrIter = istreamConstructorTablePtr_->cfind(sourceType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown topoSetFaceSource type "
|
||||
<< sourceType << nl << nl
|
||||
<< "Valid types :" << endl
|
||||
<< istreamConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<topoSetFaceSource>(cstrIter()(mesh, is));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
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
|
||||
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/>.
|
||||
|
||||
Class
|
||||
Foam::topoSetFaceSource
|
||||
|
||||
Description
|
||||
Base class of a topoSet source for selecting faces.
|
||||
|
||||
SourceFiles
|
||||
topoSetFaceSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef topoSetFaceSource_H
|
||||
#define topoSetFaceSource_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class topoSetFaceSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class topoSetFaceSource
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("topoSetFaceSource");
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
// For the dictionary constructor
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
topoSetFaceSource,
|
||||
word,
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
),
|
||||
(mesh, dict)
|
||||
);
|
||||
|
||||
// For the Istream constructor
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
topoSetFaceSource,
|
||||
istream,
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
),
|
||||
(mesh, is)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
explicit topoSetFaceSource(const polyMesh& mesh);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected source type
|
||||
static autoPtr<topoSetFaceSource> New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Return a reference to the selected source type
|
||||
static autoPtr<topoSetFaceSource> New
|
||||
(
|
||||
const word& sourceType,
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~topoSetFaceSource() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual topoSetSource::sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(zoneToFace, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, zoneToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, zoneToFace, istream);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, zoneToFace, word);
|
||||
addToRunTimeSelectionTable(topoSetFaceSource, zoneToFace, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
zoneToFace,
|
||||
word,
|
||||
zone
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetFaceSource,
|
||||
zoneToFace,
|
||||
istream,
|
||||
zone
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -54,14 +70,17 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
|
||||
|
||||
for (const faceZone& zone : mesh_.faceZones())
|
||||
{
|
||||
if (zoneName_.match(zone.name()))
|
||||
if (selectedZones_.match(zone.name()))
|
||||
{
|
||||
hasMatched = true;
|
||||
|
||||
const labelList& faceLabels = zone;
|
||||
|
||||
Info<< " Found matching zone " << zone.name()
|
||||
<< " with " << faceLabels.size() << " faces." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Found matching zone " << zone.name()
|
||||
<< " with " << faceLabels.size() << " faces." << endl;
|
||||
}
|
||||
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
@ -77,8 +96,10 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
|
||||
if (!hasMatched)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find any faceZone named " << zoneName_ << endl
|
||||
<< "Valid names are " << mesh_.faceZones().names() << endl;
|
||||
<< "Cannot find any faceZone matching "
|
||||
<< flatOutput(selectedZones_) << nl
|
||||
<< "Valid names are " << flatOutput(mesh_.faceZones().names())
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,11 +109,11 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
|
||||
Foam::zoneToFace::zoneToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName
|
||||
const wordRe& zoneName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(zoneName)
|
||||
topoSetFaceSource(mesh),
|
||||
selectedZones_(one(), zoneName)
|
||||
{}
|
||||
|
||||
|
||||
@ -102,9 +123,17 @@ Foam::zoneToFace::zoneToFace
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(dict.get<wordRe>("name"))
|
||||
{}
|
||||
topoSetFaceSource(mesh),
|
||||
selectedZones_()
|
||||
{
|
||||
// Look for 'zones' and 'zone', but accept 'name' as well
|
||||
if (!dict.readIfPresent("zones", selectedZones_))
|
||||
{
|
||||
selectedZones_.resize(1);
|
||||
selectedZones_.first() =
|
||||
dict.getCompat<wordRe>("zone", {{"name", 1806}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::zoneToFace::zoneToFace
|
||||
@ -113,8 +142,8 @@ Foam::zoneToFace::zoneToFace
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(checkIs(is))
|
||||
topoSetFaceSource(mesh),
|
||||
selectedZones_(one(), wordRe(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
@ -126,17 +155,23 @@ void Foam::zoneToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces of faceZone " << zoneName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces of face zones "
|
||||
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces of faceZone " << zoneName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces of face zones "
|
||||
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,14 +25,19 @@ Class
|
||||
Foam::zoneToFace
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on faceZone.
|
||||
A topoSetFaceSource to select faces based on one of more faceZones.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
name | The face zone name or regex | yes |
|
||||
Property | Description | Required | Default
|
||||
zone | The face zone name or regex | possibly |
|
||||
zones | The face zone names or regexs | possibly |
|
||||
name | Older specification for 'zone' | no |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Selection of multiple zones has precedence.
|
||||
|
||||
SourceFiles
|
||||
zoneToFace.C
|
||||
|
||||
@ -41,8 +46,8 @@ SourceFiles
|
||||
#ifndef zoneToFace_H
|
||||
#define zoneToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "wordRe.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,12 +55,12 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class zoneToFace Declaration
|
||||
Class zoneToFace Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class zoneToFace
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetFaceSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -63,8 +68,8 @@ class zoneToFace
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name/regular expression of the faceZone
|
||||
wordRe zoneName_;
|
||||
//- Matcher for zones
|
||||
wordRes selectedZones_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -80,11 +85,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
zoneToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName
|
||||
);
|
||||
zoneToFace(const polyMesh& mesh, const wordRe& zoneName);
|
||||
|
||||
//- Construct from dictionary
|
||||
zoneToFace(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -99,11 +100,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return FACESETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -96,53 +96,59 @@ void Foam::faceZoneToFaceZone::applyToSet
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneSet& fSet = refCast<faceZoneSet>(set);
|
||||
faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces from faceZone " << setName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces from faceZone " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
faceZoneSet loadedSet(mesh_, setName_);
|
||||
|
||||
DynamicList<label> newAddressing(fSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fSet.flipMap());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap());
|
||||
|
||||
forAll(loadedSet.addressing(), i)
|
||||
{
|
||||
if (!fSet.found(loadedSet.addressing()[i]))
|
||||
if (!zoneSet.found(loadedSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(loadedSet.addressing()[i]);
|
||||
newFlipMap.append(loadedSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fSet.addressing().transfer(newAddressing);
|
||||
fSet.flipMap().transfer(newFlipMap);
|
||||
fSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces from faceZone " << setName_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces from faceZone " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
faceZoneSet loadedSet(mesh_, setName_);
|
||||
|
||||
DynamicList<label> newAddressing(fSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(fSet.flipMap().size());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
forAll(zoneSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fSet.addressing()[i]))
|
||||
if (!loadedSet.found(zoneSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fSet.addressing()[i]);
|
||||
newFlipMap.append(fSet.flipMap()[i]);
|
||||
newAddressing.append(zoneSet.addressing()[i]);
|
||||
newFlipMap.append(zoneSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fSet.addressing().transfer(newAddressing);
|
||||
fSet.flipMap().transfer(newFlipMap);
|
||||
fSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,7 @@ Foam::topoSetSource::addToUsageTable Foam::searchableSurfaceToFaceZone::usage_
|
||||
|
||||
Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
|
||||
(
|
||||
const word& surfaceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
@ -67,7 +68,7 @@ Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
|
||||
(
|
||||
searchableSurface::New
|
||||
(
|
||||
dict.get<word>("surface"),
|
||||
surfaceType,
|
||||
IOobject
|
||||
(
|
||||
dict.lookupOrDefault("name", mesh.objectRegistry::db().name()),
|
||||
@ -83,6 +84,21 @@ Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
|
||||
{}
|
||||
|
||||
|
||||
Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
searchableSurfaceToFaceZone
|
||||
(
|
||||
dict.get<word>("surface"),
|
||||
mesh,
|
||||
dict
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::searchableSurfaceToFaceZone::~searchableSurfaceToFaceZone()
|
||||
@ -162,10 +178,13 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
|
||||
// Select intersected faces
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces from surface "
|
||||
<< surfacePtr_().name() << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces from surface "
|
||||
<< surfacePtr_().name() << " ..." << endl;
|
||||
}
|
||||
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap());
|
||||
@ -184,10 +203,13 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces from surface "
|
||||
<< surfacePtr_().name() << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces from surface "
|
||||
<< surfacePtr_().name() << " ..." << endl;
|
||||
}
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
|
||||
@ -75,6 +75,15 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct surface-type from dictionary
|
||||
searchableSurfaceToFaceZone
|
||||
(
|
||||
const word& surfaceType,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Construct from dictionary
|
||||
searchableSurfaceToFaceZone
|
||||
(
|
||||
@ -89,7 +98,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
virtual topoSetSource::sourceType setType() const
|
||||
{
|
||||
return FACEZONESOURCE;
|
||||
}
|
||||
|
||||
@ -100,27 +100,30 @@ void Foam::setAndNormalToFaceZone::applyToSet
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
|
||||
faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the sets
|
||||
faceSet loadedSet(mesh_, setName_);
|
||||
labelHashSet& faceIds = loadedSet;
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap());
|
||||
|
||||
const faceList& faces = mesh_.faces();
|
||||
const pointField& points = mesh_.points();
|
||||
|
||||
for (const label facei : faceIds)
|
||||
{
|
||||
if (!fzSet.found(facei))
|
||||
if (!zoneSet.found(facei))
|
||||
{
|
||||
newAddressing.append(facei);
|
||||
|
||||
@ -136,33 +139,36 @@ void Foam::setAndNormalToFaceZone::applyToSet
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap().size());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
forAll(zoneSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
if (!loadedSet.found(zoneSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
newFlipMap.append(fzSet.flipMap()[i]);
|
||||
newAddressing.append(zoneSet.addressing()[i]);
|
||||
newFlipMap.append(zoneSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,57 +97,63 @@ void Foam::setToFaceZone::applyToSet
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
|
||||
faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the sets
|
||||
faceSet loadedSet(mesh_, setName_);
|
||||
const labelHashSet& faceLabels = loadedSet;
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap());
|
||||
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
if (!fzSet.found(facei))
|
||||
if (!zoneSet.found(facei))
|
||||
{
|
||||
newAddressing.append(facei);
|
||||
newFlipMap.append(false);
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap().size());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
forAll(zoneSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
if (!loadedSet.found(zoneSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
newFlipMap.append(fzSet.flipMap()[i]);
|
||||
newAddressing.append(zoneSet.addressing()[i]);
|
||||
newFlipMap.append(zoneSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ Description
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
faceSet | Name of input faceSet | yes |
|
||||
Property | Description | Required | Default
|
||||
faceSet | Name of input faceSet | yes |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
|
||||
@ -106,26 +106,29 @@ void Foam::setsToFaceZone::applyToSet
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
|
||||
faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << faceSetName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << faceSetName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the sets
|
||||
faceSet fSet(mesh_, faceSetName_);
|
||||
cellSet cSet(mesh_, cellSetName_);
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap());
|
||||
|
||||
forAllConstIter(faceSet, fSet, iter)
|
||||
{
|
||||
label facei = iter.key();
|
||||
|
||||
if (!fzSet.found(facei))
|
||||
if (!zoneSet.found(facei))
|
||||
{
|
||||
bool flipFace = false;
|
||||
|
||||
@ -176,33 +179,36 @@ void Foam::setsToFaceZone::applyToSet
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << faceSetName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << faceSetName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
// Load the set
|
||||
faceZoneSet loadedSet(mesh_, faceSetName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap().size());
|
||||
DynamicList<label> newAddressing(zoneSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
forAll(zoneSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
if (!loadedSet.found(zoneSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
newFlipMap.append(fzSet.flipMap()[i]);
|
||||
newAddressing.append(zoneSet.addressing()[i]);
|
||||
newFlipMap.append(zoneSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
zoneSet.addressing().transfer(newAddressing);
|
||||
zoneSet.flipMap().transfer(newFlipMap);
|
||||
zoneSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,10 +29,10 @@ Description
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
cellSet | Name of input cellSet | yes |
|
||||
faceSet | Name of input faceSet | yes |
|
||||
flip | Force flip of faces | no | false
|
||||
Property | Description | Required | Default
|
||||
cellSet | Name of input cellSet | yes |
|
||||
faceSet | Name of input faceSet | yes |
|
||||
flip | Force flip of faces | no | false
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(boxToPoint, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, boxToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, boxToPoint, istream);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, boxToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, boxToPoint, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetPointSource,
|
||||
boxToPoint,
|
||||
word,
|
||||
box
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetPointSource,
|
||||
boxToPoint,
|
||||
istream,
|
||||
box
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -73,29 +89,37 @@ Foam::boxToPoint::boxToPoint
|
||||
const treeBoundBoxList& bbs
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
bbs_(bbs)
|
||||
{}
|
||||
|
||||
|
||||
Foam::boxToPoint::boxToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
treeBoundBoxList&& bbs
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
bbs_(std::move(bbs))
|
||||
{}
|
||||
|
||||
|
||||
Foam::boxToPoint::boxToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
bbs_()
|
||||
{
|
||||
if (dict.found("box"))
|
||||
// Look for 'boxes' or 'box'
|
||||
if (!dict.readIfPresent("boxes", bbs_))
|
||||
{
|
||||
bbs_.resize(1);
|
||||
dict.readEntry("box", bbs_.first());
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.readEntry("boxes", bbs_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,8 +129,8 @@ Foam::boxToPoint::boxToPoint
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
bbs_(1, treeBoundBox(checkIs(is)))
|
||||
topoSetPointSource(mesh),
|
||||
bbs_(one(), treeBoundBox(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
@ -118,17 +142,23 @@ void Foam::boxToPoint::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding points that are within boxes " << bbs_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding points that are within boxes " << bbs_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing points that are within boxes " << bbs_ << " ..."
|
||||
<< endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing points that are within boxes " << bbs_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,17 +25,18 @@ Class
|
||||
Foam::boxToPoint
|
||||
|
||||
Description
|
||||
A topoSetSource to select points based on whether they are inside box.
|
||||
A topoSetPointSource to select points based on whether they are inside box.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
box | A single bounding box | partly |
|
||||
boxes | Multiple bounding boxes | partly |
|
||||
Property | Description | Required | Default
|
||||
box | A single bounding box | partly |
|
||||
boxes | Multiple bounding boxes | partly |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Must specify either "box" or "boxes"
|
||||
Must specify either "box" or "boxes".
|
||||
The selection of multiple boxes has precedence.
|
||||
|
||||
SourceFiles
|
||||
boxToPoint.C
|
||||
@ -45,7 +46,7 @@ SourceFiles
|
||||
#ifndef boxToPoint_H
|
||||
#define boxToPoint_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetPointSource.H"
|
||||
#include "treeBoundBoxList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -59,7 +60,7 @@ namespace Foam
|
||||
|
||||
class boxToPoint
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetPointSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -83,12 +84,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
boxToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const treeBoundBoxList& bbs
|
||||
);
|
||||
//- Construct from components, copying bounding boxes
|
||||
boxToPoint(const polyMesh& mesh, const treeBoundBoxList& bbs);
|
||||
|
||||
//- Construct from components, moving bounding boxes
|
||||
boxToPoint(const polyMesh& mesh, treeBoundBoxList&& bbs);
|
||||
|
||||
//- Construct from dictionary
|
||||
boxToPoint(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -103,11 +103,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return POINTSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(cellToPoint, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, cellToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, cellToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, cellToPoint, istream);
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +92,7 @@ Foam::cellToPoint::cellToPoint
|
||||
const cellAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
setName_(setName),
|
||||
option_(option)
|
||||
{}
|
||||
@ -102,9 +104,12 @@ Foam::cellToPoint::cellToPoint
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set")),
|
||||
option_(cellActionNames_.get("option", dict))
|
||||
cellToPoint
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set"),
|
||||
cellActionNames_.get("option", dict)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -114,7 +119,7 @@ Foam::cellToPoint::cellToPoint
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
option_(cellActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
@ -128,15 +133,23 @@ void Foam::cellToPoint::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding from " << setName_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding from " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing from " << setName_ << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing from " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cellToPoint
|
||||
|
||||
Description
|
||||
A topoSetSource to select points based on usage in cells.
|
||||
A topoSetPointSource to select points based on usage in cells.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef cellToPoint_H
|
||||
#define cellToPoint_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetPointSource.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,7 +56,7 @@ namespace Foam
|
||||
|
||||
class cellToPoint
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetPointSource
|
||||
{
|
||||
|
||||
public:
|
||||
@ -114,11 +114,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return POINTSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(faceToPoint, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, faceToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, faceToPoint, istream);
|
||||
}
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::faceToPoint::usage_
|
||||
@ -84,7 +86,7 @@ Foam::faceToPoint::faceToPoint
|
||||
const faceAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
setName_(setName),
|
||||
option_(option)
|
||||
{}
|
||||
@ -96,9 +98,12 @@ Foam::faceToPoint::faceToPoint
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.get<word>("set")),
|
||||
option_(faceActionNames_.get("option", dict))
|
||||
faceToPoint
|
||||
(
|
||||
mesh,
|
||||
dict.get<word>("set"),
|
||||
faceActionNames_.get("option", dict)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -108,7 +113,7 @@ Foam::faceToPoint::faceToPoint
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
setName_(checkIs(is)),
|
||||
option_(faceActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
@ -122,17 +127,23 @@ void Foam::faceToPoint::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding points from face in faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding points from face in faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing points from face in faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing points from face in faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::faceToPoint
|
||||
|
||||
Description
|
||||
A topoSetSource to select points based on usage in faces.
|
||||
A topoSetPointSource to select points based on usage in faces.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#ifndef faceToPoint_H
|
||||
#define faceToPoint_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetPointSource.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,7 +56,7 @@ namespace Foam
|
||||
|
||||
class faceToPoint
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetPointSource
|
||||
{
|
||||
|
||||
public:
|
||||
@ -114,11 +114,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return POINTSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -34,6 +34,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(labelToPoint, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, labelToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, labelToPoint, istream);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, labelToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, labelToPoint, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetPointSource,
|
||||
labelToPoint,
|
||||
word,
|
||||
label
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetPointSource,
|
||||
labelToPoint,
|
||||
istream,
|
||||
label
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -53,19 +69,29 @@ Foam::labelToPoint::labelToPoint
|
||||
const labelList& labels
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
labels_(labels)
|
||||
{}
|
||||
|
||||
|
||||
Foam::labelToPoint::labelToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
labelList&& labels
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
labels_(std::move(labels))
|
||||
{}
|
||||
|
||||
|
||||
Foam::labelToPoint::labelToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
labels_(dict.get<labelList>("value"))
|
||||
labelToPoint(mesh, dict.get<labelList>("value"))
|
||||
{}
|
||||
|
||||
|
||||
@ -75,7 +101,7 @@ Foam::labelToPoint::labelToPoint
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
labels_(checkIs(is))
|
||||
{
|
||||
check(labels_, mesh.nPoints());
|
||||
@ -90,15 +116,23 @@ void Foam::labelToPoint::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding points mentioned in dictionary" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding points mentioned in dictionary"
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
addOrDelete(set, labels_, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing points mentioned in dictionary" << " ..." << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing points mentioned in dictionary"
|
||||
<< " ..." << endl;
|
||||
}
|
||||
|
||||
addOrDelete(set, labels_, false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::labelToPoint
|
||||
|
||||
Description
|
||||
A topoSetSource to select points given explicitly provided labels.
|
||||
A topoSetPointSource to select points given explicitly provided labels.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
@ -41,7 +41,7 @@ SourceFiles
|
||||
#ifndef labelToPoint_H
|
||||
#define labelToPoint_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "topoSetPointSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Foam
|
||||
|
||||
class labelToPoint
|
||||
:
|
||||
public topoSetSource
|
||||
public topoSetPointSource
|
||||
{
|
||||
|
||||
// Private data
|
||||
@ -73,12 +73,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Copy construct from components
|
||||
labelToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& labels
|
||||
);
|
||||
//- Construct from components, copying labels
|
||||
labelToPoint(const polyMesh& mesh, const labelList& labels);
|
||||
|
||||
//- Construct from components, moving labels
|
||||
labelToPoint(const polyMesh& mesh, labelList&& labels);
|
||||
|
||||
//- Construct from dictionary
|
||||
labelToPoint(const polyMesh& mesh, const dictionary& dict);
|
||||
@ -93,11 +92,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual sourceType setType() const
|
||||
{
|
||||
return POINTSETSOURCE;
|
||||
}
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
|
||||
@ -35,6 +35,22 @@ namespace Foam
|
||||
defineTypeNameAndDebug(nearestToPoint, 0);
|
||||
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, istream);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, nearestToPoint, word);
|
||||
addToRunTimeSelectionTable(topoSetPointSource, nearestToPoint, istream);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetPointSource,
|
||||
nearestToPoint,
|
||||
word,
|
||||
nearest
|
||||
);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
topoSetPointSource,
|
||||
nearestToPoint,
|
||||
istream,
|
||||
nearest
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -106,19 +122,29 @@ Foam::nearestToPoint::nearestToPoint
|
||||
const pointField& points
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
points_(points)
|
||||
{}
|
||||
|
||||
|
||||
Foam::nearestToPoint::nearestToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
pointField&& points
|
||||
)
|
||||
:
|
||||
topoSetPointSource(mesh),
|
||||
points_(std::move(points))
|
||||
{}
|
||||
|
||||
|
||||
Foam::nearestToPoint::nearestToPoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
points_(dict.get<pointField>("points"))
|
||||
nearestToPoint(mesh, dict.get<pointField>("points"))
|
||||
{}
|
||||
|
||||
|
||||
@ -128,7 +154,7 @@ Foam::nearestToPoint::nearestToPoint
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
topoSetPointSource(mesh),
|
||||
points_(checkIs(is))
|
||||
{}
|
||||
|
||||
@ -141,15 +167,21 @@ void Foam::nearestToPoint::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
|
||||
{
|
||||
Info<< " Adding points nearest to " << points_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Adding points nearest to " << points_ << endl;
|
||||
}
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
else if (action == topoSetSource::SUBTRACT)
|
||||
{
|
||||
Info<< " Removing points nearest to " << points_ << endl;
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< " Removing points nearest to " << points_ << endl;
|
||||
}
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user