binaryTree.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "binaryTree.H"
30 #include "SortableList.H"
31 
32 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
33 
34 template<class CompType, class ThermoType>
36 (
37  chemPoint*& phi0,
38  node*& newNode
39 )
40 {
41  if (phi0 == phi0->node()->leafRight())
42  {
43  // phi0 is on the right
44  phi0->node()->leafRight() = nullptr;
45  phi0->node()->nodeRight() = newNode;
46  return;
47  }
48  else if (phi0 == phi0->node()->leafLeft())
49  {
50  // phi0 is on the left
51  phi0->node()->leafLeft() = nullptr;
52  phi0->node()->nodeLeft() = newNode;
53  return;
54 
55  }
56 
57  // if we reach this point, there is an issue with the addressing
59  << "trying to insert a node with a wrong pointer to a chemPoint"
60  << exit(FatalError);
61 }
62 
63 
64 template<class CompType, class ThermoType>
66 (
67  const scalarField& phiq,
68  node* y,
69  chemPoint* x
70 )
71 {
72  if ((n2ndSearch_ < max2ndSearch_) && (y != nullptr))
73  {
74  scalar vPhi = 0;
75  const scalarField& v = y->v();
76  const scalar a = y->a();
77 
78  // compute v*phi
79  for (label i=0; i<phiq.size(); ++i)
80  {
81  vPhi += phiq[i]*v[i];
82  }
83  if (vPhi <= a)
84  {
85  // on the left side of the node
86  if (y->nodeLeft() == nullptr)
87  {
88  // left is a chemPoint
89  ++n2ndSearch_;
90  if (y->leafLeft()->inEOA(phiq))
91  {
92  x = y->leafLeft();
93  return true;
94  }
95  }
96  else
97  {
98  // the left side is a node
99  if (inSubTree(phiq, y->nodeLeft(), x))
100  {
101  return true;
102  }
103  }
104 
105  // not on the left side, try the right side
106  if ((n2ndSearch_ < max2ndSearch_) && y->nodeRight() == nullptr)
107  {
108  ++n2ndSearch_;
109  // we reach the end of the subTree we can return the result
110  if (y->leafRight()->inEOA(phiq))
111  {
112  x = y->leafRight();
113  return true;
114  }
115  else
116  {
117  x = nullptr;
118  return false;
119  }
120  }
121 
122  // Test for n2ndSearch is done in the call of inSubTree
123  return inSubTree(phiq, y->nodeRight(), x);
124  }
125  else
126  {
127  // on right side (symmetric of above)
128 
129  if (y->nodeRight() == nullptr)
130  {
131  ++n2ndSearch_;
132  if (y->leafRight()->inEOA(phiq))
133  {
134  return true;
135  }
136  }
137  else // the right side is a node
138  {
139  if (inSubTree(phiq, y->nodeRight(), x))
140  {
141  x = y->leafRight();
142  return true;
143  }
144  }
145 
146  // if we reach this point, the retrieve has
147  // failed on the right side, explore the left side
148  if ((n2ndSearch_ < max2ndSearch_) && y->nodeLeft() == nullptr)
149  {
150  ++n2ndSearch_;
151  if (y->leafLeft()->inEOA(phiq))
152  {
153  x = y->leafLeft();
154  return true;
155  }
156  else
157  {
158  x = nullptr;
159  return false;
160  }
161  }
162 
163  return inSubTree(phiq, y->nodeLeft(), x);
164  }
165  }
166 
167  return false;
168 }
169 
170 
171 template<class CompType, class ThermoType>
173 {
174  if (subTreeRoot != nullptr)
175  {
176  deleteDemandDrivenData(subTreeRoot->leafLeft());
177  deleteDemandDrivenData(subTreeRoot->leafRight());
178  deleteSubTree(subTreeRoot->nodeLeft());
179  deleteSubTree(subTreeRoot->nodeRight());
180  deleteDemandDrivenData(subTreeRoot);
181  }
182 }
183 
184 
185 template<class CompType, class ThermoType>
187 {
188  if (v != nullptr)
189  {
190  // u is root_
191  if (u->parent() == nullptr)
192  {
193  root_ = v;
194  }
195  // u is on the left of its parent
196  else if (u == u->parent()->nodeLeft())
197  {
198  u->parent()->nodeLeft() = v;
199  }
200  // u is ont the right of its parent
201  else if (u == u->parent()->nodeRight())
202  {
203  u->parent()->nodeRight() = v;
204  }
205  else
206  {
208  << "wrong addressing of the initial node"
209  << exit(FatalError);
210  }
211  v->parent() = u->parent();
212  }
213  else
214  {
216  << "trying to transplant a nullptr node"
217  << exit(FatalError);
218  }
219 }
220 
221 
222 template<class CompType, class ThermoType>
225 {
226  if (y->parent() != nullptr)
227  {
228  if (y == y->parent()->nodeLeft())// y is on the left, return right side
229  {
230  // might return nullptr if the right side is a node
231  return y->parent()->leafRight();
232  }
233  else if (y == y->parent()->nodeRight())
234  {
235  return y->parent()->leafLeft();
236  }
237 
239  << "wrong addressing of the initial node"
240  << exit(FatalError);
241  }
242 
243  // the binaryNode is root_ and has no sibling
244  return nullptr;
245 }
246 
247 
248 template<class CompType, class ThermoType>
251 {
252  if (size_ > 1)
253  {
254  if (x == x->node()->leafLeft())
255  {
256  // x is on the left, return right side
257  // might return nullptr if the right side is a node
258  return x->node()->leafRight();
259  }
260  else if (x == x->node()->leafRight())
261  {
262  // x is on the right, return left side
263  return x->node()->leafLeft();
264  }
265 
267  << "wrong addressing of the initial leaf"
268  << exit(FatalError);
269  }
270 
271  // there is only one leaf attached to the root_, no sibling
272  return nullptr;
273 }
274 
275 
276 template<class CompType, class ThermoType>
279 {
280  if (y->parent() != nullptr)
281  {
282  if (y == y->parent()->nodeLeft())
283  {
284  // y is on the left, return right side
285  return y->parent()->nodeRight();
286  }
287  else if (y == y->parent()->nodeRight())
288  {
289  return y->parent()->nodeLeft();
290  }
291 
293  << "wrong addressing of the initial node"
294  << exit(FatalError);
295  }
296 
297  return nullptr;
298 }
299 
300 
301 template<class CompType, class ThermoType>
304 {
305  if (size_ > 1)
306  {
307  if (x == x->node()->leafLeft())
308  {
309  // x is on the left, return right side
310  return x->node()->nodeRight();
311  }
312  else if (x == x->node()->leafRight())
313  {
314  // x is on the right, return left side
315  return x->node()->nodeLeft();
316  }
317 
319  << "wrong addressing of the initial leaf"
320  << exit(FatalError);
321  }
322 
323  return nullptr;
324 }
325 
326 
327 template<class CompType, class ThermoType>
329 {
330  if (subTreeRoot != nullptr)
331  {
332  deleteAllNode(subTreeRoot->nodeLeft());
333  deleteAllNode(subTreeRoot->nodeRight());
334  deleteDemandDrivenData(subTreeRoot);
335  }
336 }
337 
338 
339 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
340 
341 template<class CompType, class ThermoType>
343 (
345  dictionary coeffsDict
346 )
347 :
348  chemistry_(chemistry),
349  root_(nullptr),
350  maxNLeafs_(coeffsDict.get<label>("maxNLeafs")),
351  size_(0),
352  n2ndSearch_(0),
353  max2ndSearch_(coeffsDict.lookupOrDefault("max2ndSearch",0)),
354  coeffsDict_(coeffsDict)
355 {}
356 
357 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
358 
359 template<class CompType, class ThermoType>
361 {
362  // when we reach the leaf, we return 0
363  if (subTreeRoot == nullptr)
364  {
365  return 0;
366  }
367  else
368  {
369  return
370  1
371  + max
372  (
373  depth(subTreeRoot->nodeLeft()),
374  depth(subTreeRoot->nodeRight())
375  );
376  }
377 }
378 
379 
380 template<class CompType, class ThermoType>
382 (
383  const scalarField& phiq,
384  const scalarField& Rphiq,
385  const scalarSquareMatrix& A,
386  const scalarField& scaleFactor,
387  const scalar& epsTol,
388  const label nCols,
389  chemPoint*& phi0
390 )
391 {
392  if (size_ == 0) // no points are stored
393  {
394  // create an empty binary node and point root_ to it
395  root_ = new node();
396  // create the new chemPoint which holds the composition point
397  // phiq and the data to initialize the EOA
398  chemPoint* newChemPoint =
399  new chemPoint
400  (
401  chemistry_,
402  phiq,
403  Rphiq,
404  A,
405  scaleFactor,
406  epsTol,
407  nCols,
408  coeffsDict_,
409  root_
410  );
411  root_->leafLeft() = newChemPoint;
412  }
413  else // at least one point stored
414  {
415  // no reference chemPoint, a BT search is required
416  if (phi0 == nullptr)
417  {
418  binaryTreeSearch(phiq, root_, phi0);
419  }
420  // access to the parent node of the chemPoint
421  node* parentNode = phi0->node();
422 
423  // create the new chemPoint which holds the composition point
424  // phiq and the data to initialize the EOA
425  chemPoint* newChemPoint =
426  new chemPoint
427  (
428  chemistry_,
429  phiq,
430  Rphiq,
431  A,
432  scaleFactor,
433  epsTol,
434  nCols,
435  coeffsDict_
436  );
437  // insert new node on the parent node in the position of the
438  // previously stored leaf (phi0)
439  // the new node contains phi0 on the left and phiq on the right
440  // the hyper plane is computed in the binaryNode constructor
441  node* newNode;
442  if (size_ > 1)
443  {
444  newNode = new node(phi0, newChemPoint, parentNode);
445  // make the parent of phi0 point to the newly created node
446  insertNode(phi0, newNode);
447  }
448  else // size_ == 1 (because not equal to 0)
449  {
450  // when size is 1, the binaryNode is without hyperplane
451  deleteDemandDrivenData(root_);
452  newNode = new node(phi0, newChemPoint, nullptr);
453  root_ = newNode;
454  }
455 
456  phi0->node() = newNode;
457  newChemPoint->node()=newNode;
458  }
459 
460  ++size_;
461 }
462 
463 
464 template<class CompType, class ThermoType>
466 (
467  const scalarField& phiq,
468  node* node,
469  chemPoint*& nearest
470 )
471 {
472  if (size_ > 1)
473  {
474  scalar vPhi=0.0;
475  const scalarField& v = node->v();
476  const scalar& a = node->a();
477  // compute v*phi
478  for (label i=0; i<phiq.size(); ++i)
479  {
480  vPhi += phiq[i]*v[i];
481  }
482 
483 
484  if (vPhi > a) // on right side (side of the newly added point)
485  {
486  if (node->nodeRight() != nullptr)
487  {
488  binaryTreeSearch(phiq, node->nodeRight(), nearest);
489  }
490  else // the terminal node is reached, store leaf on the right
491  {
492  nearest = node->leafRight();
493  return;
494  }
495  }
496  else // on left side (side of the previously stored point)
497  {
498  if (node->nodeLeft() != nullptr)
499  {
500  binaryTreeSearch(phiq, node->nodeLeft(), nearest);
501  }
502  else // the terminal node is reached, return element on right
503  {
504  nearest = node->leafLeft();
505  return;
506  }
507  }
508  }
509  // only one point stored (left element of the root)
510  else if (size_ == 1)
511  {
512  nearest = root_->leafLeft();
513  }
514  else // no point stored
515  {
516  nearest = nullptr;
517  }
518 }
519 
520 
521 template<class CompType, class ThermoType>
523 (
524  const scalarField& phiq,
525  chemPoint*& x
526 )
527 {
528  // initialize n2ndSearch_
529  n2ndSearch_ = 0;
530  if ((n2ndSearch_ < max2ndSearch_) && (size_ > 1))
531  {
532  chemPoint* xS = chemPSibling(x);
533  if (xS != nullptr)
534  {
535  n2ndSearch_++;
536  if (xS->inEOA(phiq))
537  {
538  x = xS;
539  return true;
540  }
541  }
542  else if (inSubTree(phiq, nodeSibling(x), x))
543  {
544  return true;
545  }
546 
547  // if we reach this point, no leafs were found at this depth or lower
548  // we move upward in the tree
549  node* y = x->node();
550  while ((y->parent()!= nullptr) && (n2ndSearch_ < max2ndSearch_))
551  {
552  xS = chemPSibling(y);
553  if (xS != nullptr)
554  {
555  n2ndSearch_++;
556  if (xS->inEOA(phiq))
557  {
558  x=xS;
559  return true;
560  }
561  }
562  else if (inSubTree(phiq, nodeSibling(y),x))
563  {
564  return true;
565  }
566  y = y->parent();
567  }
568 
569  // if we reach this point it is either because
570  // we did not find another covering EOA in the entire tree or
571  // we reach the maximum number of secondary search
572  return false;
573  }
574 
575  return false;
576 }
577 
578 
579 template<class CompType, class ThermoType>
581 {
582  if (size_ == 1) // only one point is stored
583  {
585  deleteDemandDrivenData(root_);
586  }
587  else if (size_ > 1)
588  {
589  node* z = phi0->node();
590  node* x;
591  chemPoint* siblingPhi0 = chemPSibling(phi0);
592 
593  if (siblingPhi0 != nullptr)// the sibling of phi0 is a chemPoint
594  {
595  // z was root (only two chemPoints in the tree)
596  if (z->parent() == nullptr)
597  {
598  root_ = new node();
599  root_->leafLeft()=siblingPhi0;
600  siblingPhi0->node()=root_;
601  }
602  else if (z == z->parent()->nodeLeft())
603  {
604  z->parent()->leafLeft() = siblingPhi0;
605  z->parent()->nodeLeft() = nullptr;
606  siblingPhi0->node() = z->parent();
607  }
608  else if (z == z->parent()->nodeRight())
609  {
610  z->parent()->leafRight() = siblingPhi0;
611  z->parent()->nodeRight() = nullptr;
612  siblingPhi0->node() = z->parent();
613  }
614  else
615  {
617  << "wrong addressing of the initial leaf"
618  << exit(FatalError);
619  }
620  }
621  else
622  {
623  x = nodeSibling(phi0);
624  if (x !=nullptr)
625  {
626  transplant(z, x);
627  }
628  else
629  {
631  << "inconsistent structure of the tree, no leaf and no node"
632  << exit(FatalError);
633  }
634  }
637  }
638 
639  --size_;
640 }
641 
642 
643 template<class CompType, class ThermoType>
645 {
646  //1) walk through the entire tree by starting with the tree's most left
647  // chemPoint
648  chemPoint* x = treeMin();
649  List<chemPoint*> chemPoints(size_);
650  label chemPointi = 0;
651 
652  //2) compute the mean composition
653  label n = x->phi().size();
654  scalarField mean(n, Zero);
655  while (x != nullptr)
656  {
657  const scalarField& phij = x->phi();
658  mean += phij;
659  chemPoints[chemPointi++] = x;
660  x = treeSuccessor(x);
661  }
662  mean /= scalar(size_);
663 
664  //3) compute the variance for each space direction
665  List<scalar> variance(n, Zero);
666  forAll(chemPoints, j)
667  {
668  const scalarField& phij = chemPoints[j]->phi();
669  forAll(variance, vi)
670  {
671  variance[vi] += sqr(phij[vi] - mean[vi]);
672  }
673  }
674 
675  //4) analyze what is the direction of the maximal variance
676  scalar maxVariance(-1.0);
677  label maxDir(-1);
678  forAll(variance, vi)
679  {
680  if (maxVariance < variance[vi])
681  {
682  maxVariance = variance[vi];
683  maxDir = vi;
684  }
685  }
686  // maxDir indicates the direction of maximum variance
687  // we create the new root node by taking the two extreme points
688  // in this direction if these extreme points were not deleted in the
689  // cleaning that come before the balance function they are still important
690  // and the tree should therefore take them into account
691  SortableList<scalar> phiMaxDir(chemPoints.size(), Zero);
692  forAll(chemPoints, j)
693  {
694  phiMaxDir[j] = chemPoints[j]->phi()[maxDir];
695  }
696 
697  phiMaxDir.sort();
698  // delete reference to all node since the tree is reshaped
699  deleteAllNode();
700  root_ = nullptr;
701 
702  // add the node for the two extremum
703  node* newNode = new node
704  (
705  chemPoints[phiMaxDir.indices()[0]],
706  chemPoints[phiMaxDir.indices()[phiMaxDir.size()-1]],
707  nullptr
708  );
709  root_ = newNode;
710 
711  chemPoints[phiMaxDir.indices()[0]]->node() = newNode;
712  chemPoints[phiMaxDir.indices()[phiMaxDir.size()-1]]->node() = newNode;
713 
714  for (label cpi=1; cpi<chemPoints.size()-1; ++cpi)
715  {
716  chemPoint* phi0;
717  binaryTreeSearch
718  (
719  chemPoints[phiMaxDir.indices()[cpi]]->phi(),
720  root_,
721  phi0
722  );
723  // add the chemPoint
724  node* nodeToAdd =
725  new node(phi0, chemPoints[phiMaxDir.indices()[cpi]], phi0->node());
726  // make the parent of phi0 point to the newly created node
727  insertNode(phi0, nodeToAdd);
728  phi0->node() = nodeToAdd;
729  chemPoints[phiMaxDir.indices()[cpi]]->node() = nodeToAdd;
730  }
731 }
732 
733 
734 template<class CompType, class ThermoType>
737 {
738  if (subTreeRoot != nullptr)
739  {
740  while (subTreeRoot->nodeLeft() != nullptr)
741  {
742  subTreeRoot = subTreeRoot->nodeLeft();
743  }
744  return subTreeRoot->leafLeft();
745  }
746 
747  return nullptr;
748 }
749 
750 
751 template<class CompType, class ThermoType>
754 {
755  if (size_ > 1)
756  {
757  if (x == x->node()->leafLeft())
758  {
759  if (x->node()->nodeRight() == nullptr)
760  {
761  return x->node()->leafRight();
762  }
763  else
764  {
765  return treeMin(x->node()->nodeRight());
766  }
767  }
768  else if (x == x->node()->leafRight())
769  {
770  node* y = x->node();
771  while ((y->parent() != nullptr))
772  {
773  if (y == y->parent()->nodeLeft())
774  {
775  if (y->parent()->nodeRight() == nullptr)
776  {
777  return y->parent()->leafRight();
778  }
779  else
780  {
781  return treeMin(y->parent()->nodeRight());
782  }
783  }
784  y = y->parent();
785  }
786 
787  // when we reach this point, y points to the root and
788  // never entered in the if loop (coming from the right)
789  // so we are at the tree maximum and there is no successor
790  return nullptr;
791  }
792 
794  << "inconsistent structure of the tree, no leaf and no node"
795  << exit(FatalError);
796  }
797 
798  return nullptr;
799 }
800 
801 
802 template<class CompType, class ThermoType>
804 {
805  // Recursively delete the element in the subTree
806  deleteSubTree();
807 
808  // Reset root node (should already be nullptr)
809  root_ = nullptr;
810 
811  // Reset size_
812  size_ = 0;
813 }
814 
815 
816 template<class CompType, class ThermoType>
818 {
819  return size_ >= maxNLeafs_;
820 }
821 
822 
823 template<class CompType, class ThermoType>
825 {
826  // Has to go along each chemPoint of the tree
827  if (size_ > 0)
828  {
829  // First finds the first leaf
830  chemPoint* chemPoint0 = treeMin();
831  chemPoint0->resetNumRetrieve();
832 
833  // Then go to each successor
834  chemPoint* nextchemPoint = treeSuccessor(chemPoint0);
835  while (nextchemPoint != nullptr)
836  {
837  nextchemPoint->resetNumRetrieve();
838  nextchemPoint = treeSuccessor(nextchemPoint);
839  }
840  }
841 }
842 
843 
844 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::binaryTree::treeMin
chemPoint * treeMin()
Definition: binaryTree.H:228
Foam::binaryTree::treeSuccessor
chemPoint * treeSuccessor(chemPoint *x)
Definition: binaryTree.C:753
Foam::binaryNode::parent
binaryNode< CompType, ThermoType > *& parent()
Definition: binaryNode.H:164
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::binaryTree::deleteLeaf
void deleteLeaf(chemPoint *&phi0)
Delete a leaf from the binary tree and reshape the binary tree for.
Definition: binaryTree.C:580
Foam::binaryTree::isFull
bool isFull()
ListFull.
Definition: binaryTree.C:817
Foam::binaryTree::resetNumRetrieve
void resetNumRetrieve()
Definition: binaryTree.C:824
A
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Foam::chemPointISAT::resetNumRetrieve
void resetNumRetrieve()
Resets the number of retrieves at each time step.
Definition: chemPointISAT.C:799
chemistry
BasicChemistryModel< psiReactionThermo > & chemistry
Definition: createFieldRefs.H:1
Foam::chemPointISAT::inEOA
bool inEOA(const scalarField &phiq)
To RETRIEVE the mapping from the stored chemPoint phi, the query.
Definition: chemPointISAT.C:370
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:81
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.H:1241
Foam::binaryTree::deleteAllNode
void deleteAllNode()
Definition: binaryTree.H:221
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::binaryNode::leafRight
chemPointISAT< CompType, ThermoType > *& leafRight()
Definition: binaryNode.H:149
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:42
n
label n
Definition: TABSMDCalcMethod2.H:31
SortableList.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::Field< scalar >
Foam::chemPointISAT
Leaf of the binary tree. The chemPoint stores the composition 'phi', the mapping of this composition ...
Definition: chemPointISAT.H:142
Foam::constant::electromagnetic::phi0
const dimensionedScalar phi0
Magnetic flux quantum: default SI units: [Wb].
Foam::binaryTree::insertNewLeaf
void insertNewLeaf(const scalarField &phiq, const scalarField &Rphiq, const scalarSquareMatrix &A, const scalarField &scaleFactor, const scalar &epsTol, const label nCols, chemPoint *&phi0)
Definition: binaryTree.C:382
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::binaryTree::balance
void balance()
Cheap balance function.
Definition: binaryTree.C:644
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::SortableList
A list that is sorted upon construction or when explicitly requested with the sort() method.
Definition: List.H:66
Foam::binaryNode::leafLeft
chemPointISAT< CompType, ThermoType > *& leafLeft()
Access.
Definition: binaryNode.H:144
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::binaryTree
Data storage of the chemistryOnLineLibrary according to a binary tree structure.
Definition: binaryTree.H:59
Foam::SquareMatrix< scalar >
binaryTree.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::binaryTree::secondaryBTSearch
bool secondaryBTSearch(const scalarField &phiq, chemPoint *&x)
Definition: binaryTree.C:523
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::binaryNode
Node of the binary tree.
Definition: binaryNode.H:51
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
Foam::chemPointISAT::node
binaryNode< CompType, ThermoType > *& node()
Definition: chemPointISAT.H:317
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::binaryNode::a
const scalar & a() const
Definition: binaryNode.H:181
Foam::binaryTree::binaryTree
binaryTree(TDACChemistryModel< CompType, ThermoType > &chemistry, dictionary coeffsDict)
Construct from dictionary and chemistryOnLineLibrary.
Definition: binaryTree.C:343
Foam::TDACChemistryModel< CompType, ThermoType >
Foam::binaryTree::binaryTreeSearch
void binaryTreeSearch(const scalarField &phiq, node *node, chemPoint *&nearest)
Definition: binaryTree.C:466
Foam::binaryTree::depth
label depth()
Definition: binaryTree.H:148
Foam::binaryTree::clear
void clear()
Removes every entries of the tree and delete the associated objects.
Definition: binaryTree.C:803
Foam::binaryNode::nodeRight
binaryNode< CompType, ThermoType > *& nodeRight()
Definition: binaryNode.H:159
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::binaryNode::nodeLeft
binaryNode< CompType, ThermoType > *& nodeLeft()
Definition: binaryNode.H:154
Foam::binaryNode::v
const scalarField & v() const
Topology.
Definition: binaryNode.H:171