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:
@ -57,7 +57,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
if (element_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
label nHex08 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
@ -80,7 +80,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
else if (element_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label nPen06 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
@ -103,7 +103,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
else if (element_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label nPyr05 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
@ -126,7 +126,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
else if (element_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label nTet04 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
|
||||
@ -37,8 +37,8 @@ const cellShapeList& cellShapes = meshPtr->cellShapes();
|
||||
// hexa's
|
||||
if (which_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
//const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
//const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
|
||||
label counter = 1;
|
||||
for (label celli=0; celli<nCells; celli++)
|
||||
@ -56,7 +56,7 @@ if (which_type == Z_HEX08)
|
||||
// penta's
|
||||
if (which_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -74,7 +74,7 @@ if (which_type == Z_PEN06)
|
||||
// pyramids's
|
||||
if (which_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -92,7 +92,7 @@ if (which_type == Z_PYR05)
|
||||
// tet's
|
||||
if (which_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
|
||||
@ -37,8 +37,8 @@ const cellShapeList& cellShapes = meshPtr->cellShapes();
|
||||
// hexa's
|
||||
if (which_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
//const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
//const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -56,7 +56,7 @@ if (which_type == Z_HEX08)
|
||||
// penta's
|
||||
if (which_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -74,7 +74,7 @@ if (which_type == Z_PEN06)
|
||||
// pyramids's
|
||||
if (which_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -93,7 +93,7 @@ if (which_type == Z_PYR05)
|
||||
// penta's
|
||||
if (which_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label counter = 1;
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ const cellShapeList& cellShapes = meshPtr->cellShapes();
|
||||
// hexa's
|
||||
if (which_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
//const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
//const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -56,7 +56,7 @@ if (which_type == Z_HEX08)
|
||||
// penta's
|
||||
if (which_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -74,7 +74,7 @@ if (which_type == Z_PEN06)
|
||||
// pyramids's
|
||||
if (which_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -93,7 +93,7 @@ if (which_type == Z_PYR05)
|
||||
// tet's
|
||||
if (which_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
|
||||
@ -43,7 +43,7 @@ Description
|
||||
#include "Cloud.H"
|
||||
#include "passiveParticle.H"
|
||||
#include "fvMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "globalFoam.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user