Problem writing to dictionary
Hello!
I am developing an OpenFOAM model for electrolytes and in this context one module predicts diffusivities and is supposed to write its results to a dictionary for others to read. Writing to dictionaries seems straight-forward enough, but for some reason I can't get it to work. This is how I define the IODictionary to be written to: Code:
IOdictionary electrolyteProperties Code:
dictionary& DDict = electrolyteProperties.subDict("D"); Code:
D Code:
electrolyteProperties.set("values",DVals); Code:
DVals: 3(4.34118e-12 4.56812e-12 3.49564e-12) Anyone have an idea of what may cause my problem? |
Actually, printing the dictionary (using Info) gives exactly what I want, but it never ends up in the file. Do I need to call some write function of some sort? Just writing DDict.write() or electrolyteProperties.write() does not work, then the compiler complains that function call is ambiguous.
|
Hi,
You can resolve write method ambiguity, for example, like this: Code:
IOdictionary electrolyteProperties |
Thanks a lot Alexey! That solved my problem.
/Rasmus |
declaration issues with update code
Hello,
I run into compile errors with this code which I want to use to update some values in a dictionary: code: Code:
// IO test changing p-minIter value in fvSolutions file myPCG_solve.C:111:1: error: ‘IOdictionary’ was not declared in this scope IOdictionary fvSolution(IOobject("fvSolution",runTime.system(), mesh,IOobject::NO_READ,IOobject::AUTO_WRITE)); ^ myPCG_solve.C:114:1: error: ‘dictionary’ was not declared in this scope dictionary mySubDictUpdate(fvSolution.subDict("p")); myPCG_solve.C:117:1: error: ‘mySubDictUpdate’ was not declared in this scope mySubDictUpdate.set("minIter", 33 ); ^ myPCG_solve.C:122:1: error: ‘fvSolution’ was not declared in this scope fvSolution.Foam::IOobject::write(); ^ myPCG_solve.C:122:18: error: ‘Foam::IOobject’ has not been declared fvSolution.Foam::IOobject::write(); How can I declare the object and dictionaries "in this scope"? Klaus |
All times are GMT -4. The time now is 03:02. |