31 Foam::radiationModels::absorptionEmissionModels::interpolationLookUpTable::index
33 const List<scalar>& indices,
42 for (
int j = i + 1; j < dim_.size(); j++)
58 label iLastdim = dim_.size() - 1;
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::
154 dim_.setSize(entries_.size());
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)
386 const label n = this->size();
415 const label n = this->size();
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]))
487 interpOutput_[entryIndices_[i]] = retvals;
491 interpOutput_[outputIndices_[j]] =
tmp;
#define forAll(list, i)
Loop across all elements in list.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
bool writeHeader(Ostream &) const
Write header.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
T & operator[](const label)
Return element of UList.
friend Ostream & operator(Ostream &, const UList< T > &)
A list of keyword definitions, which are a keyword followed by any number of values (e....
A class for handling file names.
Registry of regIOobjects.
const List< label > & dim() const
Return const access to the list of dimensions.
const List< scalar > & lookUp(const scalar)
Return the output list given a single input scalar.
interpolationLookUpTable()
Construct null.
bool found(const word &fieldName) const
Return true if the field exists in the table.
void write(Ostream &, const fileName &, const word &instance, const objectRegistry &) const
Write lookup table to filename.
A class for managing temporary objects.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
string expand(const string &s, string::size_type &index, const dictionary &dict, const bool allowEnvVars, const bool allowEmpty)