mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user