|
[Sponsors] |
May 10, 2010, 17:41 |
Creating pre-processing utility
|
#1 |
Member
Pascal
Join Date: Jun 2009
Location: Montreal
Posts: 65
Rep Power: 17 |
Hi all,
I've created an utility (vit_cond_init_2t_test) and every thing goes right. But now I would like to be able to give parameters (entries) to my utility to customize it like that: vit_cond_init_2t_test a b c d where a, b, c and d are input parameters I would like to modify my utility to do so. Here's what I've tried : Code:
int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" # include "createFields.H" argList::validArgs.append("value"); argList::validArgs.append("value"); argList::validArgs.append("value"); argList::validArgs.append("value"); scalar a(readScalar(IStringStream(args.args()[1])())); scalar b(readScalar(IStringStream(args.args()[2])())); scalar c(readScalar(IStringStream(args.args()[3])())); scalar d(readScalar(IStringStream(args.args()[4])())); ... return(0); } Code:
Wrong number of arguments, expected 0 found 4 FOAM exiting Pascal |
|
May 11, 2010, 03:22 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
You want something like this: Code:
int main(int argc, char *argv[]) { // does it work correctly in parallel? If not you need this: // argList::noParallel(); // define allowable options and arguments argList::validArgs.append("valueA"); argList::validArgs.append("valueB"); argList::validArgs.append("valueC"); argList::validArgs.append("valueD"); // construct 'args' from command-line, parsing options/arguments: # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" # include "createFields.H" const scalar a(readScalar(IStringStream(args.args()[1])())); const scalar b(readScalar(IStringStream(args.args()[2])())); const scalar c(readScalar(IStringStream(args.args()[3])())); const scalar d(readScalar(IStringStream(args.args()[4])())); ... return 0; } This hopefully gets you going. |
||
May 11, 2010, 18:58 |
|
#3 |
Member
Pascal
Join Date: Jun 2009
Location: Montreal
Posts: 65
Rep Power: 17 |
Thanks a lot M. Olesen, everything works perfectly!
Pascal |
|
Tags |
entries, pre-processing, utility |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commercial meshers] Fluent3DMeshToFoam | simvun | OpenFOAM Meshing & Mesh Conversion | 50 | January 19, 2020 16:33 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |
Problems with Meshing: Collapsed Cells | Emmanuel Resch | Siemens | 1 | July 30, 2007 04:02 |
Creating new utility Lorentz force calculation | adekian | OpenFOAM Running, Solving & CFD | 0 | May 24, 2007 06:16 |
PRE and POST processing package | Astrid Barros | Main CFD Forum | 6 | November 16, 2000 11:31 |