diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 5b8a4b73bbe85c562c9e50527fd1b113a8796c3b..2bbe8ec55a34befab54d618ccc9274145eeadd3f 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -86,6 +86,7 @@ FoamFile // set p0; // option any; // cell with any point in pointSet // //option all; // cell with all points in pointSet +// //option edge; // cell with an edge with both points in pointSet // } // // // Select based on cellShape @@ -198,6 +199,7 @@ FoamFile // set p0; // option any; // Faces using any point in pointSet // //option all // Faces with all points in pointSet +// //option edge // Faces with two consecutive points in pointSet // } // // // Select by explicitly providing face labels diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C index 9701431dc41eb045e4e9f4e73c34376b37f1f8a3..0939a2e3bec5142b84c8b3eb25a2d3788234458d 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,10 +41,11 @@ namespace Foam const char* Foam::NamedEnum < Foam::pointToCell::pointAction, - 1 + 2 >::names[] = { - "any" + "any", + "edge" }; } @@ -52,11 +53,12 @@ namespace Foam Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_ ( pointToCell::typeName, - "\n Usage: pointToCell <pointSet> any\n\n" - " Select all cells with any point in the pointSet\n\n" + "\n Usage: pointToCell <pointSet> any|edge\n\n" + " Select all cells with any point ('any') or any edge ('edge')" + " in the pointSet\n\n" ); -const Foam::NamedEnum<Foam::pointToCell::pointAction, 1> +const Foam::NamedEnum<Foam::pointToCell::pointAction, 2> Foam::pointToCell::pointActionNames_; @@ -82,6 +84,26 @@ void Foam::pointToCell::combine(topoSet& set, const bool add) const } } } + else if (option_ == EDGE) + { + const faceList& faces = mesh_.faces(); + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + forAll(f, fp) + { + if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp))) + { + addOrDelete(set, mesh_.faceOwner()[faceI], add); + if (mesh_.isInternalFace(faceI)) + { + addOrDelete(set, mesh_.faceNeighbour()[faceI], add); + } + } + } + } + } } diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H b/src/meshTools/sets/cellSources/pointToCell/pointToCell.H index 2e8a507640ae01cc54ea01b6369d81e383d8940a..96f02f18bf64c475f8526e82403c45e3b6627ba7 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,8 @@ public: //- Enumeration defining the valid options enum pointAction { - ANY // Cells using any point in set + ANY, // Cells using any point in set + EDGE // Cells using an edge with both points in set //ALL // Possible extension: cells whose all points are in set }; @@ -64,7 +65,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<pointAction, 1> pointActionNames_; + static const NamedEnum<pointAction, 2> pointActionNames_; //- Name of set to use word setName_; diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C index 81e13e4fc459d26bdd85ee0bd8c0edc00c48f114..7d66aaefe2cd999053f8cca4d2d5209c8e6dd9dd 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,11 +41,12 @@ namespace Foam const char* Foam::NamedEnum < Foam::pointToFace::pointAction, - 2 + 3 >::names[] = { "any", - "all" + "all", + "edge" }; } @@ -53,13 +54,14 @@ namespace Foam Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_ ( pointToFace::typeName, - "\n Usage: pointToFace <pointSet> any|all\n\n" + "\n Usage: pointToFace <pointSet> any|all|edge\n\n" " Select faces with\n" " -any point in the pointSet\n" " -all points in the pointSet\n\n" + " -two consecutive points (an edge) in the pointSet\n\n" ); -const Foam::NamedEnum<Foam::pointToFace::pointAction, 2> +const Foam::NamedEnum<Foam::pointToFace::pointAction, 3> Foam::pointToFace::pointActionNames_; @@ -126,6 +128,23 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const } } } + else if (option_ == EDGE) + { + const faceList& faces = mesh_.faces(); + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + forAll(f, fp) + { + if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp))) + { + addOrDelete(set, faceI, add); + break; + } + } + } + } } diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H b/src/meshTools/sets/faceSources/pointToFace/pointToFace.H index 482626f33fc3aa652e893a4a31061648190f2446..e31bc65086f02e96086085e25bfbe57c778d48ca 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,7 +58,8 @@ public: enum pointAction { ANY, - ALL + ALL, + EDGE }; @@ -67,7 +68,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<pointAction, 2> pointActionNames_; + static const NamedEnum<pointAction, 3> pointActionNames_; //- Name of set to use word setName_;