mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: enumerations for known cell models in cellModel, ptr/ref lookups
- this provides a better typesafe means of locating predefined cell models than relying on strings. The lookup is now ptr() or ref() directly. The lookup functions behave like on-demand singletons when loading "etc/cellModels". Functionality is now located entirely in cellModel but a forwarding version of cellModeller is provided for API (but not ABI) compatibility with older existing user code. STYLE: use constexpr for cellMatcher constants
This commit is contained in:
@ -25,7 +25,7 @@ Class
|
||||
Foam::fileFormats::STARCDedgeFormat
|
||||
|
||||
Description
|
||||
Read/write the lines from pro-STAR vrt/cel files.
|
||||
Read/write the lines from PROSTAR vrt/cel files.
|
||||
|
||||
Note
|
||||
Uses the extension \a .inp (input) to denote the format.
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "rotatedBoxToCell.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -73,7 +73,7 @@ void Foam::rotatedBoxToCell::combine(topoSet& set, const bool add) const
|
||||
boxVerts[i] = i;
|
||||
}
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
// Get outwards pointing faces.
|
||||
faceList boxFaces(cellShape(hex, boxVerts).faces());
|
||||
|
||||
@ -76,7 +76,7 @@ void Foam::shapeToCell::combine(topoSet& set, const bool add) const
|
||||
}
|
||||
else
|
||||
{
|
||||
const cellModel& wantedModel = *(cellModeller::lookup(type_));
|
||||
const cellModel& wantedModel = cellModel::ref(type_);
|
||||
|
||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||
|
||||
@ -93,7 +93,6 @@ void Foam::shapeToCell::combine(topoSet& set, const bool add) const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::shapeToCell::shapeToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -103,7 +102,7 @@ Foam::shapeToCell::shapeToCell
|
||||
topoSetSource(mesh),
|
||||
type_(type)
|
||||
{
|
||||
if (!cellModeller::lookup(type_) && (type_ != "splitHex"))
|
||||
if (!cellModel::ptr(type_) && type_ != "splitHex")
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal cell type " << type_ << exit(FatalError);
|
||||
@ -111,7 +110,6 @@ Foam::shapeToCell::shapeToCell
|
||||
}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::shapeToCell::shapeToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -121,7 +119,7 @@ Foam::shapeToCell::shapeToCell
|
||||
topoSetSource(mesh),
|
||||
type_(dict.lookup("type"))
|
||||
{
|
||||
if (!cellModeller::lookup(type_) && (type_ != "splitHex"))
|
||||
if (!cellModel::ptr(type_) && type_ != "splitHex")
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal cell type " << type_ << exit(FatalError);
|
||||
@ -129,7 +127,6 @@ Foam::shapeToCell::shapeToCell
|
||||
}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::shapeToCell::shapeToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -139,13 +136,14 @@ Foam::shapeToCell::shapeToCell
|
||||
topoSetSource(mesh),
|
||||
type_(checkIs(is))
|
||||
{
|
||||
if (!cellModeller::lookup(type_) && (type_ != "splitHex"))
|
||||
if (!cellModel::ptr(type_) && type_ != "splitHex")
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal cell type " << type_ << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::shapeToCell::~shapeToCell()
|
||||
|
||||
@ -27,8 +27,8 @@ Class
|
||||
Description
|
||||
A topoSetSource to select cells based on cell shape.
|
||||
|
||||
Handles all ones from cellModeller and splitHex with 10 degrees
|
||||
feature angle.
|
||||
Handles all known ones from static collection in cellModel
|
||||
and splitHex with 10 degrees feature angle.
|
||||
|
||||
SourceFiles
|
||||
shapeToCell.C
|
||||
|
||||
Reference in New Issue
Block a user