Forum: Forums topas RSS
run certain code on stop?
rowlesmr #1
Member since Oct 2011 · 169 posts
Group memberships: Members
Show profile · Link to this post
Subject: run certain code on stop?
I'm doing some experimenting with sequential refinements and #list.

I'm copying the out file over the input file so that the next refinement starts from the end point of the previous.

In order for the starting input file not to disappear, I'm copying that to a backup file, and then when I've done the last run, the backup gets copied over the input file, setting it back to the start point.

This is fine if it runs to completion. If I stop it before it gets there, or something errors out, then it is very easy to lose the original input file/backup.

Is there a way to have a portion of the input file run after everything has completed, or is stopped, or errors out?

If not, is there a way to copy the input file to a temporary file, and then run the temporary file, leaving the original untouched?

Thanks

Matthew
--
Matthew
johnsoevans (Administrator) #2
User title: John Evans
Member since Aug 2009 · 177 posts
Group memberships: Administrators, Members
Show profile · Link to this post
We always just default to the method in the tutorial:

Backup_INP
out_file = Concat(String(INP_File), ".INP");

Doesn't that do what you need?  I've never had it mess up mid run.  The only problem you get is if you change num_runs to 1 you will get a blank INP file created.  That's when you rely on the .BCK file.  We tend to put in an if/else statement to avoid that problem.

The other thing we typically do is always refine a VT data set up and down.  That way the final INP file left behind is the one that you need if you restart the analysis.  You also get a check on whether you're hitting the same minimum.  It doubles the analysis time, but that's rarely a major issue.  You can spend the extra time writing AWK scripts!

I'm feeling I might have missed the point of your problem.

John
AlanCoelho #3
Member since Aug 2011 · 242 posts
Group memberships: Members
Show profile · Link to this post
Hi Matthew

To add to John's comments you could also save the results of each INP file as follows:

     system_after_save_OUT {
       copy INP_File##.out INP_File####Run_Number##.out
     }

IN_File and Run_Number are two macros which as defined on start-up.

cheers
alan
rowlesmr #4
Member since Oct 2011 · 169 posts
Group memberships: Members
Show profile · Link to this post
Argh. Forum issues.
--
Matthew
This post was edited 3 times, last on 2018-08-08, 05:48 by rowlesmr.
rowlesmr #5
Member since Oct 2011 · 169 posts
Group memberships: Members
Show profile · Link to this post
Quote by johnsoevans:
Backup_INP
out_file = Concat(String(INP_File), ".INP");

That backs up the current input file to INP_File.backup, and then copies the output of the input file over the current input file so that the next run starts from where the previous run ends.

It then copies the input file over the backup, so you lose your backup of the start point.

I wrote my own Backup_INP_for_Run_0 that only runs when Run_Number == 0.

I also save the OUT files of each step too.


.

I've already let Alan know about the num_runs = 1 bug.

.

It's more a safety issue. When doing sequential runs in TC5 with a batch file, I copied my original input file to TEMP.INP, and then used TEMP.
--
Matthew
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Not logged in. · Lost password · Register
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Current time: 2018-10-22, 00:27:06 (UTC +00:00)