41 { modelType::UNKNOWN,
"unknown" },
42 { modelType::HEX,
"hex" },
43 { modelType::WEDGE,
"wedge" },
44 { modelType::PRISM,
"prism" },
45 { modelType::PYR,
"pyr" },
46 { modelType::TET,
"tet" },
47 { modelType::TETWEDGE,
"tetWedge" },
48 { modelType::SPLITHEX,
"splitHex" },
54 void Foam::cellModel::constructModels()
59 <<
"attempt to re-construct cellModeller when it already exists" 65 PtrList<cellModel> newPtrs(is);
66 models_.swap(newPtrs);
80 if (maxIndex < models_[i].
index())
82 maxIndex = models_[i].index();
87 modelPtrs_.setSize(maxIndex+1,
nullptr);
93 const label modelIndex = models_[i].index();
94 const word& modelName = models_[i].name();
99 if (modelPtrs_[modelIndex])
102 <<
"more than one model share the index " 107 modelPtrs_[modelIndex] =
ptr;
112 <<
"more than one model share the name " 122 return ptr(label(model));
133 const label
n = models_.size();
134 for (label i = 0; i <
n; ++i)
136 if (models_[i].
name() == modelName)
138 return &(models_[i]);
153 return (modelIndex < modelPtrs_.size() ? modelPtrs_[modelIndex] :
nullptr);
159 const cellModel*
p = ptr(model);
164 <<
"No such cellModel: " << modelNames[model]
174 const cellModel*
p = ptr(modelName);
179 <<
"No such cellModel: " << modelName
189 const cellModel*
p = ptr(modelIndex);
194 <<
"No such cellModel: " << modelIndex
errorManipArg< error, int > exit(error &err, const int errNo=1)
labelHashSet used(const bitSet &select)
Convert a bitset to a labelHashSet of the indices used.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
cellModel(Istream &is)
Construct from Istream.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
#define forAll(list, i)
Loop across all elements in list.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Functions to search 'etc' directories for configuration files etc.
static const cellModel * ptr(const modelType model)
Look up pointer to cellModel by enumeration, or nullptr on failure.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
modelType
Enumeration of commonly used cellModel types.
fileName findEtcFile(const fileName &name, const bool mandatory=false, unsigned short location=0777)
Search for a single FILE within the etc directories.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
label index() const noexcept
Return index of model in the model list.
Maps a geometry to a set of cell primitives.
static const Enum< modelType > modelNames
Names of commonly used cellModels corresponding to modelType.