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)
144 return List<scalarField>::operator[](ofield).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_)
311 scalar prevValue = List<scalarField>::operator[](0).operator[](0);
313 for (
int j = 1; j < dim_.size(); j++)
318 for (label i = 1; i < dim_[0]; i++)
321 const scalar currValue =
322 List<scalarField>::operator[](0).operator[](index);
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);
362 if (this->size() == 0)
377 const label
n = this->size();
403 const label
n = this->size();
418 <<
"index (" << i <<
") overflow" <<
nl
429 return fieldIndices_.found(fieldName);
437 const label lo = index(retvals);
439 return interpOutput_;
453 label ofield = outputIndices_[j];
454 scalar baseValue = List<scalarField>::operator[](ofield).operator[](lo);
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;