Skip to content
Snippets Groups Projects
Commit 306e43fa authored by mattijs's avatar mattijs
Browse files

ENH: shellSurfaces: allow wildcards

parent 26fee7bc
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -360,84 +360,48 @@ void Foam::shellSurfaces::findHigherLevel ...@@ -360,84 +360,48 @@ void Foam::shellSurfaces::findHigherLevel
Foam::shellSurfaces::shellSurfaces Foam::shellSurfaces::shellSurfaces
( (
const searchableSurfaces& allGeometry, const searchableSurfaces& allGeometry,
const PtrList<dictionary>& shellDicts const dictionary& shellsDict
) )
: :
allGeometry_(allGeometry) allGeometry_(allGeometry)
{ {
shells_.setSize(shellDicts.size()); // Wilcard specification : loop over all surfaces and try to find a match.
modes_.setSize(shellDicts.size());
distances_.setSize(shellDicts.size());
levels_.setSize(shellDicts.size());
forAll(shellDicts, shellI) // Count number of shells.
label shellI = 0;
forAll(allGeometry.names(), geomI)
{ {
const dictionary& dict = shellDicts[shellI]; const word& geomName = allGeometry_.names()[geomI];
const word name = dict.lookup("name");
const word type = dict.lookup("type");
shells_[shellI] = allGeometry_.findSurfaceID(name); if (shellsDict.found(geomName))
if (shells_[shellI] == -1)
{ {
FatalErrorIn shellI++;
(
"shellSurfaces::shellSurfaces"
"(const searchableSurfaces&, const PtrList<dictionary>&)"
) << "No surface called " << name << endl
<< "Valid surfaces are " << allGeometry_.names()
<< exit(FatalError);
} }
modes_[shellI] = refineModeNames_.read(dict.lookup("refineMode"));
// Read pairs of distance+level
setAndCheckLevels(shellI, dict.lookup("levels"));
} }
// Orient shell surfaces before any searching is done. Note that this
// only needs to be done for inside or outside. Orienting surfaces
// constructs lots of addressing which we want to avoid.
orient();
}
// Size lists
shells_.setSize(shellI);
modes_.setSize(shellI);
distances_.setSize(shellI);
levels_.setSize(shellI);
Foam::shellSurfaces::shellSurfaces shellI = 0;
( forAll(allGeometry.names(), geomI)
const searchableSurfaces& allGeometry,
const dictionary& shellsDict
)
:
allGeometry_(allGeometry)
{
shells_.setSize(shellsDict.size());
modes_.setSize(shellsDict.size());
distances_.setSize(shellsDict.size());
levels_.setSize(shellsDict.size());
label shellI = 0;
forAllConstIter(dictionary, shellsDict, iter)
{ {
shells_[shellI] = allGeometry_.findSurfaceID(iter().keyword()); const word& geomName = allGeometry_.names()[geomI];
if (shells_[shellI] == -1) if (shellsDict.found(geomName))
{ {
FatalErrorIn shells_[shellI] = geomI;
( const dictionary& dict = shellsDict.subDict(geomName);
"shellSurfaces::shellSurfaces" modes_[shellI] = refineModeNames_.read(dict.lookup("mode"));
"(const searchableSurfaces&, const dictionary>&"
) << "No surface called " << iter().keyword() << endl
<< "Valid surfaces are " << allGeometry_.names()
<< exit(FatalError);
}
const dictionary& dict = shellsDict.subDict(iter().keyword());
modes_[shellI] = refineModeNames_.read(dict.lookup("mode"));
// Read pairs of distance+level // Read pairs of distance+level
setAndCheckLevels(shellI, dict.lookup("levels")); setAndCheckLevels(shellI, dict.lookup("levels"));
shellI++; shellI++;
}
} }
// Orient shell surfaces before any searching is done. Note that this // Orient shell surfaces before any searching is done. Note that this
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -113,23 +113,6 @@ public: ...@@ -113,23 +113,6 @@ public:
// Constructors // Constructors
//- Construct from components
shellSurfaces
(
const searchableSurfaces& allGeometry,
const labelList& shells,
const List<refineMode>& modes,
const List<scalarField>& distances,
const labelListList& levels
);
//- Construct from geometry and dictionaries
shellSurfaces
(
const searchableSurfaces& allGeometry,
const PtrList<dictionary>& shellDicts
);
//- Construct from geometry and dictionary //- Construct from geometry and dictionary
shellSurfaces shellSurfaces
( (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment