setArgs.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
5 
6  Description:
7  Set the arguments for wrapping OpenFOAM with Cython.
8  For an OpenFOAM lib, we only pass the argsAll parameter, so here we need
9  to convert argsAll to argv and argc for the main function
10 
11 \*---------------------------------------------------------------------------*/
12 
13 // create argc and argv, given argsAll
14 List<word> argvList;
15 
16 char* pch;
17 pch = strtok(argsAll_, " ");
18 int argc = 0;
19 while (pch != NULL)
20 {
21  argc++;
22  argvList.append(pch);
23  pch = strtok(NULL, " ");
24 }
25 
26 char** argv = new char*[argc];
27 for (int i = 0; i < argc; i++)
28 {
29  argv[i] = const_cast<char*>(argvList[i].c_str());
30 }
argvList
List< word > argvList
Definition: setArgs.H:14
argc
int argc
Definition: setArgs.H:18
pch
char * pch
Definition: setArgs.H:16
argv
char ** argv
Definition: setArgs.H:26