dev:data_output
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dev:data_output [2014/10/17 03:39] – csymonds | dev:data_output [2014/10/17 03:55] (current) – [AbstractDriver.h] csymonds | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| 2. / | 2. / | ||
| - | ===main.cpp=== | + | ====main.cpp==== | 
| To edit the main.cpp file, paste the following code into the **Private** section of the file: | To edit the main.cpp file, paste the following code into the **Private** section of the file: | ||
| Line 32: | Line 32: | ||
| </ | </ | ||
| + | Then paste the following in the **public** section of main.cpp: | ||
| + | <code cpp> | ||
| + | virtual void DoEpochEvents(Grid< | ||
| + | { | ||
| + | u32 H = Grid< | ||
| + | u32 W = Grid< | ||
| + | |||
| + | u32 emptyCount = 0; | ||
| + | for (u32 y = 0; y < H; ++y) | ||
| + | { | ||
| + | for (u32 x = 0; x < W; ++x) | ||
| + | { | ||
| + | Tile< | ||
| + | for (u32 x = 0; x < P:: | ||
| + | { | ||
| + | for (u32 y = 0; y < P:: | ||
| + | { | ||
| + | const SPoint pt(x, y); | ||
| + | if(Tile< | ||
| + | { | ||
| + | continue; | ||
| + | } | ||
| + | const T * atom = tile.GetAtom(x, | ||
| + |  | ||
| + | //<<< | ||
| + | if (atom-> | ||
| + | ++emptyCount; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + |  | ||
| + | //<<< | ||
| + | const char* path = GetSimDirPathTemporary(" | ||
| + | FILE* fp = fopen(path, " | ||
| + |  | ||
| + | //<<< | ||
| + | fprintf(fp, "%d %d %d\n", | ||
| + | fclose(fp); | ||
| + | // Remember to let the parent run too! | ||
| + | Super:: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Please note: There are 3 TODO tags in the above snippet. These are where you'll need to modify the code to suit your needs. | ||
| + | |||
| + | ====AbstractDriver.h==== | ||
| + | Now we need to do a small modifcation to the AbstractDriver.h file. Paste the following code into the **public** section: | ||
| + | <code cpp> | ||
| + | const char * GetSimulationBasePath() const | ||
| + | { | ||
| + | return & | ||
| + | } | ||
| + | </ | ||
| + | And that's it! Happy scienceing. | ||
dev/data_output.1413517150.txt.gz · Last modified: 2014/10/17 03:39 by csymonds
                
                