ENH: add operator[](const word&) as "find-by-name" to some classes

- affected: polyBoundary, fvBoundaryMesh, ZoneMesh, searchableSurfaces

  before:
      const label zoneI = mesh.cellZones().findZoneID(zoneName);
      const cellZone& cz = mesh.cellZones()[zoneI];
  after:
      const cellZone& cz = mesh.cellZones()[zoneName];
This commit is contained in:
Mark Olesen
2010-04-29 10:12:35 +02:00
parent 845314b280
commit 72f7d46f23
46 changed files with 438 additions and 258 deletions

View File

@ -63,8 +63,7 @@
<< exit(FatalIOError);
}
const labelList& faces =
mesh.faceZones()[magnetZonei];
const labelList& faces = mesh.faceZones()[magnetZonei];
const scalar muri = magnets[i].mur();
const scalar Mri = magnets[i].Mr().value();

View File

@ -1,4 +1,4 @@
Info << "Reading field p\n" << endl;
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
@ -12,7 +12,7 @@
mesh
);
Info << "Reading field U\n" << endl;
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
@ -34,7 +34,7 @@
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
Info << "Reading field pa\n" << endl;
Info<< "Reading field pa\n" << endl;
volScalarField pa
(
IOobject
@ -48,7 +48,7 @@
mesh
);
Info << "Reading field Ua\n" << endl;
Info<< "Reading field Ua\n" << endl;
volVectorField Ua
(
IOobject
@ -84,10 +84,8 @@
dimensionedScalar lambda(laminarTransport.lookup("lambda"));
dimensionedScalar alphaMax(laminarTransport.lookup("alphaMax"));
const labelList& inletCells =
mesh.boundary()[mesh.boundaryMesh().findPatchID("inlet")].faceCells();
//const labelList& outletCells =
// mesh.boundary()[mesh.boundaryMesh().findPatchID("outlet")].faceCells();
const labelList& inletCells = mesh.boundary()["inlet"].faceCells();
//const labelList& outletCells = mesh.boundary()["outlet"].faceCells();
volScalarField alpha
(

View File

@ -220,10 +220,7 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
const word patchName = args[1];
label patchI = mesh.boundaryMesh().findPatchID(patchName);
const polyPatch& patch = mesh.boundaryMesh()[patchI];
const polyPatch& patch = mesh.boundaryMesh()[patchName];
Info<< "Patch:" << patch.name() << endl;

View File

@ -20,8 +20,7 @@ Notes for fluentMeshToFoam with zone preservation
with the cellZones(), faceZones() and pointZones() member functions
- Example (Members from polyMesh.H and ZoneMesh.H):
label thisCellZoneID = mesh.cellZones().findZoneID("thisZoneName");
const labelList& thisCellZone = mesh.cellZones()[thisCellZoneID];
const labelList& thisCellZone = mesh.cellZones()["thisZoneName"];
- Zone integrity is preserved during mesh modification and decompomposition.

View File

@ -27,10 +27,7 @@
// Master patch
const word masterPatchName(mergePatchPairs[pairI].first());
const polyPatch& masterPatch =
mesh.boundaryMesh()
[
mesh.boundaryMesh().findPatchID(masterPatchName)
];
mesh.boundaryMesh()[masterPatchName];
labelList isf(masterPatch.size());
@ -51,10 +48,7 @@
// Slave patch
const word slavePatchName(mergePatchPairs[pairI].second());
const polyPatch& slavePatch =
mesh.boundaryMesh()
[
mesh.boundaryMesh().findPatchID(slavePatchName)
];
mesh.boundaryMesh()[slavePatchName];
labelList osf(slavePatch.size());

View File

@ -123,7 +123,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
label findPatchID(const polyBoundaryMesh& patches, const word& name)
{
label patchID = patches.findPatchID(name);
const label patchID = patches.findPatchID(name);
if (patchID == -1)
{

View File

@ -849,8 +849,7 @@ int main(int argc, char *argv[])
nExtrudeFaces = 0;
forAll(zoneNames, i)
{
label zoneI = faceZones.findZoneID(zoneNames[i]);
const faceZone& fz = faceZones[zoneI];
const faceZone& fz = faceZones[zoneNames[i]];
forAll(fz, j)
{
extrudeTopPatchID[nExtrudeFaces] = interRegionTopPatch[i];

View File

@ -107,7 +107,7 @@ void modifyOrAddFace
label findPatchID(const polyMesh& mesh, const word& name)
{
label patchI = mesh.boundaryMesh().findPatchID(name);
const label patchI = mesh.boundaryMesh().findPatchID(name);
if (patchI == -1)
{

View File

@ -678,17 +678,17 @@ int main(int argc, char *argv[])
{
const dictionary& dict = patchSources[addedI];
word patchName(dict.lookup("name"));
const word patchName(dict.lookup("name"));
label destPatchI = patches.findPatchID(patchName);
if (destPatchI == -1)
{
FatalErrorIn(args.executable()) << "patch " << patchName
<< " not added. Problem." << abort(FatalError);
FatalErrorIn(args.executable())
<< "patch " << patchName << " not added. Problem."
<< abort(FatalError);
}
word sourceType(dict.lookup("constructFrom"));
const word sourceType(dict.lookup("constructFrom"));
if (sourceType == "patches")
{
@ -716,7 +716,7 @@ int main(int argc, char *argv[])
}
else if (sourceType == "set")
{
word setName(dict.lookup("set"));
const word setName(dict.lookup("set"));
faceSet faces(mesh, setName);

View File

@ -85,12 +85,12 @@ label findEdge(const primitiveMesh& mesh, const label v0, const label v1)
// Checks whether patch present
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
{
label patchI = bMesh.findPatchID(name);
const label patchI = bMesh.findPatchID(name);
if (patchI == -1)
{
FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)")
<< "Cannot find patch " << name << endl
<< "Cannot find patch " << name << nl
<< "It should be present but of zero size" << endl
<< "Valid patches are " << bMesh.names()
<< exit(FatalError);

View File

@ -170,7 +170,7 @@ label addCellZone(const polyMesh& mesh, const word& name)
// Checks whether patch present
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
{
label patchI = bMesh.findPatchID(name);
const label patchI = bMesh.findPatchID(name);
if (patchI == -1)
{
@ -312,11 +312,7 @@ int main(int argc, char *argv[])
// Create and add face zones and mesh modifiers
// Master patch
const polyPatch& masterPatch =
mesh.boundaryMesh()
[
mesh.boundaryMesh().findPatchID(masterPatchName)
];
const polyPatch& masterPatch = mesh.boundaryMesh()[masterPatchName];
// Make list of masterPatch faces
labelList isf(masterPatch.size());
@ -373,11 +369,7 @@ int main(int argc, char *argv[])
);
// Slave patch
const polyPatch& slavePatch =
mesh.boundaryMesh()
[
mesh.boundaryMesh().findPatchID(slavePatchName)
];
const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchName];
labelList osf(slavePatch.size());

View File

@ -55,7 +55,7 @@ void Foam::domainDecomposition::distributeCells()
forAll(pNames, i)
{
label patchI = patches.findPatchID(pNames[i]);
const label patchI = patches.findPatchID(pNames[i]);
if (patchI == -1)
{

View File

@ -328,7 +328,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
VTK_POLYHEDRON,
nodeCount,
uniqueNodeIds.data(),
faceCount,
nFaces,
faceLabels.data()
);
#else

View File

@ -236,7 +236,7 @@ Foam::channelIndex::channelIndex
forAll(patchNames, i)
{
label patchI = patches.findPatchID(patchNames[i]);
const label patchI = patches.findPatchID(patchNames[i]);
if (patchI == -1)
{
@ -254,7 +254,7 @@ Foam::channelIndex::channelIndex
forAll(patchNames, i)
{
const polyPatch& pp = patches[patches.findPatchID(patchNames[i])];
const polyPatch& pp = patches[patchNames[i]];
forAll(pp, j)
{

View File

@ -65,8 +65,8 @@ int main(int argc, char *argv[])
{
mesh.readUpdate();
label patchi = mesh.boundaryMesh().findPatchID(patchName);
if (patchi < 0)
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
if (patchI < 0)
{
FatalError
<< "Unable to find patch " << patchName << nl
@ -78,20 +78,20 @@ int main(int argc, char *argv[])
Info<< " Reading volScalarField " << fieldName << endl;
volScalarField field(fieldHeader, mesh);
scalar area = gSum(mesh.magSf().boundaryField()[patchi]);
scalar area = gSum(mesh.magSf().boundaryField()[patchI]);
scalar sumField = 0;
if (area > 0)
{
sumField = gSum
(
mesh.magSf().boundaryField()[patchi]
* field.boundaryField()[patchi]
mesh.magSf().boundaryField()[patchI]
* field.boundaryField()[patchI]
) / area;
}
Info<< " Average of " << fieldName << " over patch "
<< patchName << '[' << patchi << ']' << " = "
<< patchName << '[' << patchI << ']' << " = "
<< sumField << endl;
}
else

View File

@ -67,8 +67,8 @@ int main(int argc, char *argv[])
{
mesh.readUpdate();
label patchi = mesh.boundaryMesh().findPatchID(patchName);
if (patchi < 0)
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
if (patchI < 0)
{
FatalError
<< "Unable to find patch " << patchName << nl
@ -76,16 +76,16 @@ int main(int argc, char *argv[])
}
// Give patch area
if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchi]))
if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchI]))
{
Info<< " Cyclic patch vector area: " << nl;
label nFaces = mesh.boundaryMesh()[patchi].size();
label nFaces = mesh.boundaryMesh()[patchI].size();
vector sum1 = vector::zero;
vector sum2 = vector::zero;
for (label i=0; i<nFaces/2; i++)
{
sum1 += mesh.Sf().boundaryField()[patchi][i];
sum2 += mesh.Sf().boundaryField()[patchi][i+nFaces/2];
sum1 += mesh.Sf().boundaryField()[patchI][i];
sum2 += mesh.Sf().boundaryField()[patchI][i+nFaces/2];
}
reduce(sum1, sumOp<vector>());
reduce(sum2, sumOp<vector>());
@ -94,16 +94,16 @@ int main(int argc, char *argv[])
<< " - total = " << (sum1 + sum2) << ", "
<< mag(sum1 + sum2) << endl;
Info<< " Cyclic patch area magnitude = "
<< gSum(mesh.magSf().boundaryField()[patchi])/2.0 << endl;
<< gSum(mesh.magSf().boundaryField()[patchI])/2.0 << endl;
}
else
{
Info<< " Area vector of patch "
<< patchName << '[' << patchi << ']' << " = "
<< gSum(mesh.Sf().boundaryField()[patchi]) << endl;
<< patchName << '[' << patchI << ']' << " = "
<< gSum(mesh.Sf().boundaryField()[patchI]) << endl;
Info<< " Area magnitude of patch "
<< patchName << '[' << patchi << ']' << " = "
<< gSum(mesh.magSf().boundaryField()[patchi]) << endl;
<< patchName << '[' << patchI << ']' << " = "
<< gSum(mesh.magSf().boundaryField()[patchI]) << endl;
}
// Read field and calc integral
@ -116,21 +116,21 @@ int main(int argc, char *argv[])
Info<< " Integral of " << fieldName
<< " over vector area of patch "
<< patchName << '[' << patchi << ']' << " = "
<< patchName << '[' << patchI << ']' << " = "
<< gSum
(
mesh.Sf().boundaryField()[patchi]
*field.boundaryField()[patchi]
mesh.Sf().boundaryField()[patchI]
*field.boundaryField()[patchI]
)
<< nl;
Info<< " Integral of " << fieldName
<< " over area magnitude of patch "
<< patchName << '[' << patchi << ']' << " = "
<< patchName << '[' << patchI << ']' << " = "
<< gSum
(
mesh.magSf().boundaryField()[patchi]
*field.boundaryField()[patchi]
mesh.magSf().boundaryField()[patchI]
*field.boundaryField()[patchI]
)
<< nl;
}
@ -143,10 +143,10 @@ int main(int argc, char *argv[])
<< fieldName << endl;
surfaceScalarField field(fieldHeader, mesh);
scalar sumField = gSum(field.boundaryField()[patchi]);
scalar sumField = gSum(field.boundaryField()[patchI]);
Info<< " Integral of " << fieldName << " over patch "
<< patchName << '[' << patchi << ']' << " = "
<< patchName << '[' << patchI << ']' << " = "
<< sumField << nl;
}
else

View File

@ -105,7 +105,7 @@ int main(int argc, char *argv[])
forAll(patchNames, patchNameI)
{
const word& patchName = patchNames[patchNameI];
label patchI = bMesh.findPatchID(patchName);
const label patchI = bMesh.findPatchID(patchName);
if (patchI == -1)
{

View File

@ -120,9 +120,9 @@ Foam::polyBoundaryMesh::~polyBoundaryMesh()
void Foam::polyBoundaryMesh::clearGeom()
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).clearGeom();
operator[](patchI).clearGeom();
}
}
@ -132,9 +132,9 @@ void Foam::polyBoundaryMesh::clearAddressing()
neighbourEdgesPtr_.clear();
patchIDPtr_.clear();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).clearAddressing();
operator[](patchI).clearAddressing();
}
}
@ -151,16 +151,16 @@ void Foam::polyBoundaryMesh::calcGeometry()
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).initGeometry(pBufs);
operator[](patchI).initGeometry(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).calcGeometry(pBufs);
operator[](patchI).calcGeometry(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -172,15 +172,15 @@ void Foam::polyBoundaryMesh::calcGeometry()
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
const label patchI = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initGeometry(pBufs);
operator[](patchI).initGeometry(pBufs);
}
else
{
operator[](patchi).calcGeometry(pBufs);
operator[](patchI).calcGeometry(pBufs);
}
}
}
@ -204,15 +204,15 @@ Foam::polyBoundaryMesh::neighbourEdges() const
// Initialize.
label nEdgePairs = 0;
forAll(*this, patchi)
forAll(*this, patchI)
{
const polyPatch& pp = operator[](patchi);
const polyPatch& pp = operator[](patchI);
neighbourEdges[patchi].setSize(pp.nEdges() - pp.nInternalEdges());
neighbourEdges[patchI].setSize(pp.nEdges() - pp.nInternalEdges());
forAll(neighbourEdges[patchi], i)
forAll(neighbourEdges[patchI], i)
{
labelPair& edgeInfo = neighbourEdges[patchi][i];
labelPair& edgeInfo = neighbourEdges[patchI][i];
edgeInfo[0] = -1;
edgeInfo[1] = -1;
@ -225,9 +225,9 @@ Foam::polyBoundaryMesh::neighbourEdges() const
// point addressing) to patch + relative edge index.
HashTable<labelPair, edge, Hash<edge> > pointsToEdge(nEdgePairs);
forAll(*this, patchi)
forAll(*this, patchI)
{
const polyPatch& pp = operator[](patchi);
const polyPatch& pp = operator[](patchI);
const edgeList& edges = pp.edges();
@ -256,7 +256,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
meshEdge,
labelPair
(
patchi,
patchI,
edgei - pp.nInternalEdges()
)
);
@ -266,11 +266,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const
// Second occurrence. Store.
const labelPair& edgeInfo = fnd();
neighbourEdges[patchi][edgei - pp.nInternalEdges()] =
neighbourEdges[patchI][edgei - pp.nInternalEdges()] =
edgeInfo;
neighbourEdges[edgeInfo[0]][edgeInfo[1]]
= labelPair(patchi, edgei - pp.nInternalEdges());
= labelPair(patchI, edgei - pp.nInternalEdges());
// Found all two occurrences of this edge so remove from
// hash to save space. Note that this will give lots of
@ -288,11 +288,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const
<< abort(FatalError);
}
forAll(*this, patchi)
forAll(*this, patchI)
{
const polyPatch& pp = operator[](patchi);
const polyPatch& pp = operator[](patchI);
const labelPairList& nbrEdges = neighbourEdges[patchi];
const labelPairList& nbrEdges = neighbourEdges[patchI];
forAll(nbrEdges, i)
{
@ -409,8 +409,7 @@ Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const
// Patch not found
if (debug)
{
Pout<< "label polyBoundaryMesh::findPatchID(const word& "
<< "patchName) const"
Pout<< "label polyBoundaryMesh::findPatchID(const word&) const"
<< "Patch named " << patchName << " not found. "
<< "List of available patch names: " << names() << endl;
}
@ -641,16 +640,16 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).initMovePoints(pBufs, p);
operator[](patchI).initMovePoints(pBufs, p);
}
pBufs.finishedSends();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).movePoints(pBufs, p);
operator[](patchI).movePoints(pBufs, p);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -662,15 +661,15 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
const label patchI = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initMovePoints(pBufs, p);
operator[](patchI).initMovePoints(pBufs, p);
}
else
{
operator[](patchi).movePoints(pBufs, p);
operator[](patchI).movePoints(pBufs, p);
}
}
}
@ -690,16 +689,16 @@ void Foam::polyBoundaryMesh::updateMesh()
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).initUpdateMesh(pBufs);
operator[](patchI).initUpdateMesh(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).updateMesh(pBufs);
operator[](patchI).updateMesh(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -711,15 +710,15 @@ void Foam::polyBoundaryMesh::updateMesh()
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
const label patchI = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initUpdateMesh(pBufs);
operator[](patchI).initUpdateMesh(pBufs);
}
else
{
operator[](patchi).updateMesh(pBufs);
operator[](patchI).updateMesh(pBufs);
}
}
}
@ -734,9 +733,9 @@ void Foam::polyBoundaryMesh::reorder(const UList<label>& oldToNew)
// Adapt indices
polyPatchList& patches = *this;
forAll(patches, patchi)
forAll(patches, patchI)
{
patches[patchi].index() = patchi;
patches[patchI].index() = patchI;
}
updateMesh();
@ -749,11 +748,11 @@ bool Foam::polyBoundaryMesh::writeData(Ostream& os) const
os << patches.size() << nl << token::BEGIN_LIST << incrIndent << nl;
forAll(patches, patchi)
forAll(patches, patchI)
{
os << indent << patches[patchi].name() << nl
os << indent << patches[patchI].name() << nl
<< indent << token::BEGIN_BLOCK << nl
<< incrIndent << patches[patchi] << decrIndent
<< incrIndent << patches[patchI] << decrIndent
<< indent << token::END_BLOCK << endl;
}
@ -776,6 +775,49 @@ bool Foam::polyBoundaryMesh::writeObject
return regIOobject::writeObject(fmt, ver, IOstream::UNCOMPRESSED);
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
const Foam::polyPatch& Foam::polyBoundaryMesh::operator[]
(
const word& patchName
) const
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"polyBoundaryMesh::operator[](const word&) const"
) << "Patch named " << patchName << " not found." << nl
<< "Available patch names: " << names() << endl
<< abort(FatalError);
}
return operator[](patchI);
}
Foam::polyPatch& Foam::polyBoundaryMesh::operator[]
(
const word& patchName
)
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"polyBoundaryMesh::operator[](const word&)"
) << "Patch named " << patchName << " not found." << nl
<< "Available patch names: " << names() << endl
<< abort(FatalError);
}
return operator[](patchI);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //

