Commit 5f556ffb authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: make sourceInfo sub-dictionary optional for topoSet (#1060)

- helps reduce clutter in the topoSetDict files.

  Caveats when using this.

  The older specification styles using "name" will conflict with the
  set name. Eg,

    {
        name    f0
        type    faceSet;
        action  add;
        source  patchToFace;
        sourceInfo
        {
            name   inlet;
        }
    }

    would flattened to the following
    {
        name    f0
        type    faceSet;
        action  add;
        source  patchToFace;
        name   inlet;
    }
    which overwrites the "name" used for the faceSet.

    The solution is to use the updated syntax:

    {
        name    f0
        type    faceSet;
        action  add;
        source  patchToFace;
        patch   inlet;
    }
parent 6090faed
......@@ -251,8 +251,8 @@ int main(int argc, char *argv[])
|| action == topoSetSource::CLEAR
)
{
currentSet = topoSet::New(setType, mesh, setName, 10000);
Info<< "Created " << currentSet().type() << " "
currentSet = topoSet::New(setType, mesh, setName, 16384);
Info<< "Created " << currentSet().type() << ' '
<< setName << endl;
}
else if (action == topoSetSource::REMOVE)
......@@ -268,7 +268,7 @@ int main(int argc, char *argv[])
setName,
IOobject::MUST_READ
);
Info<< "Read set " << currentSet().type() << " "
Info<< "Read set " << currentSet().type() << ' '
<< setName << " with size "
<< returnReduce(currentSet().size(), sumOp<label>())
<< endl;
......@@ -283,14 +283,14 @@ int main(int argc, char *argv[])
case topoSetSource::ADD:
case topoSetSource::SUBTRACT:
{
const word sourceName(dict.get<word>("source"));
const word sourceType(dict.get<word>("source"));
Info<< " Applying source " << sourceName << endl;
Info<< " Applying source " << sourceType << endl;
autoPtr<topoSetSource> source = topoSetSource::New
(
sourceName,
sourceType,
mesh,
dict.subDict("sourceInfo")
dict.optionalSubDict("sourceInfo")
);
source().applyToSet(action, currentSet());
......@@ -308,14 +308,14 @@ int main(int argc, char *argv[])
case topoSetSource::SUBSET:
{
const word sourceName(dict.get<word>("source"));
const word sourceType(dict.get<word>("source"));
Info<< " Applying source " << sourceName << endl;
Info<< " Applying source " << sourceType << endl;
autoPtr<topoSetSource> source = topoSetSource::New
(
sourceName,
sourceType,
mesh,
dict.subDict("sourceInfo")
dict.optionalSubDict("sourceInfo")
);
// Backup current set.
......@@ -385,7 +385,7 @@ int main(int argc, char *argv[])
if (currentSet.valid())
{
Info<< " "
<< currentSet().type() << " "
<< currentSet().type() << ' '
<< currentSet().name() << " now size "
<< returnReduce(currentSet().size(), sumOp<label>())
<< endl;
......
......@@ -21,10 +21,7 @@ actions
type cellSet;
action new;
source regionToCell;
sourceInfo
{
insidePoints ((0.001 0.001 0.001));
}
insidePoints ((0.001 0.001 0.001));
}
{
......@@ -32,10 +29,7 @@ actions
type cellSet;
action new;
source cellToCell;
sourceInfo
{
set c0;
}
set c0;
}
{
......@@ -51,10 +45,7 @@ actions
type cellSet;
action new;
source cellToCell;
sourceInfo
{
set c1;
}
set c1;
}
{
......@@ -62,10 +53,7 @@ actions
type cellSet;
action subset;
source boxToCell;
sourceInfo
{
box (0.4 0.4 -100)(0.6 0.6 100);
}
box (0.4 0.4 -100)(0.6 0.6 100);
}
{
......
......@@ -21,10 +21,7 @@ actions
type cellSet;
action new;
source regionToCell;
sourceInfo
{
insidePoints ((-1.999 0 -1.999));
}
insidePoints ((-1.999 0 -1.999));
}
{
......@@ -32,10 +29,7 @@ actions
type cellSet;
action new;
source cellToCell;
sourceInfo
{
set c0;
}
set c0;
}
{
......
......@@ -17,15 +17,12 @@ FoamFile
actions
(
{
{
name blockedFacesSet;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (1 1 0.99) (2 2 1);
}
box (1 1 0.99) (2 2 1);
}
{
......@@ -33,10 +30,7 @@ actions
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (2.4 2.4 0) (3 3 1);
}
box (2.4 2.4 0) (3 3 1);
}
{
......@@ -44,10 +38,7 @@ actions
type cellSet;
action add;
source boxToCell;
sourceInfo
{
box (0 0 0) (0.6 0.6 1);
}
box (0 0 0) (0.6 0.6 1);
}
{
......@@ -55,11 +46,8 @@ actions
type faceSet;
action add;
source cellToFace;
sourceInfo
{
set blockedCellsSet;
option all;
}
set blockedCellsSet;
option all;
}
{
......@@ -67,10 +55,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (1.0 1.99 0) (2.0 2.09 0.6);
}
box (1.0 1.99 0) (2.0 2.09 0.6);
}
);
......
......@@ -22,10 +22,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.201 -0.001 -0.201)(-0.199 0.031 0.201);
}
box (-0.201 -0.001 -0.201)(-0.199 0.031 0.201);
}
{
......@@ -33,20 +30,14 @@ actions
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet slot_bottom;
}
faceSet slot_bottom;
}
{
name slot_top;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.201 0.369 -0.201)(-0.199 0.401 0.201);
}
box (-0.201 0.369 -0.201)(-0.199 0.401 0.201);
}
{
......@@ -54,10 +45,7 @@ actions
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet slot_top;
}
faceSet slot_top;
}
{
......@@ -65,10 +53,7 @@ actions
type faceSet;
action new;
source patchToFace;
sourceInfo
{
patch inlet;
}
patch inlet;
}
{
......@@ -76,10 +61,7 @@ actions
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-0.201 -0.001 -0.201)(0.201 0.401 0.201);
}
box (-0.201 -0.001 -0.201)(0.201 0.401 0.201);
}
{
......@@ -87,10 +69,7 @@ actions
type cellZoneSet;
action new;
source setToCellZone;
sourceInfo
{
set compartment_fire;
}
set compartment_fire;
}
{
......@@ -98,10 +77,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.2001 0.0301 -0.2001)(-0.1999 0.3701 0.2001);
}
box (-0.2001 0.0301 -0.2001)(-0.1999 0.3701 0.2001);
}
{
......@@ -109,10 +85,7 @@ actions
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet internalWallPanel;
}
faceSet internalWallPanel;
}
{
......@@ -120,21 +93,15 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.2001 -0.0001 -0.2001)(0.2001 0.4001 -0.1999);
}
box (-0.2001 -0.0001 -0.2001)(0.2001 0.4001 -0.1999);
}
{
{
name wallFaces_front;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.2001 -0.0001 0.1999)(0.2001 0.4001 0.2001);
}
box (-0.2001 -0.0001 0.1999)(0.2001 0.4001 0.2001);
}
{
......@@ -142,10 +109,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.2001 0.3999 -0.2001)(0.2001 0.4001 0.2001);
}
box (-0.2001 0.3999 -0.2001)(0.2001 0.4001 0.2001);
}
{
......@@ -153,10 +117,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (0.1999 -0.0001 -0.2001)(0.2001 0.4001 0.2001);
}
box (0.1999 -0.0001 -0.2001)(0.2001 0.4001 0.2001);
}
{
......@@ -164,10 +125,7 @@ actions
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet wallFaces_back;
}
faceSet wallFaces_back;
}
{
......@@ -175,10 +133,7 @@ actions
type faceZoneSet;
action add;
source setToFaceZone;
sourceInfo
{
faceSet wallFaces_front;
}
faceSet wallFaces_front;
}
{
......@@ -186,10 +141,7 @@ actions
type faceZoneSet;
action add;
source setToFaceZone;
sourceInfo
{
faceSet wallFaces_top;
}
faceSet wallFaces_top;
}
{
......@@ -197,10 +149,7 @@ actions
type faceZoneSet;
action add;
source setToFaceZone;
sourceInfo
{
faceSet wallFaces_side;
}
faceSet wallFaces_side;
}
{
......@@ -208,10 +157,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.2001 -0.001 -0.2001)(0.2001 0.001 0.2001);
}
box (-0.2001 -0.001 -0.2001)(0.2001 0.001 0.2001);
}
{
......@@ -219,10 +165,7 @@ actions
type faceZoneSet;
action add;
source setToFaceZone;
sourceInfo
{
faceSet baseFace;
}
faceSet baseFace;
}
{
......@@ -230,10 +173,7 @@ actions
type faceZoneSet;
action subtract;
source setToFaceZone;
sourceInfo
{
faceSet inletFace;
}
faceSet inletFace;
}
);
......
......@@ -22,10 +22,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-1 -0.00001 -0.00001) (1 1.00001 0.00001);
}
box (-1 -0.00001 -0.00001) (1 1.00001 0.00001);
}
......@@ -34,32 +31,23 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-1 0.99999 -0.00001) (1 1.00001 2.00001);
}
box (-1 0.99999 -0.00001) (1 1.00001 2.00001);
}
{
{
name f2;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-1 -0.00001 1.99999) (1 1.00001 2.00001);
}
box (-1 -0.00001 1.99999) (1 1.00001 2.00001);
}
{
{
name f3;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-1 -0.00001 -0.00001) (1 0.00001 2.00001);
}
box (-1 -0.00001 -0.00001) (1 0.00001 2.00001);
}
);
......
......@@ -22,10 +22,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.1 -2.1 -0.1)(0.201 2.51 0.01);
}
box (-0.1 -2.1 -0.1)(0.201 2.51 0.01);
}
......@@ -34,10 +31,7 @@ actions
type faceSet;
action new;
source patchToFace;
sourceInfo
{
patch coupledWallTmp;
}
patch coupledWallTmp;
}
{
......@@ -45,10 +39,7 @@ actions
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet coupledWall;
}
faceSet coupledWall;
}
);
......
......@@ -22,10 +22,7 @@ actions
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-0.15 0.0 -0.3)(0.15 2.4 0.3);
}
box (-0.15 0.0 -0.3)(0.15 2.4 0.3);
}
);
......
......@@ -22,20 +22,14 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.151 0 -0.3)(-0.14999 2.4 0.3);
}
box (-0.151 0 -0.3)(-0.14999 2.4 0.3);
}
{
name fRight;
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (0.14999 0 -0.3)(0.151 2.4 0.3);
}
box (0.14999 0 -0.3)(0.151 2.4 0.3);
}
{
......@@ -43,10 +37,7 @@ actions
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet fRight;
}
faceSet fRight;
}
{
......@@ -54,12 +45,8 @@ actions
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet fLeft;
}
faceSet fLeft;
}
);
......
......@@ -22,10 +22,7 @@ actions
type faceSet;
action new;
source boxToFace;
sourceInfo
{
box (-0.15 -0.001 -0.30) (0.15 0.001 0.30);
}
box (-0.15 -0.001 -0.30) (0.15 0.001 0.30);
}
);
......
......@@ -18,25 +18,19 @@ FoamFile
actions
(
{
name coupledPatch;
type faceSet;
action new;
source patchToFace;
sourceInfo
{
patch coupledPatch;
}
name coupledPatch;
type faceSet;
action new;
source patchToFace;
patch coupledPatch;
}
{
name panel;
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet coupledPatch;
}