| Date: Tue, 5 Apr 2016 14:04:40 -0700
add shear test
Diffstat:
M tests/elasticity/Makefile | 23 ++++++++++++-----------
A tests/elasticity/shear.c | 48 +++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 11 deletions(-)
--- |
| t@@ -9,11 +9,16 @@ ESSENTIALOBJS=$(SRCFOLDER)/main.o \
$(SRCFOLDER)/grid.o \
$(SRCFOLDER)/vector_math.o \
$(SRCFOLDER)/simulation.o
-BIN=normal
+BINS=normal shear
-default: run-test
+default: normal-output shear-output
-run-test: normal
+normal-output: normal
+ ./$< --verbose
+ python $(ROOT)postprocessing.py --plot-kinetic-energy $<-output
+ #python $(ROOT)postprocessing.py --plot-sliders $<-output
+
+shear-output: shear
./$< --verbose
python $(ROOT)postprocessing.py --plot-kinetic-energy $<-output
#python $(ROOT)postprocessing.py --plot-sliders $<-output
t@@ -21,14 +26,10 @@ run-test: normal
normal: normal.o $(ESSENTIALOBJS)
$(CC) $(LDLIBS) $^ -o $@
-profile: $(BIN)
- @gprof $< > $<-profile.txt
- @less $<-profile.txt
-
-debug: $(BIN)
- @gdb $<
+shear: shear.o $(ESSENTIALOBJS)
+ $(CC) $(LDLIBS) $^ -o $@
clean:
- @$(RM) $(BIN)
- @$(RM) -r $(BIN)-output
+ @$(RM) $(BINS)
+ @$(RM) -r *-output
@$(RM) *.o |
| t@@ -0,0 +1,48 @@
+#include "../../slidergrid/simulation.h"
+#include "../../slidergrid/grid.h"
+#include "../../slidergrid/slider.h"
+
+#include
+
+// test a regular, 2d, orthogonal grid of sliders
+simulation setup_simulation()
+{
+ // create empty simulation structure with default values
+ simulation sim = create_simulation();
+ sim.id = "shear";
+
+ // initialize grid of sliders
+ //int nx = 10;
+ int nx = 2;
+ int ny = 1;
+ int nz = 1;
+ sim.N = nx*ny*nz;
+ sim.sliders = create_regular_slider_grid(nx, ny, nz, 1.0, 1.0, 1.0);
+
+ sim.bond_length_limit = 1.5;
+
+ // set slider masses and moments of inertia
+ int i;
+ for (i=0; i |