Skip to content

Commit 2f2e4cb

Browse files
committed
Move to git
0 parents  commit 2f2e4cb

30 files changed

+7979
-0
lines changed

LICENSE

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#makefile for Jenn3d
2+
3+
####### switch this to whatever is appropriate for your platform ##############
4+
5+
#COMPILE_TYPE = mac
6+
#COMPILE_TYPE = mac_debug
7+
#COMPILE_TYPE = cygwin
8+
#COMPILE_TYPE = linux
9+
#COMPILE_TYPE = debug
10+
#COMPILE_TYPE = profile
11+
COMPILE_TYPE = devel
12+
13+
#### if you have libpng installed, uncomment this:
14+
15+
HAVE_PNG = true
16+
17+
######## leave everything else the same #######################################
18+
19+
CC = g++
20+
CXX = g++
21+
22+
#OPT = -O3 -funroll-loops -pipe
23+
OPT = -O3 -ffast-math -fomit-frame-pointer -funroll-loops -pipe
24+
#OPT = -O3 -m32 -march=prescott -malign-double -mfpmath=sse -ffast-math -fomit-frame-pointer -funroll-loops -fprefetch-loop-arrays -ftree-vectorize -fno-exceptions -fno-check-new -pipe
25+
WARNINGS = -Wall
26+
27+
#opengl stuff
28+
GL_LINUX = -lglut -lGLU -lGL
29+
GL_MAC = -framework OpenGL -framework Glut
30+
GL_CYGWIN = -lglut32 -lglu32 -lopengl32
31+
32+
#png stuff
33+
ifdef HAVE_PNG
34+
PNG_LINUX = -lpng
35+
PNG_MAC = -L/sw/lib -lpng -lz
36+
PNG_CYGWIN = -L/usr/local/lib -lpng -lz
37+
USR_CAPT = -DCAPTURE=4
38+
DEV_CAPT = -DCAPTURE=24
39+
else
40+
PNG_LINUX =
41+
PNG_MAC =
42+
PNG_CYGWIN =
43+
USER_CAPT =
44+
DEVEL_CAPT =
45+
endif
46+
47+
#compiler flags
48+
ifeq ($(COMPILE_TYPE), mac)
49+
CPPFLAGS = -I/sw/include -DDEBUG_LEVEL=0 -DMAC_HACKS $(USR_CAPT)
50+
CXXFLAGS = $(OPT) -I/sw/include
51+
LDFLAGS = $(OPT) -L/sw/libs
52+
LIBS = $(GL_MAC) $(PNG_MAC)
53+
endif
54+
ifeq ($(COMPILE_TYPE), mac_debug)
55+
CPPFLAGS = -I/sw/include -DDEBUG_LEVEL=2 -DMAC_HACKS $(USR_CAPT)
56+
CXXFLAGS = -I/sw/include -ggdb
57+
LDFLAGS = -L/sw/lib -rdynamic -ggdb
58+
LIBS = $(GL_MAC) $(PNG_MAC)
59+
endif
60+
ifeq ($(COMPILE_TYPE), cygwin)
61+
CPPFLAGS = -I/usr/local/include -DDEBUG_LEVEL=0 -DCYGWIN_HACKS $(USR_CAPT)
62+
CXXFLAGS = -I/usr/local/include -mno-cygwin -mwin32
63+
LDFLAGS = -L/usr/local/lib -mno-cygwin -mwin32
64+
LIBS = $(GL_CYGWIN) $(PNG_CYGWIN)
65+
endif
66+
ifeq ($(COMPILE_TYPE), linux)
67+
CPPFLAGS = -DDEBUG_LEVEL=0 $(USR_CAPT)
68+
CXXFLAGS = $(OPT)
69+
LDFLAGS = $(OPT)
70+
LIBS = $(GL_LINUX) $(PNG_LINUX)
71+
endif
72+
ifeq ($(COMPILE_TYPE), debug)
73+
CPPFLAGS = -DDEBUG_LEVEL=2 $(DEV_CAPT)
74+
CXXFLAGS = $(WARNINGS) -ggdb
75+
LDFLAGS = -rdynamic -ggdb
76+
LIBS = $(GL_LINUX) $(PNG_LINUX)
77+
endif
78+
ifeq ($(COMPILE_TYPE), profile)
79+
CPPFLAGS = -DDEBUG_LEVEL=0 $(DEV_CAPT)
80+
CXXFLAGS = -O2 -pg -ftest-coverage -fprofile-arcs
81+
LDFLAGS = -O2 -pg -ftest-coverage -fprofile-arcs
82+
LIBS = $(GL_LINUX) $(PNG_LINUX)
83+
endif
84+
ifeq ($(COMPILE_TYPE), devel)
85+
CPPFLAGS = -DDEBUG_LEVEL=0 $(DEV_CAPT)
86+
CXXFLAGS = $(OPT)
87+
LDFLAGS = $(OPT)
88+
LIBS = $(GL_LINUX) $(PNG_LINUX)
89+
endif
90+
91+
#default target
92+
all: jenn
93+
94+
#modules
95+
definitions.o: definitions.C definitions.h
96+
linalg.o: linalg.C linalg.h definitions.h
97+
todd_coxeter.o: todd_coxeter.C todd_coxeter.h linalg.h definitions.h
98+
go_game.o: go_game.C go_game.h linalg.h todd_coxeter.h definitions.h
99+
drawing.o: drawing.C drawing.h linalg.h go_game.h aligned_vect.h definitions.h
100+
trail.o: trail.C trail.h linalg.h aligned_vect.h definitions.h
101+
animation.o: animation.C animation.h linalg.h definitions.h
102+
projection.o: projection.C projection.h animation.h drawing.h trail.h linalg.h definitions.h
103+
polytopes.o: polytopes.C polytopes.h projection.h animation.h drawing.h definitions.h
104+
menus.o: menus.C menus.h main.h polytopes.h projection.h animation.h drawing.h definitions.h
105+
aligned_alloc.o: aligned_alloc.C aligned_alloc.h
106+
107+
#final product
108+
MAIN_O = main.o linalg.o menus.o todd_coxeter.o go_game.o polytopes.o animation.o projection.o drawing.o trail.o aligned_alloc.o definitions.o
109+
main.o: main.C main.h linalg.h menus.h go_game.h trail.h polytopes.h drawing.h animation.h projection.h definitions.h
110+
jenn: $(MAIN_O)
111+
$(CC) $(CXXFLAGS) -o jenn $(MAIN_O) $(LIBS)
112+
113+
profile: jenn
114+
./jenn -c 5 2 2 3 2 3 -v 3 -e 0 1 2 -f 02 03 12 13
115+
gcov drawing.C
116+
gprof -l -b jenn > jenn.prof
117+
gvim jenn.prof &
118+
test: test.C
119+
$(CC) -o test test.C $(LIBS)
120+
121+
clean:
122+
rm -f core *.o jenn temp.* *.prof *.gcov *.da *.bb *.bbg gmon.out jenn_capture.png jenn_export.stl

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
# Jenn3d #
3+
4+
[Main site](http://jenn3d.org)
5+
6+
Jenn is a toy for playing with various quotients of Cayley graphs of finite
7+
Coxeter groups on four generators. Jenn builds the graphs using the
8+
Todd-Coxeter algorithm, embeds them into the 3-sphere, and stereographically
9+
projects them onto euclidean 3-space. (The models really live in the
10+
hypersphere so they looked curved in our flat space.) Jenn has some basic
11+
motion models governing the six degrees of freedom of rotation of the
12+
hypersphere.
13+
14+
## Example Arguments ##
15+
16+
# free polytopes
17+
-c 5 2 2 3 2 3 # (3,3,5)-polytope
18+
-c 3 2 2 4 2 3 # (3,4,3)-polytope
19+
-c 4 2 2 3 2 3 # (3,3,4)-polytope
20+
-c 3 2 2 3 2 3 # (3,3,3)-polytope
21+
22+
# free polyhedra (2x)
23+
-c 12 2 2 2 2 12 # (12,12)-torus
24+
-c 3 2 2 5 2 2 # (3,5)-polyhedron
25+
-c 3 2 2 4 2 2 # (3,4)-polyhedron
26+
-c 3 2 2 3 2 2 # (3,3)-polyhedron
27+
28+
# polytopes with complete circles
29+
-c 3 2 2 3 2 5 -v 1 2 3 # 600-cell
30+
-c 3 2 2 4 2 3 -v 1 2 3 # 24-cell
31+
-c 3 2 2 3 2 4 -v 1 2 3 # 16-cell
32+
-c 3 2 2 3 2 3 -v 1 2 # ???
33+
-c 12 2 2 2 2 12 -v 1 2 3 # a circle (boring)
34+
35+
# polytopes with complete spheres
36+
# those above, but the 24-cell needs mods:
37+
-c 3 2 2 4 2 3 -v 1 2 3 -f 1210 01 -e 10 12101210 #24-cell
38+
39+
# minimal spanning
40+
-c 5 2 2 3 2 3 -v 1 2 3 # 120-cell
41+
-c 4 2 2 3 2 3 -v 1 2 3 # 8-cell (hypercube)
42+
-c 4 2 2 2 2 4 # 8-cell (hypercube)
43+
-c 4 2 2 2 2 4 # 9-cell
44+
-c 3 2 2 3 2 3 -v 1 2 3 # 5-cell (simplex)
45+
-c 3 2 2 2 5 2 -v 2 3 # buckyball
46+
47+
# misc
48+
-c 3 2 2 4 2 3 -v 0 2 3 # ???
49+
-c 3 2 2 3 2 3 -v 0 2 # ???
50+
51+
# with faces
52+
-c 4 2 2 3 2 3 -v 1 2 3 -e 0 -f 01 # hypercube
53+
-c 5 2 2 3 2 3 -v 1 2 3 -e 0 -f 01 # 120-cell
54+
-c 3 2 2 3 2 5 -v 1 2 3 -e 0 -f 01 # 600-cell
55+
56+
# solids
57+
-c 7 2 2 2 2 7 -e 0 1 2 3 -f 02 03 12 13 # a torus
58+
-c 4 2 2 3 2 3 -v 1 2 -e 0 -f 01 # lots of cubes
59+
-c 3 2 2 3 2 4 -v 2 3 -e 1 -f 12 # lots of octahedra
60+
-c 5 2 2 3 2 3 -v 1 2 -e 0 -f 01 -w 1 2 2 2 # lots of dodecahedra
61+
-c 3 2 2 3 2 5 -v 2 3 -e 1 -f 12 -w 2 3 3 3 # lots of icosahedra
62+
-c 5 2 2 3 2 3 -v 2 3 -e 1 -f 12 # lots of tetrahedra
63+
-c 3 2 2 4 2 3 -e 0 1 3 -f 01 03 13 # lots of hexagonal prisms
64+
-c 4 2 2 3 2 3 -e 0 1 3 -f 01 03 13 # lots of octagonal prisms
65+
66+
# mazes
67+
-c 3 2 2 5 2 2 -e 0 1 2 3 -f 01 02 13 23 # prairie of glass
68+
-c 3 2 2 3 2 3 -e 0 1 2 3 -f 02 03 12 13 # house of glass
69+
-c 4 2 2 3 2 3 -e 0 1 2 3 -f 02 03 12 13 # block of glass
70+
-c 3 2 2 4 2 3 -e 0 1 2 3 -f 01 02 13 23 # town of glass
71+
-c 5 2 2 3 2 3 -v 0 2 -e 0 1 2 3 -f 12 13 # city of glass 0
72+
-c 5 2 2 3 2 3 -v 3 -e 0 1 2 -f 02 03 12 13 # city of glass 1
73+
-c 5 2 2 3 2 3 -v 2 -e 0 1 3 -f 02 03 12 13 # city of glass 2
74+
-c 5 2 2 3 2 3 -e 0 2 1 3 -f 02 03 12 13 -w 2 1 1 1 # world of glass
75+
76+
#subgroups
77+
-c 3 2 2 4 2 3 -g 01 02 03 12 13 23 -e 01 02 03 12 13 23 -f 01 02 03 12 13 23
78+
79+
## Table of Polytopes ##
80+
81+
Notation: "relns" : "cosets" : "verts","edges"
82+
83+
Name | relations | cosets | vertices | edges
84+
5-3-3 | 0,1,2 | 120 | 720
85+
5-3-3 | 1,2,3 | 600 | 1200
86+
87+
## License ##
88+
89+
Copyright (c) 2001-2010 Fritz Obermeyer
90+
Licensed under the [GNU Public License version 2](http://www.gnu.org/copyleft/gpl.html)

aligned_alloc.C

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
This file is part of Jenn.
3+
Copyright 2001-2007 Fritz Obermeyer.
4+
5+
Jenn is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 2 of the License, or
8+
(at your option) any later version.
9+
10+
Jenn is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with Jenn; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#include "definitions.h"
21+
#include "aligned_alloc.h"
22+
#include <cstdlib> //for posix_memalign, free
23+
#include <cstring> //for memset
24+
25+
//log levels
26+
#define LOG_DEBUG1(mess)
27+
#define LOG_INDENT_DEBUG1
28+
//#define LOG_DEBUG1(mess) {logger.debug() << message |0;}
29+
//#define LOG_INDENT_DEBUG1 Logging::IndentBlock block;
30+
31+
namespace nonstd
32+
{
33+
34+
using Logging::logger;
35+
36+
unsigned roundDown (unsigned i) {
37+
unsigned j = 1;
38+
for (i>>=1; i; i>>=1) j <<= 1;
39+
return j;
40+
}
41+
42+
void* alloc_blocks (size_t blockSize, size_t numBlocks)
43+
{//allocates an aligned array, wraps posix_memalign
44+
logger.debug() << "Allocating " << numBlocks
45+
<< " blocks of size " << blockSize << 'B' |0;
46+
Logging::IndentBlock block();
47+
48+
size_t alignment = roundDown(blockSize);
49+
size_t numBytes = blockSize * numBlocks;
50+
void* base;
51+
#if defined(CYGWIN_HACKS) || defined(MAC_HACKS)
52+
if (NULL == (base = malloc(numBytes)))
53+
#else
54+
if (posix_memalign(&base, alignment, numBytes))
55+
#endif
56+
{
57+
logger.warning() << "posix_memalign failed" |0;
58+
return NULL;
59+
} else {
60+
//bzero (base, numBytes); //initializes to all zeros
61+
return base;
62+
}
63+
}
64+
void free_blocks (void* base)
65+
{//just wraps free()
66+
logger.debug() << "Freeing blocks" |0;
67+
Logging::IndentBlock block();
68+
69+
free(base);
70+
}
71+
void clear_block (void* base, size_t blockSize)
72+
{//sets data to zero, wraps memset
73+
LOG_DEBUG1( "Clearing block of size " << blockSize << 'B' )
74+
Logging::IndentBlock block();
75+
76+
std::memset(base, 0, blockSize);
77+
}
78+
void copy_blocks (void* destin_base, const void* source_base,
79+
size_t blockSize, size_t numBlocks)
80+
{//justs wraps for memcpy
81+
LOG_DEBUG1( "Copying blocks" )
82+
Logging::IndentBlock block();
83+
84+
memcpy (destin_base, source_base, blockSize * numBlocks);
85+
}
86+
87+
}
88+

aligned_alloc.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
This file is part of Jenn.
3+
Copyright 2001-2007 Fritz Obermeyer.
4+
5+
Jenn is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 2 of the License, or
8+
(at your option) any later version.
9+
10+
Jenn is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with Jenn; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef NONSTD_ALIGNED_ALLOC_H
21+
#define NONSTD_ALIGNED_ALLOC_H
22+
23+
namespace nonstd
24+
{
25+
26+
//memory functions
27+
void* alloc_blocks (size_t blockSize,
28+
size_t numBlocks);
29+
void free_blocks (void* base);
30+
void clear_block (void* base,
31+
size_t blockSize);
32+
void copy_blocks (void* destin_base,
33+
const void* source_base,
34+
size_t blockSize,
35+
size_t numBlocks);
36+
}
37+
38+
#endif

aligned_vect.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
This file is part of Jenn.
3+
Copyright 2001-2007 Fritz Obermeyer.
4+
5+
Jenn is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 2 of the License, or
8+
(at your option) any later version.
9+
10+
Jenn is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with Jenn; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef NONSTD_ALIGNED_VECT_H
21+
#define NONSTD_ALIGNED_VECT_H
22+
23+
#include "aligned_alloc.h"
24+
25+
namespace nonstd
26+
{
27+
28+
template<class T>
29+
class aligned_vect
30+
{
31+
T* m_data;
32+
public:
33+
aligned_vect () : m_data(NULL) {}
34+
aligned_vect (int size)
35+
: m_data (static_cast<Vect*>(alloc_blocks(sizeof(T), size))) {}
36+
aligned_vect (int size, int block)
37+
: m_data (static_cast<Vect*>(alloc_blocks(sizeof(T)*block, size))) {}
38+
~aligned_vect () { if (m_data) free_blocks(m_data); }
39+
40+
T& operator[] (int i) { return m_data[i]; }
41+
T operator[] (int i) const { return m_data[i]; }
42+
};
43+
44+
}
45+
#endif
46+

0 commit comments

Comments
 (0)