View File

@ -126,7 +126,7 @@ public:
void clearAddressing();
// Member functions
// Member Functions
//- Return the mesh reference
const polyMesh& mesh() const
@ -194,6 +194,17 @@ public:
IOstream::compressionType cmp
) const;
// Member Operators
//- Return const and non-const reference to polyPatch by index.
using polyPatchList::operator[];
//- Return const reference to polyPatch by name.
const polyPatch& operator[](const word&) const;
//- Return reference to polyPatch by name.
polyPatch& operator[](const word&);
// Ostream operator

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,15 +27,10 @@ License
#include "entry.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
void Foam::ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
{
// It is an error to attempt to recalculate cellEdges
// if the pointer is already set
@ -77,7 +72,7 @@ void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
// Read constructor given IOobject and a MeshType reference
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::ZoneMesh
Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
(
const IOobject& io,
const MeshType& mesh
@ -136,7 +131,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh
// Construct given size. Zones will be set later
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::ZoneMesh
Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
(
const IOobject& io,
const MeshType& mesh,
@ -153,7 +148,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
Foam::ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
{
clearAddressing();
}
@ -163,7 +158,8 @@ ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
// Map of zones for quick zone lookup
template<class ZoneType, class MeshType>
const Map<label>& ZoneMesh<ZoneType, MeshType>::zoneMap() const
const Foam::Map<Foam::label>&
Foam::ZoneMesh<ZoneType, MeshType>::zoneMap() const
{
if (!zoneMapPtr_)
{
@ -177,7 +173,10 @@ const Map<label>& ZoneMesh<ZoneType, MeshType>::zoneMap() const
// Given a global object index, return the zone it is in.
// If object does not belong to any zones, return -1
template<class ZoneType, class MeshType>
label ZoneMesh<ZoneType, MeshType>::whichZone(const label objectIndex) const
Foam::label Foam::ZoneMesh<ZoneType, MeshType>::whichZone
(
const label objectIndex
) const
{
const Map<label>& zm = zoneMap();
Map<label>::const_iterator zmIter = zm.find(objectIndex);
@ -195,40 +194,43 @@ label ZoneMesh<ZoneType, MeshType>::whichZone(const label objectIndex) const
// Return a list of zone names
template<class ZoneType, class MeshType>
wordList ZoneMesh<ZoneType, MeshType>::types() const
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::types() const
{
const PtrList<ZoneType>& zones = *this;
wordList t(zones.size());
wordList lst(zones.size());
forAll(zones, zoneI)
{
t[zoneI] = zones[zoneI].type();
lst[zoneI] = zones[zoneI].type();
}
return t;
return lst;
}
// Return a list of zone names
template<class ZoneType, class MeshType>
wordList ZoneMesh<ZoneType, MeshType>::names() const
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names() const
{
const PtrList<ZoneType>& zones = *this;
wordList t(zones.size());
wordList lst(zones.size());
forAll(zones, zoneI)
{
t[zoneI] = zones[zoneI].name();
lst[zoneI] = zones[zoneI].name();
}
return t;
return lst;
}
template<class ZoneType, class MeshType>
label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const
Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findZoneID
(
const word& zoneName
) const
{
const PtrList<ZoneType>& zones = *this;
@ -243,19 +245,18 @@ label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const
// Zone not found
if (debug)
{
Info<< "label ZoneMesh<ZoneType>::findZoneID(const word& "
<< "zoneName) const : "
Info<< "label ZoneMesh<ZoneType>::findZoneID(const word&) const : "
<< "Zone named " << zoneName << " not found. "
<< "List of available zone names: " << names() << endl;
}
// A dummy return to kep the compiler happy
// A dummy return to keep the compiler happy
return -1;
}
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::clearAddressing()
void Foam::ZoneMesh<ZoneType, MeshType>::clearAddressing()
{
deleteDemandDrivenData(zoneMapPtr_);
@ -269,7 +270,7 @@ void ZoneMesh<ZoneType, MeshType>::clearAddressing()
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::clear()
void Foam::ZoneMesh<ZoneType, MeshType>::clear()
{
clearAddressing();
PtrList<ZoneType>::clear();
@ -278,7 +279,10 @@ void ZoneMesh<ZoneType, MeshType>::clear()
// Check zone definition
template<class ZoneType, class MeshType>
bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const
bool Foam::ZoneMesh<ZoneType, MeshType>::checkDefinition
(
const bool report
) const
{
bool inError = false;
@ -294,7 +298,7 @@ bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const
// Correct zone mesh after moving points
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
void Foam::ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
{
PtrList<ZoneType>& zones = *this;
@ -307,17 +311,66 @@ void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
// writeData member function required by regIOobject
template<class ZoneType, class MeshType>
bool ZoneMesh<ZoneType, MeshType>::writeData(Ostream& os) const
bool Foam::ZoneMesh<ZoneType, MeshType>::writeData(Ostream& os) const
{
os << *this;
os << *this;
return os.good();
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<class ZoneType, class MeshType>
const ZoneType& Foam::ZoneMesh<ZoneType, MeshType>::operator[]
(
const word& zoneName
) const
{
const label zoneI = findZoneID(zoneName);
if (zoneI < 0)
{
FatalErrorIn
(
"ZoneMesh<ZoneType>::operator[](const word&) const"
) << "Zone named " << zoneName << " not found." << nl
<< "Available zone names: " << names() << endl
<< abort(FatalError);
}
return operator[](zoneI);
}
template<class ZoneType, class MeshType>
ZoneType& Foam::ZoneMesh<ZoneType, MeshType>::operator[]
(
const word& zoneName
)
{
const label zoneI = findZoneID(zoneName);
if (zoneI < 0)
{
FatalErrorIn
(
"ZoneMesh<ZoneType>::operator[](const word&)"
) << "Zone named " << zoneName << " not found." << nl
<< "Available zone names: " << names() << endl
<< abort(FatalError);
}
return operator[](zoneI);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ZoneType, class MeshType>
Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones)
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const ZoneMesh<ZoneType, MeshType>& zones
)
{
os << zones.size() << nl << token::BEGIN_LIST;
@ -332,8 +385,4 @@ Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -109,7 +109,7 @@ public:
~ZoneMesh();
// Member functions
// Member Functions
//- Return the mesh reference
const MeshType& mesh() const
@ -149,6 +149,17 @@ public:
//- writeData member function required by regIOobject
bool writeData(Ostream&) const;
// Member Operators
//- Return const and non-const reference to ZoneType by index.
using PtrList<ZoneType>::operator[];
//- Return const reference to ZoneType by name.
const ZoneType& operator[](const word&) const;
//- Return reference to ZoneType by name.
ZoneType& operator[](const word&);
// Ostream operator

View File

@ -1125,13 +1125,11 @@ void Foam::boundaryMesh::patchify
forAll(oldPatches, oldPatchI)
{
const polyPatch& patch = oldPatches[oldPatchI];
label newPatchI = findPatchID(patch.name());
const label newPatchI = findPatchID(patch.name());
if (newPatchI != -1)
{
nameToIndex.insert(patch.name(), newPatchI);
indexToName.insert(newPatchI, patch.name());
}
}
@ -1145,7 +1143,6 @@ void Foam::boundaryMesh::patchify
if (!nameToIndex.found(bp.name()))
{
nameToIndex.insert(bp.name(), bPatchI);
indexToName.insert(bPatchI, bp.name());
}
}
@ -1167,10 +1164,10 @@ void Foam::boundaryMesh::patchify
{
const boundaryPatch& bp = patches_[bPatchI];
label newPatchI = nameToIndex[bp.name()];
const label newPatchI = nameToIndex[bp.name()];
// Find corresponding patch in polyMesh
label oldPatchI = findPatchID(oldPatches, bp.name());
const label oldPatchI = findPatchID(oldPatches, bp.name());
if (oldPatchI == -1)
{
@ -1599,7 +1596,7 @@ void Foam::boundaryMesh::addPatch(const word& patchName)
void Foam::boundaryMesh::deletePatch(const word& patchName)
{
label delPatchI = findPatchID(patchName);
const label delPatchI = findPatchID(patchName);
if (delPatchI == -1)
{
@ -1658,7 +1655,7 @@ void Foam::boundaryMesh::changePatchType
const word& patchType
)
{
label changeI = findPatchID(patchName);
const label changeI = findPatchID(patchName);
if (changeI == -1)
{

View File

@ -343,7 +343,7 @@ Foam::directions::directions
const word patchName(patchDict.lookup("patch"));
label patchI = mesh.boundaryMesh().findPatchID(patchName);
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
if (patchI == -1)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,16 +70,33 @@ Foam::fvBoundaryMesh::fvBoundaryMesh
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fvBoundaryMesh::movePoints()
Foam::label Foam::fvBoundaryMesh::findPatchID(const word& patchName) const
{
forAll(*this, patchi)
const fvPatchList& patches = *this;
forAll(patches, patchI)
{
operator[](patchi).initMovePoints();
if (patches[patchI].name() == patchName)
{
return patchI;
}
}
forAll(*this, patchi)
// Not found, return -1
return -1;
}
void Foam::fvBoundaryMesh::movePoints()
{
forAll(*this, patchI)
{
operator[](patchi).movePoints();
operator[](patchI).initMovePoints();
}
forAll(*this, patchI)
{
operator[](patchI).movePoints();
}
}
@ -88,14 +105,14 @@ Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const
{
lduInterfacePtrsList interfaces(size());
forAll(interfaces, patchi)
forAll(interfaces, patchI)
{
if (isA<lduInterface>(this->operator[](patchi)))
if (isA<lduInterface>(this->operator[](patchI)))
{
interfaces.set
(
patchi,
&refCast<const lduInterface>(this->operator[](patchi))
patchI,
&refCast<const lduInterface>(this->operator[](patchI))
);
}
}
@ -111,4 +128,46 @@ void Foam::fvBoundaryMesh::readUpdate(const polyBoundaryMesh& basicBdry)
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
const Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
(
const word& patchName
) const
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"fvBoundaryMesh::operator[](const word&) const"
) << "Patch named " << patchName << " not found." << nl
<< abort(FatalError);
}
return operator[](patchI);
}
Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
(
const word& patchName
)
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"fvBoundaryMesh::operator[](const word&)"
) << "Patch named " << patchName << " not found." << nl
<< abort(FatalError);
}
return operator[](patchI);
}
// ************************************************************************* //

View File

@ -54,8 +54,6 @@ class fvBoundaryMesh
:
public fvPatchList
{
private:
// Private data
//- Reference to mesh
@ -101,7 +99,7 @@ public:
);
// Member functions
// Member Functions
// Access
@ -115,9 +113,24 @@ public:
// with only those pointing to interfaces being set
lduInterfacePtrsList interfaces() const;
//- Find patch index given a name
label findPatchID(const word& patchName) const;
//- Correct patches after moving points
void movePoints();
// Member Operators
//- Return const and non-const reference to fvPatch by index.
using fvPatchList::operator[];
//- Return const reference to fvPatch by name.
const fvPatch& operator[](const word&) const;
//- Return reference to fvPatch by name.
fvPatch& operator[](const word&);
};

View File

@ -148,8 +148,7 @@ displacementInterpolationFvMotionSolver
forAll(faceZoneToTable, i)
{
const word& zoneName = faceZoneToTable[i][0];
label zoneI = fZones.findZoneID(zoneName);
const faceZone& fz = fZones[zoneI];
const faceZone& fz = fZones[zoneName];
scalar minCoord = VGREAT;
scalar maxCoord = -VGREAT;

View File

@ -353,8 +353,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve
const dictionary& faceZoneDict = patchIter().dict();
// Determine the points of the faceZone within the cellZone
label zoneI = mesh().faceZones().findZoneID(faceZoneName);
const faceZone& fz = mesh().faceZones()[zoneI];
const faceZone& fz = mesh().faceZones()[faceZoneName];
const labelList& fzMeshPoints = fz().meshPoints();
DynamicList<label> meshPoints(fzMeshPoints.size());
forAll(fzMeshPoints, i)

View File

@ -78,7 +78,7 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
forAll(patchNames_, i)
{
label pID = bdry.findPatchID(patchNames_[i]);
const label pID = bdry.findPatchID(patchNames_[i]);
if (pID > -1)
{

View File

@ -78,7 +78,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
forAll(patchNames_, i)
{
label pID = bdry.findPatchID(patchNames_[i]);
const label pID = bdry.findPatchID(patchNames_[i]);
if (pID > -1)
{

View File

@ -87,7 +87,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
{
const pointZoneMesh& pZones = mesh.pointZones();
zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)];
zonePtr = &pZones[frozenPointsZone_];
Pout<< "surfaceDisplacementPointPatchVectorField : Fixing all "
<< zonePtr->size() << " points in pointZone " << zonePtr->name()

View File

@ -86,7 +86,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
{
const pointZoneMesh& pZones = mesh.pointZones();
zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)];
zonePtr = &pZones[frozenPointsZone_];
Pout<< "surfaceSlipDisplacementPointPatchVectorField : Fixing all "
<< zonePtr->size() << " points in pointZone " << zonePtr->name()

View File

@ -101,7 +101,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
cellOwners_(),
fraction_(1.0)
{
label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_);
const label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_);
if (patchId < 0)
{

View File

@ -128,7 +128,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
{
forAll(patchNames_, patchI)
{
label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
const label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
if (id < 0)
{
FatalErrorIn

View File

@ -70,9 +70,7 @@ Foam::Map<Foam::label> Foam::autoSnapDriver::getZoneBafflePatches
if (faceZoneNames[surfI].size())
{
// Get zone
label zoneI = fZones.findZoneID(faceZoneNames[surfI]);
const faceZone& fZone = fZones[zoneI];
const faceZone& fZone = fZones[faceZoneNames[surfI]];
//// Get patch allocated for zone
//label patchI = surfaceToCyclicPatch_[surfI];
@ -1311,11 +1309,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
forAll(zonedSurfaces, i)
{
label zoneSurfI = zonedSurfaces[i];
label zoneI = fZones.findZoneID(faceZoneNames[zoneSurfI]);
const faceZone& fZone = fZones[zoneI];
const label zoneSurfI = zonedSurfaces[i];
const faceZone& fZone = fZones[faceZoneNames[zoneSurfI]];
forAll(fZone, i)
{

View File

@ -1119,9 +1119,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
if (fzNames[surfI].size())
{
// Get zone
label zoneI = fZones.findZoneID(fzNames[surfI]);
const faceZone& fZone = fZones[zoneI];
const faceZone& fZone = fZones[fzNames[surfI]];
forAll(fZone, i)
{
@ -1540,7 +1538,7 @@ Foam::label Foam::meshRefinement::addPatch
polyBoundaryMesh& polyPatches =
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
label patchI = polyPatches.findPatchID(patchName);
const label patchI = polyPatches.findPatchID(patchName);
if (patchI != -1)
{
if (polyPatches[patchI].type() == patchType)

View File

@ -744,7 +744,7 @@ const Foam::polyPatch& Foam::directMappedPatchBase::samplePolyPatch() const
{
const polyMesh& nbrMesh = sampleMesh();
label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_);
const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_);
if (patchI == -1)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,12 +30,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(searchableSurfaces, 0);
}
defineTypeNameAndDebug(Foam::searchableSurfaces, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -256,8 +251,10 @@ Foam::searchableSurfaces::searchableSurfaces
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::searchableSurfaces::findSurfaceID(const word& wantedName)
const
Foam::label Foam::searchableSurfaces::findSurfaceID
(
const word& wantedName
) const
{
return findIndex(names_, wantedName);
}
@ -344,5 +341,48 @@ Foam::pointIndexHit Foam::searchableSurfaces::facesIntersection
);
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
const Foam::searchableSurface& Foam::searchableSurfaces::operator[]
(
const word& surfName
) const
{
const label surfI = findSurfaceID(surfName);
if (surfI < 0)
{
FatalErrorIn
(
"searchableSurfaces::operator[](const word&) const"
) << "Surface named " << surfName << " not found." << nl
<< "Available surface names: " << names_ << endl
<< abort(FatalError);
}
return operator[](surfI);
}
Foam::searchableSurface& Foam::searchableSurfaces::operator[]
(
const word& surfName
)
{
const label surfI = findSurfaceID(surfName);
if (surfI < 0)
{
FatalErrorIn
(
"searchableSurfaces::operator[](const word&)"
) << "Surface named " << surfName << " not found." << nl
<< "Available surface names: " << names_ << endl
<< abort(FatalError);
}
return operator[](surfI);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -174,6 +174,19 @@ public:
const point& start
) const;
// Member Operators
//- Return const and non-const reference to searchableSurface by index.
using PtrList<searchableSurface>::operator[];
//- Return const reference to searchableSurface by name.
const searchableSurface& operator[](const word&) const;
//- Return reference to searchableSurface by name.
searchableSurface& operator[](const word&);
};

View File

@ -161,7 +161,7 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
void Foam::fieldValues::faceSource::setPatchFaces()
{
label patchId = mesh().boundaryMesh().findPatchID(sourceName_);
const label patchId = mesh().boundaryMesh().findPatchID(sourceName_);
if (patchId < 0)
{

View File

@ -304,7 +304,7 @@ bool Foam::sampledIsoSurface::updateGeometry() const
const polyBoundaryMesh& patches = mesh().boundaryMesh();
// Patch to put exposed internal faces into
label exposedPatchI = patches.findPatchID(exposedPatchName_);
const label exposedPatchI = patches.findPatchID(exposedPatchName_);
if (debug)
{

View File

@ -67,7 +67,7 @@ void Foam::sampledCuttingPlane::createGeometry()
const polyBoundaryMesh& patches = mesh().boundaryMesh();
// Patch to put exposed internal faces into
label exposedPatchI = patches.findPatchID(exposedPatchName_);
const label exposedPatchI = patches.findPatchID(exposedPatchName_);
if (debug)
{

View File

@ -111,7 +111,7 @@ bool Foam::sampledPatch::update()
return false;
}
label patchI = mesh().boundaryMesh().findPatchID(patchName_);
const label patchI = mesh().boundaryMesh().findPatchID(patchName_);
if (patchI != -1)
{

View File

@ -84,8 +84,7 @@ void Foam::linearValveFvMesh::addZonesAndModifiers()
// Inner slider
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
const polyPatch& innerSlider =
boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)];
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
labelList isf(innerSlider.size());
@ -105,8 +104,7 @@ void Foam::linearValveFvMesh::addZonesAndModifiers()
// Outer slider
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
const polyPatch& outerSlider =
boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)];
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
labelList osf(outerSlider.size());

View File

@ -37,7 +37,6 @@ License
namespace Foam
{
defineTypeNameAndDebug(linearValveLayersFvMesh, 0);
addToRunTimeSelectionTable(topoChangerFvMesh, linearValveLayersFvMesh, IOobject);
}
@ -87,8 +86,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
// Inner slider
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
const polyPatch& innerSlider =
boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)];
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
labelList isf(innerSlider.size());
@ -108,8 +106,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
// Outer slider
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
const polyPatch& outerSlider =
boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)];
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
labelList osf(outerSlider.size());
@ -143,8 +140,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
motionDict_.subDict("layer").lookup("patch")
);
const polyPatch& layerPatch =
boundaryMesh()[boundaryMesh().findPatchID(layerPatchName)];
const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
labelList lpf(layerPatch.size());
@ -317,8 +313,7 @@ Foam::tmp<Foam::pointField> Foam::linearValveLayersFvMesh::newPoints() const
motionDict_.subDict("layer").lookup("patch")
);
const polyPatch& layerPatch =
boundaryMesh()[boundaryMesh().findPatchID(layerPatchName)];
const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
const labelList& patchPoints = layerPatch.meshPoints();

View File

@ -84,8 +84,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
// Inner slider
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
const polyPatch& innerSlider =
boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)];
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
labelList isf(innerSlider.size());
@ -105,8 +104,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
// Outer slider
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
const polyPatch& outerSlider =
boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)];
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
labelList osf(outerSlider.size());
@ -217,8 +215,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const
const cellList& c = cells();
const faceList& f = faces();
const labelList& cellAddr =
cellZones()[cellZones().findZoneID("movingCells")];
const labelList& cellAddr = cellZones()["movingCells"];
forAll(cellAddr, cellI)
{
@ -242,8 +239,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const
+ "Zone"
);
const labelList& innerSliderAddr =
faceZones()[faceZones().findZoneID(innerSliderZoneName)];
const labelList& innerSliderAddr = faceZones()[innerSliderZoneName];
forAll(innerSliderAddr, faceI)
{
@ -261,8 +257,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const
+ "Zone"
);
const labelList& outerSliderAddr =
faceZones()[faceZones().findZoneID(outerSliderZoneName)];
const labelList& outerSliderAddr = faceZones()[outerSliderZoneName];
forAll(outerSliderAddr, faceI)
{

View File

@ -290,18 +290,12 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
curLeft_ = average
(
faceZones()
[
faceZones().findZoneID("leftExtrusionFaces")
]().localPoints()
faceZones()["leftExtrusionFaces"]().localPoints()
).x() - SMALL;
curRight_ = average
(
faceZones()
[
faceZones().findZoneID("rightExtrusionFaces")
]().localPoints()
faceZones()["rightExtrusionFaces"]().localPoints()
).x() + SMALL;
}
@ -448,18 +442,12 @@ bool Foam::movingConeTopoFvMesh::update()
// curRight_ += curMotionVel_.x()*time().deltaTValue();
curLeft_ = average
(
faceZones()
[
faceZones().findZoneID("leftExtrusionFaces")
]().localPoints()
faceZones()["leftExtrusionFaces"]().localPoints()
).x() - SMALL;
curRight_ = average
(
faceZones()
[
faceZones().findZoneID("rightExtrusionFaces")
]().localPoints()
faceZones()["rightExtrusionFaces"]().localPoints()
).x() + SMALL;