Commit 26aa0b28 authored by Vladislav Perepelkin's avatar Vladislav Perepelkin
Browse files

added config.c generator

parent ded70ffa
......@@ -26,8 +26,20 @@ rules.txt:
15-15=0.3333 21-21=0.3333 26-26=0.3333 > rules.txt ; \
fi
config.c: system/config.c.example
if [ -f config.c ] ; then echo "config.c exists, not overriding" ; touch config.c ; else echo "config.c does not exist, create from system/config.c.example" ; cp system/config.c.example config.c ; fi
config.c:
if [ -f config.c ] ; \
then echo "config.c exists, not overriding" ; \
touch config.c ; \
else echo "config.c does not exist, create" ; \
WIDTH=500 HEIGHT=500 ITERS=501 \
SAVE_PERIOD=50 AVERAGING_RADIUS=1 ENSEMBLE_SIZE=2 \
INIT1=0.7 INIT2=0.7 INIT4=0.7 INIT8=0.7 \
INIT16=0.25 INIT32=0 INIT64=0 INIT128=0 \
SOURCE_WIDTH=20 \
SRC1=1 SRC2=1 SRC4=1 SRC8=1 \
SRC16=0.75 SRC32=0 SRC64=0 SRC128=0 \
python system/gen_config_flatwave.py > config.c ; \
fi
density/density.avi:
system/image_gen.sh density density/density.avi
......
#!/usr/bin/python
KEYS='WIDTH HEIGHT ITERS SAVE_PERIOD AVERAGING_RADIUS ENSEMBLE_SIZE INIT1 INIT2 INIT4 INIT8 INIT16 INIT32 INIT64 INIT128 SOURCE_WIDTH SRC1 SRC2 SRC4 SRC8 SRC16 SRC32 SRC64 SRC128'
import sys, os
KEYS=KEYS.split(' ')
failed=False
for key in KEYS:
if key not in os.environ:
failed=True
print "ERROR: undefined environment variable:", key
assert not failed
print '// Generated by', sys.argv[0]
print '#define THREADS 8'
print '#define WIDTH', os.environ['WIDTH']
print '#define HEIGHT', os.environ['HEIGHT']
print '#define ITERS', os.environ['ITERS']
print '#define SAVE_PERIOD', os.environ['SAVE_PERIOD']
print '#define AVERAGING_RADIUS', os.environ['AVERAGING_RADIUS']
print '#define ENSEMBLE_SIZE', os.environ['ENSEMBLE_SIZE']
print '#define SOURCE_WIDTH', os.environ['SOURCE_WIDTH']
print '''
// Field initialization
void init()
{
fill(0, 0, HEIGHT, WIDTH, ''' + \
', '.join([os.environ[key] for key in [
'INIT1', 'INIT2', 'INIT4', 'INIT8',
'INIT16', 'INIT32', 'INIT64', 'INIT128'
]]) + ''');
}
// Sources rules
void sources(int iter)
{
if (iter==0) {
fill(0, WIDTH/2-SOURCE_WIDTH/2, HEIGHT, WIDTH/2+SOURCE_WIDTH/2, ''' + \
', '.join([os.environ[key] for key in [
'SRC1', 'SRC2', 'SRC4', 'SRC8',
'SRC16', 'SRC32', 'SRC64', 'SRC128'
]]) +''');
}
}
'''
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment