writing controlDict as otherfields
I am trying to first read controlDict and then want to do some changes. After doing changes I am interested to write this controlDict back into system folder of my case.
What I am doing are the following steps:
I declared a dictionary first of all as..
IOdictionary m_controlDict(IOobject("controlDict", runTime.system(),mesh,IOobject::MUST_READ,IOobject ::AUTO_WRITE));
I think all the files should be written in their respective folders by using runTime.write(). But still I am not getting new controlDict file. I am sure that the value of endTime has been changed to 500 but I want to write it back to controlDict file.
I have also seen another function called as write(Ostream,bool) as a member function of dictionary, but I am not getting how can I get Ostream of controlDict.
Please guide me, how can I proceed with my case.
Thanks a lot in advance.
runTime.write() will only write the changes at every writeInterval (within controlDict).
You can use controlDict.write(); to write to the file at any point within a simulation.
write(Ostream,bool) is no longer a member function of dictionary because IOdictionary was also inheriting write() from regIOobject. It is now writeData(Ostream,bool). You can try it using writeData(Info); and it will write the file to screen.
Thanks a lot for the reply.
I tried to use controlDict.write(), but I get always error, probably, I am not selecting accurate arguments.
I did like below:
but i get following error..
candidates are void Foam::regIOobject::write(Foam::Ostream&,bool)const .
Can you please guide me, what I have to write inside these arguments. For the time being I am using runTime.writeNow(); but its not good because it writes all the files at that time, I just have to write specific files.
Have you got the latest version of OF-1.7.x?
Try controlDict.Foam::regIOobject::write(); if you haven't.
But it works now, I did as you say... I used "controlDict.Foam::regIOobject::write(); " and now it works really good.
If you dont mind, can you please tell me why it works by controlDict.Foam::regIOobject::write() and not by simple controlDict.write().
Thanks a lot for all this help...:)
|All times are GMT -4. The time now is 12:53.|