31 bool Foam::binaryTree::inSubTree
38 if ((n2ndSearch_ < max2ndSearch_) && (y!=
nullptr))
42 const scalar a = y->a();
44 for (
label i=0; i<phiq.size(); i++)
50 if (y->nodeLeft() ==
nullptr)
53 if (y->leafLeft()->inEOA(phiq))
61 if (inSubTree(phiq, y->nodeLeft(),
x))
68 if ((n2ndSearch_ < max2ndSearch_) && y->nodeRight() ==
nullptr)
72 if (y->leafRight()->inEOA(phiq))
85 return inSubTree(phiq, y->nodeRight(),
x);
90 if (y->nodeRight() ==
nullptr)
93 if (y->leafRight()->inEOA(phiq))
100 if (inSubTree(phiq, y->nodeRight(),
x))
108 if ((n2ndSearch_ < max2ndSearch_) && y->nodeLeft() ==
nullptr)
111 if (y->leafLeft()->inEOA(phiq))
124 return inSubTree(phiq, y->nodeLeft(),
x);
149 coeffsDict_(coeffsDict)
160 const scalar& epsTol,
220 newNode =
new binaryNode(phi0, newChemPoint, parentNode);
222 insertNode(phi0, newNode);
228 newNode =
new binaryNode(phi0, newChemPoint,
nullptr);
232 phi0->
node() = newNode;
233 newChemPoint->
node()=newNode;
247 if ((n2ndSearch_ < max2ndSearch_) && (size_ > 1))
259 else if (inSubTree(phiq, nodeSibling(x),x))
266 while((y->
parent()!=
nullptr) && (n2ndSearch_ < max2ndSearch_))
268 xS = chemPSibling(y);
278 else if (inSubTree(phiq, nodeSibling(y),x))
309 if (siblingPhi0 !=
nullptr)
312 if (z->
parent() ==
nullptr)
316 siblingPhi0->
node()=root_;
333 <<
"wrong addressing of the initial leaf" 339 x = nodeSibling(phi0);
347 <<
"inconsistent structure of the tree, no leaf and no node" 364 label chemPointISATi=0;
367 chemPoints[chemPointISATi++] =
x;
387 variance[vi] +=
sqr(phij[vi]-mean[vi]);
392 scalar maxVariance(-1.0);
396 if (maxVariance < variance[vi])
398 maxVariance = variance[vi];
411 phiMaxDir[j] = chemPoints[j]->phi()[maxDir];
422 chemPoints[phiMaxDir.
indices()[0]],
423 chemPoints[phiMaxDir.
indices()[phiMaxDir.
size()-1]],
428 chemPoints[phiMaxDir.
indices()[0]]->node() = newNode;
429 chemPoints[phiMaxDir.
indices()[phiMaxDir.
size()-1]]->node() = newNode;
431 for (
label cpi=1; cpi<chemPoints.
size()-1; cpi++)
436 chemPoints[phiMaxDir.
indices()[cpi]]->phi(),
444 chemPoints[phiMaxDir.
indices()[cpi]],
449 insertNode(phi0, nodeToAdd);
450 phi0->
node() = nodeToAdd;
451 chemPoints[phiMaxDir.
indices()[cpi]]->node() = nodeToAdd;
474 while((y->
parent() !=
nullptr))
497 <<
"inconsistent structure of the tree, no leaf and no node" #define forAll(list, i)
Loop across all elements in list.
void sort()
(stable) sort the list (if changed after construction time)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#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...
A list that is sorted upon construction or when explicitly requested with the sort() method...
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void balance()
Cheap balance function.
void size(const label)
Override size to be inconsistent with allocated storage.
Leaf of the binary tree. The chemPoint stores the composition 'phi', the mapping of this composition ...
chemPointISAT * treeSuccessor(chemPointISAT *x)
label size() const
Member functions.
void deleteLeaf(chemPointISAT *&phi0)
Delete a leaf from the binary tree and reshape the binary tree for.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void binaryTreeSearch(const scalarField &phiq, binaryNode *node, chemPointISAT *&nearest)
bool secondaryBTSearch(const scalarField &phiq, chemPointISAT *&x)
chemPointISAT * treeMin()
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
chemPointISAT *& leafRight()
volScalarField scalarField(fieldObject, mesh)
void insertNewLeaf(const scalarField &phiq, const scalarField &Rphiq, const scalarSquareMatrix &A, const scalarField &scaleFactor, const scalar &epsTol, const label nCols, const label nActive, chemPointISAT *&phi0)
binaryNode *& nodeRight()
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
bool inEOA(const scalarField &phiq)
To RETRIEVE the mapping from the stored chemPoint phi, the query.
Implementation of the ISAT (In-situ adaptive tabulation), for chemistry calculation.
const dimensionedScalar phi0
Magnetic flux quantum: default SI units: [Wb].
void deleteDemandDrivenData(DataPtr &dataPtr)
binaryTree(chemistryTabulationMethods::ISAT &table, dictionary coeffsDict)
Constructors.
chemPointISAT *& leafLeft()
Access.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.