← Back to team overview

yade-users team mailing list archive

Re: snapshot saving function

 

luc.scholtes wrote:
> Hi,
>
> Is there any function to include in the code which permits to save a xml 
> file during the simulation (If a condition test is verified 
> (resultantForce on a wall >= Fo,...) for example), without being obliged 
> to save every xxx iterations like with the command lines.
>
> Thanks in advance
>
>   Luc
> _______________________________________________
> Yade-users mailing list
> Yade-users@xxxxxxxxxxxxxxxx
> https://lists.berlios.de/mailman/listinfo/yade-users
>
>   
Hi,

You can do it by this command "Omega::instance().saveSimulation(fileName)"

I give a copy of my program..
/////////////////////////
if( Omega::instance().getCurrentIteration() % snapshotInterval == 0 ) 
//<--- you can change this line with

resultantForce on a wall >= Fo,...

{
string fileName = "../data/" + snapshotName + "_" + 
lexical_cast<string>(Omega::instance().getCurrentIteration()) + ".xml";
cerr << "saving snapshot: " << fileName << " ...";
Omega::instance().saveSimulation(fileName);
}

////////////////////
So in this example, You just need to define "snapshotInterval", 
"snapshotName". I put this function in one of my Recorder Class ( 
ForceRecorder for example!!!)

Best regards

wenjie

_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users



Follow ups

References