diff --git a/applications/solvers/multiphase/bubbleFoam/createPhia.H b/applications/solvers/multiphase/bubbleFoam/createPhia.H index 74d4678872..703587bfd5 100644 --- a/applications/solvers/multiphase/bubbleFoam/createPhia.H +++ b/applications/solvers/multiphase/bubbleFoam/createPhia.H @@ -38,7 +38,7 @@ for (label i=0; i(Ua.boundaryField()[i])) + if (isA(Ua.boundaryField()[i])) { phiTypes[i] = fixedValueFvPatchScalarField::typeName; } diff --git a/applications/solvers/multiphase/bubbleFoam/createPhib.H b/applications/solvers/multiphase/bubbleFoam/createPhib.H index b1807e48ad..77bb467063 100644 --- a/applications/solvers/multiphase/bubbleFoam/createPhib.H +++ b/applications/solvers/multiphase/bubbleFoam/createPhib.H @@ -38,7 +38,7 @@ for (label i=0; i(Ub.boundaryField()[i])) + if (isA(Ub.boundaryField()[i])) { phiTypes[i] = fixedValueFvPatchScalarField::typeName; } diff --git a/applications/solvers/multiphase/bubbleFoam/wallDissipation.H b/applications/solvers/multiphase/bubbleFoam/wallDissipation.H index 5c84c9e7ac..b374f64cec 100644 --- a/applications/solvers/multiphase/bubbleFoam/wallDissipation.H +++ b/applications/solvers/multiphase/bubbleFoam/wallDissipation.H @@ -37,7 +37,7 @@ Description { const fvPatch& p = patches[patchi]; - if (isType(p)) + if (isA(p)) { epsEqn.setValues ( diff --git a/applications/solvers/multiphase/bubbleFoam/wallFunctions.H b/applications/solvers/multiphase/bubbleFoam/wallFunctions.H index 38b7297b10..fe5d16909e 100644 --- a/applications/solvers/multiphase/bubbleFoam/wallFunctions.H +++ b/applications/solvers/multiphase/bubbleFoam/wallFunctions.H @@ -12,7 +12,7 @@ { const fvPatch& currPatch = patches[patchi]; - if (isType(currPatch)) + if (isA(currPatch)) { forAll(currPatch, facei) { @@ -30,7 +30,7 @@ { const fvPatch& currPatch = patches[patchi]; - if (isType(currPatch)) + if (isA(currPatch)) { const scalarField& nuw = nutb.boundaryField()[patchi]; @@ -74,7 +74,7 @@ { const fvPatch& curPatch = patches[patchi]; - if (isType(curPatch)) + if (isA(curPatch)) { forAll(curPatch, facei) { diff --git a/applications/solvers/multiphase/bubbleFoam/wallViscosity.H b/applications/solvers/multiphase/bubbleFoam/wallViscosity.H index 21ea94d8d7..aef31a3d16 100644 --- a/applications/solvers/multiphase/bubbleFoam/wallViscosity.H +++ b/applications/solvers/multiphase/bubbleFoam/wallViscosity.H @@ -10,7 +10,7 @@ { const fvPatch& currPatch = patches[patchi]; - if (isType(currPatch)) + if (isA(currPatch)) { scalarField& nutw = nutb.boundaryField()[patchi]; diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 240207c8ab..2ebb83c2fc 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -352,7 +352,7 @@ void Foam::multiphaseMixture::correctContactAngle forAll(boundary, patchi) { - if (typeid(gbf[patchi]) == typeid(alphaContactAngleFvPatchScalarField)) + if (isA(gbf[patchi])) { const alphaContactAngleFvPatchScalarField& acap = refCast(gbf[patchi]); diff --git a/applications/solvers/multiphase/settlingFoam/wallDissipation.H b/applications/solvers/multiphase/settlingFoam/wallDissipation.H index 5c84c9e7ac..b374f64cec 100644 --- a/applications/solvers/multiphase/settlingFoam/wallDissipation.H +++ b/applications/solvers/multiphase/settlingFoam/wallDissipation.H @@ -37,7 +37,7 @@ Description { const fvPatch& p = patches[patchi]; - if (isType(p)) + if (isA(p)) { epsEqn.setValues ( diff --git a/applications/solvers/multiphase/settlingFoam/wallFunctions.H b/applications/solvers/multiphase/settlingFoam/wallFunctions.H index ae323691e3..decccfbff5 100644 --- a/applications/solvers/multiphase/settlingFoam/wallFunctions.H +++ b/applications/solvers/multiphase/settlingFoam/wallFunctions.H @@ -12,7 +12,7 @@ { const fvPatch& curPatch = patches[patchi]; - if (isType(curPatch)) + if (isA(curPatch)) { forAll(curPatch, facei) { @@ -30,7 +30,7 @@ { const fvPatch& curPatch = patches[patchi]; - if (isType(curPatch)) + if (isA(curPatch)) { const scalarField& rhow = rho.boundaryField()[patchi]; @@ -76,7 +76,7 @@ { const fvPatch& curPatch = patches[patchi]; - if (isType(curPatch)) + if (isA(curPatch)) { forAll(curPatch, facei) { diff --git a/applications/solvers/multiphase/settlingFoam/wallViscosity.H b/applications/solvers/multiphase/settlingFoam/wallViscosity.H index 35d6f9ba8b..8f64c27b3c 100644 --- a/applications/solvers/multiphase/settlingFoam/wallViscosity.H +++ b/applications/solvers/multiphase/settlingFoam/wallViscosity.H @@ -9,7 +9,7 @@ { const fvPatch& curPatch = patches[patchi]; - if (isType(curPatch)) + if (isA(curPatch)) { const scalarField& rhow = rho.boundaryField()[patchi]; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C index 5442ad17ba..aec2daf24a 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C @@ -109,7 +109,7 @@ Foam::phaseModel::phaseModel for (label i=0; i(U_.boundaryField()[i])) + if (isA(U_.boundaryField()[i])) { phiTypes[i] = fixedValueFvPatchScalarField::typeName; } diff --git a/applications/test/nearWallDist-wave/testWallDist2.C b/applications/test/nearWallDist-wave/testWallDist2.C index 8666e0905c..724702810c 100644 --- a/applications/test/nearWallDist-wave/testWallDist2.C +++ b/applications/test/nearWallDist-wave/testWallDist2.C @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) { const fvPatch& patch = mesh.boundary()[patchI]; - if (typeid(patch) == typeid(wallFvPatch)) + if (isA(patch)) { nWalls += patch.size(); } @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) { const fvPatch& patch = mesh.boundary()[patchI]; - if (typeid(patch) == typeid(wallFvPatch)) + if (isA(patch)) { forAll (patch.Cf(), patchFaceI) { diff --git a/applications/test/nearWallDist-wave/testWallDistData.C b/applications/test/nearWallDist-wave/testWallDistData.C index ab6f1d2e8d..cb742f435f 100644 --- a/applications/test/nearWallDist-wave/testWallDistData.C +++ b/applications/test/nearWallDist-wave/testWallDistData.C @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { const fvPatch& patch = mesh.boundary()[patchI]; - if (typeid(patch) == typeid(wallFvPatch)) + if (isA(patch)) { fvPatchVectorField& wallData = n.boundaryField()[patchI]; diff --git a/applications/test/nearWallDist-wave/testYPlus.C b/applications/test/nearWallDist-wave/testYPlus.C index fd718be643..d5a0020d44 100644 --- a/applications/test/nearWallDist-wave/testYPlus.C +++ b/applications/test/nearWallDist-wave/testYPlus.C @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { const fvPatch& patch = mesh.boundary()[patchI]; - if (typeid(patch) == typeid(wallFvPatch)) + if (isA(patch)) { fvPatchScalarField& wallData = yStar.boundaryField()[patchI]; diff --git a/applications/test/router/processorRouter.C b/applications/test/router/processorRouter.C index aac34dff23..e94025ff2b 100644 --- a/applications/test/router/processorRouter.C +++ b/applications/test/router/processorRouter.C @@ -55,7 +55,7 @@ labelList procNeighbours(const polyMesh& mesh) forAll (mesh.boundaryMesh(), patchI) { - if (typeid(mesh.boundaryMesh()[patchI]) == typeid(processorPolyPatch)) + if (isA(mesh.boundaryMesh()[patchI])) { nNeighbours++; } @@ -67,7 +67,7 @@ labelList procNeighbours(const polyMesh& mesh) forAll (mesh.boundaryMesh(), patchI) { - if (typeid(mesh.boundaryMesh()[patchI]) == typeid(processorPolyPatch)) + if (isA(mesh.boundaryMesh()[patchI])) { const polyPatch& patch = mesh.boundaryMesh()[patchI]; diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C index 5ead5e5584..65ee7d1b49 100644 --- a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C +++ b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C @@ -174,17 +174,11 @@ void Foam::fluentFvMesh::writeFluentMesh() const nWrittenFaces += patchFaces.size(); // Write patch type - if - ( - typeid(boundary()[patchI]) == typeid(wallFvPatch) - ) + if (isA(boundary()[patchI])) { fluentMeshFile << 3; } - else if - ( - typeid(boundary()[patchI]) == typeid(symmetryFvPatch) - ) + else if (isA(boundary()[patchI])) { fluentMeshFile << 7; } @@ -282,17 +276,11 @@ void Foam::fluentFvMesh::writeFluentMesh() const << "(39 (" << patchI + 10 << " "; // Write patch type - if - ( - typeid(boundary()[patchI]) == typeid(wallFvPatch) - ) + if (isA(boundary()[patchI])) { fluentMeshFile << "wall "; } - else if - ( - typeid(boundary()[patchI]) == typeid(symmetryFvPatch) - ) + else if (isA(boundary()[patchI])) { fluentMeshFile << "symmetry "; } diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index e7beaf0082..bbe5775b51 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -268,10 +268,7 @@ label twoDNess(const polyMesh& mesh) { const polyPatch& patch = patches[patchI]; - if - ( - typeid(patch) != typeid(wedgePolyPatch) - ) + if (!isA(patch)) { const vectorField& n = patch.faceAreas(); diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index 5290750d4c..a1d7a38912 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -121,7 +121,7 @@ void writeVTK const fileName& vtkName ) { - if (typeid(currentSet) == typeid(faceSet)) + if (isA(currentSet)) { // Faces of set with OpenFOAM faceID as value @@ -148,7 +148,7 @@ void writeVTK mesh.time().path()/vtkName ); } - else if (typeid(currentSet) == typeid(cellSet)) + else if (isA(currentSet)) { // External faces of cellset with OpenFOAM cellID as value @@ -208,7 +208,7 @@ void writeVTK mesh.time().path()/vtkName ); } - else if (typeid(currentSet) == typeid(pointSet)) + else if (isA(currentSet)) { writePointSet ( diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index dfc657fe8f..e709163218 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -160,12 +160,8 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew) // Adds patch if not yet there. Returns patchID. -label addPatch -( - fvMesh& mesh, - const word& patchName, - const word& patchType -) +template +label addPatch(fvMesh& mesh, const word& patchName) { polyBoundaryMesh& polyPatches = const_cast(mesh.boundaryMesh()); @@ -173,11 +169,18 @@ label addPatch label patchI = polyPatches.findPatchID(patchName); if (patchI != -1) { - if (polyPatches[patchI].type() == patchType) + if (isA(polyPatches[patchI])) { // Already there return patchI; } + else + { + FatalErrorIn("addPatch(fvMesh&, const word&)") + << "Already have patch " << patchName + << " but of type " << PatchType::typeName + << exit(FatalError); + } } @@ -214,7 +217,7 @@ label addPatch sz, polyPatch::New ( - patchType, + PatchType::typeName, patchName, 0, // size startFaceI, @@ -1021,17 +1024,15 @@ EdgeMap