diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index c1b516e97cefb1319594da61f0c0838c010f48b7..c024d98389b64ee3d8b573ba119c58e3f6a0cb96 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<Type>::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 c8ec20fff2c03ac53301d391839364f9851e7369..adddf9777c43811861e57aa8b5531144e4bd78cf 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 afbc52c93f91d856be9f8262ca47147a3e05610d..f07b03ea9a0f4818830495a770623191040d0109 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;