forked from AMReX-Codes/amrex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ParmParse: Math expression support (AMReX-Codes#4032)
ParmParse: Math expression support Support math expression for integers and floating point numbers in ParmParse. For example, n_cell = 128 amrex.n_cell = n_cell*2 8 16**2 becomes n_cell = 128 amrex.n_cell = 256 8 256 Note that if the expression contains another variable, it will be looked up by ParmParse. ParmParse's constructor now accepts an optional second argument, `parser_prefix`. When a variable in a math expression is being looked up, it will first try to find it by using the exact name of the variable. If this attempt fails and the `ParmParse` object has a non-empty `parser_prefix`, it will try again, this time looking up the variable by prefixing its name with `parser_prefix` followed by a `.`. For example, physical_constants.c = 3.e8 amrex.pi = 3.14 amrex.foo = sin(amrex.pi/2)*c**2 will give `foo = 8.999997146e+16` if we do amrex::ParmParse pp("amrex", "physical_constants"); double foo; pp.get("foo", foo);
- Loading branch information
1 parent
11d31e5
commit fd1633e
Showing
3 changed files
with
479 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.