Commit e500cefc authored by franjo.juretic@c-fields.com's avatar franjo.juretic@c-fields.com
Browse files

Added possibility to specify cellSize or additionalRefinementLevels for

local refinement


git-svn-id: https://pl5.projectlocker.com/igui/meshGeneration/svn@58 fdcce57e-7e00-11e2-b579-49867b4cea03
parent 62269bec
......@@ -89,22 +89,42 @@ void checkMeshDict::checkLocalRefinementLevel() const
{
const dictionary& dict = refDict.subDict(entries[dictI]);
if( !dict.found("additionalRefinementLevels") )
FatalErrorIn
if( dict.found("cellSize") )
{
const scalar cs = readScalar(dict.lookup("cellSize"));
if( cs > 0.0 )
continue;
WarningIn
(
"void checkMeshDict::checkLocalRefinementLevel() const"
) << "Cannot read keyword additionalRefinementLevels "
<< "for " << entries[dictI] << exit(FatalError);
) << "Cell size for " << entries[dictI]
<< " is negative" << endl;
}
else if( dict.found("additionalRefinementLevels") )
{
const label nLevels =
readLabel(dict.lookup("additionalRefinementLevels"));
const label nLevels =
readLabel(dict.lookup("additionalRefinementLevels"));
if( nLevels > 0 )
continue;
if( nLevels < 0 )
WarningIn
(
"void checkMeshDict::checkLocalRefinementLevel() const"
) << "Refinement level for " << entries[dictI]
<< " is negative" << endl;
}
else
{
FatalErrorIn
(
"void checkMeshDict::checkLocalRefinementLevel() const"
) << "Cannot read keyword"
<< " additionalRefinementLevels or cellSize"
<< "for " << entries[dictI] << exit(FatalError);
}
}
}
else
......
......@@ -134,7 +134,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const scalar lSize = maxSize / Foam::pow(2, addLevel);
if( lSize < cs )
if( lSize <= cs )
{
finished = true;
}
......@@ -210,7 +210,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const scalar lSize = maxSize / Foam::pow(2, addLevel);
if( lSize < cs )
if( lSize <= cs )
{
finished = true;
}
......@@ -289,7 +289,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const scalar lSize = maxSize / Foam::pow(2, addLevel);
if( lSize < cs )
if( lSize <= cs )
{
finished = true;
}
......@@ -339,8 +339,35 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const word& pName = entries[dictI];
const dictionary& patchDict = dict.subDict(pName);
const direction nLevel =
readLabel(patchDict.lookup("additionalRefinementLevels"));
label nLevel(0);
if( patchDict.found("additionalRefinementLevels") )
{
nLevel =
readLabel(patchDict.lookup("additionalRefinementLevels"));
}
else if( patchDict.found("cellSize") )
{
const scalar cs =
readScalar(patchDict.lookup("cellSize"));
do
{
finished = false;
const scalar lSize = maxSize / Foam::pow(2, nLevel);
if( lSize <= cs )
{
finished = true;
}
else
{
++nLevel;
}
} while( !finished );
}
const direction level = globalRefLevel_ + nLevel;
if( patchToIndex.find(pName) != patchToIndex.end() )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment