ENH: verify manual input for labelToCell etc (issue #895)

DOC: document topo sources inputs in doxygen format

ENH: check for excess tokens in dictionary input (issue #762)

- various bits of code cleanup (modernization) in meshTool/sets.
This commit is contained in:
Mark Olesen
2018-07-07 00:22:58 +02:00
parent dda1c5f004
commit 322d642b57
114 changed files with 1478 additions and 1749 deletions

View File

@ -60,15 +60,12 @@ void Foam::vtk::writeCellSetFaces
Map<label> cellFaces(2*set.size());
forAllConstIters(set, iter)
for (const label celli : static_cast<const labelHashSet&>(set))
{
label celli = iter.key();
const cell& cFaces = mesh.cells()[celli];
forAll(cFaces, i)
for (const label facei : cFaces)
{
label facei = cFaces[i];
if (mesh.isInternalFace(facei))
{
label otherCelli = mesh.faceOwner()[facei];
@ -90,7 +87,7 @@ void Foam::vtk::writeCellSetFaces
}
}
const labelList faceLabels = cellFaces.sortedToc();
const labelList faceLabels(cellFaces.sortedToc());
labelList faceValues(cellFaces.size());
forAll(faceLabels, facei)

View File

@ -45,6 +45,8 @@ SourceFiles
namespace Foam
{
// Forward declarations
class primitiveMesh;
class cellSet;
class fileName;

View File

@ -57,7 +57,7 @@ void Foam::vtk::writeFaceSet
//-------------------------------------------------------------------------
// Faces of set with OpenFOAM faceID as value
const labelList faceLabels = set.sortedToc();
const labelList faceLabels(set.sortedToc());
uindirectPrimitivePatch pp
(

View File

@ -42,6 +42,8 @@ SourceFiles
namespace Foam
{
// Forward declarations
class primitiveMesh;
class faceSet;
class fileName;

View File

@ -42,6 +42,8 @@ SourceFiles
namespace Foam
{
// Forward declarations
class primitiveMesh;
class pointSet;
class fileName;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,9 +53,9 @@ void Foam::boxToCell::combine(topoSet& set, const bool add) const
forAll(ctrs, celli)
{
forAll(bbs_, i)
for (const auto& bb : bbs_)
{
if (bbs_[i].contains(ctrs[celli]))
if (bb.contains(ctrs[celli]))
{
addOrDelete(set, celli, add);
break;
@ -110,12 +110,6 @@ Foam::boxToCell::boxToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::boxToCell::~boxToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::boxToCell::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,16 @@ Class
Description
A topoSetSource 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 |
\endtable
Note
Must specify either "box" or "boxes"
SourceFiles
boxToCell.C
@ -56,7 +66,7 @@ class boxToCell
//- Add usage string
static addToUsageTable usage_;
//- Bounding box.
//- Bounding boxes
treeBoundBoxList bbs_;
@ -80,22 +90,14 @@ public:
);
//- Construct from dictionary
boxToCell
(
const polyMesh& mesh,
const dictionary& dict
);
boxToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
boxToCell
(
const polyMesh& mesh,
Istream&
);
boxToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~boxToCell();
virtual ~boxToCell() = default;
// Member Functions
@ -108,7 +110,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ Foam::cellToCell::cellToCell
)
:
topoSetSource(mesh),
setName_(dict.lookup("set"))
setName_(dict.get<word>("set"))
{}
@ -81,12 +81,6 @@ Foam::cellToCell::cellToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cellToCell::~cellToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cellToCell::applyToSet

View File

@ -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.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select the cells from another cellSet.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | The cell set name | yes |
\endtable
SourceFiles
cellToCell.C
@ -73,22 +79,14 @@ public:
);
//- Construct from dictionary
cellToCell
(
const polyMesh& mesh,
const dictionary& dict
);
cellToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
cellToCell
(
const polyMesh& mesh,
Istream&
);
cellToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~cellToCell();
virtual ~cellToCell() = default;
// Member Functions
@ -101,7 +99,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,7 +50,7 @@ Foam::topoSetSource::addToUsageTable Foam::cylinderAnnulusToCell::usage_
void Foam::cylinderAnnulusToCell::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const vector axis = (point2_ - point1_);
const scalar orad2 = sqr(outerRadius_);
const scalar irad2 = sqr(innerRadius_);
const scalar magAxis2 = magSqr(axis);
@ -59,12 +59,12 @@ void Foam::cylinderAnnulusToCell::combine(topoSet& set, const bool add) const
forAll(ctrs, celli)
{
vector d = ctrs[celli] - p1_;
scalar magD = d & axis;
const vector d = ctrs[celli] - point1_;
const scalar magD = d & axis;
if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
const scalar d2 = (d & d) - sqr(magD)/magAxis2;
if ((d2 < orad2) && (d2 > irad2))
{
addOrDelete(set, celli, add);
@ -79,15 +79,15 @@ void Foam::cylinderAnnulusToCell::combine(topoSet& set, const bool add) const
Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar outerRadius,
const scalar innerRadius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
point1_(point1),
point2_(point2),
outerRadius_(outerRadius),
innerRadius_(innerRadius)
{}
@ -100,10 +100,10 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
outerRadius_(readScalar(dict.lookup("outerRadius"))),
innerRadius_(readScalar(dict.lookup("innerRadius")))
point1_(dict.get<point>("p1")),
point2_(dict.get<point>("p2")),
outerRadius_(dict.get<scalar>("outerRadius")),
innerRadius_(dict.get<scalar>("innerRadius"))
{}
@ -114,19 +114,13 @@ Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
point1_(checkIs(is)),
point2_(checkIs(is)),
outerRadius_(readScalar(checkIs(is))),
innerRadius_(readScalar(checkIs(is)))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cylinderAnnulusToCell::~cylinderAnnulusToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylinderAnnulusToCell::applyToSet
@ -139,18 +133,19 @@ void Foam::cylinderAnnulusToCell::applyToSet
{
Info<< " Adding cells with centre within cylinder annulus,"
<< " with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius = " << innerRadius_
<< endl;
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing cells with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius " << innerRadius_
<< endl;
Info<< " Removing cells with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
combine(set, false);
}

View File

@ -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.
@ -28,6 +28,15 @@ Description
A topoSetSource to select cells based on cell centres inside a
cylinder annulus.
\heading Dictionary parameters
\table
Property | Description | Required | Default
p1 | coordinate of endpoint | yes |
p2 | coordinate of endpoint | yes |
outerRadius | cylinder outer radius | yes |
innerRadius | cylinder inner radius | yes |
\endtable
SourceFiles
cylinderAnnulusToCell.C
@ -58,10 +67,10 @@ class cylinderAnnulusToCell
static addToUsageTable usage_;
//- First point on cylinder axis
vector p1_;
point point1_;
//- Second point on cylinder axis
vector p2_;
point point2_;
//- Outer Radius
scalar outerRadius_;
@ -87,29 +96,22 @@ public:
cylinderAnnulusToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar outerRadius,
const scalar innerRadius
);
//- Construct from dictionary
cylinderAnnulusToCell
(
const polyMesh& mesh,
const dictionary& dict
);
cylinderAnnulusToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
cylinderAnnulusToCell
(
const polyMesh& mesh,
Istream&
);
cylinderAnnulusToCell(const polyMesh& mesh, Istream& is);
// Destructor
virtual ~cylinderAnnulusToCell();
//- Destructor
virtual ~cylinderAnnulusToCell() = default;
// Member Functions
@ -121,7 +123,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,7 +49,7 @@ Foam::topoSetSource::addToUsageTable Foam::cylinderToCell::usage_
void Foam::cylinderToCell::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const vector axis = (point2_ - point1_);
const scalar rad2 = sqr(radius_);
const scalar magAxis2 = magSqr(axis);
@ -57,12 +57,12 @@ void Foam::cylinderToCell::combine(topoSet& set, const bool add) const
forAll(ctrs, celli)
{
vector d = ctrs[celli] - p1_;
scalar magD = d & axis;
const vector d = ctrs[celli] - point1_;
const scalar magD = d & axis;
if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
const scalar d2 = (d & d) - sqr(magD)/magAxis2;
if (d2 < rad2)
{
addOrDelete(set, celli, add);
@ -77,14 +77,14 @@ void Foam::cylinderToCell::combine(topoSet& set, const bool add) const
Foam::cylinderToCell::cylinderToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar radius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
point1_(point1),
point2_(point2),
radius_(radius)
{}
@ -96,9 +96,9 @@ Foam::cylinderToCell::cylinderToCell
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
radius_(readScalar(dict.lookup("radius")))
point1_(dict.get<point>("p1")),
point2_(dict.get<point>("p2")),
radius_(dict.get<scalar>("radius"))
{}
@ -109,18 +109,12 @@ Foam::cylinderToCell::cylinderToCell
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
point1_(checkIs(is)),
point2_(checkIs(is)),
radius_(readScalar(checkIs(is)))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cylinderToCell::~cylinderToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylinderToCell::applyToSet
@ -132,14 +126,16 @@ void Foam::cylinderToCell::applyToSet
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding cells with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing cells with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
combine(set, false);
}

View File

@ -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.
@ -27,6 +27,14 @@ Class
Description
A topoSetSource to select cells based on cell centres inside a cylinder.
\heading Dictionary parameters
\table
Property | Description | Required | Default
p1 | coordinate of endpoint | yes |
p2 | coordinate of endpoint | yes |
radius | cylinder radius | yes |
\endtable
SourceFiles
cylinderToCell.C
@ -57,10 +65,10 @@ class cylinderToCell
static addToUsageTable usage_;
//- First point on cylinder axis
vector p1_;
point point1_;
//- Second point on cylinder axis
vector p2_;
point point2_;
//- Radius
scalar radius_;
@ -83,28 +91,20 @@ public:
cylinderToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar radius
);
//- Construct from dictionary
cylinderToCell
(
const polyMesh& mesh,
const dictionary& dict
);
cylinderToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
cylinderToCell
(
const polyMesh& mesh,
Istream&
);
cylinderToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~cylinderToCell();
virtual ~cylinderToCell() = default;
// Member Functions
@ -117,7 +117,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,10 +52,10 @@ const Foam::Enum
>
Foam::faceToCell::faceActionNames_
{
{ faceAction::NEIGHBOUR, "neighbour" },
{ faceAction::OWNER, "owner" },
{ faceAction::ANY, "any" },
{ faceAction::ALL, "all" },
{ faceAction::OWNER, "owner" },
{ faceAction::NEIGHBOUR, "neighbour" },
};
@ -66,12 +66,11 @@ void Foam::faceToCell::combine(topoSet& set, const bool add) const
// Load the set
faceSet loadedSet(mesh_, setName_);
const labelHashSet& faceLabels = loadedSet;
// Handle owner/neighbour/any selection
forAllConstIter(faceSet, loadedSet, iter)
for (const label facei : faceLabels)
{
const label facei = iter.key();
if ((option_ == OWNER) || (option_ == ANY))
{
const label celli = mesh_.faceOwner()[facei];
@ -97,46 +96,26 @@ void Foam::faceToCell::combine(topoSet& set, const bool add) const
Map<label> facesPerCell(loadedSet.size());
forAllConstIter(faceSet, loadedSet, iter)
for (const label facei : faceLabels)
{
const label facei = iter.key();
const label own = mesh_.faceOwner()[facei];
Map<label>::iterator fndOwn = facesPerCell.find(own);
if (fndOwn == facesPerCell.end())
{
facesPerCell.insert(own, 1);
}
else
{
fndOwn()++;
}
// Count faces on owner
++(facesPerCell(mesh_.faceOwner()[facei], 0));
if (mesh_.isInternalFace(facei))
{
label nei = mesh_.faceNeighbour()[facei];
Map<label>::iterator fndNei = facesPerCell.find(nei);
if (fndNei == facesPerCell.end())
{
facesPerCell.insert(nei, 1);
}
else
{
fndNei()++;
}
// Count faces on neighbour
++(facesPerCell(mesh_.faceNeighbour()[facei], 0));
}
}
// Include cells that are referenced as many times as they have faces
// -> all faces in set.
forAllConstIter(Map<label>, facesPerCell, iter)
forAllConstIters(facesPerCell, iter)
{
const label celli = iter.key();
const label count = iter.object();
if (iter() == mesh_.cells()[celli].size())
if (count == mesh_.cells()[celli].size())
{
addOrDelete(set, celli, add);
}
@ -167,7 +146,7 @@ Foam::faceToCell::faceToCell
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
setName_(dict.get<word>("set")),
option_(faceActionNames_.lookup("option", dict))
{}
@ -184,12 +163,6 @@ Foam::faceToCell::faceToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceToCell::~faceToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceToCell::applyToSet

View File

@ -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,7 +25,14 @@ Class
Foam::faceToCell
Description
A topoSetSource to select cells based on usage in faces.
A topoSetSource to select cells based on usage in a face set.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | The face set name to use | yes |
option | Selection type (all/any/owner/neighbour) | yes |
\endtable
SourceFiles
faceToCell.C
@ -55,10 +62,10 @@ public:
//- Enumeration defining the valid options
enum faceAction
{
NEIGHBOUR,
OWNER,
ANY,
ALL
ALL,
OWNER,
NEIGHBOUR
};
private:
@ -99,22 +106,14 @@ public:
);
//- Construct from dictionary
faceToCell
(
const polyMesh& mesh,
const dictionary& dict
);
faceToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
faceToCell
(
const polyMesh& mesh,
Istream&
);
faceToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~faceToCell();
virtual ~faceToCell() = default;
// Member Functions
@ -127,7 +126,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -63,12 +63,12 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
{
bool hasMatched = false;
forAll(mesh_.faceZones(), i)
for (const faceZone& zone : mesh_.faceZones())
{
const faceZone& zone = mesh_.faceZones()[i];
if (zoneName_.match(zone.name()))
{
hasMatched = true;
const labelList& cellLabels =
(
option_ == MASTER
@ -80,14 +80,12 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
<< " with " << cellLabels.size() << " cells on selected side."
<< endl;
hasMatched = true;
forAll(cellLabels, i)
for (const label celli : cellLabels)
{
// Only do active cells
if (cellLabels[i] >= 0 && cellLabels[i] < mesh_.nCells())
if (celli >= 0 && celli < mesh_.nCells())
{
addOrDelete(set, cellLabels[i], add);
addOrDelete(set, celli, add);
}
}
}
@ -96,8 +94,9 @@ void Foam::faceZoneToCell::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 named " << zoneName_ << nl
<< "Valid names: " << flatOutput(mesh_.faceZones().names())
<< endl;
}
}
@ -124,7 +123,7 @@ Foam::faceZoneToCell::faceZoneToCell
)
:
topoSetSource(mesh),
zoneName_(dict.lookup("name")),
zoneName_(dict.get<wordRe>("name")),
option_(faceActionNames_.lookup("option", dict))
{}
@ -141,12 +140,6 @@ Foam::faceZoneToCell::faceZoneToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceZoneToCell::~faceZoneToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceZoneToCell::applyToSet

View File

@ -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.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource 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 |
\endtable
SourceFiles
faceZoneToCell.C
@ -96,22 +103,14 @@ public:
);
//- Construct from dictionary
faceZoneToCell
(
const polyMesh& mesh,
const dictionary& dict
);
faceZoneToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
faceZoneToCell
(
const polyMesh& mesh,
Istream&
);
faceZoneToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~faceZoneToCell();
virtual ~faceZoneToCell() = default;
// Member Functions
@ -124,7 +123,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -40,7 +40,6 @@ Description
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fieldDictionary Declaration
\*---------------------------------------------------------------------------*/

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,7 +29,6 @@ License
#include "Time.H"
#include "IFstream.H"
#include "fieldDictionary.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -115,9 +114,9 @@ Foam::fieldToCell::fieldToCell
)
:
topoSetSource(mesh),
fieldName_(dict.lookup("field")),
min_(readScalar(dict.lookup("min"))),
max_(readScalar(dict.lookup("max")))
fieldName_(dict.get<word>("field")),
min_(dict.get<scalar>("min")),
max_(dict.get<scalar>("max"))
{}
@ -134,12 +133,6 @@ Foam::fieldToCell::fieldToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fieldToCell::~fieldToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fieldToCell::applyToSet
@ -170,22 +163,22 @@ void Foam::fieldToCell::applyToSet
// Note: should use volScalarField::typeName instead below
// but that would introduce linkage problems (finiteVolume needs
// meshTools)
else if (fieldObject.headerClassName() == "volScalarField")
else if ("volScalarField" == fieldObject.headerClassName())
{
IFstream str(typeFilePath<labelIOList>(fieldObject));
// Read dictionary
// Read as dictionary
fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
scalarField internalVals("internalField", fieldDict, mesh().nCells());
applyToSet(action, internalVals, set);
}
else if (fieldObject.headerClassName() == "volVectorField")
else if ("volVectorField" == fieldObject.headerClassName())
{
IFstream str(typeFilePath<labelIOList>(fieldObject));
// Read dictionary
// Read as dictionary
fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
vectorField internalVals("internalField", fieldDict, mesh().nCells());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,14 @@ Class
Description
A topoSetSource to select cells based on field values.
\heading Dictionary parameters
\table
Property | Description | Required | Default
field | The (scalar, vector) field to use | yes |
min | The min value for the subset | yes |
max | The max value for the subset | yes |
\endtable
SourceFiles
fieldToCell.C
@ -58,13 +66,13 @@ class fieldToCell
static addToUsageTable usage_;
//- Name of volScalarField
//- Name of volScalarField, volVectorField
word fieldName_;
//- Min to subset field values with
scalar min_;
//- Max ,,
//- Max to subset field values with
scalar max_;
@ -95,22 +103,14 @@ public:
);
//- Construct from dictionary
fieldToCell
(
const polyMesh& mesh,
const dictionary& dict
);
fieldToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
fieldToCell
(
const polyMesh& mesh,
Istream&
);
fieldToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~fieldToCell();
virtual ~fieldToCell() = default;
// Member Functions
@ -123,7 +123,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,17 +45,6 @@ Foam::topoSetSource::addToUsageTable Foam::labelToCell::usage_
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::labelToCell::combine(topoSet& set, const bool add) const
{
forAll(labels_, labelI)
{
addOrDelete(set, labels_[labelI], add);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::labelToCell::labelToCell
@ -76,7 +65,7 @@ Foam::labelToCell::labelToCell
)
:
topoSetSource(mesh),
labels_(dict.lookup("value"))
labels_(dict.get<labelList>("value"))
{}
@ -88,13 +77,9 @@ Foam::labelToCell::labelToCell
:
topoSetSource(mesh),
labels_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::labelToCell::~labelToCell()
{}
{
check(labels_, mesh.nCells());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -109,13 +94,13 @@ void Foam::labelToCell::applyToSet
{
Info<< " Adding cells mentioned in dictionary" << " ..." << endl;
combine(set, true);
addOrDelete(set, labels_, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing cells mentioned in dictionary" << " ..." << endl;
combine(set, false);
addOrDelete(set, labels_, false);
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select cells based on explicitly given labels.
\heading Dictionary parameters
\table
Property | Description | Required | Default
value | The cell labels | yes |
\endtable
SourceFiles
labelToCell.C
@ -60,11 +66,6 @@ class labelToCell
labelList labels_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
@ -80,22 +81,14 @@ public:
);
//- Construct from dictionary
labelToCell
(
const polyMesh& mesh,
const dictionary& dict
);
labelToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
labelToCell
(
const polyMesh& mesh,
Istream&
);
labelToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~labelToCell();
virtual ~labelToCell() = default;
// Member Functions
@ -108,7 +101,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -54,17 +54,15 @@ void Foam::nbrToCell::combine(topoSet& set, const bool add) const
boolList isCoupled(mesh_.nFaces()-mesh_.nInternalFaces(), false);
forAll(patches, patchi)
for (const polyPatch& pp : patches)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled())
{
label facei = pp.start();
forAll(pp, i)
{
isCoupled[facei-mesh_.nInternalFaces()] = true;
facei++;
++facei;
}
}
}
@ -75,17 +73,15 @@ void Foam::nbrToCell::combine(topoSet& set, const bool add) const
label nNbrCells = 0;
forAll(cFaces, i)
for (const label facei : cFaces)
{
label facei = cFaces[i];
if (mesh_.isInternalFace(facei))
{
nNbrCells++;
++nNbrCells;
}
else if (isCoupled[facei-mesh_.nInternalFaces()])
{
nNbrCells++;
++nNbrCells;
}
}
@ -117,7 +113,7 @@ Foam::nbrToCell::nbrToCell
)
:
topoSetSource(mesh),
minNbrs_(readLabel(dict.lookup("neighbours")))
minNbrs_(dict.get<label>("neighbours"))
{}
@ -132,12 +128,6 @@ Foam::nbrToCell::nbrToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::nbrToCell::~nbrToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::nbrToCell::applyToSet

View File

@ -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.
@ -28,6 +28,12 @@ Description
A topoSetSource to select cells based on number of neighbouring cells
(i.e. number of internal or coupled faces)
\heading Dictionary parameters
\table
Property | Description | Required | Default
neighbours | Number of neighbours | yes |
\endtable
SourceFiles
nbrToCell.C
@ -71,6 +77,7 @@ public:
//- Runtime type information
TypeName("nbrToCell");
// Constructors
//- Construct from components
@ -81,22 +88,14 @@ public:
);
//- Construct from dictionary
nbrToCell
(
const polyMesh& mesh,
const dictionary& dict
);
nbrToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
nbrToCell
(
const polyMesh& mesh,
Istream&
);
nbrToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~nbrToCell();
virtual ~nbrToCell() = default;
// Member Functions
@ -109,7 +108,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,8 +55,9 @@ void Foam::nearestToCell::combine(topoSet& set, const bool add) const
forAll(points_, pointi)
{
label celli = mesh_.findNearestCell(points_[pointi]);
const label celli = mesh_.findNearestCell(points_[pointi]);
const point& cc = mesh_.cellCentres()[celli];
nearest[pointi].first() = pointIndexHit(true, cc, celli);
nearest[pointi].second() = Tuple2<scalar, label>
(
@ -68,11 +69,11 @@ void Foam::nearestToCell::combine(topoSet& set, const bool add) const
Pstream::listCombineGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineScatter(nearest);
forAll(nearest, pointi)
for (const auto& near : nearest)
{
if (nearest[pointi].second().second() == Pstream::myProcNo())
if (near.second().second() == Pstream::myProcNo())
{
addOrDelete(set, nearest[pointi].first().index(), add);
addOrDelete(set, near.first().index(), add);
}
}
}
@ -98,7 +99,7 @@ Foam::nearestToCell::nearestToCell
)
:
topoSetSource(mesh),
points_(dict.lookup("points"))
points_(dict.get<pointField>("points"))
{}
@ -113,12 +114,6 @@ Foam::nearestToCell::nearestToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::nearestToCell::~nearestToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::nearestToCell::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select cells nearest to points.
\heading Dictionary parameters
\table
Property | Description | Required | Default
points | List of selection points | yes |
\endtable
SourceFiles
nearestToCell.C
@ -80,22 +86,14 @@ public:
);
//- Construct from dictionary
nearestToCell
(
const polyMesh& mesh,
const dictionary& dict
);
nearestToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
nearestToCell
(
const polyMesh& mesh,
Istream&
);
nearestToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~nearestToCell();
virtual ~nearestToCell() = default;
// Member Functions
@ -108,7 +106,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -64,31 +64,36 @@ void Foam::pointToCell::combine(topoSet& set, const bool add) const
// Load the set
pointSet loadedSet(mesh_, setName_);
const labelHashSet& pointLabels = loadedSet;
// Handle any selection
if (option_ == ANY)
{
forAllConstIter(pointSet, loadedSet, iter)
for (const label pointi : pointLabels)
{
const label pointi = iter.key();
const labelList& pCells = mesh_.pointCells()[pointi];
forAll(pCells, pCelli)
for (const label celli : pCells)
{
addOrDelete(set, pCells[pCelli], add);
addOrDelete(set, celli, add);
}
}
}
else if (option_ == EDGE)
{
const faceList& faces = mesh_.faces();
forAll(faces, facei)
{
const face& f = faces[facei];
forAll(f, fp)
{
if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp)))
if
(
pointLabels.found(f[fp])
&& pointLabels.found(f.nextLabel(fp))
)
{
addOrDelete(set, mesh_.faceOwner()[facei], add);
if (mesh_.isInternalFace(facei))
@ -124,7 +129,7 @@ Foam::pointToCell::pointToCell
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
setName_(dict.get<word>("set")),
option_(pointActionNames_.lookup("option", dict))
{}
@ -141,12 +146,6 @@ Foam::pointToCell::pointToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointToCell::~pointToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pointToCell::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource to select cells based on usage of points.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | The point set name | yes |
option | Selection type (any / edge) | yes |
\endtable
SourceFiles
pointToCell.C
@ -96,22 +103,14 @@ public:
);
//- Construct from dictionary
pointToCell
(
const polyMesh& mesh,
const dictionary& dict
);
pointToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
pointToCell
(
const polyMesh& mesh,
Istream&
);
pointToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~pointToCell();
virtual ~pointToCell() = default;
// Member Functions
@ -124,7 +123,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -232,7 +232,8 @@ void Foam::regionToCell::shrinkRegions
}
}
}
Info<< " Eroded " << returnReduce(nChanged, sumOp<label>())
Info<< " Eroded "
<< returnReduce(nChanged, sumOp<label>())
<< " cells." << endl;
}
@ -257,7 +258,6 @@ void Foam::regionToCell::erode
//generateField("shrunkSelectedCell", shrunkSelectedCell)().write();
// Determine faces on the edge of shrunkSelectedCell
boolList blockedFace(mesh_.nFaces(), false);
markRegionFaces(shrunkSelectedCell, blockedFace);
@ -283,7 +283,6 @@ void Foam::regionToCell::erode
//generateField("removeCell_before", removeCell)().write();
// Grow removeCell
for (label iter = 0; iter < nErode_; iter++)
{
@ -345,8 +344,10 @@ void Foam::regionToCell::combine(topoSet& set, const bool add) const
if (setName_.size() && setName_ != "none")
{
Info<< " Loading subset " << setName_ << " to delimit search region."
Info<< " Loading subset " << setName_
<< " to delimit search region."
<< endl;
cellSet subSet(mesh_, setName_);
selectedCell = false;
@ -402,11 +403,9 @@ Foam::regionToCell::regionToCell
setName_(dict.lookupOrDefault<word>("set", "none")),
insidePoints_
(
dict.found("insidePoints")
? dict.lookup("insidePoints")
: dict.lookup("insidePoint")
dict.getCompat<pointField>("insidePoints", {{ "insidePoint", 0 }})
),
nErode_(dict.lookupOrDefault("nErode", 0))
nErode_(dict.lookupOrDefault<label>("nErode", 0))
{}
@ -423,12 +422,6 @@ Foam::regionToCell::regionToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionToCell::~regionToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regionToCell::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,7 +29,7 @@ Description
(that contains given points)
In dictionary input:
\verbatim
// optional name of cellSet delimiting search
set c0;
@ -39,7 +39,15 @@ Description
// points inside region to select
insidePoints ((1 2 3));
\endverbatim
\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 | ''
\endtable
SourceFiles
regionToCell.C
@ -126,22 +134,14 @@ public:
);
//- Construct from dictionary
regionToCell
(
const polyMesh& mesh,
const dictionary& dict
);
regionToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
regionToCell
(
const polyMesh& mesh,
Istream&
);
regionToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~regionToCell();
virtual ~regionToCell() = default;
// Member Functions
@ -151,8 +151,11 @@ public:
return CELLSETSOURCE;
}
virtual void applyToSet(const topoSetSource::setAction action, topoSet&)
const;
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -136,10 +136,10 @@ Foam::rotatedBoxToCell::rotatedBoxToCell
)
:
topoSetSource(mesh),
origin_(dict.lookup("origin")),
i_(dict.lookup("i")),
j_(dict.lookup("j")),
k_(dict.lookup("k"))
origin_(dict.get<point>("origin")),
i_(dict.get<vector>("i")),
j_(dict.get<vector>("j")),
k_(dict.get<vector>("k"))
{}
@ -153,12 +153,6 @@ Foam::rotatedBoxToCell::rotatedBoxToCell(const polyMesh& mesh, Istream& is)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::rotatedBoxToCell::~rotatedBoxToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::rotatedBoxToCell::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,6 +38,15 @@ Description
k ( 0.0 0.0 100);
\endverbatim
\heading Dictionary parameters
\table
Property | Description | Required | Default
origin | The box centre | yes |
i | | yes |
j | | yes |
k | | yes |
\endtable
SourceFiles
rotatedBoxToCell.C
@ -70,7 +79,7 @@ class rotatedBoxToCell
//- Skewed box
const vector origin_;
const point origin_;
const vector i_;
const vector j_;
const vector k_;
@ -102,11 +111,11 @@ public:
rotatedBoxToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
rotatedBoxToCell(const polyMesh& mesh, Istream&);
rotatedBoxToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~rotatedBoxToCell();
virtual ~rotatedBoxToCell() = default;
// Member Functions
@ -119,7 +128,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,7 +59,7 @@ void Foam::shapeToCell::combine(topoSet& set, const bool add) const
{
if (type_ == "splitHex")
{
for (label celli = 0; celli < mesh_.nCells(); celli++)
for (label celli = 0; celli < mesh_.nCells(); ++celli)
{
cellFeatures superCell(mesh_, featureCos, celli);
@ -91,11 +91,11 @@ void Foam::shapeToCell::combine(topoSet& set, const bool add) const
Foam::shapeToCell::shapeToCell
(
const polyMesh& mesh,
const word& type
const word& shapeName
)
:
topoSetSource(mesh),
type_(type)
type_(shapeName)
{
if (!cellModel::ptr(type_) && type_ != "splitHex")
{
@ -112,7 +112,7 @@ Foam::shapeToCell::shapeToCell
)
:
topoSetSource(mesh),
type_(dict.lookup("type"))
type_(dict.get<word>("type"))
{
if (!cellModel::ptr(type_) && type_ != "splitHex")
{
@ -139,12 +139,6 @@ Foam::shapeToCell::shapeToCell
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::shapeToCell::~shapeToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::shapeToCell::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,6 +30,12 @@ Description
Handles all known ones from static collection in cellModel
and splitHex with 10 degrees feature angle.
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | The cell model type (hex, ..) | yes |
\endtable
SourceFiles
shapeToCell.C
@ -62,6 +68,7 @@ class shapeToCell
//- Name of cell type
word type_;
// Private Member Functions
//- Depending on cell type add to or delete from cellSet.
@ -79,32 +86,25 @@ public:
//- Cos of feature angle for polyHedral to be splitHex
static scalar featureCos;
// Constructors
//- Construct from components
shapeToCell
(
const polyMesh& mesh,
const word& type
const word& shapeName
);
//- Construct from dictionary
shapeToCell
(
const polyMesh& mesh,
const dictionary& dict
);
shapeToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
shapeToCell
(
const polyMesh& mesh,
Istream&
);
shapeToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~shapeToCell();
virtual ~shapeToCell() = default;
// Member Functions
@ -117,7 +117,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,12 +51,11 @@ void Foam::sphereToCell::combine(topoSet& set, const bool add) const
{
const pointField& ctrs = mesh_.cellCentres();
const scalar radSquared = radius_*radius_;
const scalar rad2 = radius_*radius_;
forAll(ctrs, celli)
{
scalar offset = magSqr(centre_ - ctrs[celli]);
if (offset <= radSquared)
if (magSqr(ctrs[celli] - centre_) <= rad2)
{
addOrDelete(set, celli, add);
}
@ -69,7 +68,7 @@ void Foam::sphereToCell::combine(topoSet& set, const bool add) const
Foam::sphereToCell::sphereToCell
(
const polyMesh& mesh,
const vector& centre,
const point& centre,
const scalar radius
)
:
@ -86,8 +85,8 @@ Foam::sphereToCell::sphereToCell
)
:
topoSetSource(mesh),
centre_(dict.lookup("centre")),
radius_(readScalar(dict.lookup("radius")))
centre_(dict.get<point>("centre")),
radius_(dict.get<scalar>("radius"))
{}
@ -103,12 +102,6 @@ Foam::sphereToCell::sphereToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sphereToCell::~sphereToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sphereToCell::applyToSet

View File

@ -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.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource 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 |
\endtable
SourceFiles
sphereToCell.C
@ -56,10 +63,10 @@ class sphereToCell
//- Add usage string
static addToUsageTable usage_;
//- Centre
vector centre_;
//- Centre point of the sphere
point centre_;
//- Radius
//- The outer radius of the sphere
scalar radius_;
@ -80,27 +87,19 @@ public:
sphereToCell
(
const polyMesh& mesh,
const vector& centre,
const point& centre,
const scalar radius
);
//- Construct from dictionary
sphereToCell
(
const polyMesh& mesh,
const dictionary& dict
);
sphereToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
sphereToCell
(
const polyMesh& mesh,
Istream&
);
sphereToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~sphereToCell();
virtual ~sphereToCell() = default;
// Member Functions
@ -113,7 +112,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -113,14 +113,12 @@ bool Foam::surfaceToCell::differingPointNormals
const labelList& cFaces = mesh().cells()[celli];
forAll(cFaces, cFacei)
for (const label facei : cFaces)
{
const face& f = faces[cFaces[cFacei]];
const face& f = faces[facei];
forAll(f, fp)
for (const label pointi : f)
{
label pointi = f[fp];
label pointTriI =
getNearest
(
@ -186,10 +184,8 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
// Check all 'outside' points
forAll(outsidePoints_, outsideI)
for (const point& outsidePoint : outsidePoints_)
{
const point& outsidePoint = outsidePoints_[outsideI];
// Find cell point is in. Linear search.
label celli = queryMesh.findCell(outsidePoint, -1, false);
if (returnReduce(celli, maxOp<label>()) == -1)
@ -424,17 +420,17 @@ Foam::surfaceToCell::surfaceToCell
)
:
topoSetSource(mesh),
surfName_(fileName(dict.lookup("file")).expand()),
outsidePoints_(dict.lookup("outsidePoints")),
includeCut_(readBool(dict.lookup("includeCut"))),
includeInside_(readBool(dict.lookup("includeInside"))),
includeOutside_(readBool(dict.lookup("includeOutside"))),
surfName_(dict.get<fileName>("file").expand()),
outsidePoints_(dict.get<pointField>("outsidePoints")),
includeCut_(dict.get<bool>("includeCut")),
includeInside_(dict.get<bool>("includeInside")),
includeOutside_(dict.get<bool>("includeOutside")),
useSurfaceOrientation_
(
dict.lookupOrDefault("useSurfaceOrientation", false)
),
nearDist_(readScalar(dict.lookup("nearDistance"))),
curvature_(readScalar(dict.lookup("curvature"))),
nearDist_(dict.get<scalar>("nearDistance")),
curvature_(dict.get<scalar>("curvature")),
surfPtr_
(
new triSurface

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,6 +36,20 @@ Description
at nearest point to centre and cell-corners differing by
more than YYY (i.e., point of high curvature)
\heading Dictionary parameters
\table
Property | Description | Required | Default
file | The surface "filename" | yes |
scale | surface scaling factor | no | -1
nearDistance | Near distance to the surface | yes |
curvature | surface curvature selection | yes |
outsidePoints| Points outside of surface | yes |
includeCut | Include cut cells (bool) | yes |
includeInside | Include inside cells (bool) | yes |
includeOutside | Include outside cells (bool) | yes |
useSurfaceOrientation | useSurfaceOrientation | no | false
\endtable
SourceFiles
surfaceToCell.C
@ -183,18 +197,10 @@ public:
);
//- Construct from dictionary
surfaceToCell
(
const polyMesh& mesh,
const dictionary& dict
);
surfaceToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
surfaceToCell
(
const polyMesh& mesh,
Istream&
);
surfaceToCell(const polyMesh& mesh, Istream& is);
//- Destructor

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,7 @@ License
#include "polyMesh.H"
#include "globalMeshData.H"
#include "plane.H"
#include "bitSet.H"
#include "cellSet.H"
#include "addToRunTimeSelectionTable.H"
@ -57,13 +58,12 @@ Foam::scalar Foam::targetVolumeToCell::volumeOfSet
{
scalar sumVol = 0.0;
forAll(selected, celli)
// Loop over selected cells only
for (const label celli : selected)
{
if (selected.test(celli))
{
sumVol += mesh_.cellVolumes()[celli];
}
sumVol += mesh_.cellVolumes()[celli];
}
return returnReduce(sumVol, sumOp<scalar>());
}
@ -84,12 +84,13 @@ Foam::label Foam::targetVolumeToCell::selectCells
{
const point& cc = mesh_.cellCentres()[celli];
if (maskSet.test(celli) && ((cc&n_) < normalComp))
if (maskSet.test(celli) && ((cc & normal_) < normalComp))
{
selected.set(celli);
nSelected++;
++nSelected;
}
}
return returnReduce(nSelected, sumOp<label>());
}
@ -114,10 +115,8 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
maskSet = false;
cellSet subset(mesh_, maskSetName_);
forAllConstIter(cellSet, subset, iter)
{
maskSet.set(iter.key());
}
const labelHashSet& cellLabels = subset;
maskSet.setMany(cellLabels.begin(), cellLabels.end());
nTotCells = returnReduce(subset.size(), sumOp<label>());
}
@ -139,7 +138,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
label maxPointi = -1;
forAll(points, pointi)
{
scalar c = (points[pointi]&n_);
scalar c = (points[pointi] & normal_);
if (c > maxComp)
{
maxComp = c;
@ -160,7 +159,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
if (maxCells != nTotCells)
{
WarningInFunction
<< "Plane " << plane(points[maxPointi], n_)
<< "Plane " << plane(points[maxPointi], normal_)
<< " selects " << maxCells
<< " cells instead of all " << nTotCells
<< " cells. Results might be wrong." << endl;
@ -168,7 +167,6 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
}
// Bisection
// ~~~~~~~~~
@ -185,7 +183,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
while ((high-low) > tolerance)
{
scalar mid = 0.5*(low + high);
const scalar mid = 0.5*(low + high);
nSelected = selectCells(mid, maskSet, selected);
selectedVol = volumeOfSet(selected);
@ -240,24 +238,23 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
WarningInFunction
<< "Did not converge onto plane. " << nl
<< "high plane:"
<< plane(high*n_, n_)
<< plane(high*normal_, normal_)
<< nl
<< "low plane :"
<< plane(low*n_, n_)
<< plane(low*normal_, normal_)
<< endl;
}
}
Info<< " Selected " << nSelected << " with actual volume " << selectedVol
<< endl;
Info<< " Selected " << nSelected << " with actual volume "
<< selectedVol << endl;
forAll(selected, celli)
// Loop over selected cells only
for (const label celli : selected)
{
if (selected.test(celli))
{
addOrDelete(set, celli, add);
}
addOrDelete(set, celli, add);
}
}
@ -268,12 +265,12 @@ Foam::targetVolumeToCell::targetVolumeToCell
(
const polyMesh& mesh,
const scalar vol,
const vector& n
const vector& normal
)
:
topoSetSource(mesh),
vol_(vol),
n_(n)
normal_(normal)
{}
@ -284,8 +281,8 @@ Foam::targetVolumeToCell::targetVolumeToCell
)
:
topoSetSource(mesh),
vol_(readScalar(dict.lookup("volume"))),
n_(dict.lookup("normal")),
vol_(dict.get<scalar>("volume")),
normal_(dict.get<vector>("normal")),
maskSetName_(dict.lookupOrDefault<word>("set", ""))
{}
@ -298,12 +295,7 @@ Foam::targetVolumeToCell::targetVolumeToCell
:
topoSetSource(mesh),
vol_(readScalar(checkIs(is))),
n_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::targetVolumeToCell::~targetVolumeToCell()
normal_(checkIs(is))
{}

View File

@ -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.
@ -28,6 +28,14 @@ Description
A topoSetSource to select cells based on the wanted volume of selected
cells. Adapts a plane until it has enough.
\heading Dictionary parameters
\table
Property | Description | Required | Default
volume | The target volume (m^3) | yes |
normal | The plane normal | yes |
set | Restrict to named cellSet | no | ""
\endtable
SourceFiles
targetVolumeToCell.C
@ -37,13 +45,15 @@ SourceFiles
#define targetVolumeToCell_H
#include "topoSetSource.H"
#include "bitSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declarations
class bitSet;
/*---------------------------------------------------------------------------*\
Class targetVolumeToCell Declaration
\*---------------------------------------------------------------------------*/
@ -62,7 +72,7 @@ class targetVolumeToCell
const scalar vol_;
//- Normal of plane to sweep
const vector n_;
const vector normal_;
//- Optional name of cellSet to calculate volume in
const word maskSetName_;
@ -70,7 +80,8 @@ class targetVolumeToCell
// Private Member Functions
scalar volumeOfSet(const bitSet&) const;
//- The volume of the selected cells
scalar volumeOfSet(const bitSet& selected) const;
label selectCells
(
@ -94,26 +105,18 @@ public:
(
const polyMesh& mesh,
const scalar vol,
const vector&
const vector& normal
);
//- Construct from dictionary
targetVolumeToCell
(
const polyMesh& mesh,
const dictionary& dict
);
targetVolumeToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
targetVolumeToCell
(
const polyMesh& mesh,
Istream&
);
targetVolumeToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~targetVolumeToCell();
virtual ~targetVolumeToCell() = default;
// Member Functions
@ -126,7 +129,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,25 +52,23 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
{
bool hasMatched = false;
forAll(mesh_.cellZones(), i)
for (const cellZone& zone : mesh_.cellZones())
{
const cellZone& zone = mesh_.cellZones()[i];
if (zoneName_.match(zone.name()))
{
const labelList& cellLabels = mesh_.cellZones()[i];
hasMatched = true;
const labelList& cellLabels = zone;
Info<< " Found matching zone " << zone.name()
<< " with " << cellLabels.size() << " cells." << endl;
hasMatched = true;
forAll(cellLabels, i)
for (const label celli : cellLabels)
{
// Only do active cells
if (cellLabels[i] < mesh_.nCells())
if (celli >= 0 && celli < mesh_.nCells())
{
addOrDelete(set, cellLabels[i], add);
addOrDelete(set, celli, add);
}
}
}
@ -79,8 +77,9 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
if (!hasMatched)
{
WarningInFunction
<< "Cannot find any cellZone named " << zoneName_ << endl
<< "Valid names are " << mesh_.cellZones().names() << endl;
<< "Cannot find any cellZone named " << zoneName_ << nl
<< "Valid names: " << flatOutput(mesh_.cellZones().names())
<< endl;
}
}
@ -105,7 +104,7 @@ Foam::zoneToCell::zoneToCell
)
:
topoSetSource(mesh),
zoneName_(dict.lookup("name"))
zoneName_(dict.get<wordRe>("name"))
{}
@ -120,12 +119,6 @@ Foam::zoneToCell::zoneToCell
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::zoneToCell::~zoneToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::zoneToCell::applyToSet

View File

@ -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,7 +25,13 @@ Class
Foam::zoneToCell
Description
A topoSetSource to select faces based on cellZone.
A topoSetSource to select cells based on cellZone.
\heading Dictionary parameters
\table
Property | Description | Required | Default
name | The cell zone name or regex | yes |
\endtable
SourceFiles
zoneToCell.C
@ -81,22 +87,14 @@ public:
);
//- Construct from dictionary
zoneToCell
(
const polyMesh& mesh,
const dictionary& dict
);
zoneToCell(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
zoneToCell
(
const polyMesh& mesh,
Istream&
);
zoneToCell(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~zoneToCell();
virtual ~zoneToCell() = default;
// Member Functions
@ -109,7 +107,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ Foam::setToCellZone::setToCellZone
)
:
topoSetSource(mesh),
setName_(dict.lookup("set"))
setName_(dict.get<word>("set"))
{}
@ -81,12 +81,6 @@ Foam::setToCellZone::setToCellZone
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setToCellZone::~setToCellZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setToCellZone::applyToSet

View File

@ -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.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select cells based on usage in a cellSet.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | The cell set name | yes |
\endtable
SourceFiles
setToCellZone.C
@ -73,22 +79,14 @@ public:
);
//- Construct from dictionary
setToCellZone
(
const polyMesh& mesh,
const dictionary& dict
);
setToCellZone(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
setToCellZone
(
const polyMesh& mesh,
Istream&
);
setToCellZone(const polyMesh& mesh, Istream& is );
//- Destructor
virtual ~setToCellZone();
virtual ~setToCellZone() = default;
// Member Functions
@ -101,7 +99,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,7 +53,7 @@ void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
(
label facei = mesh().nInternalFaces();
facei < mesh().nFaces();
facei++
++facei
)
{
addOrDelete(set, facei, add);
@ -69,7 +69,11 @@ Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh)
{}
Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh, const dictionary&)
Foam::boundaryToFace::boundaryToFace
(
const polyMesh& mesh,
const dictionary&
)
:
topoSetSource(mesh)
{}
@ -78,19 +82,13 @@ Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh, const dictionary&)
Foam::boundaryToFace::boundaryToFace
(
const polyMesh& mesh,
Istream& is
Istream&
)
:
topoSetSource(mesh)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::boundaryToFace::~boundaryToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::boundaryToFace::applyToSet

View File

@ -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.
@ -27,6 +27,9 @@ Class
Description
A topoSetSource to select all external (boundary) faces.
\heading Dictionary parameters
None
SourceFiles
boundaryToFace.C
@ -69,25 +72,17 @@ public:
// Constructors
//- Construct from components
boundaryToFace(const polyMesh&);
boundaryToFace(const polyMesh& mesh);
//- Construct from dictionary
boundaryToFace
(
const polyMesh& mesh,
const dictionary& dict
);
boundaryToFace(const polyMesh& mesh, const dictionary& unused);
//- Construct from Istream
boundaryToFace
(
const polyMesh& mesh,
Istream&
);
boundaryToFace(const polyMesh& mesh, Istream& unused);
//- Destructor
virtual ~boundaryToFace();
virtual ~boundaryToFace() = default;
// Member Functions
@ -100,7 +95,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,9 +53,9 @@ void Foam::boxToFace::combine(topoSet& set, const bool add) const
forAll(ctrs, facei)
{
forAll(bbs_, i)
for (const auto& bb : bbs_)
{
if (bbs_[i].contains(ctrs[facei]))
if (bb.contains(ctrs[facei]))
{
addOrDelete(set, facei, add);
break;
@ -110,12 +110,6 @@ Foam::boxToFace::boxToFace
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::boxToFace::~boxToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::boxToFace::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,16 @@ Class
Description
A topoSetSource 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 |
\endtable
Note
Must specify either "box" or "boxes"
SourceFiles
boxToFace.C
@ -80,22 +90,14 @@ public:
);
//- Construct from dictionary
boxToFace
(
const polyMesh& mesh,
const dictionary& dict
);
boxToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
boxToFace
(
const polyMesh& mesh,
Istream&
);
boxToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~boxToFace();
virtual ~boxToFace() = default;
// Member Functions
@ -108,7 +110,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -71,18 +71,18 @@ void Foam::cellToFace::combine(topoSet& set, const bool add) const
}
cellSet loadedSet(mesh_, setName_);
const labelHashSet& cellLabels = loadedSet;
if (option_ == ALL)
{
// Add all faces from cell
forAllConstIter(cellSet, loadedSet, iter)
for (const label celli : cellLabels)
{
const label celli = iter.key();
const labelList& cFaces = mesh_.cells()[celli];
forAll(cFaces, cFacei)
for (const label facei : cFaces)
{
addOrDelete(set, cFaces[cFacei], add);
addOrDelete(set, facei, add);
}
}
}
@ -97,9 +97,9 @@ void Foam::cellToFace::combine(topoSet& set, const bool add) const
// Check all internal faces
for (label facei = 0; facei < nInt; facei++)
for (label facei = 0; facei < nInt; ++facei)
{
if (loadedSet.found(own[facei]) && loadedSet.found(nei[facei]))
if (cellLabels.found(own[facei]) && cellLabels.found(nei[facei]))
{
addOrDelete(set, facei, add);
}
@ -109,17 +109,15 @@ void Foam::cellToFace::combine(topoSet& set, const bool add) const
// Get coupled cell status
boolList neiInSet(mesh_.nFaces()-nInt, false);
forAll(patches, patchi)
for (const polyPatch& pp : patches)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled())
{
label facei = pp.start();
forAll(pp, i)
{
neiInSet[facei-nInt] = loadedSet.found(own[facei]);
facei++;
neiInSet[facei-nInt] = cellLabels.found(own[facei]);
++facei;
}
}
}
@ -127,20 +125,18 @@ void Foam::cellToFace::combine(topoSet& set, const bool add) const
// Check all boundary faces
forAll(patches, patchi)
for (const polyPatch& pp : patches)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled())
{
label facei = pp.start();
forAll(pp, i)
{
if (loadedSet.found(own[facei]) && neiInSet[facei-nInt])
if (cellLabels.found(own[facei]) && neiInSet[facei-nInt])
{
addOrDelete(set, facei, add);
}
facei++;
++facei;
}
}
}
@ -170,7 +166,7 @@ Foam::cellToFace::cellToFace
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
setName_(dict.get<word>("set")),
option_(cellActionNames_.lookup("option", dict))
{}
@ -187,12 +183,6 @@ Foam::cellToFace::cellToFace
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cellToFace::~cellToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cellToFace::applyToSet

View File

@ -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.
@ -27,9 +27,18 @@ Class
Description
A topoSetSource to select a faceSet from cells.
Either all faces of cell or some other criterion.
See implementation.
Note: when picking up coupled faces uses cells on neighbouring processors.
Either use 'all' cell faces, or only faces that have cells
on 'both' sides.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | Name of input cellSet | yes |
option | Selection (all/both) | yes |
\endtable
Note
When picking up coupled faces uses cells on neighbouring processors.
SourceFiles
cellToFace.C
@ -100,22 +109,14 @@ public:
);
//- Construct from dictionary
cellToFace
(
const polyMesh& mesh,
const dictionary& dict
);
cellToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
cellToFace
(
const polyMesh& mesh,
Istream&
);
cellToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~cellToFace();
virtual ~cellToFace() = default;
// Member Functions
@ -128,7 +129,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,7 +50,7 @@ Foam::topoSetSource::addToUsageTable Foam::cylinderAnnulusToFace::usage_
void Foam::cylinderAnnulusToFace::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const vector axis = (point2_ - point1_);
const scalar orad2 = sqr(outerRadius_);
const scalar irad2 = sqr(innerRadius_);
const scalar magAxis2 = magSqr(axis);
@ -59,12 +59,12 @@ void Foam::cylinderAnnulusToFace::combine(topoSet& set, const bool add) const
forAll(ctrs, facei)
{
vector d = ctrs[facei] - p1_;
scalar magD = d & axis;
const vector d = ctrs[facei] - point1_;
const scalar magD = d & axis;
if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
const scalar d2 = (d & d) - sqr(magD)/magAxis2;
if ((d2 < orad2) && (d2 > irad2))
{
addOrDelete(set, facei, add);
@ -79,15 +79,15 @@ void Foam::cylinderAnnulusToFace::combine(topoSet& set, const bool add) const
Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar outerRadius,
const scalar innerRadius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
point1_(point1),
point2_(point2),
outerRadius_(outerRadius),
innerRadius_(innerRadius)
{}
@ -100,10 +100,10 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
outerRadius_(readScalar(dict.lookup("outerRadius"))),
innerRadius_(readScalar(dict.lookup("innerRadius")))
point1_(dict.get<point>("p1")),
point2_(dict.get<point>("p2")),
outerRadius_(dict.get<scalar>("outerRadius")),
innerRadius_(dict.get<scalar>("innerRadius"))
{}
@ -114,19 +114,13 @@ Foam::cylinderAnnulusToFace::cylinderAnnulusToFace
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
point1_(checkIs(is)),
point2_(checkIs(is)),
outerRadius_(readScalar(checkIs(is))),
innerRadius_(readScalar(checkIs(is)))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cylinderAnnulusToFace::~cylinderAnnulusToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylinderAnnulusToFace::applyToSet
@ -139,18 +133,19 @@ void Foam::cylinderAnnulusToFace::applyToSet
{
Info<< " Adding faces with centre within cylinder annulus,"
<< " with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius = " << innerRadius_
<< endl;
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing faces with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius " << innerRadius_
<< endl;
Info<< " Removing faces with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
combine(set, false);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,6 +28,15 @@ Description
A topoSetSource to select faces based on face centres inside a
cylinder annulus.
\heading Dictionary parameters
\table
Property | Description | Required | Default
p1 | coordinate of endpoint | yes |
p2 | coordinate of endpoint | yes |
outerRadius | cylinder outer radius | yes |
innerRadius | cylinder inner radius | yes |
\endtable
SourceFiles
cylinderAnnulusToFace.C
@ -58,10 +67,10 @@ class cylinderAnnulusToFace
static addToUsageTable usage_;
//- First point on cylinder axis
vector p1_;
point point1_;
//- Second point on cylinder axis
vector p2_;
point point2_;
//- Outer Radius
scalar outerRadius_;
@ -87,29 +96,22 @@ public:
cylinderAnnulusToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar outerRadius,
const scalar innerRadius
);
//- Construct from dictionary
cylinderAnnulusToFace
(
const polyMesh& mesh,
const dictionary& dict
);
cylinderAnnulusToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
cylinderAnnulusToFace
(
const polyMesh& mesh,
Istream&
);
cylinderAnnulusToFace(const polyMesh& mesh, Istream& is);
// Destructor
virtual ~cylinderAnnulusToFace();
//- Destructor
virtual ~cylinderAnnulusToFace() = default;
// Member Functions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,7 +49,7 @@ Foam::topoSetSource::addToUsageTable Foam::cylinderToFace::usage_
void Foam::cylinderToFace::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const vector axis = (point2_ - point1_);
const scalar rad2 = sqr(radius_);
const scalar magAxis2 = magSqr(axis);
@ -57,12 +57,12 @@ void Foam::cylinderToFace::combine(topoSet& set, const bool add) const
forAll(ctrs, facei)
{
vector d = ctrs[facei] - p1_;
scalar magD = d & axis;
const vector d = ctrs[facei] - point1_;
const scalar magD = d & axis;
if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
const scalar d2 = (d & d) - sqr(magD)/magAxis2;
if (d2 < rad2)
{
addOrDelete(set, facei, add);
@ -77,14 +77,14 @@ void Foam::cylinderToFace::combine(topoSet& set, const bool add) const
Foam::cylinderToFace::cylinderToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar radius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
point1_(point1),
point2_(point2),
radius_(radius)
{}
@ -96,9 +96,9 @@ Foam::cylinderToFace::cylinderToFace
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
radius_(readScalar(dict.lookup("radius")))
point1_(dict.get<point>("p1")),
point2_(dict.get<point>("p2")),
radius_(dict.get<scalar>("radius"))
{}
@ -109,18 +109,12 @@ Foam::cylinderToFace::cylinderToFace
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
point1_(checkIs(is)),
point2_(checkIs(is)),
radius_(readScalar(checkIs(is)))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cylinderToFace::~cylinderToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylinderToFace::applyToSet
@ -131,15 +125,17 @@ void Foam::cylinderToFace::applyToSet
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding faces with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
Info<< " Adding faces with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing faces with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
combine(set, false);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,14 @@ Class
Description
A topoSetSource to select faces based on face centres inside a cylinder.
\heading Dictionary parameters
\table
Property | Description | Required | Default
p1 | coordinate of endpoint | yes |
p2 | coordinate of endpoint | yes |
radius | cylinder radius | yes |
\endtable
SourceFiles
cylinderToFace.C
@ -57,10 +65,10 @@ class cylinderToFace
static addToUsageTable usage_;
//- First point on cylinder axis
vector p1_;
point point1_;
//- Second point on cylinder axis
vector p2_;
point point2_;
//- Radius
scalar radius_;
@ -83,28 +91,20 @@ public:
cylinderToFace
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const point& point1,
const point& point2,
const scalar radius
);
//- Construct from dictionary
cylinderToFace
(
const polyMesh& mesh,
const dictionary& dict
);
cylinderToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
cylinderToFace
(
const polyMesh& mesh,
Istream&
);
cylinderToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~cylinderToFace();
virtual ~cylinderToFace() = default;
// Member Functions
@ -117,7 +117,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ Foam::faceToFace::faceToFace
)
:
topoSetSource(mesh),
setName_(dict.lookup("set"))
setName_(dict.get<word>("set"))
{}
@ -81,12 +81,6 @@ Foam::faceToFace::faceToFace
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceToFace::~faceToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceToFace::applyToSet

View File

@ -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.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select faces based on usage in another faceSet.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | Name of the input faceSet | yes |
\endtable
SourceFiles
faceToFace.C
@ -73,22 +79,14 @@ public:
);
//- Construct from dictionary
faceToFace
(
const polyMesh& mesh,
const dictionary& dict
);
faceToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
faceToFace
(
const polyMesh& mesh,
Istream&
);
faceToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~faceToFace();
virtual ~faceToFace() = default;
// Member Functions
@ -101,7 +99,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,17 +45,6 @@ Foam::topoSetSource::addToUsageTable Foam::labelToFace::usage_
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::labelToFace::combine(topoSet& set, const bool add) const
{
forAll(labels_, labelI)
{
addOrDelete(set, labels_[labelI], add);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::labelToFace::labelToFace
@ -76,7 +65,7 @@ Foam::labelToFace::labelToFace
)
:
topoSetSource(mesh),
labels_(dict.lookup("value"))
labels_(dict.get<labelList>("value"))
{}
@ -88,13 +77,9 @@ Foam::labelToFace::labelToFace
:
topoSetSource(mesh),
labels_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::labelToFace::~labelToFace()
{}
{
check(labels_, mesh.nFaces());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -109,13 +94,13 @@ void Foam::labelToFace::applyToSet
{
Info<< " Adding faces mentioned in dictionary" << " ..." << endl;
combine(set, true);
addOrDelete(set, labels_, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing faces mentioned dictionary" << " ..." << endl;
combine(set, false);
addOrDelete(set, labels_, false);
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource to select faces given explicitly provided face labels.
\heading Dictionary parameters
\table
Property | Description | Required | Default
normal | The normal for selecting faces | yes |
cos | Tolerance angle (range -1, +1) | yes |
\endtable
SourceFiles
labelToFace.C
@ -60,11 +67,6 @@ class labelToFace
labelList labels_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
@ -80,22 +82,14 @@ public:
);
//- Construct from dictionary
labelToFace
(
const polyMesh& mesh,
const dictionary& dict
);
labelToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
labelToFace
(
const polyMesh& mesh,
Istream&
);
labelToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~labelToFace();
virtual ~labelToFace() = default;
// Member Functions
@ -108,7 +102,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -84,8 +84,8 @@ Foam::normalToFace::normalToFace
Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict)
:
topoSetSource(mesh),
normal_(dict.lookup("normal")),
tol_(readScalar(dict.lookup("cos")))
normal_(dict.get<vector>("normal")),
tol_(dict.get<scalar>("cos"))
{
setNormal();
}
@ -101,12 +101,6 @@ Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is)
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::normalToFace::~normalToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::normalToFace::applyToSet
@ -136,7 +130,6 @@ void Foam::normalToFace::applyToSet
Info<< " Removing faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl;
DynamicList<label> toBeRemoved(set.size()/10);
forAllConstIter(topoSet, set, iter)

View File

@ -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.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource to select faces based on normal.
\heading Dictionary parameters
\table
Property | Description | Required | Default
normal | The normal for selecting faces | yes |
cos | Tolerance angle (range -1, +1) | yes |
\endtable
SourceFiles
normalToFace.C
@ -92,7 +99,7 @@ public:
//- Destructor
virtual ~normalToFace();
virtual ~normalToFace() = default;
// Member Functions
@ -105,7 +112,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -67,7 +67,7 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
(
label facei = pp.start();
facei < pp.start() + pp.size();
facei++
++facei
)
{
addOrDelete(set, facei, add);
@ -103,7 +103,7 @@ Foam::patchToFace::patchToFace
)
:
topoSetSource(mesh),
patchName_(dict.lookup("name"))
patchName_(dict.get<wordRe>("name"))
{}
@ -118,12 +118,6 @@ Foam::patchToFace::patchToFace
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchToFace::~patchToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::patchToFace::applyToSet

View File

@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select faces based on usage in patches.
\heading Dictionary parameters
\table
Property | Description | Required | Default
name | Patch name or regex to select | yes |
\endtable
SourceFiles
patchToFace.C
@ -81,22 +87,14 @@ public:
);
//- Construct from dictionary
patchToFace
(
const polyMesh& mesh,
const dictionary& dict
);
patchToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
patchToFace
(
const polyMesh& mesh,
Istream&
);
patchToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~patchToFace();
virtual ~patchToFace() = default;
// Member Functions
@ -109,7 +107,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -67,17 +67,18 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const
// Load the set
pointSet loadedSet(mesh_, setName_);
const labelHashSet& pointLabels = loadedSet;
if (option_ == ANY)
{
// Add faces with any point in loadedSet
forAllConstIter(pointSet, loadedSet, iter)
for (const label pointi : pointLabels)
{
const label pointi = iter.key();
const labelList& pFaces = mesh_.pointFaces()[pointi];
forAll(pFaces, pFacei)
for (const label facei : pFaces)
{
addOrDelete(set, pFaces[pFacei], add);
addOrDelete(set, facei, add);
}
}
}
@ -86,38 +87,27 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const
// Add all faces whose points are all in set.
// Count number of points using face.
Map<label> numPoints(loadedSet.size());
Map<label> numPoints(pointLabels.size());
forAllConstIter(pointSet, loadedSet, iter)
for (const label pointi : pointLabels)
{
const label pointi = iter.key();
const labelList& pFaces = mesh_.pointFaces()[pointi];
forAll(pFaces, pFacei)
for (const label facei : pFaces)
{
const label facei = pFaces[pFacei];
Map<label>::iterator fndFace = numPoints.find(facei);
if (fndFace == numPoints.end())
{
numPoints.insert(facei, 1);
}
else
{
fndFace()++;
}
++(numPoints(facei, 0));
}
}
// Include faces that are referenced as many times as there are points
// in face -> all points of face
forAllConstIter(Map<label>, numPoints, iter)
forAllConstIters(numPoints, iter)
{
const label facei = iter.key();
const label count = iter.object();
if (iter() == mesh_.faces()[facei].size())
if (count == mesh_.faces()[facei].size())
{
addOrDelete(set, facei, add);
}
@ -126,13 +116,18 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const
else if (option_ == EDGE)
{
const faceList& faces = mesh_.faces();
forAll(faces, facei)
{
const face& f = faces[facei];
forAll(f, fp)
{
if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp)))
if
(
pointLabels.found(f[fp])
&& pointLabels.found(f.nextLabel(fp))
)
{
addOrDelete(set, facei, add);
break;
@ -165,7 +160,7 @@ Foam::pointToFace::pointToFace
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
setName_(dict.get<word>("set")),
option_(pointActionNames_.lookup("option", dict))
{}
@ -182,12 +177,6 @@ Foam::pointToFace::pointToFace
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointToFace::~pointToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pointToFace::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource to select faces based on use of points.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | The point set name to use | yes |
option | Selection type (all/any/edge) | yes |
\endtable
SourceFiles
pointToFace.C
@ -99,22 +106,14 @@ public:
);
//- Construct from dictionary
pointToFace
(
const polyMesh& mesh,
const dictionary& dict
);
pointToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
pointToFace
(
const polyMesh& mesh,
Istream&
);
pointToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~pointToFace();
virtual ~pointToFace() = default;
// Member Functions
@ -127,7 +126,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -73,9 +73,9 @@ void Foam::regionToFace::markZone
if (Pstream::myProcNo() == proci)
{
const labelList& fEdges = patch.faceEdges()[facei];
forAll(fEdges, i)
for (const label edgei : fEdges)
{
changedEdges.append(fEdges[i]);
changedEdges.append(edgei);
changedInfo.append(zoneI);
}
}
@ -108,8 +108,9 @@ void Foam::regionToFace::markZone
void Foam::regionToFace::combine(topoSet& set, const bool add) const
{
Info<< " Loading subset " << setName_ << " to delimit search region."
<< endl;
Info<< " Loading subset " << setName_
<< " to delimit search region." << endl;
faceSet subSet(mesh_, setName_);
indirectPrimitivePatch patch
@ -192,8 +193,8 @@ Foam::regionToFace::regionToFace
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
nearPoint_(dict.lookup("nearPoint"))
setName_(dict.get<word>("set")),
nearPoint_(dict.get<point>("nearPoint"))
{}
@ -209,12 +210,6 @@ Foam::regionToFace::regionToFace
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionToFace::~regionToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regionToFace::applyToSet

View File

@ -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.
@ -28,6 +28,13 @@ Description
A topoSetSource to select faces belonging to topological connected region
(that contains given point)
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | The face set name to use | yes |
nearPoint | The point on/near to the region | yes |
\endtable
SourceFiles
regionToFace.C
@ -37,7 +44,6 @@ SourceFiles
#define regionToFace_H
#include "topoSetSource.H"
#include "bitSet.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,6 +70,7 @@ class regionToFace
//- Coordinate that is nearest/on connected region
point nearPoint_;
// Private Member Functions
//- Walk edge-face-edge
@ -94,22 +101,14 @@ public:
);
//- Construct from dictionary
regionToFace
(
const polyMesh& mesh,
const dictionary& dict
);
regionToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
regionToFace
(
const polyMesh& mesh,
Istream&
);
regionToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~regionToFace();
virtual ~regionToFace() = default;
// Member Functions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,25 +52,23 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
{
bool hasMatched = false;
forAll(mesh_.faceZones(), i)
for (const faceZone& zone : mesh_.faceZones())
{
const faceZone& zone = mesh_.faceZones()[i];
if (zoneName_.match(zone.name()))
{
const labelList& faceLabels = mesh_.faceZones()[i];
hasMatched = true;
const labelList& faceLabels = zone;
Info<< " Found matching zone " << zone.name()
<< " with " << faceLabels.size() << " faces." << endl;
hasMatched = true;
forAll(faceLabels, i)
for (const label facei : faceLabels)
{
// Only do active faces
if (faceLabels[i] < mesh_.nFaces())
if (facei >= 0 && facei < mesh_.nFaces())
{
addOrDelete(set, faceLabels[i], add);
addOrDelete(set, facei, add);
}
}
}
@ -105,7 +103,7 @@ Foam::zoneToFace::zoneToFace
)
:
topoSetSource(mesh),
zoneName_(dict.lookup("name"))
zoneName_(dict.get<wordRe>("name"))
{}
@ -120,12 +118,6 @@ Foam::zoneToFace::zoneToFace
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::zoneToFace::~zoneToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::zoneToFace::applyToSet

View File

@ -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.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select faces based on faceZone.
\heading Dictionary parameters
\table
Property | Description | Required | Default
name | The face zone name or regex | yes |
\endtable
SourceFiles
zoneToFace.C
@ -57,7 +63,7 @@ class zoneToFace
//- Add usage string
static addToUsageTable usage_;
//- Name/regular expression of cellZone
//- Name/regular expression of the faceZone
wordRe zoneName_;
@ -81,22 +87,14 @@ public:
);
//- Construct from dictionary
zoneToFace
(
const polyMesh& mesh,
const dictionary& dict
);
zoneToFace(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
zoneToFace
(
const polyMesh& mesh,
Istream&
);
zoneToFace(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~zoneToFace();
virtual ~zoneToFace() = default;
// Member Functions
@ -109,7 +107,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ Foam::faceZoneToFaceZone::faceZoneToFaceZone
)
:
topoSetSource(mesh),
setName_(dict.lookup("zone"))
setName_(dict.get<word>("zone"))
{}
@ -81,12 +81,6 @@ Foam::faceZoneToFaceZone::faceZoneToFaceZone
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceZoneToFaceZone::~faceZoneToFaceZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceZoneToFaceZone::applyToSet

View File

@ -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.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select faces based on usage in another faceSet.
\heading Dictionary parameters
\table
Property | Description | Required | Default
zone | Name of input face zone (no regex) | yes |
\endtable
SourceFiles
faceZoneToFaceZone.C
@ -73,22 +79,14 @@ public:
);
//- Construct from dictionary
faceZoneToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
faceZoneToFaceZone(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
faceZoneToFaceZone
(
const polyMesh& mesh,
Istream&
);
faceZoneToFaceZone(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~faceZoneToFaceZone();
virtual ~faceZoneToFaceZone() = default;
// Member Functions
@ -101,7 +99,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,7 +29,6 @@ License
#include "searchableSurface.H"
#include "syncTools.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -68,7 +67,7 @@ Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone
(
searchableSurface::New
(
word(dict.lookup("surface")),
dict.get<word>("surface"),
IOobject
(
dict.lookupOrDefault("name", mesh.objectRegistry::db().name()),
@ -128,10 +127,8 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
forAll(pbm, patchi)
for (const polyPatch& pp : pbm)
{
const polyPatch& pp = pbm[patchi];
if (pp.coupled())
{
forAll(pp, i)

View File

@ -28,6 +28,13 @@ Description
A topoSetSource to select faces based on intersection (of cell-cell
vector) with a surface.
\heading Dictionary parameters
\table
Property | Description | Required | Default
surface | The searchable surface type | yes |
name | Name for the IOobject | no | mesh-name
\endtable
SourceFiles
searchableSurfaceToFaceZone.C
@ -90,7 +97,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,20 +26,15 @@ License
#include "setAndNormalToFaceZone.H"
#include "polyMesh.H"
#include "faceZoneSet.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(setAndNormalToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, istream);
defineTypeNameAndDebug(setAndNormalToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, istream);
}
@ -73,8 +68,8 @@ Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
)
:
topoSetSource(mesh),
setName_(dict.lookup("faceSet")),
normal_(dict.lookup("normal"))
setName_(dict.get<word>("faceSet")),
normal_(dict.get<vector>("normal"))
{}
@ -90,12 +85,6 @@ Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setAndNormalToFaceZone::~setAndNormalToFaceZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setAndNormalToFaceZone::applyToSet
@ -119,7 +108,8 @@ void Foam::setAndNormalToFaceZone::applyToSet
<< " ..." << endl;
// Load the sets
faceSet fSet(mesh_, setName_);
faceSet loadedSet(mesh_, setName_);
labelHashSet& faceIds = loadedSet;
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
@ -128,10 +118,8 @@ void Foam::setAndNormalToFaceZone::applyToSet
const faceList& faces = mesh_.faces();
const pointField& points = mesh_.points();
forAllConstIter(faceSet, fSet, iter)
for (const label facei : faceIds)
{
label facei = iter.key();
if (!fzSet.found(facei))
{
newAddressing.append(facei);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,6 +28,13 @@ Description
A topoSetSource to select faces based on usage in a faceSet, where the
normal vector is used to orient the faces.
\heading Dictionary parameters
\table
Property | Description | Required | Default
faceSet | Name of input faceSet | yes |
normal | The normal vector for orientation | yes |
\endtable
SourceFiles
setAndNormalToFaceZone.C
@ -79,22 +86,14 @@ public:
);
//- Construct from dictionary
setAndNormalToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
setAndNormalToFaceZone(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
setAndNormalToFaceZone
(
const polyMesh& mesh,
Istream&
);
setAndNormalToFaceZone(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~setAndNormalToFaceZone();
virtual ~setAndNormalToFaceZone() = default;
// Member Functions
@ -107,7 +106,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -67,7 +67,7 @@ Foam::setToFaceZone::setToFaceZone
)
:
topoSetSource(mesh),
setName_(dict.lookup("faceSet"))
setName_(dict.get<word>("faceSet"))
{}
@ -82,12 +82,6 @@ Foam::setToFaceZone::setToFaceZone
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setToFaceZone::~setToFaceZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setToFaceZone::applyToSet
@ -111,16 +105,15 @@ void Foam::setToFaceZone::applyToSet
<< " ..." << endl;
// Load the sets
faceSet fSet(mesh_, setName_);
faceSet loadedSet(mesh_, setName_);
const labelHashSet& faceLabels = loadedSet;
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
DynamicList<bool> newFlipMap(fzSet.flipMap());
forAllConstIter(faceSet, fSet, iter)
for (const label facei : faceLabels)
{
label facei = iter.key();
if (!fzSet.found(facei))
{
newAddressing.append(facei);

View File

@ -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,8 +25,19 @@ Class
Foam::setToFaceZone
Description
A topoSetSource to select faces based on usage in a faceSet. Sets flipMap
to true.
A topoSetSource to select faces based on usage in a faceSet.
Sets flipMap to true.
\heading Dictionary parameters
\table
Property | Description | Required | Default
faceSet | Name of input faceSet | yes |
\endtable
Note
The use of keyword \c faceSet is consistent with the setsToFaceZone,
but inconsistent with setToCellZone and setToPointZone.
Both of which use \c set instead.
SourceFiles
setToFaceZone.C
@ -74,22 +85,14 @@ public:
);
//- Construct from dictionary
setToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
setToFaceZone(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
setToFaceZone
(
const polyMesh& mesh,
Istream&
);
setToFaceZone(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~setToFaceZone();
virtual ~setToFaceZone() = default;
// Member Functions
@ -102,7 +105,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,7 +27,6 @@ License
#include "polyMesh.H"
#include "faceZoneSet.H"
#include "cellSet.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -56,7 +55,7 @@ Foam::setsToFaceZone::setsToFaceZone
const polyMesh& mesh,
const word& faceSetName,
const word& cellSetName,
const Switch& flip
const bool flip
)
:
topoSetSource(mesh),
@ -73,8 +72,8 @@ Foam::setsToFaceZone::setsToFaceZone
)
:
topoSetSource(mesh),
faceSetName_(dict.lookup("faceSet")),
cellSetName_(dict.lookup("cellSet")),
faceSetName_(dict.get<word>("faceSet")),
cellSetName_(dict.get<word>("cellSet")),
flip_(dict.lookupOrDefault("flip", false))
{}
@ -92,12 +91,6 @@ Foam::setsToFaceZone::setsToFaceZone
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setsToFaceZone::~setsToFaceZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setsToFaceZone::applyToSet
@ -136,8 +129,8 @@ void Foam::setsToFaceZone::applyToSet
{
bool flipFace = false;
label own = mesh_.faceOwner()[facei];
bool ownFound = cSet.found(own);
const label own = mesh_.faceOwner()[facei];
const bool ownFound = cSet.found(own);
if (mesh_.isInternalFace(facei))
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,14 @@ Class
Description
A topoSetSource to select faces based on usage in a faceSet and cellSet
\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
\endtable
SourceFiles
setsToFaceZone.C
@ -36,7 +44,6 @@ SourceFiles
#define setsToFaceZone_H
#include "topoSetSource.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -63,7 +70,7 @@ class setsToFaceZone
const word cellSetName_;
//- Whether cellSet is slave cells or master cells
const Switch flip_;
const bool flip_;
public:
@ -78,26 +85,18 @@ public:
const polyMesh& mesh,
const word& faceSetName,
const word& cellSetName,
const Switch& flip
const bool flip
);
//- Construct from dictionary
setsToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
setsToFaceZone(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
setsToFaceZone
(
const polyMesh& mesh,
Istream&
);
setsToFaceZone(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~setsToFaceZone();
virtual ~setsToFaceZone() = default;
// Member Functions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,11 +53,12 @@ void Foam::boxToPoint::combine(topoSet& set, const bool add) const
forAll(pts, pointi)
{
forAll(bbs_, i)
for (const auto& bb : bbs_)
{
if (bbs_[i].contains(pts[pointi]))
if (bb.contains(pts[pointi]))
{
addOrDelete(set, pointi, add);
break;
}
}
}
@ -109,12 +110,6 @@ Foam::boxToPoint::boxToPoint
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::boxToPoint::~boxToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::boxToPoint::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,16 @@ Class
Description
A topoSetSource 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 |
\endtable
Note
Must specify either "box" or "boxes"
SourceFiles
boxToPoint.C
@ -57,7 +67,7 @@ class boxToPoint
//- Add usage string
static addToUsageTable usage_;
//- Bounding box.
//- Bounding boxes
treeBoundBoxList bbs_;
@ -77,26 +87,18 @@ public:
boxToPoint
(
const polyMesh& mesh,
const treeBoundBoxList& bb
const treeBoundBoxList& bbs
);
//- Construct from dictionary
boxToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
boxToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
boxToPoint
(
const polyMesh& mesh,
Istream&
);
boxToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~boxToPoint();
virtual ~boxToPoint() = default;
// Member Functions
@ -109,7 +111,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,20 +61,20 @@ void Foam::cellToPoint::combine(topoSet& set, const bool add) const
{
// Load the set
cellSet loadedSet(mesh_, setName_);
const labelHashSet& cellLabels = loadedSet;
// Add all point from cells in loadedSet
forAllConstIter(cellSet, loadedSet, iter)
for (const label celli : cellLabels)
{
const label celli = iter.key();
const labelList& cFaces = mesh_.cells()[celli];
forAll(cFaces, cFacei)
for (const label facei : cFaces)
{
const face& f = mesh_.faces()[cFaces[cFacei]];
const face& f = mesh_.faces()[facei];
forAll(f, fp)
for (const label pointi : f)
{
addOrDelete(set, f[fp], add);
addOrDelete(set, pointi, add);
}
}
}
@ -103,7 +103,7 @@ Foam::cellToPoint::cellToPoint
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
setName_(dict.get<word>("set")),
option_(cellActionNames_.lookup("option", dict))
{}
@ -120,12 +120,6 @@ Foam::cellToPoint::cellToPoint
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cellToPoint::~cellToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cellToPoint::applyToSet

View File

@ -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.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource to select points based on usage in cells.
\heading Dictionary parameters
\table
Property | Description | Required | Default
name | The input cellSet name | yes |
option | Selection type (all) | yes |
\endtable
SourceFiles
cellToPoint.C
@ -95,22 +102,14 @@ public:
);
//- Construct from dictionary
cellToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
cellToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
cellToPoint
(
const polyMesh& mesh,
Istream&
);
cellToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~cellToPoint();
virtual ~cellToPoint() = default;
// Member Functions
@ -123,7 +122,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,15 +60,16 @@ void Foam::faceToPoint::combine(topoSet& set, const bool add) const
{
// Load the set
faceSet loadedSet(mesh_, setName_);
const labelHashSet& faceLabels = loadedSet;
// Add all points from faces in loadedSet
forAllConstIter(faceSet, loadedSet, iter)
for (const label facei : faceLabels)
{
const face& f = mesh_.faces()[iter.key()];
const face& f = mesh_.faces()[facei];
forAll(f, fp)
for (const label pointi : f)
{
addOrDelete(set, f[fp], add);
addOrDelete(set, pointi, add);
}
}
}
@ -96,7 +97,7 @@ Foam::faceToPoint::faceToPoint
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
setName_(dict.get<word>("set")),
option_(faceActionNames_.lookup("option", dict))
{}
@ -113,12 +114,6 @@ Foam::faceToPoint::faceToPoint
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceToPoint::~faceToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceToPoint::applyToSet

View File

@ -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.
@ -27,6 +27,13 @@ Class
Description
A topoSetSource to select points based on usage in faces.
\heading Dictionary parameters
\table
Property | Description | Required | Default
name | The input faceSet name | yes |
option | Selection type (all) | yes |
\endtable
SourceFiles
faceToPoint.C
@ -95,22 +102,14 @@ public:
);
//- Construct from dictionary
faceToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
faceToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
faceToPoint
(
const polyMesh& mesh,
Istream&
);
faceToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~faceToPoint();
virtual ~faceToPoint() = default;
// Member Functions
@ -123,7 +122,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,17 +45,6 @@ Foam::topoSetSource::addToUsageTable Foam::labelToPoint::usage_
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::labelToPoint::combine(topoSet& set, const bool add) const
{
forAll(labels_, labelI)
{
addOrDelete(set, labels_[labelI], add);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::labelToPoint::labelToPoint
@ -76,7 +65,7 @@ Foam::labelToPoint::labelToPoint
)
:
topoSetSource(mesh),
labels_(dict.lookup("value"))
labels_(dict.get<labelList>("value"))
{}
@ -88,13 +77,9 @@ Foam::labelToPoint::labelToPoint
:
topoSetSource(mesh),
labels_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::labelToPoint::~labelToPoint()
{}
{
check(labels_, mesh.nPoints());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -109,14 +94,13 @@ void Foam::labelToPoint::applyToSet
{
Info<< " Adding points mentioned in dictionary" << " ..." << endl;
combine(set, true);
addOrDelete(set, labels_, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing points mentioned in dictionary" << " ..."
<< endl;
Info<< " Removing points mentioned in dictionary" << " ..." << endl;
combine(set, false);
addOrDelete(set, labels_, false);
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select points given explicitly provided labels.
\heading Dictionary parameters
\table
Property | Description | Required | Default
value | The point labels | yes |
\endtable
SourceFiles
labelToPoint.C
@ -60,11 +66,6 @@ class labelToPoint
labelList labels_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
@ -72,7 +73,7 @@ public:
// Constructors
//- Construct from components
//- Copy construct from components
labelToPoint
(
const polyMesh& mesh,
@ -80,22 +81,14 @@ public:
);
//- Construct from dictionary
labelToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
labelToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
labelToPoint
(
const polyMesh& mesh,
Istream&
);
labelToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~labelToPoint();
virtual ~labelToPoint() = default;
// Member Functions
@ -108,7 +101,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -88,11 +88,11 @@ void Foam::nearestToPoint::combine(topoSet& set, const bool add) const
Pstream::listCombineGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineScatter(nearest);
forAll(nearest, pointi)
for (const auto& near : nearest)
{
if (nearest[pointi].second().second() == Pstream::myProcNo())
if (near.second().second() == Pstream::myProcNo())
{
addOrDelete(set, nearest[pointi].first().index(), add);
addOrDelete(set, near.first().index(), add);
}
}
}
@ -118,7 +118,7 @@ Foam::nearestToPoint::nearestToPoint
)
:
topoSetSource(mesh),
points_(dict.lookup("points"))
points_(dict.get<pointField>("points"))
{}
@ -133,12 +133,6 @@ Foam::nearestToPoint::nearestToPoint
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::nearestToPoint::~nearestToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::nearestToPoint::applyToSet

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select points nearest to points.
\heading Dictionary parameters
\table
Property | Description | Required | Default
points | List of selection points | yes |
\endtable
SourceFiles
nearestToPoint.C
@ -80,22 +86,14 @@ public:
);
//- Construct from dictionary
nearestToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
nearestToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
nearestToPoint
(
const polyMesh& mesh,
Istream&
);
nearestToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~nearestToPoint();
virtual ~nearestToPoint() = default;
// Member Functions
@ -108,7 +106,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ Foam::pointToPoint::pointToPoint
)
:
topoSetSource(mesh),
setName_(dict.lookup("set"))
setName_(dict.get<word>("set"))
{}
@ -81,12 +81,6 @@ Foam::pointToPoint::pointToPoint
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointToPoint::~pointToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pointToPoint::applyToSet

View File

@ -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,7 +25,13 @@ Class
Foam::pointToPoint
Description
A topoSetSource to select points based on usage in pointSet.
A topoSetSource to select the points from another pointSet.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | The point set name | yes |
\endtable
SourceFiles
pointToPoint.C
@ -73,22 +79,14 @@ public:
);
//- Construct from dictionary
pointToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
pointToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
pointToPoint
(
const polyMesh& mesh,
Istream&
);
pointToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~pointToPoint();
virtual ~pointToPoint() = default;
// Member Functions
@ -101,7 +99,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,7 +75,11 @@ void Foam::surfaceToPoint::combine(topoSet& set, const bool add) const
{
bool isInside = pointInside[pointi];
if ((isInside && includeInside_) || (!isInside && includeOutside_))
if
(
(isInside && includeInside_)
|| (!isInside && includeOutside_)
)
{
addOrDelete(set, pointi, add);
}
@ -147,11 +151,11 @@ Foam::surfaceToPoint::surfaceToPoint
)
:
topoSetSource(mesh),
surfName_(fileName(dict.lookup("file")).expand()),
scale_(dict.lookupOrDefault<scalar>("scale", 1.0)),
nearDist_(readScalar(dict.lookup("nearDistance"))),
includeInside_(readBool(dict.lookup("includeInside"))),
includeOutside_(readBool(dict.lookup("includeOutside")))
surfName_(dict.get<fileName>("file").expand()),
scale_(dict.lookupOrDefault<scalar>("scale", -1)),
nearDist_(dict.get<scalar>("nearDistance")),
includeInside_(dict.get<bool>("includeInside")),
includeOutside_(dict.get<bool>("includeOutside"))
{
checkSettings();
}
@ -174,12 +178,6 @@ Foam::surfaceToPoint::surfaceToPoint
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceToPoint::~surfaceToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::surfaceToPoint::applyToSet
@ -188,7 +186,7 @@ void Foam::surfaceToPoint::applyToSet
topoSet& set
) const
{
if ( (action == topoSetSource::NEW) || (action == topoSetSource::ADD))
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding points in relation to surface " << surfName_
<< " ..." << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,6 +33,16 @@ Description
(Uses normal of nearest surface triangle so requires valid surface
topology!)
\heading Dictionary parameters
\table
Property | Description | Required | Default
file | The surface "filename" | yes |
scale | surface scaling factor | no | -1
nearDistance | Near distance to the surface | yes |
includeInside | Include inside cells (bool) | yes |
includeOutside | Include outside cells (bool) | yes |
\endtable
SourceFiles
surfaceToPoint.C
@ -42,12 +52,13 @@ SourceFiles
#define surfaceToPoint_H
#include "topoSetSource.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declarations
class triSurfaceSearch;
/*---------------------------------------------------------------------------*\
@ -106,22 +117,14 @@ public:
);
//- Construct from dictionary
surfaceToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
surfaceToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
surfaceToPoint
(
const polyMesh& mesh,
Istream&
);
surfaceToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~surfaceToPoint();
virtual ~surfaceToPoint() = default;
// Member Functions
@ -134,7 +137,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,7 +25,6 @@ License
#include "zoneToPoint.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -53,25 +52,23 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
{
bool hasMatched = false;
forAll(mesh_.pointZones(), i)
for (const pointZone& zone : mesh_.pointZones())
{
const pointZone& zone = mesh_.pointZones()[i];
if (zoneName_.match(zone.name()))
{
const labelList& pointLabels = mesh_.pointZones()[i];
hasMatched = true;
const labelList& pointLabels = zone;
Info<< " Found matching zone " << zone.name()
<< " with " << pointLabels.size() << " points." << endl;
hasMatched = true;
forAll(pointLabels, i)
for (const label pointi : pointLabels)
{
// Only do active points
if (pointLabels[i] < mesh_.nPoints())
if (pointi >= 0 && pointi < mesh_.nPoints())
{
addOrDelete(set, pointLabels[i], add);
addOrDelete(set, pointi, add);
}
}
}
@ -80,8 +77,9 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
if (!hasMatched)
{
WarningInFunction
<< "Cannot find any pointZone named " << zoneName_ << endl
<< "Valid names are " << mesh_.pointZones().names() << endl;
<< "Cannot find any pointZone named " << zoneName_ << nl
<< "Valid names: " << flatOutput(mesh_.pointZones().names())
<< endl;
}
}
@ -106,7 +104,7 @@ Foam::zoneToPoint::zoneToPoint
)
:
topoSetSource(mesh),
zoneName_(dict.lookup("name"))
zoneName_(dict.get<wordRe>("name"))
{}
@ -121,12 +119,6 @@ Foam::zoneToPoint::zoneToPoint
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::zoneToPoint::~zoneToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::zoneToPoint::applyToSet

View File

@ -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.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select points based on pointZone.
\heading Dictionary parameters
\table
Property | Description | Required | Default
name | The point zone name or regex | yes |
\endtable
SourceFiles
zoneToPoint.C
@ -81,22 +87,14 @@ public:
);
//- Construct from dictionary
zoneToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
zoneToPoint(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
zoneToPoint
(
const polyMesh& mesh,
Istream&
);
zoneToPoint(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~zoneToPoint();
virtual ~zoneToPoint() = default;
// Member Functions
@ -109,7 +107,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ Foam::setToPointZone::setToPointZone
)
:
topoSetSource(mesh),
setName_(dict.lookup("set"))
setName_(dict.get<word>("set"))
{}
@ -81,12 +81,6 @@ Foam::setToPointZone::setToPointZone
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setToPointZone::~setToPointZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setToPointZone::applyToSet
@ -110,15 +104,14 @@ void Foam::setToPointZone::applyToSet
<< " ..." << endl;
// Load the sets
pointSet fSet(mesh_, setName_);
pointSet loadedSet(mesh_, setName_);
const labelHashSet& pointLabels = loadedSet;
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
forAllConstIter(pointSet, fSet, iter)
for (const label pointi : pointLabels)
{
label pointi = iter.key();
if (!fzSet.found(pointi))
{
newAddressing.append(pointi);

View File

@ -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.
@ -27,6 +27,12 @@ Class
Description
A topoSetSource to select points based on usage in a pointSet.
\heading Dictionary parameters
\table
Property | Description | Required | Default
set | Name of input pointSet | yes |
\endtable
SourceFiles
setToPointZone.C
@ -73,22 +79,14 @@ public:
);
//- Construct from dictionary
setToPointZone
(
const polyMesh& mesh,
const dictionary& dict
);
setToPointZone(const polyMesh& mesh, const dictionary& dict);
//- Construct from Istream
setToPointZone
(
const polyMesh& mesh,
Istream&
);
setToPointZone(const polyMesh& mesh, Istream& is);
//- Destructor
virtual ~setToPointZone();
virtual ~setToPointZone() = default;
// Member Functions
@ -101,7 +99,7 @@ public:
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
topoSet& set
) const;
};

View File

@ -44,7 +44,7 @@ const Foam::Enum
<
Foam::topoSetSource::setAction
>
Foam::topoSetSource::actionNames_
Foam::topoSetSource::actionNames
{
{ setAction::CLEAR, "clear" },
{ setAction::NEW, "new" },
@ -63,6 +63,40 @@ const Foam::string Foam::topoSetSource::illegalSource_
);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::topoSetSource::check(labelList& list, const label maxLabel)
{
const label len = list.size();
label nGood = 0;
for (label i=0; i < len; ++i)
{
const label val = list[i];
if (val >= 0 && val < maxLabel)
{
if (nGood != i)
{
list[nGood] = val;
}
++nGood;
}
}
const label nReject = (len - nGood);
if (nReject)
{
list.resize(nGood);
// Report?
}
return !nReject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -122,9 +156,9 @@ Foam::Istream& Foam::topoSetSource::checkIs(Istream& is)
{
FatalErrorInFunction
<< exit(FatalError);
return is;
}
return is;
}
@ -133,17 +167,35 @@ Foam::Istream& Foam::topoSetSource::checkIs(Istream& is)
void Foam::topoSetSource::addOrDelete
(
topoSet& set,
const label celli,
const label id,
const bool add
) const
{
if (add)
{
set.insert(celli);
set.insert(id);
}
else
{
set.erase(celli);
set.erase(id);
}
}
void Foam::topoSetSource::addOrDelete
(
topoSet& set,
const labelUList& labels,
const bool add
) const
{
if (add)
{
set.insert(labels);
}
else
{
set.erase(labels);
}
}
@ -156,10 +208,4 @@ Foam::topoSetSource::topoSetSource(const polyMesh& mesh)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::topoSetSource::~topoSetSource()
{}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,7 +53,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward declarations
class polyMesh;
class topoSet;
@ -92,6 +92,10 @@ public:
REMOVE
};
//- The setActions text representations
static const Enum<setAction> actionNames;
protected:
//- A table of usage strings
@ -124,16 +128,30 @@ protected:
// Protected data
//- Reference to the mesh
const polyMesh& mesh_;
//- Add (if bool) celli to set or delete celli from set.
void addOrDelete(topoSet& set, const label celli, const bool) const;
// Protected Member Functions
//- Detect and remove any values less than 0 or ge maxLabel.
// \return false if invalid elements were detected (and removed)
static bool check(labelList& list, const label maxLabel);
//- Add or delete id from set. Add when 'add' is true
void addOrDelete(topoSet& set, const label id, const bool add) const;
//- Add or delete labels from set. Add when 'add' is true
void addOrDelete
(
topoSet& set,
const labelUList& labels,
const bool add
) const;
private:
static const Enum<setAction> actionNames_;
static const string illegalSource_;
@ -155,14 +173,16 @@ public:
// Static Functions
//- Convert string to action
// \deprecated use direct access to actionNames (JUL-2018)
static setAction toAction(const word& actionName)
{
return actionNames_[actionName];
return actionNames[actionName];
}
//- Check state of stream.
static Istream& checkIs(Istream& is);
// Declare run-time constructor selection table
// For the dictionary constructor
@ -207,9 +227,9 @@ public:
autoPtr<topoSetSource> operator()(Istream& is) const
{
word topoSetSourceType(is);
const word sourceTypeName(is);
dictionary dict(is);
return topoSetSource::New(topoSetSourceType, mesh_, dict);
return topoSetSource::New(sourceTypeName, mesh_, dict);
}
};
@ -221,25 +241,16 @@ public:
usageTablePtr_ = new HashTable<string>();
}
const HashTable<string>& usageTable = *usageTablePtr_;
if (usageTable.found(name))
{
return usageTable[name];
}
else
{
return illegalSource_;
}
return usageTablePtr_->lookup(name, illegalSource_);
}
// Constructors
//- Construct from components
topoSetSource(const polyMesh& mesh);
explicit topoSetSource(const polyMesh& mesh);
//- Clone
//- Clone (disallowed)
autoPtr<topoSetSource> clone() const
{
NotImplemented;
@ -267,11 +278,12 @@ public:
//- Destructor
virtual ~topoSetSource();
virtual ~topoSetSource() = default;
// Member Functions
//- Reference to the mesh
const polyMesh& mesh() const
{
return mesh_;
@ -280,9 +292,11 @@ public:
// Member Functions
//- The type of set being used by the source
virtual sourceType setType() const = 0;
virtual void applyToSet(const setAction action, topoSet&) const = 0;
//- Apply specified action to the topoSet
virtual void applyToSet(const setAction action, topoSet& set) const = 0;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,7 +41,8 @@ addToRunTimeSelectionTable(topoSet, cellSet, size);
addToRunTimeSelectionTable(topoSet, cellSet, set);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cellSet::cellSet(const IOobject& obj)
:
@ -92,11 +93,11 @@ Foam::cellSet::cellSet
(
const polyMesh& mesh,
const word& name,
const labelHashSet& set,
const labelHashSet& labels,
writeOption w
)
:
topoSet(mesh, name, set, w)
topoSet(mesh, name, labels, w)
{}
@ -104,11 +105,23 @@ Foam::cellSet::cellSet
(
const polyMesh& mesh,
const word& name,
const labelUList& set,
labelHashSet&& labels,
writeOption w
)
:
topoSet(mesh, name, set, w)
topoSet(mesh, name, std::move(labels), w)
{}
Foam::cellSet::cellSet
(
const polyMesh& mesh,
const word& name,
const labelUList& labels,
writeOption w
)
:
topoSet(mesh, name, labels, w)
{}
@ -149,24 +162,18 @@ Foam::cellSet::cellSet
(
const Time& runTime,
const word& name,
const labelHashSet& set,
const labelHashSet& labels,
writeOption w
)
:
topoSet
(
findIOobject(runTime, name, IOobject::NO_READ, w),
set
labels
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cellSet::~cellSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::cellSet::maxSize(const polyMesh& mesh) const
@ -184,10 +191,14 @@ void Foam::cellSet::updateMesh(const mapPolyMesh& morphMap)
void Foam::cellSet::distribute(const mapDistributePolyMesh& map)
{
boolList inSet(map.nOldCells());
forAllConstIter(cellSet, *this, iter)
const labelHashSet& labels = *this;
for (const label celli : labels)
{
inSet[iter.key()] = true;
inSet[celli] = true;
}
map.distributeCellData(inSet);
// Count
@ -196,7 +207,7 @@ void Foam::cellSet::distribute(const mapDistributePolyMesh& map)
{
if (inSet[celli])
{
n++;
++n;
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -76,7 +76,7 @@ public:
writeOption w=NO_WRITE
);
//- Construct empty from size of labelHashSet
//- Construct empty with initial size for labelHashSet
cellSet
(
const polyMesh& mesh,
@ -94,21 +94,30 @@ public:
writeOption w=NO_WRITE
);
//- Construct from labelHashSet
//- Construct (no-read) with copy of labelHashSet
cellSet
(
const polyMesh& mesh,
const word& name,
const labelHashSet& set,
const labelHashSet& labels,
writeOption w=NO_WRITE
);
//- Construct from additional list of labels for the labelHashSet
//- Construct (no-read) with moving labelHashSet
cellSet
(
const polyMesh& mesh,
const word& name,
const labelUList& set,
labelHashSet&& labels,
writeOption w=NO_WRITE
);
//- Construct (no-read) with copy labels
cellSet
(
const polyMesh& mesh,
const word& name,
const labelUList& labels,
writeOption w=NO_WRITE
);
@ -138,13 +147,13 @@ public:
(
const Time&,
const word& name,
const labelHashSet&,
const labelHashSet& labels,
writeOption w=NO_WRITE
);
//- Destructor
virtual ~cellSet();
virtual ~cellSet() = default;
// Member functions
@ -160,7 +169,7 @@ public:
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&);
virtual void distribute(const mapDistributePolyMesh& map);
//- Write maxLen items with label and coordinates.
virtual void writeDebug

Some files were not shown because too many files have changed in this diff Show More