Introduction
Introduction Statistics Contact Development Disclaimer Help
trename postprocessing script, restructure test - slidergrid - grid of elastic …
git clone git://src.adamsgaard.dk/slidergrid
Log
Files
Refs
README
LICENSE
---
commit 9a7c3f858d084821a9aba2343c74f8607fbffed2
parent 5420c99b87bf0d3a043aaf7d8ad2ba6dc972bfda
Author: Anders Damsgaard <[email protected]>
Date: Thu, 17 Mar 2016 13:07:19 -0700
rename postprocessing script, restructure test
Diffstat:
M Makefile | 7 ++++++-
D plot_output.py | 60 -----------------------------…
A postprocessing.py | 65 +++++++++++++++++++++++++++++…
M test.c | 6 +++---
4 files changed, 74 insertions(+), 64 deletions(-)
---
diff --git a/Makefile b/Makefile
t@@ -10,7 +10,12 @@ ESSENTIALOBJS=$(SRCFOLDER)/main.o \
$(SRCFOLDER)/simulation.o
BIN=test
-default: debug
+default: run-test
+
+run-test: test
+ ./$<
+ python plot_output.py $<-output
+
test: test.o $(ESSENTIALOBJS)
$(CC) $(LDLIBS) $^ -o $@
diff --git a/plot_output.py b/plot_output.py
t@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-import sys
-import os
-import numpy as np
-import matplotlib.pyplot as plt
-
-VERSION = '0.1-beta'
-
-
-def print_usage(argv0):
- print('usage: ' + argv0 + ' [OPTIONS] <FOLDER>')
- print('where FOLDER is an output folder placed in this directory')
- print('options:')
- print(' -h, --help \tshow this information')
- print(' -v, --version \tshow version information')
-
-
-def print_version(argv0):
- print(argv0 + ' ' + VERSION)
- print('author: Anders Damsgaard, [email protected]')
- print('web: https://github.com/anders-dc/slidergrid')
- print('Licensed under the GNU Public License v3, see LICENSE for details')
-
-
-class sgvis:
-
- def __init__(self, folder):
- self.folder = folder
-
- def read_sliders(self, filename):
- self.filename = filename
- self.sliders = np.loadtxt(self.folder + '/' + self.filename)
-
- def plot_sliders(self):
- plt.plot(self.sliders[:, 0], self.sliders[:, 1], '+')
- outfile = self.folder + '/' + self.filename + '.png'
- print(outfile)
- plt.savefig(outfile)
-
- def plot_all_sliders(self):
- for filename in os.listdir(self.folder):
- if 'sliders' in filename and '.png' not in filename:
- self.read_sliders(filename)
- self.plot_sliders()
-
-if __name__ == '__main__':
- if len(sys.argv) < 2:
- print_usage(sys.argv[0])
- exit()
-
- if sys.argv[1] == '-h' or sys.argv[1] == '--help':
- print_usage(sys.argv[0])
- exit()
-
- if sys.argv[1] == '-v' or sys.argv[1] == '--version':
- print_version(sys.argv[0])
- exit()
-
- sgvis = sgvis(sys.argv[1])
- sgvis.plot_all_sliders()
diff --git a/postprocessing.py b/postprocessing.py
t@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+import sys
+import os
+import numpy as np
+import matplotlib.pyplot as plt
+
+VERSION = '0.1-beta'
+
+
+def print_usage(argv0):
+ print('usage: ' + argv0 + ' [OPTIONS] <FOLDER>')
+ print('where FOLDER is an output folder placed in this directory')
+ print('options:')
+ print(' -h, --help \tshow this information')
+ print(' -v, --version \tshow version information')
+
+
+def print_version(argv0):
+ print(argv0 + ' ' + VERSION)
+ print('author: Anders Damsgaard, [email protected]')
+ print('web: https://github.com/anders-dc/slidergrid')
+ print('Licensed under the GNU Public License v3, see LICENSE for details')
+
+
+class sgvis:
+
+ def __init__(self, folder):
+ self.folder = folder
+
+ def read_sliders(self, filename):
+ self.filename = filename
+ self.sliders = np.loadtxt(self.folder + '/' + self.filename)
+
+ def plot_sliders(self):
+ plt.plot(self.sliders[:, 0], self.sliders[:, 1], '+')
+ outfile = self.folder + '/' + self.filename + '.png'
+ print(outfile)
+ plt.savefig(outfile)
+ plt.clf()
+
+ def plot_all_sliders(self):
+ for filename in os.listdir(self.folder):
+ if 'sliders' in filename and '.png' not in filename:
+ self.read_sliders(filename)
+ self.plot_sliders()
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print_usage(sys.argv[0])
+ exit()
+
+ for arg in sys.argv:
+
+ if sys.argv[1] == '-h' or sys.argv[1] == '--help':
+ print_usage(sys.argv[0])
+ exit()
+
+ if sys.argv[1] == '-v' or sys.argv[1] == '--version':
+ print_version(sys.argv[0])
+ exit()
+
+ sgvis = sgvis(sys.argv[1])
+
+ if sys.argv[1] == '-v' or sys.argv[1] == '--version':
+ sgvis.plot_all_sliders()
diff --git a/test.c b/test.c
t@@ -10,7 +10,7 @@ simulation setup_simulation()
sim.id = "test";
// initialize grid of sliders
- int nx = 4;
+ int nx = 10;
int ny = 1;
int nz = 1;
sim.N = nx*ny*nz;
t@@ -30,8 +30,8 @@ simulation setup_simulation()
// set temporal parameters
sim.time = 0.0;
- sim.time_end = 1.0;
- sim.file_interval = 0.1;
+ sim.time_end = 10.0;
+ sim.file_interval = 0.01;
return sim;
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.