CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   init() method of class UpStream (https://www.cfd-online.com/Forums/openfoam-programming-development/126821-init-method-class-upstream.html)

maybee November 26, 2013 16:19

init() method of class UpStream
 
Hi, in one constructor that I am analysing are the methods below:

Code:

if (validParOptions.found(optionName))
{
parRunControl_.runPar(argc, argv);
break;  //leave loop
}

with
Code:

ParRunControl parRunControl_ //- Switch on/off parallel mode.
and
Code:

void runPar(int& argc, char**& argv)
{
RunPar = true;  //bool RunPar;
if (!Pstream::init(argc, argv))
{
Info<< "Failed to start parallel run" << endl;
Pstream::exit(1);
}
}

and herein
Code:

bool Foam::UPstream::init(int& argc, char**& argv) //Spawns slave processes and                     
{                                                  //initialises inter-communication                                                                                 
FatalErrorIn("UPstream::init(int& argc, char**& argv)")
{                                                                                                                     
<< "Trying to use the dummy Pstream library." << nl                                                                                                                           
<< "This dummy library cannot be used in parallel mode"                                                                                                                             
<< Foam::exit(FatalError);                                                                                                                             
return false;                                                                                                                             
}

Within the first if condition the existance of options of commandlinearguments are checked and like the description of the last method init tells a slave process should be spawned und inter-communication should be initialised. Two quesitons:

  1. I don't see where in method init() which I found in class reference of class UpStream a process is spawned. Rather I only see a error message within the method. Am I missing something? Furthermore when searching my PC for Files of class U
    class UpStreampstream I get three different .H and .C Files with different definitions for init() and therefore don't know which one is taken in the above example.
    The paths of the different .C files are:
    • /opt/openfoam221/src/Pstream/dummy
    • /opt/openfoam221/src/Pstream/mpi
    • /opt/openfoam221/src/OpenFOAM/db/IOstreams/Pstreams
  2. Do Options in commandlinearguments generally spawn slave process?

greetings


All times are GMT -4. The time now is 19:26.