diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index c1b516e97c..c024d98389 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,21 +49,16 @@ readField << endl; } - // Patch or patch-groups. (using non-wild card entries of dictionaries) + + // 1. Handle explicit patch names forAllConstIter(dictionary, dict, iter) { if (iter().isDict() && !iter().keyword().isPattern()) { - const labelList patchIDs = bmesh_.findIndices - ( - iter().keyword(), - true - ); + label patchi = bmesh_.findPatchID(iter().keyword()); - forAll(patchIDs, i) + if (patchi != -1) { - label patchi = patchIDs[i]; - this->set ( patchi, @@ -78,7 +73,43 @@ readField } } - // Check for wildcard patch overrides + + // 2. Patch-groups. (using non-wild card entries of dictionaries) + // (patchnames already matched above) + // Note: in order of entries in the dictionary (first patchGroups wins) + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict() && !iter().keyword().isPattern()) + { + const labelList patchIDs = bmesh_.findIndices + ( + iter().keyword(), + true // use patchGroups + ); + + forAll(patchIDs, i) + { + label patchi = patchIDs[i]; + + if (!this->set(patchi)) + { + this->set + ( + patchi, + PatchField::New + ( + bmesh_[patchi], + field, + iter().dict() + ) + ); + } + } + } + } + + + // 3. Wildcard patch overrides forAll(bmesh_, patchi) { if (!this->set(patchi)) diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C index c8ec20fff2..adddf9777c 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,6 +58,12 @@ Foam::pointBoundaryMesh::pointBoundaryMesh // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::label Foam::pointBoundaryMesh::findPatchID(const word& patchName) const +{ + return mesh()().boundaryMesh().findPatchID(patchName); +} + + Foam::labelList Foam::pointBoundaryMesh::findIndices ( const keyType& key, diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H index afbc52c93f..f07b03ea9a 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,6 +96,9 @@ public: return mesh_; } + //- Find patch index given a name + label findPatchID(const word& patchName) const; + //- Find patch indices given a name labelList findIndices(const keyType&, const bool useGroups) const;