12.07.2015 Views

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOLFIN</strong> <strong>User</strong> <strong>Manual</strong>Hoffman, Jansson, Logg, Wellslog system if there is no parameter with the given key in the database.The value of the parameter is automatically cast to the correct type whenassigning the value of get() to a variable, as illustrated by the followingexamples:real TOL = get(‘‘tolerance’’);int num_samples = get(‘‘number of samples’’);bool solve_dual = get(‘‘solve dual problem’’);std::string filename = get(‘‘file name’’);Note that there is a small cost associated with accessing the value of a parameter,so if the value of a parameter is to be used multiple times, then itshould be retrieved once and stored in a local variable as illustrated by thefollowing example:int num_samples = get(‘‘number of samples’’);for (int i = 0; i < num_samples; i++){...}11.2 Modifying the value of a parameterTo modify the value of a parameter, use the function set() available in thedolfin namespace:void set(std::string key, Parameter value);This function accepts as arguments a string key together with the correspondingvalue. The value type should match the type of parameter that is74

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!