CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

A question about the function MyProcNo() in UPstream.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2023, 21:11
Post A question about the function MyProcNo() in UPstream.
  #1
New Member
 
Join Date: Jul 2022
Posts: 18
Rep Power: 3
applekiller is on a distinguished road
Hello, every Foamers!

This is the definition and initialization of worldComm.
Code:
        //- Default communicator (all processors)
        static label worldComm;

Foam::label Foam::UPstream::worldComm(0);

This is the implementation code for myProcNo, This function returns the number of the current processor in parallel.
Code:
        //- Number of this process (starting from masterNo() = 0)
        static int myProcNo(const label communicator = worldComm)
        {
            return myProcNo_[communicator];
        }
In OpenFOAM code, it's common to see functions that call Pstream::myProcNo(), each of which uses the default argument worldComm. So since worldComm is the same, shouldn't Pstream::myProcNo() get the same value? Why is the number of the current processor returned? (In other words, the return value is different when multiple cores are parallel?)
applekiller is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
LiencubiclowRemodel nzy102 OpenFOAM Bugs 14 January 10, 2012 08:53
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 04:37
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


All times are GMT -4. The time now is 07:30.