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:
Mark Olesen
2017-11-18 11:05:05 +01:00
parent 810d090e34
commit 8730a7622a
106 changed files with 984 additions and 1035 deletions

View File

@ -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;