diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C index d794ae342d..18466603b3 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C +++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C @@ -140,6 +140,23 @@ int main(int argc, char *argv[]) case topoSetSource::NEW: case topoSetSource::ADD: case topoSetSource::DELETE: + { + Info<< " Applying source " << word(dict.lookup("source")) + << endl; + autoPtr source = topoSetSource::New + ( + dict.lookup("source"), + mesh, + dict.subDict("sourceInfo") + ); + + source().applyToSet(action, currentSet()); + // Synchronize for coupled patches. + currentSet().sync(mesh); + currentSet().write(); + } + break; + case topoSetSource::SUBSET: { Info<< " Applying source " << word(dict.lookup("source")) @@ -148,10 +165,26 @@ int main(int argc, char *argv[]) ( dict.lookup("source"), mesh, - dict.subDict("sourceDict") + dict.subDict("sourceInfo") ); - source().applyToSet(action, currentSet()); + // Backup current set. + autoPtr oldSet + ( + topoSet::New + ( + setType, + mesh, + currentSet().name() + "_old2", + currentSet() + ) + ); + + currentSet().clear(); + source().applyToSet(topoSetSource::NEW, currentSet()); + + // Combine new value of currentSet with old one. + currentSet().subset(oldSet()); // Synchronize for coupled patches. currentSet().sync(mesh); currentSet().write(); diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index ff487c6e64..40afc5ecb9 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -301,31 +301,61 @@ FoamFile actions ( + // Example:pick up internal faces on outside of cellSet + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Load initial cellSet { name c0; type cellSet; action new; source labelToCell; - sourceDict + sourceInfo { value (12 13 56); } } + // Get all faces in cellSet { - name c0; + name f0; + type faceSet; + action new; + source cellToFace; + sourceInfo + { + set c0; + option all; + } + } + + // Determine inverse cellSet + { + name c1; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c0; + } + } + { + name c1; type cellSet; action invert; } + // Keep in f0 all faces in c1 { - name c0; - type cellSet; - action delete; - source labelToCell; - sourceDict + name f0; + type faceSet; + action subset; + source cellToFace; + sourceInfo { - value (1 2 3); + set c1; + option all; } } ); diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict index ccaf0363cd..814c5a8f9e 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict @@ -23,7 +23,7 @@ actions action new; source sphereToCell; - sourceDict + sourceInfo { centre ( 0.125 0.375 0.05 ); radius 0.005; diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.1 b/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.1 index 1e1592ee39..99b65f210c 100644 --- a/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.1 +++ b/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.1 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box (0.004 -0.001 -1) (0.012 0.001 1); } diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.2 b/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.2 index ab0289c156..f0bc41c9b6 100644 --- a/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.2 +++ b/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.2 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box (0.0045 -0.00075 -1) (0.0095 0.00075 1); } diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.3 b/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.3 index 3e504e9aef..fd1ed7949f 100644 --- a/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.3 +++ b/tutorials/multiphase/cavitatingFoam/les/throttle/system/topoSetDict.3 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box (0.00475 -0.000375 -1) (0.009 0.000375 1); } diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.1 b/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.1 index cd2329f57d..5fb3df6565 100644 --- a/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.1 +++ b/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.1 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0.004 -0.001 -1 ) ( 0.012 0.001 1 ); } diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.2 b/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.2 index a8a80dff4d..59c77c8d37 100644 --- a/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.2 +++ b/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.2 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0.0045 -0.00075 -1 ) ( 0.0095 0.00075 1 ); } diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.3 b/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.3 index 67021ba219..1dcc0ebc3f 100644 --- a/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.3 +++ b/tutorials/multiphase/cavitatingFoam/les/throttle3D/system/topoSetDict.3 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0.00475 -0.000375 -1 ) ( 0.009 0.000375 1 ); } diff --git a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict index 30e3ea0006..e833aa533b 100644 --- a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict +++ b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0.00475 -0.000375 -1 ) ( 0.009 0.000375 1 ) ; } diff --git a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.1 b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.1 index 01e4f46a66..cfb66b9b72 100644 --- a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.1 +++ b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.1 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0.004 -0.001 -1 ) ( 0.012 0.001 1 ) ; } diff --git a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.2 b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.2 index 20bc81f6ba..d3cf8a3aeb 100644 --- a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.2 +++ b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.2 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0.0045 -0.00075 -1 ) ( 0.0095 0.00075 1 ) ; } diff --git a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.3 b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.3 index 30e3ea0006..e833aa533b 100644 --- a/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.3 +++ b/tutorials/multiphase/cavitatingFoam/ras/throttle/system/topoSetDict.3 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0.00475 -0.000375 -1 ) ( 0.009 0.000375 1 ) ; } diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/topoSetDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/topoSetDict index c696d169b4..7fdf7ca03a 100644 --- a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/topoSetDict +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/topoSetDict @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box (0.35 0.35 0.44) (0.65 0.65 0.56); } diff --git a/tutorials/multiphase/interFoam/MRFInterFoam/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/interFoam/MRFInterFoam/mixerVessel2D/system/topoSetDict index b89e6319bf..a36ee3b31a 100644 --- a/tutorials/multiphase/interFoam/MRFInterFoam/mixerVessel2D/system/topoSetDict +++ b/tutorials/multiphase/interFoam/MRFInterFoam/mixerVessel2D/system/topoSetDict @@ -23,7 +23,7 @@ actions type cellSet; action new; source zoneToCell; - sourceDict + sourceInfo { name rotor; } diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict index cf1a5033eb..e6dc5a0687 100644 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0 0 -2e-05 ) ( 0.0036 0.0003 2e-05 ); } diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.1 b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.1 index 5c87356b4a..02ae84ba2d 100644 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.1 +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.1 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0 0 -2e-05 ) ( 0.0036 0.0008 4e-05 ) ; } diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.2 b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.2 index cf1a5033eb..e6dc5a0687 100644 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.2 +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/topoSetDict.2 @@ -22,7 +22,7 @@ actions type cellSet; action new; source boxToCell; - sourceDict + sourceInfo { box ( 0 0 -2e-05 ) ( 0.0036 0.0003 2e-05 ); }