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:
@ -63,8 +63,7 @@
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelList& faces =
|
const labelList& faces = mesh.faceZones()[magnetZonei];
|
||||||
mesh.faceZones()[magnetZonei];
|
|
||||||
|
|
||||||
const scalar muri = magnets[i].mur();
|
const scalar muri = magnets[i].mur();
|
||||||
const scalar Mri = magnets[i].Mr().value();
|
const scalar Mri = magnets[i].Mr().value();
|
||||||
|
|||||||
@ -84,10 +84,8 @@
|
|||||||
dimensionedScalar lambda(laminarTransport.lookup("lambda"));
|
dimensionedScalar lambda(laminarTransport.lookup("lambda"));
|
||||||
dimensionedScalar alphaMax(laminarTransport.lookup("alphaMax"));
|
dimensionedScalar alphaMax(laminarTransport.lookup("alphaMax"));
|
||||||
|
|
||||||
const labelList& inletCells =
|
const labelList& inletCells = mesh.boundary()["inlet"].faceCells();
|
||||||
mesh.boundary()[mesh.boundaryMesh().findPatchID("inlet")].faceCells();
|
//const labelList& outletCells = mesh.boundary()["outlet"].faceCells();
|
||||||
//const labelList& outletCells =
|
|
||||||
// mesh.boundary()[mesh.boundaryMesh().findPatchID("outlet")].faceCells();
|
|
||||||
|
|
||||||
volScalarField alpha
|
volScalarField alpha
|
||||||
(
|
(
|
||||||
|
|||||||
@ -220,10 +220,7 @@ int main(int argc, char *argv[])
|
|||||||
# include "createPolyMesh.H"
|
# include "createPolyMesh.H"
|
||||||
|
|
||||||
const word patchName = args[1];
|
const word patchName = args[1];
|
||||||
|
const polyPatch& patch = mesh.boundaryMesh()[patchName];
|
||||||
label patchI = mesh.boundaryMesh().findPatchID(patchName);
|
|
||||||
|
|
||||||
const polyPatch& patch = mesh.boundaryMesh()[patchI];
|
|
||||||
|
|
||||||
Info<< "Patch:" << patch.name() << endl;
|
Info<< "Patch:" << patch.name() << endl;
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,7 @@ Notes for fluentMeshToFoam with zone preservation
|
|||||||
with the cellZones(), faceZones() and pointZones() member functions
|
with the cellZones(), faceZones() and pointZones() member functions
|
||||||
|
|
||||||
- Example (Members from polyMesh.H and ZoneMesh.H):
|
- Example (Members from polyMesh.H and ZoneMesh.H):
|
||||||
label thisCellZoneID = mesh.cellZones().findZoneID("thisZoneName");
|
const labelList& thisCellZone = mesh.cellZones()["thisZoneName"];
|
||||||
const labelList& thisCellZone = mesh.cellZones()[thisCellZoneID];
|
|
||||||
|
|
||||||
- Zone integrity is preserved during mesh modification and decompomposition.
|
- Zone integrity is preserved during mesh modification and decompomposition.
|
||||||
|
|
||||||
|
|||||||
@ -27,10 +27,7 @@
|
|||||||
// Master patch
|
// Master patch
|
||||||
const word masterPatchName(mergePatchPairs[pairI].first());
|
const word masterPatchName(mergePatchPairs[pairI].first());
|
||||||
const polyPatch& masterPatch =
|
const polyPatch& masterPatch =
|
||||||
mesh.boundaryMesh()
|
mesh.boundaryMesh()[masterPatchName];
|
||||||
[
|
|
||||||
mesh.boundaryMesh().findPatchID(masterPatchName)
|
|
||||||
];
|
|
||||||
|
|
||||||
labelList isf(masterPatch.size());
|
labelList isf(masterPatch.size());
|
||||||
|
|
||||||
@ -51,10 +48,7 @@
|
|||||||
// Slave patch
|
// Slave patch
|
||||||
const word slavePatchName(mergePatchPairs[pairI].second());
|
const word slavePatchName(mergePatchPairs[pairI].second());
|
||||||
const polyPatch& slavePatch =
|
const polyPatch& slavePatch =
|
||||||
mesh.boundaryMesh()
|
mesh.boundaryMesh()[slavePatchName];
|
||||||
[
|
|
||||||
mesh.boundaryMesh().findPatchID(slavePatchName)
|
|
||||||
];
|
|
||||||
|
|
||||||
labelList osf(slavePatch.size());
|
labelList osf(slavePatch.size());
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
|||||||
|
|
||||||
label findPatchID(const polyBoundaryMesh& patches, const word& name)
|
label findPatchID(const polyBoundaryMesh& patches, const word& name)
|
||||||
{
|
{
|
||||||
label patchID = patches.findPatchID(name);
|
const label patchID = patches.findPatchID(name);
|
||||||
|
|
||||||
if (patchID == -1)
|
if (patchID == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -849,8 +849,7 @@ int main(int argc, char *argv[])
|
|||||||
nExtrudeFaces = 0;
|
nExtrudeFaces = 0;
|
||||||
forAll(zoneNames, i)
|
forAll(zoneNames, i)
|
||||||
{
|
{
|
||||||
label zoneI = faceZones.findZoneID(zoneNames[i]);
|
const faceZone& fz = faceZones[zoneNames[i]];
|
||||||
const faceZone& fz = faceZones[zoneI];
|
|
||||||
forAll(fz, j)
|
forAll(fz, j)
|
||||||
{
|
{
|
||||||
extrudeTopPatchID[nExtrudeFaces] = interRegionTopPatch[i];
|
extrudeTopPatchID[nExtrudeFaces] = interRegionTopPatch[i];
|
||||||
|
|||||||
@ -107,7 +107,7 @@ void modifyOrAddFace
|
|||||||
|
|
||||||
label findPatchID(const polyMesh& mesh, const word& name)
|
label findPatchID(const polyMesh& mesh, const word& name)
|
||||||
{
|
{
|
||||||
label patchI = mesh.boundaryMesh().findPatchID(name);
|
const label patchI = mesh.boundaryMesh().findPatchID(name);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -678,17 +678,17 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const dictionary& dict = patchSources[addedI];
|
const dictionary& dict = patchSources[addedI];
|
||||||
|
|
||||||
word patchName(dict.lookup("name"));
|
const word patchName(dict.lookup("name"));
|
||||||
|
|
||||||
label destPatchI = patches.findPatchID(patchName);
|
label destPatchI = patches.findPatchID(patchName);
|
||||||
|
|
||||||
if (destPatchI == -1)
|
if (destPatchI == -1)
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable()) << "patch " << patchName
|
FatalErrorIn(args.executable())
|
||||||
<< " not added. Problem." << abort(FatalError);
|
<< "patch " << patchName << " not added. Problem."
|
||||||
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
word sourceType(dict.lookup("constructFrom"));
|
const word sourceType(dict.lookup("constructFrom"));
|
||||||
|
|
||||||
if (sourceType == "patches")
|
if (sourceType == "patches")
|
||||||
{
|
{
|
||||||
@ -716,7 +716,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (sourceType == "set")
|
else if (sourceType == "set")
|
||||||
{
|
{
|
||||||
word setName(dict.lookup("set"));
|
const word setName(dict.lookup("set"));
|
||||||
|
|
||||||
faceSet faces(mesh, setName);
|
faceSet faces(mesh, setName);
|
||||||
|
|
||||||
|
|||||||
@ -85,12 +85,12 @@ label findEdge(const primitiveMesh& mesh, const label v0, const label v1)
|
|||||||
// Checks whether patch present
|
// Checks whether patch present
|
||||||
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
|
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
|
||||||
{
|
{
|
||||||
label patchI = bMesh.findPatchID(name);
|
const label patchI = bMesh.findPatchID(name);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)")
|
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
|
<< "It should be present but of zero size" << endl
|
||||||
<< "Valid patches are " << bMesh.names()
|
<< "Valid patches are " << bMesh.names()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|||||||
@ -170,7 +170,7 @@ label addCellZone(const polyMesh& mesh, const word& name)
|
|||||||
// Checks whether patch present
|
// Checks whether patch present
|
||||||
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
|
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
|
||||||
{
|
{
|
||||||
label patchI = bMesh.findPatchID(name);
|
const label patchI = bMesh.findPatchID(name);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
@ -312,11 +312,7 @@ int main(int argc, char *argv[])
|
|||||||
// Create and add face zones and mesh modifiers
|
// Create and add face zones and mesh modifiers
|
||||||
|
|
||||||
// Master patch
|
// Master patch
|
||||||
const polyPatch& masterPatch =
|
const polyPatch& masterPatch = mesh.boundaryMesh()[masterPatchName];
|
||||||
mesh.boundaryMesh()
|
|
||||||
[
|
|
||||||
mesh.boundaryMesh().findPatchID(masterPatchName)
|
|
||||||
];
|
|
||||||
|
|
||||||
// Make list of masterPatch faces
|
// Make list of masterPatch faces
|
||||||
labelList isf(masterPatch.size());
|
labelList isf(masterPatch.size());
|
||||||
@ -373,11 +369,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Slave patch
|
// Slave patch
|
||||||
const polyPatch& slavePatch =
|
const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchName];
|
||||||
mesh.boundaryMesh()
|
|
||||||
[
|
|
||||||
mesh.boundaryMesh().findPatchID(slavePatchName)
|
|
||||||
];
|
|
||||||
|
|
||||||
labelList osf(slavePatch.size());
|
labelList osf(slavePatch.size());
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
|
|
||||||
forAll(pNames, i)
|
forAll(pNames, i)
|
||||||
{
|
{
|
||||||
label patchI = patches.findPatchID(pNames[i]);
|
const label patchI = patches.findPatchID(pNames[i]);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -328,7 +328,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
VTK_POLYHEDRON,
|
VTK_POLYHEDRON,
|
||||||
nodeCount,
|
nodeCount,
|
||||||
uniqueNodeIds.data(),
|
uniqueNodeIds.data(),
|
||||||
faceCount,
|
nFaces,
|
||||||
faceLabels.data()
|
faceLabels.data()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -236,7 +236,7 @@ Foam::channelIndex::channelIndex
|
|||||||
|
|
||||||
forAll(patchNames, i)
|
forAll(patchNames, i)
|
||||||
{
|
{
|
||||||
label patchI = patches.findPatchID(patchNames[i]);
|
const label patchI = patches.findPatchID(patchNames[i]);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
@ -254,7 +254,7 @@ Foam::channelIndex::channelIndex
|
|||||||
|
|
||||||
forAll(patchNames, i)
|
forAll(patchNames, i)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patches.findPatchID(patchNames[i])];
|
const polyPatch& pp = patches[patchNames[i]];
|
||||||
|
|
||||||
forAll(pp, j)
|
forAll(pp, j)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -65,8 +65,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
mesh.readUpdate();
|
mesh.readUpdate();
|
||||||
|
|
||||||
label patchi = mesh.boundaryMesh().findPatchID(patchName);
|
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
|
||||||
if (patchi < 0)
|
if (patchI < 0)
|
||||||
{
|
{
|
||||||
FatalError
|
FatalError
|
||||||
<< "Unable to find patch " << patchName << nl
|
<< "Unable to find patch " << patchName << nl
|
||||||
@ -78,20 +78,20 @@ int main(int argc, char *argv[])
|
|||||||
Info<< " Reading volScalarField " << fieldName << endl;
|
Info<< " Reading volScalarField " << fieldName << endl;
|
||||||
volScalarField field(fieldHeader, mesh);
|
volScalarField field(fieldHeader, mesh);
|
||||||
|
|
||||||
scalar area = gSum(mesh.magSf().boundaryField()[patchi]);
|
scalar area = gSum(mesh.magSf().boundaryField()[patchI]);
|
||||||
scalar sumField = 0;
|
scalar sumField = 0;
|
||||||
|
|
||||||
if (area > 0)
|
if (area > 0)
|
||||||
{
|
{
|
||||||
sumField = gSum
|
sumField = gSum
|
||||||
(
|
(
|
||||||
mesh.magSf().boundaryField()[patchi]
|
mesh.magSf().boundaryField()[patchI]
|
||||||
* field.boundaryField()[patchi]
|
* field.boundaryField()[patchI]
|
||||||
) / area;
|
) / area;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< " Average of " << fieldName << " over patch "
|
Info<< " Average of " << fieldName << " over patch "
|
||||||
<< patchName << '[' << patchi << ']' << " = "
|
<< patchName << '[' << patchI << ']' << " = "
|
||||||
<< sumField << endl;
|
<< sumField << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -67,8 +67,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
mesh.readUpdate();
|
mesh.readUpdate();
|
||||||
|
|
||||||
label patchi = mesh.boundaryMesh().findPatchID(patchName);
|
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
|
||||||
if (patchi < 0)
|
if (patchI < 0)
|
||||||
{
|
{
|
||||||
FatalError
|
FatalError
|
||||||
<< "Unable to find patch " << patchName << nl
|
<< "Unable to find patch " << patchName << nl
|
||||||
@ -76,16 +76,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Give patch area
|
// Give patch area
|
||||||
if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchi]))
|
if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchI]))
|
||||||
{
|
{
|
||||||
Info<< " Cyclic patch vector area: " << nl;
|
Info<< " Cyclic patch vector area: " << nl;
|
||||||
label nFaces = mesh.boundaryMesh()[patchi].size();
|
label nFaces = mesh.boundaryMesh()[patchI].size();
|
||||||
vector sum1 = vector::zero;
|
vector sum1 = vector::zero;
|
||||||
vector sum2 = vector::zero;
|
vector sum2 = vector::zero;
|
||||||
for (label i=0; i<nFaces/2; i++)
|
for (label i=0; i<nFaces/2; i++)
|
||||||
{
|
{
|
||||||
sum1 += mesh.Sf().boundaryField()[patchi][i];
|
sum1 += mesh.Sf().boundaryField()[patchI][i];
|
||||||
sum2 += mesh.Sf().boundaryField()[patchi][i+nFaces/2];
|
sum2 += mesh.Sf().boundaryField()[patchI][i+nFaces/2];
|
||||||
}
|
}
|
||||||
reduce(sum1, sumOp<vector>());
|
reduce(sum1, sumOp<vector>());
|
||||||
reduce(sum2, sumOp<vector>());
|
reduce(sum2, sumOp<vector>());
|
||||||
@ -94,16 +94,16 @@ int main(int argc, char *argv[])
|
|||||||
<< " - total = " << (sum1 + sum2) << ", "
|
<< " - total = " << (sum1 + sum2) << ", "
|
||||||
<< mag(sum1 + sum2) << endl;
|
<< mag(sum1 + sum2) << endl;
|
||||||
Info<< " Cyclic patch area magnitude = "
|
Info<< " Cyclic patch area magnitude = "
|
||||||
<< gSum(mesh.magSf().boundaryField()[patchi])/2.0 << endl;
|
<< gSum(mesh.magSf().boundaryField()[patchI])/2.0 << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< " Area vector of patch "
|
Info<< " Area vector of patch "
|
||||||
<< patchName << '[' << patchi << ']' << " = "
|
<< patchName << '[' << patchI << ']' << " = "
|
||||||
<< gSum(mesh.Sf().boundaryField()[patchi]) << endl;
|
<< gSum(mesh.Sf().boundaryField()[patchI]) << endl;
|
||||||
Info<< " Area magnitude of patch "
|
Info<< " Area magnitude of patch "
|
||||||
<< patchName << '[' << patchi << ']' << " = "
|
<< patchName << '[' << patchI << ']' << " = "
|
||||||
<< gSum(mesh.magSf().boundaryField()[patchi]) << endl;
|
<< gSum(mesh.magSf().boundaryField()[patchI]) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read field and calc integral
|
// Read field and calc integral
|
||||||
@ -116,21 +116,21 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< " Integral of " << fieldName
|
Info<< " Integral of " << fieldName
|
||||||
<< " over vector area of patch "
|
<< " over vector area of patch "
|
||||||
<< patchName << '[' << patchi << ']' << " = "
|
<< patchName << '[' << patchI << ']' << " = "
|
||||||
<< gSum
|
<< gSum
|
||||||
(
|
(
|
||||||
mesh.Sf().boundaryField()[patchi]
|
mesh.Sf().boundaryField()[patchI]
|
||||||
*field.boundaryField()[patchi]
|
*field.boundaryField()[patchI]
|
||||||
)
|
)
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
Info<< " Integral of " << fieldName
|
Info<< " Integral of " << fieldName
|
||||||
<< " over area magnitude of patch "
|
<< " over area magnitude of patch "
|
||||||
<< patchName << '[' << patchi << ']' << " = "
|
<< patchName << '[' << patchI << ']' << " = "
|
||||||
<< gSum
|
<< gSum
|
||||||
(
|
(
|
||||||
mesh.magSf().boundaryField()[patchi]
|
mesh.magSf().boundaryField()[patchI]
|
||||||
*field.boundaryField()[patchi]
|
*field.boundaryField()[patchI]
|
||||||
)
|
)
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
@ -143,10 +143,10 @@ int main(int argc, char *argv[])
|
|||||||
<< fieldName << endl;
|
<< fieldName << endl;
|
||||||
|
|
||||||
surfaceScalarField field(fieldHeader, mesh);
|
surfaceScalarField field(fieldHeader, mesh);
|
||||||
scalar sumField = gSum(field.boundaryField()[patchi]);
|
scalar sumField = gSum(field.boundaryField()[patchI]);
|
||||||
|
|
||||||
Info<< " Integral of " << fieldName << " over patch "
|
Info<< " Integral of " << fieldName << " over patch "
|
||||||
<< patchName << '[' << patchi << ']' << " = "
|
<< patchName << '[' << patchI << ']' << " = "
|
||||||
<< sumField << nl;
|
<< sumField << nl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
|
|||||||
forAll(patchNames, patchNameI)
|
forAll(patchNames, patchNameI)
|
||||||
{
|
{
|
||||||
const word& patchName = patchNames[patchNameI];
|
const word& patchName = patchNames[patchNameI];
|
||||||
label patchI = bMesh.findPatchID(patchName);
|
const label patchI = bMesh.findPatchID(patchName);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -120,9 +120,9 @@ Foam::polyBoundaryMesh::~polyBoundaryMesh()
|
|||||||
|
|
||||||
void Foam::polyBoundaryMesh::clearGeom()
|
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();
|
neighbourEdgesPtr_.clear();
|
||||||
patchIDPtr_.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
|
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(*this, patchi)
|
forAll(*this, patchI)
|
||||||
{
|
{
|
||||||
operator[](patchi).initGeometry(pBufs);
|
operator[](patchI).initGeometry(pBufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
|
|
||||||
forAll(*this, patchi)
|
forAll(*this, patchI)
|
||||||
{
|
{
|
||||||
operator[](patchi).calcGeometry(pBufs);
|
operator[](patchI).calcGeometry(pBufs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||||
@ -172,15 +172,15 @@ void Foam::polyBoundaryMesh::calcGeometry()
|
|||||||
|
|
||||||
forAll(patchSchedule, patchEvali)
|
forAll(patchSchedule, patchEvali)
|
||||||
{
|
{
|
||||||
label patchi = patchSchedule[patchEvali].patch;
|
const label patchI = patchSchedule[patchEvali].patch;
|
||||||
|
|
||||||
if (patchSchedule[patchEvali].init)
|
if (patchSchedule[patchEvali].init)
|
||||||
{
|
{
|
||||||
operator[](patchi).initGeometry(pBufs);
|
operator[](patchI).initGeometry(pBufs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operator[](patchi).calcGeometry(pBufs);
|
operator[](patchI).calcGeometry(pBufs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,15 +204,15 @@ Foam::polyBoundaryMesh::neighbourEdges() const
|
|||||||
|
|
||||||
// Initialize.
|
// Initialize.
|
||||||
label nEdgePairs = 0;
|
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[0] = -1;
|
||||||
edgeInfo[1] = -1;
|
edgeInfo[1] = -1;
|
||||||
@ -225,9 +225,9 @@ Foam::polyBoundaryMesh::neighbourEdges() const
|
|||||||
// point addressing) to patch + relative edge index.
|
// point addressing) to patch + relative edge index.
|
||||||
HashTable<labelPair, edge, Hash<edge> > pointsToEdge(nEdgePairs);
|
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();
|
const edgeList& edges = pp.edges();
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
|
|||||||
meshEdge,
|
meshEdge,
|
||||||
labelPair
|
labelPair
|
||||||
(
|
(
|
||||||
patchi,
|
patchI,
|
||||||
edgei - pp.nInternalEdges()
|
edgei - pp.nInternalEdges()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -266,11 +266,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const
|
|||||||
// Second occurrence. Store.
|
// Second occurrence. Store.
|
||||||
const labelPair& edgeInfo = fnd();
|
const labelPair& edgeInfo = fnd();
|
||||||
|
|
||||||
neighbourEdges[patchi][edgei - pp.nInternalEdges()] =
|
neighbourEdges[patchI][edgei - pp.nInternalEdges()] =
|
||||||
edgeInfo;
|
edgeInfo;
|
||||||
|
|
||||||
neighbourEdges[edgeInfo[0]][edgeInfo[1]]
|
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
|
// Found all two occurrences of this edge so remove from
|
||||||
// hash to save space. Note that this will give lots of
|
// hash to save space. Note that this will give lots of
|
||||||
@ -288,11 +288,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const
|
|||||||
<< abort(FatalError);
|
<< 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)
|
forAll(nbrEdges, i)
|
||||||
{
|
{
|
||||||
@ -409,8 +409,7 @@ Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const
|
|||||||
// Patch not found
|
// Patch not found
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "label polyBoundaryMesh::findPatchID(const word& "
|
Pout<< "label polyBoundaryMesh::findPatchID(const word&) const"
|
||||||
<< "patchName) const"
|
|
||||||
<< "Patch named " << patchName << " not found. "
|
<< "Patch named " << patchName << " not found. "
|
||||||
<< "List of available patch names: " << names() << endl;
|
<< "List of available patch names: " << names() << endl;
|
||||||
}
|
}
|
||||||
@ -641,16 +640,16 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
|
|||||||
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(*this, patchi)
|
forAll(*this, patchI)
|
||||||
{
|
{
|
||||||
operator[](patchi).initMovePoints(pBufs, p);
|
operator[](patchI).initMovePoints(pBufs, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
|
|
||||||
forAll(*this, patchi)
|
forAll(*this, patchI)
|
||||||
{
|
{
|
||||||
operator[](patchi).movePoints(pBufs, p);
|
operator[](patchI).movePoints(pBufs, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||||
@ -662,15 +661,15 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
|
|||||||
|
|
||||||
forAll(patchSchedule, patchEvali)
|
forAll(patchSchedule, patchEvali)
|
||||||
{
|
{
|
||||||
label patchi = patchSchedule[patchEvali].patch;
|
const label patchI = patchSchedule[patchEvali].patch;
|
||||||
|
|
||||||
if (patchSchedule[patchEvali].init)
|
if (patchSchedule[patchEvali].init)
|
||||||
{
|
{
|
||||||
operator[](patchi).initMovePoints(pBufs, p);
|
operator[](patchI).initMovePoints(pBufs, p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operator[](patchi).movePoints(pBufs, p);
|
operator[](patchI).movePoints(pBufs, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -690,16 +689,16 @@ void Foam::polyBoundaryMesh::updateMesh()
|
|||||||
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(*this, patchi)
|
forAll(*this, patchI)
|
||||||
{
|
{
|
||||||
operator[](patchi).initUpdateMesh(pBufs);
|
operator[](patchI).initUpdateMesh(pBufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
|
|
||||||
forAll(*this, patchi)
|
forAll(*this, patchI)
|
||||||
{
|
{
|
||||||
operator[](patchi).updateMesh(pBufs);
|
operator[](patchI).updateMesh(pBufs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||||
@ -711,15 +710,15 @@ void Foam::polyBoundaryMesh::updateMesh()
|
|||||||
|
|
||||||
forAll(patchSchedule, patchEvali)
|
forAll(patchSchedule, patchEvali)
|
||||||
{
|
{
|
||||||
label patchi = patchSchedule[patchEvali].patch;
|
const label patchI = patchSchedule[patchEvali].patch;
|
||||||
|
|
||||||
if (patchSchedule[patchEvali].init)
|
if (patchSchedule[patchEvali].init)
|
||||||
{
|
{
|
||||||
operator[](patchi).initUpdateMesh(pBufs);
|
operator[](patchI).initUpdateMesh(pBufs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operator[](patchi).updateMesh(pBufs);
|
operator[](patchI).updateMesh(pBufs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -734,9 +733,9 @@ void Foam::polyBoundaryMesh::reorder(const UList<label>& oldToNew)
|
|||||||
// Adapt indices
|
// Adapt indices
|
||||||
polyPatchList& patches = *this;
|
polyPatchList& patches = *this;
|
||||||
|
|
||||||
forAll(patches, patchi)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
patches[patchi].index() = patchi;
|
patches[patchI].index() = patchI;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMesh();
|
updateMesh();
|
||||||
@ -749,11 +748,11 @@ bool Foam::polyBoundaryMesh::writeData(Ostream& os) const
|
|||||||
|
|
||||||
os << patches.size() << nl << token::BEGIN_LIST << incrIndent << nl;
|
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
|
<< indent << token::BEGIN_BLOCK << nl
|
||||||
<< incrIndent << patches[patchi] << decrIndent
|
<< incrIndent << patches[patchI] << decrIndent
|
||||||
<< indent << token::END_BLOCK << endl;
|
<< indent << token::END_BLOCK << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,6 +775,49 @@ bool Foam::polyBoundaryMesh::writeObject
|
|||||||
return regIOobject::writeObject(fmt, ver, IOstream::UNCOMPRESSED);
|
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 * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ public:
|
|||||||
void clearAddressing();
|
void clearAddressing();
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the mesh reference
|
//- Return the mesh reference
|
||||||
const polyMesh& mesh() const
|
const polyMesh& mesh() const
|
||||||
@ -194,6 +194,17 @@ public:
|
|||||||
IOstream::compressionType cmp
|
IOstream::compressionType cmp
|
||||||
) const;
|
) 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
|
// Ostream operator
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -27,15 +27,10 @@ License
|
|||||||
#include "entry.H"
|
#include "entry.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ZoneType, class MeshType>
|
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
|
// It is an error to attempt to recalculate cellEdges
|
||||||
// if the pointer is already set
|
// if the pointer is already set
|
||||||
@ -77,7 +72,7 @@ void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
|
|||||||
|
|
||||||
// Read constructor given IOobject and a MeshType reference
|
// Read constructor given IOobject and a MeshType reference
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
ZoneMesh<ZoneType, MeshType>::ZoneMesh
|
Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const MeshType& mesh
|
const MeshType& mesh
|
||||||
@ -136,7 +131,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh
|
|||||||
|
|
||||||
// Construct given size. Zones will be set later
|
// Construct given size. Zones will be set later
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
ZoneMesh<ZoneType, MeshType>::ZoneMesh
|
Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const MeshType& mesh,
|
const MeshType& mesh,
|
||||||
@ -153,7 +148,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh
|
|||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
|
Foam::ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
|
||||||
{
|
{
|
||||||
clearAddressing();
|
clearAddressing();
|
||||||
}
|
}
|
||||||
@ -163,7 +158,8 @@ ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
|
|||||||
|
|
||||||
// Map of zones for quick zone lookup
|
// Map of zones for quick zone lookup
|
||||||
template<class ZoneType, class MeshType>
|
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_)
|
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.
|
// Given a global object index, return the zone it is in.
|
||||||
// If object does not belong to any zones, return -1
|
// If object does not belong to any zones, return -1
|
||||||
template<class ZoneType, class MeshType>
|
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();
|
const Map<label>& zm = zoneMap();
|
||||||
Map<label>::const_iterator zmIter = zm.find(objectIndex);
|
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
|
// Return a list of zone names
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
wordList ZoneMesh<ZoneType, MeshType>::types() const
|
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::types() const
|
||||||
{
|
{
|
||||||
const PtrList<ZoneType>& zones = *this;
|
const PtrList<ZoneType>& zones = *this;
|
||||||
|
|
||||||
wordList t(zones.size());
|
wordList lst(zones.size());
|
||||||
|
|
||||||
forAll(zones, zoneI)
|
forAll(zones, zoneI)
|
||||||
{
|
{
|
||||||
t[zoneI] = zones[zoneI].type();
|
lst[zoneI] = zones[zoneI].type();
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Return a list of zone names
|
// Return a list of zone names
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
wordList ZoneMesh<ZoneType, MeshType>::names() const
|
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names() const
|
||||||
{
|
{
|
||||||
const PtrList<ZoneType>& zones = *this;
|
const PtrList<ZoneType>& zones = *this;
|
||||||
|
|
||||||
wordList t(zones.size());
|
wordList lst(zones.size());
|
||||||
|
|
||||||
forAll(zones, zoneI)
|
forAll(zones, zoneI)
|
||||||
{
|
{
|
||||||
t[zoneI] = zones[zoneI].name();
|
lst[zoneI] = zones[zoneI].name();
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ZoneType, class MeshType>
|
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;
|
const PtrList<ZoneType>& zones = *this;
|
||||||
|
|
||||||
@ -243,19 +245,18 @@ label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const
|
|||||||
// Zone not found
|
// Zone not found
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "label ZoneMesh<ZoneType>::findZoneID(const word& "
|
Info<< "label ZoneMesh<ZoneType>::findZoneID(const word&) const : "
|
||||||
<< "zoneName) const : "
|
|
||||||
<< "Zone named " << zoneName << " not found. "
|
<< "Zone named " << zoneName << " not found. "
|
||||||
<< "List of available zone names: " << names() << endl;
|
<< "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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
void ZoneMesh<ZoneType, MeshType>::clearAddressing()
|
void Foam::ZoneMesh<ZoneType, MeshType>::clearAddressing()
|
||||||
{
|
{
|
||||||
deleteDemandDrivenData(zoneMapPtr_);
|
deleteDemandDrivenData(zoneMapPtr_);
|
||||||
|
|
||||||
@ -269,7 +270,7 @@ void ZoneMesh<ZoneType, MeshType>::clearAddressing()
|
|||||||
|
|
||||||
|
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
void ZoneMesh<ZoneType, MeshType>::clear()
|
void Foam::ZoneMesh<ZoneType, MeshType>::clear()
|
||||||
{
|
{
|
||||||
clearAddressing();
|
clearAddressing();
|
||||||
PtrList<ZoneType>::clear();
|
PtrList<ZoneType>::clear();
|
||||||
@ -278,7 +279,10 @@ void ZoneMesh<ZoneType, MeshType>::clear()
|
|||||||
|
|
||||||
// Check zone definition
|
// Check zone definition
|
||||||
template<class ZoneType, class MeshType>
|
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;
|
bool inError = false;
|
||||||
|
|
||||||
@ -294,7 +298,7 @@ bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const
|
|||||||
|
|
||||||
// Correct zone mesh after moving points
|
// Correct zone mesh after moving points
|
||||||
template<class ZoneType, class MeshType>
|
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;
|
PtrList<ZoneType>& zones = *this;
|
||||||
|
|
||||||
@ -307,17 +311,66 @@ void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
|
|||||||
|
|
||||||
// writeData member function required by regIOobject
|
// writeData member function required by regIOobject
|
||||||
template<class ZoneType, class MeshType>
|
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();
|
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 * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ZoneType, class MeshType>
|
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;
|
os << zones.size() << nl << token::BEGIN_LIST;
|
||||||
|
|
||||||
@ -332,8 +385,4 @@ Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -109,7 +109,7 @@ public:
|
|||||||
~ZoneMesh();
|
~ZoneMesh();
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the mesh reference
|
//- Return the mesh reference
|
||||||
const MeshType& mesh() const
|
const MeshType& mesh() const
|
||||||
@ -149,6 +149,17 @@ public:
|
|||||||
//- writeData member function required by regIOobject
|
//- writeData member function required by regIOobject
|
||||||
bool writeData(Ostream&) const;
|
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
|
// Ostream operator
|
||||||
|
|
||||||
|
|||||||
@ -1125,13 +1125,11 @@ void Foam::boundaryMesh::patchify
|
|||||||
forAll(oldPatches, oldPatchI)
|
forAll(oldPatches, oldPatchI)
|
||||||
{
|
{
|
||||||
const polyPatch& patch = oldPatches[oldPatchI];
|
const polyPatch& patch = oldPatches[oldPatchI];
|
||||||
|
const label newPatchI = findPatchID(patch.name());
|
||||||
label newPatchI = findPatchID(patch.name());
|
|
||||||
|
|
||||||
if (newPatchI != -1)
|
if (newPatchI != -1)
|
||||||
{
|
{
|
||||||
nameToIndex.insert(patch.name(), newPatchI);
|
nameToIndex.insert(patch.name(), newPatchI);
|
||||||
|
|
||||||
indexToName.insert(newPatchI, patch.name());
|
indexToName.insert(newPatchI, patch.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1145,7 +1143,6 @@ void Foam::boundaryMesh::patchify
|
|||||||
if (!nameToIndex.found(bp.name()))
|
if (!nameToIndex.found(bp.name()))
|
||||||
{
|
{
|
||||||
nameToIndex.insert(bp.name(), bPatchI);
|
nameToIndex.insert(bp.name(), bPatchI);
|
||||||
|
|
||||||
indexToName.insert(bPatchI, bp.name());
|
indexToName.insert(bPatchI, bp.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1167,10 +1164,10 @@ void Foam::boundaryMesh::patchify
|
|||||||
{
|
{
|
||||||
const boundaryPatch& bp = patches_[bPatchI];
|
const boundaryPatch& bp = patches_[bPatchI];
|
||||||
|
|
||||||
label newPatchI = nameToIndex[bp.name()];
|
const label newPatchI = nameToIndex[bp.name()];
|
||||||
|
|
||||||
// Find corresponding patch in polyMesh
|
// Find corresponding patch in polyMesh
|
||||||
label oldPatchI = findPatchID(oldPatches, bp.name());
|
const label oldPatchI = findPatchID(oldPatches, bp.name());
|
||||||
|
|
||||||
if (oldPatchI == -1)
|
if (oldPatchI == -1)
|
||||||
{
|
{
|
||||||
@ -1599,7 +1596,7 @@ void Foam::boundaryMesh::addPatch(const word& patchName)
|
|||||||
|
|
||||||
void Foam::boundaryMesh::deletePatch(const word& patchName)
|
void Foam::boundaryMesh::deletePatch(const word& patchName)
|
||||||
{
|
{
|
||||||
label delPatchI = findPatchID(patchName);
|
const label delPatchI = findPatchID(patchName);
|
||||||
|
|
||||||
if (delPatchI == -1)
|
if (delPatchI == -1)
|
||||||
{
|
{
|
||||||
@ -1658,7 +1655,7 @@ void Foam::boundaryMesh::changePatchType
|
|||||||
const word& patchType
|
const word& patchType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label changeI = findPatchID(patchName);
|
const label changeI = findPatchID(patchName);
|
||||||
|
|
||||||
if (changeI == -1)
|
if (changeI == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -343,7 +343,7 @@ Foam::directions::directions
|
|||||||
|
|
||||||
const word patchName(patchDict.lookup("patch"));
|
const word patchName(patchDict.lookup("patch"));
|
||||||
|
|
||||||
label patchI = mesh.boundaryMesh().findPatchID(patchName);
|
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -70,16 +70,33 @@ Foam::fvBoundaryMesh::fvBoundaryMesh
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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()
|
||||||
{
|
{
|
||||||
operator[](patchi).movePoints();
|
forAll(*this, patchI)
|
||||||
|
{
|
||||||
|
operator[](patchI).initMovePoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(*this, patchI)
|
||||||
|
{
|
||||||
|
operator[](patchI).movePoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,14 +105,14 @@ Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const
|
|||||||
{
|
{
|
||||||
lduInterfacePtrsList interfaces(size());
|
lduInterfacePtrsList interfaces(size());
|
||||||
|
|
||||||
forAll(interfaces, patchi)
|
forAll(interfaces, patchI)
|
||||||
{
|
{
|
||||||
if (isA<lduInterface>(this->operator[](patchi)))
|
if (isA<lduInterface>(this->operator[](patchI)))
|
||||||
{
|
{
|
||||||
interfaces.set
|
interfaces.set
|
||||||
(
|
(
|
||||||
patchi,
|
patchI,
|
||||||
&refCast<const lduInterface>(this->operator[](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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -54,8 +54,6 @@ class fvBoundaryMesh
|
|||||||
:
|
:
|
||||||
public fvPatchList
|
public fvPatchList
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to mesh
|
//- Reference to mesh
|
||||||
@ -101,7 +99,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
@ -115,9 +113,24 @@ public:
|
|||||||
// with only those pointing to interfaces being set
|
// with only those pointing to interfaces being set
|
||||||
lduInterfacePtrsList interfaces() const;
|
lduInterfacePtrsList interfaces() const;
|
||||||
|
|
||||||
|
//- Find patch index given a name
|
||||||
|
label findPatchID(const word& patchName) const;
|
||||||
|
|
||||||
|
|
||||||
//- Correct patches after moving points
|
//- Correct patches after moving points
|
||||||
void movePoints();
|
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&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -148,8 +148,7 @@ displacementInterpolationFvMotionSolver
|
|||||||
forAll(faceZoneToTable, i)
|
forAll(faceZoneToTable, i)
|
||||||
{
|
{
|
||||||
const word& zoneName = faceZoneToTable[i][0];
|
const word& zoneName = faceZoneToTable[i][0];
|
||||||
label zoneI = fZones.findZoneID(zoneName);
|
const faceZone& fz = fZones[zoneName];
|
||||||
const faceZone& fz = fZones[zoneI];
|
|
||||||
|
|
||||||
scalar minCoord = VGREAT;
|
scalar minCoord = VGREAT;
|
||||||
scalar maxCoord = -VGREAT;
|
scalar maxCoord = -VGREAT;
|
||||||
|
|||||||
@ -353,8 +353,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve
|
|||||||
const dictionary& faceZoneDict = patchIter().dict();
|
const dictionary& faceZoneDict = patchIter().dict();
|
||||||
|
|
||||||
// Determine the points of the faceZone within the cellZone
|
// Determine the points of the faceZone within the cellZone
|
||||||
label zoneI = mesh().faceZones().findZoneID(faceZoneName);
|
const faceZone& fz = mesh().faceZones()[faceZoneName];
|
||||||
const faceZone& fz = mesh().faceZones()[zoneI];
|
|
||||||
const labelList& fzMeshPoints = fz().meshPoints();
|
const labelList& fzMeshPoints = fz().meshPoints();
|
||||||
DynamicList<label> meshPoints(fzMeshPoints.size());
|
DynamicList<label> meshPoints(fzMeshPoints.size());
|
||||||
forAll(fzMeshPoints, i)
|
forAll(fzMeshPoints, i)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
|
|||||||
|
|
||||||
forAll(patchNames_, i)
|
forAll(patchNames_, i)
|
||||||
{
|
{
|
||||||
label pID = bdry.findPatchID(patchNames_[i]);
|
const label pID = bdry.findPatchID(patchNames_[i]);
|
||||||
|
|
||||||
if (pID > -1)
|
if (pID > -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
|
|||||||
|
|
||||||
forAll(patchNames_, i)
|
forAll(patchNames_, i)
|
||||||
{
|
{
|
||||||
label pID = bdry.findPatchID(patchNames_[i]);
|
const label pID = bdry.findPatchID(patchNames_[i]);
|
||||||
|
|
||||||
if (pID > -1)
|
if (pID > -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -87,7 +87,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
|
|||||||
{
|
{
|
||||||
const pointZoneMesh& pZones = mesh.pointZones();
|
const pointZoneMesh& pZones = mesh.pointZones();
|
||||||
|
|
||||||
zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)];
|
zonePtr = &pZones[frozenPointsZone_];
|
||||||
|
|
||||||
Pout<< "surfaceDisplacementPointPatchVectorField : Fixing all "
|
Pout<< "surfaceDisplacementPointPatchVectorField : Fixing all "
|
||||||
<< zonePtr->size() << " points in pointZone " << zonePtr->name()
|
<< zonePtr->size() << " points in pointZone " << zonePtr->name()
|
||||||
|
|||||||
@ -86,7 +86,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
|
|||||||
{
|
{
|
||||||
const pointZoneMesh& pZones = mesh.pointZones();
|
const pointZoneMesh& pZones = mesh.pointZones();
|
||||||
|
|
||||||
zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)];
|
zonePtr = &pZones[frozenPointsZone_];
|
||||||
|
|
||||||
Pout<< "surfaceSlipDisplacementPointPatchVectorField : Fixing all "
|
Pout<< "surfaceSlipDisplacementPointPatchVectorField : Fixing all "
|
||||||
<< zonePtr->size() << " points in pointZone " << zonePtr->name()
|
<< zonePtr->size() << " points in pointZone " << zonePtr->name()
|
||||||
|
|||||||
@ -101,7 +101,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
|
|||||||
cellOwners_(),
|
cellOwners_(),
|
||||||
fraction_(1.0)
|
fraction_(1.0)
|
||||||
{
|
{
|
||||||
label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_);
|
const label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_);
|
||||||
|
|
||||||
if (patchId < 0)
|
if (patchId < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,7 +128,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
|
|||||||
{
|
{
|
||||||
forAll(patchNames_, patchI)
|
forAll(patchNames_, patchI)
|
||||||
{
|
{
|
||||||
label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
|
const label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
|
|||||||
@ -70,9 +70,7 @@ Foam::Map<Foam::label> Foam::autoSnapDriver::getZoneBafflePatches
|
|||||||
if (faceZoneNames[surfI].size())
|
if (faceZoneNames[surfI].size())
|
||||||
{
|
{
|
||||||
// Get zone
|
// Get zone
|
||||||
label zoneI = fZones.findZoneID(faceZoneNames[surfI]);
|
const faceZone& fZone = fZones[faceZoneNames[surfI]];
|
||||||
|
|
||||||
const faceZone& fZone = fZones[zoneI];
|
|
||||||
|
|
||||||
//// Get patch allocated for zone
|
//// Get patch allocated for zone
|
||||||
//label patchI = surfaceToCyclicPatch_[surfI];
|
//label patchI = surfaceToCyclicPatch_[surfI];
|
||||||
@ -1311,11 +1309,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
|
|||||||
|
|
||||||
forAll(zonedSurfaces, i)
|
forAll(zonedSurfaces, i)
|
||||||
{
|
{
|
||||||
label zoneSurfI = zonedSurfaces[i];
|
const label zoneSurfI = zonedSurfaces[i];
|
||||||
|
const faceZone& fZone = fZones[faceZoneNames[zoneSurfI]];
|
||||||
label zoneI = fZones.findZoneID(faceZoneNames[zoneSurfI]);
|
|
||||||
|
|
||||||
const faceZone& fZone = fZones[zoneI];
|
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1119,9 +1119,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
|
|||||||
if (fzNames[surfI].size())
|
if (fzNames[surfI].size())
|
||||||
{
|
{
|
||||||
// Get zone
|
// Get zone
|
||||||
label zoneI = fZones.findZoneID(fzNames[surfI]);
|
const faceZone& fZone = fZones[fzNames[surfI]];
|
||||||
|
|
||||||
const faceZone& fZone = fZones[zoneI];
|
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
@ -1540,7 +1538,7 @@ Foam::label Foam::meshRefinement::addPatch
|
|||||||
polyBoundaryMesh& polyPatches =
|
polyBoundaryMesh& polyPatches =
|
||||||
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
|
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
|
||||||
|
|
||||||
label patchI = polyPatches.findPatchID(patchName);
|
const label patchI = polyPatches.findPatchID(patchName);
|
||||||
if (patchI != -1)
|
if (patchI != -1)
|
||||||
{
|
{
|
||||||
if (polyPatches[patchI].type() == patchType)
|
if (polyPatches[patchI].type() == patchType)
|
||||||
|
|||||||
@ -744,7 +744,7 @@ const Foam::polyPatch& Foam::directMappedPatchBase::samplePolyPatch() const
|
|||||||
{
|
{
|
||||||
const polyMesh& nbrMesh = sampleMesh();
|
const polyMesh& nbrMesh = sampleMesh();
|
||||||
|
|
||||||
label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_);
|
const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,12 +30,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
defineTypeNameAndDebug(Foam::searchableSurfaces, 0);
|
||||||
{
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(searchableSurfaces, 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -256,8 +251,10 @@ Foam::searchableSurfaces::searchableSurfaces
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::label Foam::searchableSurfaces::findSurfaceID(const word& wantedName)
|
Foam::label Foam::searchableSurfaces::findSurfaceID
|
||||||
const
|
(
|
||||||
|
const word& wantedName
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return findIndex(names_, wantedName);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -174,6 +174,19 @@ public:
|
|||||||
const point& start
|
const point& start
|
||||||
) const;
|
) 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&);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,7 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
|||||||
|
|
||||||
void Foam::fieldValues::faceSource::setPatchFaces()
|
void Foam::fieldValues::faceSource::setPatchFaces()
|
||||||
{
|
{
|
||||||
label patchId = mesh().boundaryMesh().findPatchID(sourceName_);
|
const label patchId = mesh().boundaryMesh().findPatchID(sourceName_);
|
||||||
|
|
||||||
if (patchId < 0)
|
if (patchId < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -304,7 +304,7 @@ bool Foam::sampledIsoSurface::updateGeometry() const
|
|||||||
const polyBoundaryMesh& patches = mesh().boundaryMesh();
|
const polyBoundaryMesh& patches = mesh().boundaryMesh();
|
||||||
|
|
||||||
// Patch to put exposed internal faces into
|
// Patch to put exposed internal faces into
|
||||||
label exposedPatchI = patches.findPatchID(exposedPatchName_);
|
const label exposedPatchI = patches.findPatchID(exposedPatchName_);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -67,7 +67,7 @@ void Foam::sampledCuttingPlane::createGeometry()
|
|||||||
const polyBoundaryMesh& patches = mesh().boundaryMesh();
|
const polyBoundaryMesh& patches = mesh().boundaryMesh();
|
||||||
|
|
||||||
// Patch to put exposed internal faces into
|
// Patch to put exposed internal faces into
|
||||||
label exposedPatchI = patches.findPatchID(exposedPatchName_);
|
const label exposedPatchI = patches.findPatchID(exposedPatchName_);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -111,7 +111,7 @@ bool Foam::sampledPatch::update()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
label patchI = mesh().boundaryMesh().findPatchID(patchName_);
|
const label patchI = mesh().boundaryMesh().findPatchID(patchName_);
|
||||||
|
|
||||||
if (patchI != -1)
|
if (patchI != -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -84,8 +84,7 @@ void Foam::linearValveFvMesh::addZonesAndModifiers()
|
|||||||
|
|
||||||
// Inner slider
|
// Inner slider
|
||||||
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
|
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
|
||||||
const polyPatch& innerSlider =
|
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)];
|
|
||||||
|
|
||||||
labelList isf(innerSlider.size());
|
labelList isf(innerSlider.size());
|
||||||
|
|
||||||
@ -105,8 +104,7 @@ void Foam::linearValveFvMesh::addZonesAndModifiers()
|
|||||||
|
|
||||||
// Outer slider
|
// Outer slider
|
||||||
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
|
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
|
||||||
const polyPatch& outerSlider =
|
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)];
|
|
||||||
|
|
||||||
labelList osf(outerSlider.size());
|
labelList osf(outerSlider.size());
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,6 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(linearValveLayersFvMesh, 0);
|
defineTypeNameAndDebug(linearValveLayersFvMesh, 0);
|
||||||
|
|
||||||
addToRunTimeSelectionTable(topoChangerFvMesh, linearValveLayersFvMesh, IOobject);
|
addToRunTimeSelectionTable(topoChangerFvMesh, linearValveLayersFvMesh, IOobject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +86,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
|
|||||||
|
|
||||||
// Inner slider
|
// Inner slider
|
||||||
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
|
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
|
||||||
const polyPatch& innerSlider =
|
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)];
|
|
||||||
|
|
||||||
labelList isf(innerSlider.size());
|
labelList isf(innerSlider.size());
|
||||||
|
|
||||||
@ -108,8 +106,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
|
|||||||
|
|
||||||
// Outer slider
|
// Outer slider
|
||||||
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
|
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
|
||||||
const polyPatch& outerSlider =
|
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)];
|
|
||||||
|
|
||||||
labelList osf(outerSlider.size());
|
labelList osf(outerSlider.size());
|
||||||
|
|
||||||
@ -143,8 +140,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
|
|||||||
motionDict_.subDict("layer").lookup("patch")
|
motionDict_.subDict("layer").lookup("patch")
|
||||||
);
|
);
|
||||||
|
|
||||||
const polyPatch& layerPatch =
|
const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(layerPatchName)];
|
|
||||||
|
|
||||||
labelList lpf(layerPatch.size());
|
labelList lpf(layerPatch.size());
|
||||||
|
|
||||||
@ -317,8 +313,7 @@ Foam::tmp<Foam::pointField> Foam::linearValveLayersFvMesh::newPoints() const
|
|||||||
motionDict_.subDict("layer").lookup("patch")
|
motionDict_.subDict("layer").lookup("patch")
|
||||||
);
|
);
|
||||||
|
|
||||||
const polyPatch& layerPatch =
|
const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(layerPatchName)];
|
|
||||||
|
|
||||||
const labelList& patchPoints = layerPatch.meshPoints();
|
const labelList& patchPoints = layerPatch.meshPoints();
|
||||||
|
|
||||||
|
|||||||
@ -84,8 +84,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
|
|||||||
|
|
||||||
// Inner slider
|
// Inner slider
|
||||||
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
|
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
|
||||||
const polyPatch& innerSlider =
|
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)];
|
|
||||||
|
|
||||||
labelList isf(innerSlider.size());
|
labelList isf(innerSlider.size());
|
||||||
|
|
||||||
@ -105,8 +104,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
|
|||||||
|
|
||||||
// Outer slider
|
// Outer slider
|
||||||
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
|
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
|
||||||
const polyPatch& outerSlider =
|
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
|
||||||
boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)];
|
|
||||||
|
|
||||||
labelList osf(outerSlider.size());
|
labelList osf(outerSlider.size());
|
||||||
|
|
||||||
@ -217,8 +215,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const
|
|||||||
const cellList& c = cells();
|
const cellList& c = cells();
|
||||||
const faceList& f = faces();
|
const faceList& f = faces();
|
||||||
|
|
||||||
const labelList& cellAddr =
|
const labelList& cellAddr = cellZones()["movingCells"];
|
||||||
cellZones()[cellZones().findZoneID("movingCells")];
|
|
||||||
|
|
||||||
forAll(cellAddr, cellI)
|
forAll(cellAddr, cellI)
|
||||||
{
|
{
|
||||||
@ -242,8 +239,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const
|
|||||||
+ "Zone"
|
+ "Zone"
|
||||||
);
|
);
|
||||||
|
|
||||||
const labelList& innerSliderAddr =
|
const labelList& innerSliderAddr = faceZones()[innerSliderZoneName];
|
||||||
faceZones()[faceZones().findZoneID(innerSliderZoneName)];
|
|
||||||
|
|
||||||
forAll(innerSliderAddr, faceI)
|
forAll(innerSliderAddr, faceI)
|
||||||
{
|
{
|
||||||
@ -261,8 +257,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const
|
|||||||
+ "Zone"
|
+ "Zone"
|
||||||
);
|
);
|
||||||
|
|
||||||
const labelList& outerSliderAddr =
|
const labelList& outerSliderAddr = faceZones()[outerSliderZoneName];
|
||||||
faceZones()[faceZones().findZoneID(outerSliderZoneName)];
|
|
||||||
|
|
||||||
forAll(outerSliderAddr, faceI)
|
forAll(outerSliderAddr, faceI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -290,18 +290,12 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
|
|||||||
|
|
||||||
curLeft_ = average
|
curLeft_ = average
|
||||||
(
|
(
|
||||||
faceZones()
|
faceZones()["leftExtrusionFaces"]().localPoints()
|
||||||
[
|
|
||||||
faceZones().findZoneID("leftExtrusionFaces")
|
|
||||||
]().localPoints()
|
|
||||||
).x() - SMALL;
|
).x() - SMALL;
|
||||||
|
|
||||||
curRight_ = average
|
curRight_ = average
|
||||||
(
|
(
|
||||||
faceZones()
|
faceZones()["rightExtrusionFaces"]().localPoints()
|
||||||
[
|
|
||||||
faceZones().findZoneID("rightExtrusionFaces")
|
|
||||||
]().localPoints()
|
|
||||||
).x() + SMALL;
|
).x() + SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,18 +442,12 @@ bool Foam::movingConeTopoFvMesh::update()
|
|||||||
// curRight_ += curMotionVel_.x()*time().deltaTValue();
|
// curRight_ += curMotionVel_.x()*time().deltaTValue();
|
||||||
curLeft_ = average
|
curLeft_ = average
|
||||||
(
|
(
|
||||||
faceZones()
|
faceZones()["leftExtrusionFaces"]().localPoints()
|
||||||
[
|
|
||||||
faceZones().findZoneID("leftExtrusionFaces")
|
|
||||||
]().localPoints()
|
|
||||||
).x() - SMALL;
|
).x() - SMALL;
|
||||||
|
|
||||||
curRight_ = average
|
curRight_ = average
|
||||||
(
|
(
|
||||||
faceZones()
|
faceZones()["rightExtrusionFaces"]().localPoints()
|
||||||
[
|
|
||||||
faceZones().findZoneID("rightExtrusionFaces")
|
|
||||||
]().localPoints()
|
|
||||||
).x() + SMALL;
|
).x() + SMALL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user