ENH: add unique source keyword for shapeToCell (#1060)

- using 'shape', to avoid potential name clash with 'type' (action
  type) when used without an optional sourceInfo sub-dictionary
This commit is contained in:
Mark Olesen
2018-11-27 07:48:03 +01:00
parent 820b63e0b2
commit 0dc206be02
2 changed files with 16 additions and 17 deletions

View File

@ -59,7 +59,7 @@ Foam::scalar Foam::shapeToCell::featureCos = Foam::cos(degToRad(10.0));
void Foam::shapeToCell::combine(topoSet& set, const bool add) const
{
if (type_ == "splitHex")
if (shape_ == "splitHex")
{
for (label celli = 0; celli < mesh_.nCells(); ++celli)
{
@ -73,7 +73,7 @@ void Foam::shapeToCell::combine(topoSet& set, const bool add) const
}
else
{
const cellModel& wantedModel = cellModel::ref(type_);
const cellModel& wantedModel = cellModel::ref(shape_);
const cellShapeList& cellShapes = mesh_.cellShapes();
@ -97,12 +97,12 @@ Foam::shapeToCell::shapeToCell
)
:
topoSetCellSource(mesh),
type_(shapeName)
shape_(shapeName)
{
if (!cellModel::ptr(type_) && type_ != "splitHex")
if (!cellModel::ptr(shape_) && shape_ != "splitHex")
{
FatalErrorInFunction
<< "Illegal cell type " << type_ << exit(FatalError);
<< "Illegal cell shape " << shape_ << exit(FatalError);
}
}
@ -113,7 +113,7 @@ Foam::shapeToCell::shapeToCell
const dictionary& dict
)
:
shapeToCell(mesh, dict.get<word>("type"))
shapeToCell(mesh, dict.getCompat<word>("shape", {{"type", 1806}}))
{}
@ -124,12 +124,12 @@ Foam::shapeToCell::shapeToCell
)
:
topoSetCellSource(mesh),
type_(checkIs(is))
shape_(checkIs(is))
{
if (!cellModel::ptr(type_) && type_ != "splitHex")
if (!cellModel::ptr(shape_) && shape_ != "splitHex")
{
FatalErrorInFunction
<< "Illegal cell type " << type_ << exit(FatalError);
<< "Illegal cell shape " << shape_ << exit(FatalError);
}
}
@ -146,8 +146,7 @@ void Foam::shapeToCell::applyToSet
{
if (verbose_)
{
Info<< " Adding all cells of type " << type_
<< " ..." << endl;
Info<< " Adding all " << shape_ << " cells ..." << endl;
}
combine(set, true);
@ -156,8 +155,7 @@ void Foam::shapeToCell::applyToSet
{
if (verbose_)
{
Info<< " Removing all cells of type " << type_
<< " ..." << endl;
Info<< " Removing all " << shape_ << " cells ..." << endl;
}
combine(set, false);

View File

@ -32,8 +32,9 @@ Description
\heading Dictionary parameters
\table
Property | Description | Required | Default
type | The cell model type (hex, ..) | yes |
Property | Description | Required | Default
shape | The cell model (hex, ..) | yes |
type | Older specification for 'shape' | no |
\endtable
SourceFiles
@ -65,8 +66,8 @@ class shapeToCell
//- Add usage string
static addToUsageTable usage_;
//- Name of cell type
word type_;
//- Name of cell shape/type
word shape_;
// Private Member Functions