CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Pcg (http://www.cfd-online.com/Forums/openfoam-programming-development/123786-pcg.html)

luckycfd September 21, 2013 00:52

Pcg
 
Hi,
line below is from PCG.C source code:
Code:

register label nCells = psi.size();
I'm looking for some annotaions about the task of this line in the code.

Regards,
Hassan

luckycfd September 22, 2013 02:33

I need a highly annotated version of the PCG.C source code in openFoam,
please help me in this way.

regards,
Hassan

nimasam September 22, 2013 02:58

Dear Hasan

Quote:

line below is from PCG.C source code:
Code:
register label nCells = psi.size();
I'm looking for some annotaions about the task of this line in the code.
well, psi should be a variable :), or in other word its an array :). so that line return the size of array
Quote:

need a highly annotated version of the PCG.C source code in openFoam,
could you please be more specific? what do you want?

and extra comment ;), post your question just one place at forum (another similar post is:http://www.cfd-online.com/Forums/ope...tml#post452938)

Best Regards

luckycfd September 22, 2013 03:11

1 Attachment(s)
Hi,
According to part of PCG.C code that shown below;
Code:

register label nCells = psi.size(); 
scalar* __restrict__ psiPtr = psi.begin(); 
scalarField pA(nCells);
scalar* __restrict__ pAPtr = pA.begin(); 
scalarField wA(nCells);
scalar* __restrict__ wAPtr = wA.begin(); 
scalar wArA = solverPerf.great_;
scalar wArAold = wArA;

What is the task of begin() and great_ functions?

Regards,
Hassan

luckycfd September 23, 2013 09:40

Post changed.

nimasam September 23, 2013 11:46

Dear Hassan!
as you pointed, its a function :D, you should look at the definition of that function

luckycfd September 23, 2013 13:24

Dear Nima,
wow... now how ca I access to their definition?
Thanks

wyldckat September 23, 2013 15:47

Greetings to all!

@Hassan:
  1. Start from the code documentation: http://foam.sourceforge.net/docs/cpp/index.html
  2. Search for "scalarField" and pick the first one -> http://foam.sourceforge.net/docs/cpp...86e99235e0a397
  3. It tells you that:
    Quote:

    scalarField Specialisation of Field<T> for scalar.
  4. So you click on "Field" -> http://foam.sourceforge.net/docs/cpp/a00627.html
  5. This is a template class, which actually inherits a lot of its own characteristics from other template classes, so the quickest now if to search the page for "List of all members." and click on it -> http://foam.sourceforge.net/docs/cpp/a12154.html
  6. In this page, you can see all of the methods available for this class, including the method "begin()".

If you haven't studied C++ yet, you can start here: http://www.cplusplus.com/doc/tutorial/


As for other ways of investigating where the code comes from: http://openfoamwiki.net/index.php/Ho...M_with_Eclipse


Best regards,
Bruno


All times are GMT -4. The time now is 23:22.