tadd basic file structure - slidergrid - grid of elastic sliders on a frictional surface
git clone git://src.adamsgaard.dk/slidergrid
Log
Files
Refs
README
LICENSE
---
commit 97b114c780051bc40e193d0fee2f23f745ae6545
parent 3cc2eb258e5d3c27c15cd4b474cb8b8ac2135ae7
Author: Anders Damsgaard 
Date:   Tue, 15 Mar 2016 12:33:45 -0700

add basic file structure

Diffstat:
  A Makefile                            |      15 +++++++++++++++
  A main.c                              |       8 ++++++++
  A slider.c                            |       7 +++++++
  A slider.h                            |      15 +++++++++++++++
  A typedefs.h                          |      15 +++++++++++++++

5 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/Makefile b/Makefile
t@@ -0,0 +1,15 @@
+CC=gcc
+CFLAGS=-Wall -O3 -g -pg
+LDLIBS=-lm
+BIN=slidergrid
+
+$(BIN): main.o slider.o
+        $(CC) $(LDLIBS) $^ -o $@
+
+profile: $(BIN)
+        @gprof $< > $<-profile.txt
+        @less $<-profile.txt
+
+clean:
+        @$(RM) $(BIN)
+        @$(RM) *.o
diff --git a/main.c b/main.c
t@@ -0,0 +1,8 @@
+#include 
+#include 
+
+int main(int argc, char** argv)
+{
+
+    return EXIT_SUCCESS;
+}
diff --git a/slider.c b/slider.c
t@@ -0,0 +1,7 @@
+#include 
+#include "slider.h"
+
+void print_position(slider s)
+{
+    printf("%f\t%f\t%f\n", s.pos.x, s.pos.y, s.pos.z);
+};
diff --git a/slider.h b/slider.h
t@@ -0,0 +1,15 @@
+#ifndef SLIDER_H_
+#define SLIDER_H_
+
+#include "typedefs.h"
+
+typedef struct {
+    v3 pos;  // spatial position
+    Float bulk_modulus;  // elastic compressibility
+    int neighbors[];  // indexes of sliders this one is bonded to
+} slider;
+
+
+void print_position(slider s);
+
+#endif
diff --git a/typedefs.h b/typedefs.h
t@@ -0,0 +1,15 @@
+#ifndef TYPEDEFS_H_
+#define TYPEDEFS_H_
+
+/* Choose floating point precision */
+//typedef float Float;
+typedef double Float;
+
+
+typedef struct {
+    Float x;
+    Float y;
+    Float z;
+} v3;
+
+#endif