34 const List<scalar>& indices,
43 for (
int j = i + 1; j < dim_.size(); j++)
52 max(label((indices[i] - min_[i])/delta_[i]), 0),
59 label iLastdim = dim_.size() - 1;
64 label((indices[iLastdim] - min_[iLastdim])/delta_[iLastdim]),
87 label((indice - min_[i])/delta_[i]),
100 const scalar lookUpValue,
101 const label interfield
104 return lookUpValue >= min_[interfield] && lookUpValue <= max_[interfield];
113 const scalar lookUpValue,
115 const label interfield
120 List<scalarField>::operator[](interfield).
operator[](hi)
121 != List<scalarField>::operator[](interfield).
operator[](lo)
126 List<scalarField>::operator[](ofield).
operator[](lo)
128 List<scalarField>::operator[](ofield).
operator[](hi)
129 - List<scalarField>::operator[](ofield).
operator[](lo)
133 - List<scalarField>::operator[](interfield).
operator[](lo)
136 List<scalarField>::operator[](interfield).
operator[](hi)
137 - List<scalarField>::operator[](interfield).
operator[](lo)
153 dim_.setSize(entries_.size());
154 delta_.setSize(entries_.size());
155 max_.setSize(entries_.size());
156 entryIndices_.setSize(entries_.size());
157 outputIndices_.setSize(output_.size());
163 dim_[i] = entries_[i].template get<label>(
"N");
164 max_[i] = entries_[i].template get<scalar>(
"max");
165 min_[i] = entries_[i].template get<scalar>(
"min");
166 delta_[i] = (max_[i] - min_[i])/dim_[i];
167 tableDim *= dim_[i] + 1;
168 fieldIndices_.insert(entries_[i].
template get<word>(
"name"), index);
169 entryIndices_[i] = index;
175 fieldIndices_.insert(output_[i].
template get<word>(
"name"), index);
176 outputIndices_[i] = index;
180 List<scalarField>&
internal = *
this;
182 internal.setSize(entries_.size() + output_.size());
184 interpOutput_.setSize(entries_.size() + output_.size());
188 internal[i].setSize(tableDim);
196 const word& instance,
197 const objectRegistry& obr
207 IOobject::MUST_READ_IF_MODIFIED,
212 control.readEntry(
"fields", entries_);
213 control.readEntry(
"output", output_);
214 control.readEntry(
"values", *
this);
220 if (this->size() == 0)
234 fileName_(
"fileNameIsUndefined")
242 const word& instance,
258 readTable(instance, obr);
269 fileName_(interpTable.fileName_),
270 entryIndices_(interpTable.entryIndices_),
271 outputIndices_(interpTable.outputIndices_),
272 dim_(interpTable.dim_),
273 min_(interpTable.min_),
274 delta_(interpTable.delta_),
275 max_(interpTable.max_),
278 interpOutput_(interpTable.interpOutput_)
313 for (
int j = 1; j < dim_.size(); j++)
318 for (label i = 1; i < dim_[0]; i++)
321 const scalar currValue =
325 if (currValue <= prevValue)
328 <<
"out-of-order value: " << currValue
331 prevValue = currValue;
341 const word& instance,
342 const objectRegistry& obr
357 control.writeHeader(
os);
359 os.writeEntry(
"fields", entries_);
360 os.writeEntry(
"output", output_);
362 if (this->size() == 0)
367 os.writeEntry(
"values", *
this);
377 const label
n = this->size();
403 const label
n = this->size();
418 <<
"index (" << i <<
") overflow" <<
nl 429 return fieldIndices_.contains(fieldName);
437 const label lo = index(retvals);
439 return interpOutput_;
453 label ofield = outputIndices_[j];
458 if (checkRange(retvals, entryIndices_[i]))
462 label hi =
Foam::min(lo + dim, (*
this)[0].size() - 1);
464 tmp +=
interpolate(lo, hi, retvals, ofield, entryIndices_[i])
467 interpOutput_[entryIndices_[i]] = retvals;
471 interpOutput_[outputIndices_[j]] = tmp;
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
interpolationLookUpTable()
Construct null.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
constexpr char nl
The newline '\n' character (0x0a)
bool contains(const word &fieldName) const
Return true if the field exists in the table.
Lookup type of boundary radiation properties.
void write(Ostream &, const fileName &, const word &instance, const objectRegistry &) const
Write lookup table to filename.
#define forAll(list, i)
Loop across all elements in list.
T & operator[](const label i)
Return element of UList.
void setSize(const label n)
Alias for resize()
A class for handling words, derived from Foam::string.
A list of lists. Interpolates based on the first dimension. The values must be positive and monotonic...
const scalarField & operator[](const label) const
Return an element of constant List<scalar, Type>
const List< scalar > & lookUp(const scalar)
Return the output list given a single input scalar.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
OBJstream os(runTime.globalPath()/outputName)
static void check(const int retVal, const char *what)
static Ostream & output(Ostream &os, const IntRange< T > &range)
Registry of regIOobjects.
string expand(const std::string &s, const HashTable< string > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping and return the expanded string.