31 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::index
33 const List<scalar>& indices,
42 for (
int j = i + 1; j < dim_.
size(); j++)
63 label((indices[iLastdim] - min_[iLastdim])/delta_[iLastdim]),
75 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::index
86 label((indice - min_[i])/delta_[i]),
97 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::
100 const scalar lookUpValue,
101 const label interfield
104 return lookUpValue >= min_[interfield] && lookUpValue <= max_[interfield];
109 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::
114 const scalar lookUpValue,
116 const label interfield
151 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::
155 min_.setSize(entries_.size());
156 delta_.setSize(entries_.size());
157 max_.setSize(entries_.size());
158 entryIndices_.
setSize(entries_.size());
159 outputIndices_.
setSize(output_.size());
165 dim_[i] = entries_[i].template lookup<label>(
"N");
166 max_[i] = entries_[i].template lookup<scalar>(
"max");
167 min_[i] = entries_[i].template lookup<scalar>(
"min");
168 delta_[i] = (max_[i] - min_[i])/dim_[i];
169 tableDim *= dim_[i] + 1;
170 fieldIndices_.insert(entries_[i].
lookup(
"name"), index);
171 entryIndices_[i] = index;
177 fieldIndices_.insert(output_[i].
lookup(
"name"), index);
178 outputIndices_[i] = index;
182 List<scalarField>&
internal = *
this;
184 internal.
setSize(entries_.size() + output_.size());
186 interpOutput_.
setSize(entries_.size() + output_.size());
190 internal[i].setSize(tableDim);
196 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::
199 const word& instance,
200 const objectRegistry& obr
215 control.lookup(
"fields") >> entries_;
216 control.lookup(
"output") >> output_;
217 control.lookup(
"values") >> *
this;
223 if (this->
size() == 0)
237 fileName_(
"fileNameIsUndefined")
245 const word& instance,
261 readTable(instance, obr);
272 fileName_(interpTable.fileName_),
273 dim_(interpTable.dim_),
274 min_(interpTable.min_),
275 delta_(interpTable.delta_),
276 max_(interpTable.max_),
279 entryIndices_(interpTable.entryIndices_),
280 outputIndices_(interpTable.outputIndices_),
281 interpOutput_(interpTable.interpOutput_)
297 entries_(dict.
lookup(
"fields")),
298 output_(dict.
lookup(
"output")),
311 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::
317 for (
int j = 1; j < dim_.
size(); j++)
322 for (
label i = 1; i < dim_[0]; i++)
325 const scalar currValue =
329 if (currValue <= prevValue)
332 <<
"out-of-order value: " << currValue
335 prevValue = currValue;
346 const word& instance,
368 if (this->
size() == 0)
430 <<
"index (" << i <<
") overflow" <<
nl 442 const word& fieldName
445 return fieldIndices_.found(fieldName);
456 const label lo = index(retvals);
458 return interpOutput_;
463 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::
473 label ofield = outputIndices_[j];
478 if (checkRange(retvals, entryIndices_[i]))
484 tmp += interpolate(lo, hi, retvals, ofield, entryIndices_[i])
487 interpOutput_[entryIndices_[i]] = retvals;
491 interpOutput_[outputIndices_[j]] = tmp;
#define forAll(list, i)
Loop across all elements in list.
string expand(const string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
friend Ostream & operator(Ostream &, const UList< T > &)
A list of keyword definitions, which are a keyword followed by any number of values (e...
T & operator[](const label)
Return element of UList.
#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...
void size(const label)
Override size to be inconsistent with allocated storage.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
interpolationLookUpTable()
Construct null.
const List< scalar > & lookUp(const scalar)
Return the output list given a single input scalar.
void write(Ostream &, const fileName &, const word &instance, const objectRegistry &) const
Write lookup table to filename.
stressControl lookup("compactNormalStress") >> compactNormalStress
A class for handling words, derived from string.
const List< label > & dim() const
Return const access to the list of dimensions.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
void setSize(const label)
Reset size of List.
bool writeHeader(Ostream &) const
Write header.
A class for managing temporary objects.
Registry of regIOobjects.
const List< dictionary > & output() const
Return const access to the output dictionaries.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label size() const
Return the number of elements in the UList.
bool found(const word &fieldName) const
Return true if the field exists in the table.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.