|
[Sponsors] |
multiphaseEulerFoam: Method forAllIter(...) within solve() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 19, 2013, 17:59 |
multiphaseEulerFoam: Method forAllIter(...) within solve()
|
#1 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
hi,
within method solve() of multiphaseEulerFoam is found: Code:
void Foam::multiphaseSystem::solve() { forAllIter(PtrDictionary<phaseModel>, phases_, iter) //PtrDictionary<phaseModel> { iter().correct(); } . . . Code:
forAllIter (...) is defined as for \ ( \ Container::iterator iter = (container).begin(); \ iter != (container).end(); \ ++iter \ ) Iterate across all elements in the container object of type Container. Usage forAll(ContainerType, container, iter) { statements; } Where can I find the class (or struct?) "Container::iterator" , because I need to know what the operator () is doing when called on "iter" ? greetings maybee |
|
December 20, 2013, 07:41 |
|
#2 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
I don't know if this answers your Question, but here is some code of the file $FOAM_SRC/OpenFOAM/containers/PtrListI.H
I assume that phases_ is a pointer list or is based on a pointer list. So my guess is that phases_ is a dynamic data structure and iter() returns the actual element of this list. So iter().correct() calls the correct() method of the phase class. Code:
template<class T> inline T& Foam::PtrList<T>::iterator::operator*() { return **ptr_; } template<class T> inline T& Foam::PtrList<T>::iterator::operator()() { return operator*(); } |
|
December 21, 2013, 06:01 |
|
#3 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
hi,
first of all thx for the help, but I am not really sure if the operators you have listed are the right ones, because when I look in class multiphaseSystem (multiphaseSystem.H) I find for phases_ : Code:
PtrDictionary<phaseModel> phases_; //in multiphaseSystem.H However, when looking at the methods you' ve posted I think they could be the right ones since iterator iter is some kind of pointer and phases_ is a pointer dictionary -> the double dereferenziation therefore seems logical. How could you find these operators and how can I be sure that these are the right ones, since even when I look in class PtrList<T> I can't find them? greetings maybee |
|
January 6, 2014, 13:56 |
|
#4 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
The answer to your question is inhertitance and polymorphism. Both are concepts in computer science and C++ implements them.
phases_ is of the type PtrDictionary<T> The T means any data type that is compatible with all the operations performed on T. If the class PtrDictionary does not define an operator (), then this class must have inherited this operator, otherwise the compiler would throw an error when compiling OpenFOAM. Take a look from which class PtrDictionary is derived and then check this class. Note: C++ allows multiple inhertitance, i.e. class X can be derived from the classes A and B. Somewhere up the family tree you will find a definition for the operator or function you are interested in. |
|
January 7, 2014, 05:35 |
|
#5 | |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
Quote:
http://foam.sourceforge.net/docs/cpp...ce.html#l00055 Also here I canīt find the operator (). See: http://foam.sourceforge.net/docs/cpp...ce.html#l00055 and http://foam.sourceforge.net/docs/cpp/a06384_source.html |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
On the alpha Eqn of VOF method when using Immersed boundary method in OpenFOAM | keepfit | OpenFOAM | 4 | January 31, 2014 15:32 |
Lattice Boltzmann method vs Finite Element Method and Finite Volume Method | solemnpriest | Main CFD Forum | 3 | August 12, 2013 12:00 |
[ANSYS Meshing] Hex dominant method and local inflation | carlp | ANSYS Meshing & Geometry | 8 | July 12, 2012 09:02 |
Reversed Time Marching Method (RTMM) | paillou | FLUENT | 0 | July 12, 2011 07:45 |
use of MAC method to solve sloshing problem. | S.R.SAHI | Main CFD Forum | 1 | April 15, 1999 23:28 |