1
0

posledny upravy pred odovzdanim

This commit is contained in:
Dušan Poizl 2011-05-08 18:38:41 +02:00
parent 60abaa96e7
commit 68aa0c27a3
27 changed files with 2331 additions and 870 deletions

View File

@ -1,4 +1,4 @@
/**************************************************************************
/**************************************************************************
* Cellula, is cellular automata simulator accelerated on GPU. *
* Copyright (C) 2011 Dušan Poizl *
* *

View File

@ -979,21 +979,21 @@ namespace DEVS {
/* Line 678 of lalr1.cc */
#line 155 "parser.yy"
{ (yyval.stringVal)=NEWSTR; *(yyval.stringVal) = *(yysemantic_stack_[(4) - (1)].stringVal)+"("+*(yysemantic_stack_[(4) - (3)].stringVal)+")"; delete (yysemantic_stack_[(4) - (1)].stringVal); delete (yysemantic_stack_[(4) - (3)].stringVal); }
{ (yyval.stringVal)=NEWSTR; *(yyval.stringVal) = "DEVS_"+*(yysemantic_stack_[(4) - (1)].stringVal)+"("+*(yysemantic_stack_[(4) - (3)].stringVal)+")"; delete (yysemantic_stack_[(4) - (1)].stringVal); delete (yysemantic_stack_[(4) - (3)].stringVal); }
break;
case 65:
/* Line 678 of lalr1.cc */
#line 156 "parser.yy"
{ (yyval.stringVal)=NEWSTR; *(yyval.stringVal) = *(yysemantic_stack_[(1) - (1)].stringVal)+"()"; delete (yysemantic_stack_[(1) - (1)].stringVal); }
{ (yyval.stringVal)=NEWSTR; *(yyval.stringVal) = "DEVS_"+*(yysemantic_stack_[(1) - (1)].stringVal)+"()"; delete (yysemantic_stack_[(1) - (1)].stringVal); }
break;
case 66:
/* Line 678 of lalr1.cc */
#line 157 "parser.yy"
{ (yyval.stringVal)=NEWSTR; *(yyval.stringVal) = *(yysemantic_stack_[(6) - (1)].stringVal)+"("+*(yysemantic_stack_[(6) - (3)].stringVal)+","+*(yysemantic_stack_[(6) - (5)].stringVal)+")"; delete (yysemantic_stack_[(6) - (1)].stringVal); delete (yysemantic_stack_[(6) - (3)].stringVal); delete (yysemantic_stack_[(6) - (5)].stringVal); }
{ (yyval.stringVal)=NEWSTR; *(yyval.stringVal) = "DEVS_"+*(yysemantic_stack_[(6) - (1)].stringVal)+"("+*(yysemantic_stack_[(6) - (3)].stringVal)+","+*(yysemantic_stack_[(6) - (5)].stringVal)+")"; delete (yysemantic_stack_[(6) - (1)].stringVal); delete (yysemantic_stack_[(6) - (3)].stringVal); delete (yysemantic_stack_[(6) - (5)].stringVal); }
break;
case 67:

View File

@ -152,9 +152,9 @@ REAL : UREAL { $$ = $1; }
SIGN : PLUS { $$ = $1; }
| MINUS { $$ = $1; }
FUNCTION : UNARY_FUNC LBRACKET REALEXP RBRACKET { $$=NEWSTR; *$$ = *$1+"("+*$3+")"; delete $1; delete $3; }
| WITHOUT_PARAM_FUNC { $$=NEWSTR; *$$ = *$1+"()"; delete $1; }
| BINARY_FUNC LBRACKET REALEXP COMA REALEXP RBRACKET { $$=NEWSTR; *$$ = *$1+"("+*$3+","+*$5+")"; delete $1; delete $3; delete $5; }
FUNCTION : UNARY_FUNC LBRACKET REALEXP RBRACKET { $$=NEWSTR; *$$ = "DEVS_"+*$1+"("+*$3+")"; delete $1; delete $3; }
| WITHOUT_PARAM_FUNC { $$=NEWSTR; *$$ = "DEVS_"+*$1+"()"; delete $1; }
| BINARY_FUNC LBRACKET REALEXP COMA REALEXP RBRACKET { $$=NEWSTR; *$$ = "DEVS_"+*$1+"("+*$3+","+*$5+")"; delete $1; delete $3; delete $5; }
| IF LBRACKET BOOLEXP COMA REALEXP COMA REALEXP RBRACKET { $$=NEWSTR; *$$ = "DEVS_if("+*$3+","+*$5+")"; delete $3; delete $5; delete $7; }
| IFU LBRACKET BOOLEXP COMA REALEXP COMA REALEXP COMA REALEXP RBRACKET { $$=NEWSTR; *$$ = "DEVS_ifu("+*$3+","+*$5+","+*$7+","+*$9+")"; delete $3; delete $5; delete $7; delete $9; }

18
INSTALL
View File

@ -1,20 +1,16 @@
vyvijane na Ubuntu 9.04
vyvijane na Ubuntu 10.04
pri pouziti OpenCL od AMD je potrebny gcc 4.3
pre skompilovanie je potrebne mat naistalovane Qt 4.5 alebo novsie s OpenGL.
teda v Ubuntu nainstalovat balicky libqt4-dev libqt4-opengl-dev
pre skompilovanie je potrebne mat naistalovane Qt 4.5 alebo novsie s OpenGL modulom.
teda v Ubuntu nainstalovat balicky libqt4-dev libqt4-opengl-dev liblua5.1-0-dev
ak nie je v systeme nainstalovne OpenCL je mozne stiahnut mnou pripravene
balicky s ATI Stream OpenCL. http://orwell.fiit.stuba.sk/~nou
pre skompilovenie a beh su potrebne ati-opencl-runtime ati-opencl-dev
po ich naistalovanie je potrebne sa odhlasit a znova prihlasit sa
oficialne SDK je na adrese http://developer.amd.com/gpu/ATIStreamSDK/Pages/default.aspx
pre jeho stiahnutie je potrebne sa prihlasit. malo by fungovat meno aj heslo "bugmenot1"
dalej je potrebne mat naistalovane OpenCL aj s hlavickami
oficialne AMD SDK je na adrese http://developer.amd.com/gpu/AMDAPPSDK/downloads/Pages/default.aspx
pre nVidia treba stiahnut CUDA SDK http://developer.nvidia.com/cuda-downloads
tieto prikazy by mali naistalovat vsetko potrebne pre kompilaciu a beh predtym je potrebne stiahnut si balicky
sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev
sudo dpkg -i ati-opencl*.deb
sudo dpkg -i amd-app*.deb
make by malo potom skomilovat cely program

View File

@ -1,5 +1,5 @@
CC=g++
CFLAGS=-c -Wall -O3
CFLAGS=-c -Wall -O3 -s
LDFLAGS= -lOpenCL -lQtGui -lQtCore -lGL -lQtOpenGL -lQtHelp -llua5.1 -lCDparser -L./CDparser
INCLUDE= -I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui
SOURCES=asynchronousmodel.cpp \
@ -49,3 +49,6 @@ clean:
./CDparser/libCDparser.a:
cd CDparser; make libCDparser.a
lex.TreeScanner.cc :
flex treescanner.ll

View File

@ -26,6 +26,30 @@
#include <math.h>
#include "rand/randomc.h"
typedef cl_float _time;
typedef cl_float _state;
typedef cl_uint _seed;
typedef struct
{
_time time;
_state state;
}_event;
typedef struct
{
cl_int2 index;
cl_int2 index2;
_event queue[8];
}_queue;
typedef struct
{
_seed seed;
_state state;
_queue queue;
}_cell;
AsynchronousModel::AsynchronousModel(Machine *parent, string model_definition) : Model(parent)
{
queue_len = 8;
@ -44,9 +68,9 @@ AsynchronousModel::~AsynchronousModel()
int AsynchronousModel::getCellSize()
{
size_t event = sizeof(float)*2;
size_t cell = sizeof(int)*4+event*queue_len+event;
return cell;
//size_t event = sizeof(float)*2;
//size_t cell = sizeof(int)*4+event*queue_len+event+sizeof(cl_uint);
return sizeof(_cell);
}
int AsynchronousModel::loadSource()
@ -92,6 +116,7 @@ int AsynchronousModel::compile(string model_definition)
timewindow = parser->model.section.timewindow;
width = parser->model.section.width;
height = parser->model.section.height;
neighbor = parser->model.section.neighbors.size();
delete parser;
return ret;
}
@ -162,20 +187,23 @@ void AsynchronousModel::initialize(CellSpace *pattern, float *data)
}
}
cl_int err_code;
cl_mem buffer = parent->createBuffer(CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(float)*pattern->getHeight()*pattern->getWidth(), data);
cl_mem seedbuffer = parent->createBuffer(CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(uint32_t)*w*h, seed);
if(!buffer){ cerr << "Nepodarilo sa vytvorit buffer pre inicializaciu modelu" << endl; return; }
if(!buffer || !seedbuffer){ cerr << "Nepodarilo sa vytvorit buffer pre inicializaciu modelu" << endl; return; }
err_code = clSetKernelArg(init_kernel, 0, sizeof(cl_mem), pattern->getSpace());
err_code|= clSetKernelArg(init_kernel, 1, sizeof(cl_mem), &buffer);
err_code|= clSetKernelArg(init_kernel, 2, sizeof(cl_mem), &seedbuffer);
if(err_code){ cerr << "Nepodarilo sa nastavit argument pre inicializacny kernel"; clGetError(err_code); return; }
parent->run(init_kernel, pattern->getWidth(), pattern->getHeight());
parent->finish();
clReleaseMemObject(buffer);
clReleaseMemObject(seedbuffer);
if(del)delete [] data;
delete [] seed;
}
int AsynchronousModel::loadVAL(QString &input, CellSpace *cellspace)

View File

@ -1,4 +1,4 @@
/**************************************************************************
/**************************************************************************
* Cellula, is cellular automata simulator accelerated on GPU. *
* Copyright (C) 2011 Dušan Poizl *
* *
@ -37,9 +37,8 @@ CellSpace::CellSpace(Model *parent, int w, int h)
int size = parent->getCellSize()*w*h;
unsigned char *data = new unsigned char [size];
memset(data, 0, size);
data[0] = data[2] = data[4] = data[6] = data[8] = data[10] = data[12] = data[14] = 1;
space = parent->getParent()->createBuffer(CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, size, data);
delete data;
delete [] data;
tex = NULL;
gl_texture = 0;
}

View File

@ -4,151 +4,192 @@
<context>
<name>CellulaMainWindow</name>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="110"/>
<location filename="cellulamainwindow.cpp" line="143"/>
<source>Súbor</source>
<translation>File</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="121"/>
<location filename="cellulamainwindow.cpp" line="154"/>
<source>Beh</source>
<translation>Run</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="126"/>
<location filename="cellulamainwindow.cpp" line="159"/>
<source>Okno</source>
<translation>Window</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="130"/>
<location filename="cellulamainwindow.cpp" line="163"/>
<source>Zobraziť</source>
<translation>Show</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="172"/>
<location filename="cellulamainwindow.cpp" line="289"/>
<source>Pomoc</source>
<translation>Help</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="147"/>
<location filename="cellulamainwindow.cpp" line="204"/>
<source>Hlavný panel nástrojov</source>
<translation>Main toolbar</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="158"/>
<source>Nahrávací panel nástrojov</source>
<translation>Recording toolbar</translation>
<translation type="obsolete">Recording toolbar</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="167"/>
<location filename="cellulamainwindow.cpp" line="231"/>
<source>Log</source>
<translation>Log</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="174"/>
<location filename="cellulamainwindow.cpp" line="238"/>
<source>Lua</source>
<translation>Lua</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="190"/>
<location filename="cellulamainwindow.cpp" line="254"/>
<source>Cellula</source>
<translation>Cellula</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="196"/>
<location filename="cellulamainwindow.cpp" line="260"/>
<source>Nový model</source>
<translation>New model</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="198"/>
<location filename="cellulamainwindow.cpp" line="262"/>
<source>Ctrl+N</source>
<translation>Ctrl+N</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="199"/>
<location filename="cellulamainwindow.cpp" line="263"/>
<source>Nový stav</source>
<translation>New state</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="201"/>
<location filename="cellulamainwindow.cpp" line="265"/>
<source>Otvoriť model</source>
<translation>Open model</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="203"/>
<location filename="cellulamainwindow.cpp" line="267"/>
<source>Ulož model</source>
<translation>Save model</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="205"/>
<location filename="cellulamainwindow.cpp" line="269"/>
<source>Ctrl+S</source>
<translation>Ctrl+S</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="206"/>
<location filename="cellulamainwindow.cpp" line="270"/>
<source>Ulož obrázok</source>
<translation>Save image</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="208"/>
<location filename="cellulamainwindow.cpp" line="272"/>
<source>Spusti simuláciu</source>
<translation>Start simulation</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="210"/>
<location filename="cellulamainwindow.cpp" line="274"/>
<source>Pozastav simuláciu</source>
<translation>Pause simulation</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="212"/>
<location filename="cellulamainwindow.cpp" line="276"/>
<source>Zastav simuláciu</source>
<translation>Stop simulation</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="214"/>
<location filename="cellulamainwindow.cpp" line="278"/>
<source>Nastavenia</source>
<translation>Settings</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="215"/>
<location filename="cellulamainwindow.cpp" line="279"/>
<source>Koniec</source>
<translation>Quit</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="216"/>
<location filename="cellulamainwindow.cpp" line="280"/>
<source>Načítaj RLE</source>
<translation>Load RLE</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="217"/>
<location filename="cellulamainwindow.cpp" line="281"/>
<source>Dlaždice</source>
<translation>Tiled</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="218"/>
<location filename="cellulamainwindow.cpp" line="282"/>
<source>Kaskáda</source>
<translation>Cascade</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="219"/>
<location filename="cellulamainwindow.cpp" line="283"/>
<source>Štart nahrávania</source>
<translation>Start record</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="221"/>
<location filename="cellulamainwindow.cpp" line="285"/>
<source>Stop nahrávania</source>
<translation>Stop record</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="287"/>
<source>O programe</source>
<translation>About</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="343"/>
<location filename="cellulamainwindow.cpp" line="390"/>
<location filename="cellulamainwindow.cpp" line="288"/>
<source>Vyčistiť log</source>
<translation>Celar log</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="411"/>
<location filename="cellulamainwindow.cpp" line="462"/>
<source>Otvoriť súbor</source>
<translation>Open file</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="343"/>
<location filename="cellulamainwindow.cpp" line="411"/>
<source>Definícia Cellula modelu alebo stavu (*.ma *.val *.tree)</source>
<translation>Definition of Cellula model or state (*.ma *.val *.tree)</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="390"/>
<location filename="cellulamainwindow.cpp" line="432"/>
<source>Chyba pri otváraní súboru</source>
<translation>Error during opening file</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="432"/>
<source>Nepodarilo sa otvoriť súbor:
%1</source>
<translation>Can&apos;t open file:
%1</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="462"/>
<source>Definícia Cellula stavu (*.rle)</source>
<translation>Definition of Cellula state (*.rle)</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="531"/>
<source>O Cellula</source>
<translation>About Cellula</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="531"/>
<source>Cellula je simulátor celulárnych automatov akcelerovaných pomocoujednotiek GPU pomocou rozhrania OpenCL.
(C) 2011 Dušan Poizl poizl@zoznam.sk
Tento program je distribuovaný pod licenciou GPLv3</source>
<translation>Cellula is simulator celular automata aclerated with GPU throuth OpenCL interface.
(C) 2011 Dušan Poizl poizl@zoznam.sk
This program is distributed under GPLv3</translation>
</message>
<message utf8="true">
<source>Definícia Cellula modelu alebo stavu (*.m *.val *.tree)</source>
<translation type="obsolete">Definition of Cellula model or state (*.m *.val *.tree)</translation>
@ -166,24 +207,24 @@
<translation type="obsolete">Definition Cellula model or state (*)</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="400"/>
<location filename="cellulamainwindow.cpp" line="472"/>
<source>Chyba pri načítavaní súboru</source>
<translation>Error while loading file</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="400"/>
<location filename="cellulamainwindow.cpp" line="472"/>
<source>Nepodarilo sa načítať súbor %1.
Nepodarilo sa otvoriť alebo chybný formát.</source>
<translation>Failed to load file %1.
Failed to open file or file has wrong format.</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="445"/>
<location filename="cellulamainwindow.cpp" line="517"/>
<source>Uložit obrázok</source>
<translation>Save image</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="445"/>
<location filename="cellulamainwindow.cpp" line="517"/>
<source>Obrázky (*.png *.bmp *.jpg *.jpeg *.tiff *.tif)</source>
<translation>Images (*.png *.bmp *.jpg *.jpeg *.tiff *.tif)</translation>
</message>
@ -191,17 +232,17 @@ Failed to open file or file has wrong format.</translation>
<context>
<name>GLwidget</name>
<message utf8="true">
<location filename="glwidget.cpp" line="24"/>
<location filename="glwidget.cpp" line="42"/>
<source>Nový stav </source>
<translation>New state </translation>
</message>
<message>
<location filename="glwidget.cpp" line="170"/>
<location filename="glwidget.cpp" line="190"/>
<source>Chyba</source>
<translation>Error</translation>
</message>
<message utf8="true">
<location filename="glwidget.cpp" line="170"/>
<location filename="glwidget.cpp" line="190"/>
<source>Nepodarilo sa uložit obrázok do súboru
</source>
<translation>Failed to save image to file</translation>
@ -210,32 +251,32 @@ Failed to open file or file has wrong format.</translation>
<context>
<name>NewModelDialog</name>
<message>
<location filename="newmodeldialog.cpp" line="14"/>
<location filename="newmodeldialog.cpp" line="32"/>
<source>Typ modelu</source>
<translation>Model type</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="16"/>
<location filename="newmodeldialog.cpp" line="34"/>
<source>Synchrónny model</source>
<translation>Synchronous model</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="17"/>
<location filename="newmodeldialog.cpp" line="35"/>
<source>Asynchrónny model</source>
<translation>Asynchronous model</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="19"/>
<location filename="newmodeldialog.cpp" line="37"/>
<source>Názov modelu</source>
<translation>Model name</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="31"/>
<location filename="newmodeldialog.cpp" line="49"/>
<source>Chýba názov</source>
<translation>Name missing</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="31"/>
<location filename="newmodeldialog.cpp" line="49"/>
<source>Chýba názov modelu. Zadajte nejaký názov.</source>
<translation>Name of model missing. Enter some name.</translation>
</message>
@ -243,17 +284,17 @@ Failed to open file or file has wrong format.</translation>
<context>
<name>NewStateDialog</name>
<message utf8="true">
<location filename="newstatedialog.cpp" line="13"/>
<location filename="newstatedialog.cpp" line="31"/>
<source>Nový stav</source>
<translation>New state</translation>
</message>
<message utf8="true">
<location filename="newstatedialog.cpp" line="28"/>
<location filename="newstatedialog.cpp" line="46"/>
<source>Výška</source>
<translation>Height</translation>
</message>
<message utf8="true">
<location filename="newstatedialog.cpp" line="27"/>
<location filename="newstatedialog.cpp" line="45"/>
<source>Šírka</source>
<translation>Width</translation>
</message>
@ -261,17 +302,17 @@ Failed to open file or file has wrong format.</translation>
<context>
<name>Options</name>
<message>
<location filename="options.cpp" line="11"/>
<location filename="options.cpp" line="29"/>
<source>Nastavenia</source>
<translation>Settings</translation>
</message>
<message>
<location filename="options.cpp" line="85"/>
<location filename="options.cpp" line="103"/>
<source>OpenCL</source>
<translation>OpenCL</translation>
</message>
<message utf8="true">
<location filename="options.cpp" line="115"/>
<location filename="options.cpp" line="133"/>
<source>Použiť OpenCL/OpenGL interoperabilitu</source>
<translation>Use OpenCL/OpenGL interoperability</translation>
</message>
@ -279,49 +320,53 @@ Failed to open file or file has wrong format.</translation>
<context>
<name>TextEditor</name>
<message utf8="true">
<location filename="texteditor.cpp" line="72"/>
<source>Nový model </source>
<translation>New model </translation>
<translation type="obsolete">New model </translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="90"/>
<source>Nový model %1</source>
<translation>New model %1</translation>
</message>
<message>
<location filename="texteditor.cpp" line="104"/>
<location filename="texteditor.cpp" line="124"/>
<source>Chyba pri parsovani</source>
<translation>Error during parsing</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="104"/>
<location filename="texteditor.cpp" line="124"/>
<source>Nepodarilo sa sparsovať definiciu modelu</source>
<translation>Could not parse definition of model</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="135"/>
<location filename="texteditor.cpp" line="173"/>
<source>Uložiť súbor</source>
<translation>Save file</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="135"/>
<location filename="texteditor.cpp" line="173"/>
<source>Definícia Cellula modelu alebo stavu (*)</source>
<translation>Definition Cellula model or state (*)</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="142"/>
<location filename="texteditor.cpp" line="180"/>
<source>Chyba súboru</source>
<translation>Error file</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="142"/>
<location filename="texteditor.cpp" line="180"/>
<source>Nepodarilo sa otvoriť súbor %1 na zápis
</source>
<translation>Could not open file %1 for write
</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="165"/>
<location filename="texteditor.cpp" line="204"/>
<source>Uložiť?</source>
<translation>Save?</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="165"/>
<location filename="texteditor.cpp" line="204"/>
<source>Model bol zmenený. Chcete uložiť zmeny?</source>
<translation>The model was changed. Do you want save the changes?</translation>
</message>

View File

@ -4,151 +4,192 @@
<context>
<name>CellulaMainWindow</name>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="110"/>
<location filename="cellulamainwindow.cpp" line="143"/>
<source>Súbor</source>
<translation>Súbor</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="121"/>
<location filename="cellulamainwindow.cpp" line="154"/>
<source>Beh</source>
<translation>Beh</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="126"/>
<location filename="cellulamainwindow.cpp" line="159"/>
<source>Okno</source>
<translation>Okno</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="130"/>
<location filename="cellulamainwindow.cpp" line="163"/>
<source>Zobraziť</source>
<translation>Zobraziť</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="172"/>
<location filename="cellulamainwindow.cpp" line="289"/>
<source>Pomoc</source>
<translation>Pomoc</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="147"/>
<location filename="cellulamainwindow.cpp" line="204"/>
<source>Hlavný panel nástrojov</source>
<translation>Hlavný panel nástrojov</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="158"/>
<source>Nahrávací panel nástrojov</source>
<translation>Nahrávací panel nástrojov</translation>
<translation type="obsolete">Nahrávací panel nástrojov</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="167"/>
<location filename="cellulamainwindow.cpp" line="231"/>
<source>Log</source>
<translation>Log</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="174"/>
<location filename="cellulamainwindow.cpp" line="238"/>
<source>Lua</source>
<translation>Lua</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="190"/>
<location filename="cellulamainwindow.cpp" line="254"/>
<source>Cellula</source>
<translation>Cellula</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="196"/>
<location filename="cellulamainwindow.cpp" line="260"/>
<source>Nový model</source>
<translation>Nový model</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="198"/>
<location filename="cellulamainwindow.cpp" line="262"/>
<source>Ctrl+N</source>
<translation>Ctrl+N</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="199"/>
<location filename="cellulamainwindow.cpp" line="263"/>
<source>Nový stav</source>
<translation>Nový stav</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="201"/>
<location filename="cellulamainwindow.cpp" line="265"/>
<source>Otvoriť model</source>
<translation>Otvoriť model</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="203"/>
<location filename="cellulamainwindow.cpp" line="267"/>
<source>Ulož model</source>
<translation>Ulož model</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="205"/>
<location filename="cellulamainwindow.cpp" line="269"/>
<source>Ctrl+S</source>
<translation>Ctrl+S</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="206"/>
<location filename="cellulamainwindow.cpp" line="270"/>
<source>Ulož obrázok</source>
<translation>Ulož obrázok</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="208"/>
<location filename="cellulamainwindow.cpp" line="272"/>
<source>Spusti simuláciu</source>
<translation>Spusti simuláciu</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="210"/>
<location filename="cellulamainwindow.cpp" line="274"/>
<source>Pozastav simuláciu</source>
<translation>Pozastav simuláciu</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="212"/>
<location filename="cellulamainwindow.cpp" line="276"/>
<source>Zastav simuláciu</source>
<translation>Zastav simuláciu</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="214"/>
<location filename="cellulamainwindow.cpp" line="278"/>
<source>Nastavenia</source>
<translation>Nastavenia</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="215"/>
<location filename="cellulamainwindow.cpp" line="279"/>
<source>Koniec</source>
<translation>Koniec</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="216"/>
<location filename="cellulamainwindow.cpp" line="280"/>
<source>Načítaj RLE</source>
<translation>Načítaj RLE</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="217"/>
<location filename="cellulamainwindow.cpp" line="281"/>
<source>Dlaždice</source>
<translation>Dlaždice</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="218"/>
<location filename="cellulamainwindow.cpp" line="282"/>
<source>Kaskáda</source>
<translation>Kaskáda</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="219"/>
<location filename="cellulamainwindow.cpp" line="283"/>
<source>Štart nahrávania</source>
<translation>Štart nahrávania</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="221"/>
<location filename="cellulamainwindow.cpp" line="285"/>
<source>Stop nahrávania</source>
<translation>Stop nahrávania</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="287"/>
<source>O programe</source>
<translation>O programe</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="343"/>
<location filename="cellulamainwindow.cpp" line="390"/>
<location filename="cellulamainwindow.cpp" line="288"/>
<source>Vyčistiť log</source>
<translation>Vyčistiť log</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="411"/>
<location filename="cellulamainwindow.cpp" line="462"/>
<source>Otvoriť súbor</source>
<translation>Otvoriť súbor</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="343"/>
<location filename="cellulamainwindow.cpp" line="411"/>
<source>Definícia Cellula modelu alebo stavu (*.ma *.val *.tree)</source>
<translation>Definícia Cellula modelu alebo stavu (*.ma *.val *.tree)</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="390"/>
<location filename="cellulamainwindow.cpp" line="432"/>
<source>Chyba pri otváraní súboru</source>
<translation>Chyba pri otváraní súboru</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="432"/>
<source>Nepodarilo sa otvoriť súbor:
%1</source>
<translation>Nepodarilo sa otvoriť súbor:
%1</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="462"/>
<source>Definícia Cellula stavu (*.rle)</source>
<translation>Definícia Cellula stavu (*.rle)</translation>
</message>
<message>
<location filename="cellulamainwindow.cpp" line="531"/>
<source>O Cellula</source>
<translation>O Cellula</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="531"/>
<source>Cellula je simulátor celulárnych automatov akcelerovaných pomocoujednotiek GPU pomocou rozhrania OpenCL.
(C) 2011 Dušan Poizl poizl@zoznam.sk
Tento program je distribuovaný pod licenciou GPLv3</source>
<translation>Cellula je simulátor celulárnych automatov akcelerovaných pomocou GPU pomocou rozhrania OpenCL.
(C) 2011 Dušan Poizl poizl@zoznam.sk
Tento program je distribuovaný pod licenciou GPLv3</translation>
</message>
<message utf8="true">
<source>Definícia Cellula modelu alebo stavu (*.m *.val *.tree)</source>
<translation type="obsolete">Definícia Cellula modelu alebo stavu (*.m *.val *.tree)</translation>
@ -166,24 +207,24 @@
<translation type="obsolete">Definícia Cellula modelu alebo stavu (*)</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="400"/>
<location filename="cellulamainwindow.cpp" line="472"/>
<source>Chyba pri načítavaní súboru</source>
<translation>Chyba pri načítavaní súboru</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="400"/>
<location filename="cellulamainwindow.cpp" line="472"/>
<source>Nepodarilo sa načítať súbor %1.
Nepodarilo sa otvoriť alebo chybný formát.</source>
<translation>Nepodarilo sa načítať súbor %1.
Nepodarilo sa otvoriť súbor alebo súbor chybný formát.</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="445"/>
<location filename="cellulamainwindow.cpp" line="517"/>
<source>Uložit obrázok</source>
<translation>Uložiť obrázok</translation>
</message>
<message utf8="true">
<location filename="cellulamainwindow.cpp" line="445"/>
<location filename="cellulamainwindow.cpp" line="517"/>
<source>Obrázky (*.png *.bmp *.jpg *.jpeg *.tiff *.tif)</source>
<translation>Obrázky (*.png *.bmp *.jpg *.jpeg *.tiff *.tif)</translation>
</message>
@ -191,17 +232,17 @@ Nepodarilo sa otvoriť súbor alebo má súbor chybný formát.</translation>
<context>
<name>GLwidget</name>
<message utf8="true">
<location filename="glwidget.cpp" line="24"/>
<location filename="glwidget.cpp" line="42"/>
<source>Nový stav </source>
<translation>Nový stav </translation>
</message>
<message>
<location filename="glwidget.cpp" line="170"/>
<location filename="glwidget.cpp" line="190"/>
<source>Chyba</source>
<translation>Chyba</translation>
</message>
<message utf8="true">
<location filename="glwidget.cpp" line="170"/>
<location filename="glwidget.cpp" line="190"/>
<source>Nepodarilo sa uložit obrázok do súboru
</source>
<translation>Nepodarilo sa uložit obrázok do súboru
@ -211,32 +252,32 @@ Nepodarilo sa otvoriť súbor alebo má súbor chybný formát.</translation>
<context>
<name>NewModelDialog</name>
<message>
<location filename="newmodeldialog.cpp" line="14"/>
<location filename="newmodeldialog.cpp" line="32"/>
<source>Typ modelu</source>
<translation>Typ modelu</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="16"/>
<location filename="newmodeldialog.cpp" line="34"/>
<source>Synchrónny model</source>
<translation>Synchrónny model</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="17"/>
<location filename="newmodeldialog.cpp" line="35"/>
<source>Asynchrónny model</source>
<translation>Asynchrónny model</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="19"/>
<location filename="newmodeldialog.cpp" line="37"/>
<source>Názov modelu</source>
<translation>Názov modelu</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="31"/>
<location filename="newmodeldialog.cpp" line="49"/>
<source>Chýba názov</source>
<translation>Chýba názov</translation>
</message>
<message utf8="true">
<location filename="newmodeldialog.cpp" line="31"/>
<location filename="newmodeldialog.cpp" line="49"/>
<source>Chýba názov modelu. Zadajte nejaký názov.</source>
<translation>Chýba názov modelu. Zadajte nejaký názov.</translation>
</message>
@ -244,17 +285,17 @@ Nepodarilo sa otvoriť súbor alebo má súbor chybný formát.</translation>
<context>
<name>NewStateDialog</name>
<message utf8="true">
<location filename="newstatedialog.cpp" line="13"/>
<location filename="newstatedialog.cpp" line="31"/>
<source>Nový stav</source>
<translation>Nový stav</translation>
</message>
<message utf8="true">
<location filename="newstatedialog.cpp" line="28"/>
<location filename="newstatedialog.cpp" line="46"/>
<source>Výška</source>
<translation>Výška</translation>
</message>
<message utf8="true">
<location filename="newstatedialog.cpp" line="27"/>
<location filename="newstatedialog.cpp" line="45"/>
<source>Šírka</source>
<translation>Šírka</translation>
</message>
@ -262,17 +303,17 @@ Nepodarilo sa otvoriť súbor alebo má súbor chybný formát.</translation>
<context>
<name>Options</name>
<message>
<location filename="options.cpp" line="11"/>
<location filename="options.cpp" line="29"/>
<source>Nastavenia</source>
<translation>Nastavenia</translation>
</message>
<message>
<location filename="options.cpp" line="85"/>
<location filename="options.cpp" line="103"/>
<source>OpenCL</source>
<translation>OpenCL</translation>
</message>
<message utf8="true">
<location filename="options.cpp" line="115"/>
<location filename="options.cpp" line="133"/>
<source>Použiť OpenCL/OpenGL interoperabilitu</source>
<translation>Použiť OpenCL/OpenGL interoperabilitu</translation>
</message>
@ -280,49 +321,53 @@ Nepodarilo sa otvoriť súbor alebo má súbor chybný formát.</translation>
<context>
<name>TextEditor</name>
<message utf8="true">
<location filename="texteditor.cpp" line="72"/>
<source>Nový model </source>
<translation>Nový model </translation>
<translation type="obsolete">Nový model </translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="90"/>
<source>Nový model %1</source>
<translation>Nový model %1</translation>
</message>
<message>
<location filename="texteditor.cpp" line="104"/>
<location filename="texteditor.cpp" line="124"/>
<source>Chyba pri parsovani</source>
<translation>Chyba pri parsovani</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="104"/>
<location filename="texteditor.cpp" line="124"/>
<source>Nepodarilo sa sparsovať definiciu modelu</source>
<translation>Nepodarilo sa sparsovať definiciu modelu</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="135"/>
<location filename="texteditor.cpp" line="173"/>
<source>Uložiť súbor</source>
<translation>Uložiť súbor</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="135"/>
<location filename="texteditor.cpp" line="173"/>
<source>Definícia Cellula modelu alebo stavu (*)</source>
<translation>Definícia Cellula modelu alebo stavu (*)</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="142"/>
<location filename="texteditor.cpp" line="180"/>
<source>Chyba súboru</source>
<translation>Chyba súboru</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="142"/>
<location filename="texteditor.cpp" line="180"/>
<source>Nepodarilo sa otvoriť súbor %1 na zápis
</source>
<translation>Nepodarilo sa otvoriť súbor %1 na zápis
</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="165"/>
<location filename="texteditor.cpp" line="204"/>
<source>Uložiť?</source>
<translation>Uložiť?</translation>
</message>
<message utf8="true">
<location filename="texteditor.cpp" line="165"/>
<location filename="texteditor.cpp" line="204"/>
<source>Model bol zmenený. Chcete uložiť zmeny?</source>
<translation>Model bol zmenený. Chcete uložiť zmeny?</translation>
</message>

View File

@ -102,6 +102,8 @@ CellulaMainWindow::CellulaMainWindow()
mdi->addSubWindow(editor);
editor->setName("Live");*/
lastSubWindow = 0;
const char *src = "num_states=2\n" "num_neighbors=8\n" "num_nodes=32\n" "1 0 0\n"
"2 0 0\n" "1 0 1\n" "2 0 2\n" "3 1 3\n" "1 1 1\n" "2 2 5\n"
"3 3 6\n" "4 4 7\n" "2 5 0\n" "3 6 9\n" "4 7 10\n"
@ -419,8 +421,9 @@ void CellulaMainWindow::load()
else if(suf=="ma")new_model = new TextEditor("", new AsynchronousModel(machine, ""), this);
else if(suf=="val")
{
TextEditor *editor = dynamic_cast<TextEditor*>(mdi->activeSubWindow() ? mdi->activeSubWindow()->widget() : 0);
if(editor==0)return ;
if(lastSubWindow==0)return;
TextEditor *editor = dynamic_cast<TextEditor*>(lastSubWindow->widget());
if(editor==0)return;
AsynchronousModel *model = dynamic_cast<AsynchronousModel*>(editor->getModel());
if(model==0)return;
QFile fr(file);
@ -433,6 +436,9 @@ void CellulaMainWindow::load()
QString val = fr.readAll();
CellSpace *cellspace = new CellSpace(model, model->getWidth(), model->getHeight());
model->loadVAL(val, cellspace);
GLwidget *new_gl =new GLwidget(QGLFormat(QGL::DoubleBuffer), this, cellspace, gl_widget);
mdi->addSubWindow(new_gl)->show();
new_gl->setName(file);
}
if(new_model)
@ -548,6 +554,7 @@ void CellulaMainWindow::stepsChanged(int index)
void CellulaMainWindow::mdiWindowChanged(QMdiSubWindow *window)
{
if(window)lastSubWindow = window;
GLwidget *gl = dynamic_cast<GLwidget*>(mdi->activeSubWindow() ? mdi->activeSubWindow()->widget() : 0);
if(gl)
{

View File

@ -52,6 +52,7 @@ class CellulaMainWindow : public QMainWindow
NewModelDialog *newmodeldialog;
Machine *machine;
QMdiArea *mdi;
QMdiSubWindow *lastSubWindow;
QDockWidget *log, *lua_console;
Model *model,*asyn_model;
void createMenu();

View File

@ -162,6 +162,7 @@ int GLwidget::number = 1;
void GLwidget::startSimulation()
{
timer.start();
runSimulation();
}
void GLwidget::stopSimulation()

259
help/prirucka.html Normal file
View File

@ -0,0 +1,259 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Unix)">
<META NAME="AUTHOR" CONTENT="Dušan Poizl">
<META NAME="CREATED" CONTENT="20110508;18223200">
<META NAME="CHANGEDBY" CONTENT="Dušan Poizl">
<META NAME="CHANGED" CONTENT="20110508;18343000">
<META NAME="CHANGEDBY" CONTENT="Dušan Poizl">
<STYLE TYPE="text/css">
<!--
H1.nadpisa { background: transparent; page-break-before: auto; page-break-after: auto }
H2.western { font-family: "Albany", sans-serif; font-size: 14pt; font-style: italic }
H2.cjk { font-family: "HG Mincho Light J"; font-size: 14pt; font-style: italic }
H2.ctl { font-family: "Arial Unicode MS"; font-size: 14pt; font-style: italic }
-->
</STYLE>
</HEAD>
<BODY LANG="sk-SK" DIR="LTR">
<H1 CLASS="nadpisa" STYLE="page-break-before: always">Používateľská
príručka</H1>
<H1>Modely</H1>
<P>Cellula pracuje s dvoma typmi modelov synchrónne a asynchrónne.
Každý model má svoju definíciu vo forme textového zápisu. Potom
je tu aj stav modelu. K jednej definícii modelu može byť
priradených viacero stavov.</P>
<H1>Hlavné okno</H1>
<P>Po spustení aplikácie sa zobrazí hlavné okno. Hore je hlavné
menu. Pod ním sú štadardný panely nástrojov. Na spodnom okraji
hlavného okna sú pripevnené dve konzoly. Jedna konzola záznamu a
druhá konzola skriptovacieho jazyka Lua. V strede zaberajúc
najväčšiu plochu je oblasť dokumentov. Tu sú zobrazované okná
obsahujúce definície a stav modelov. Každé okno reprezentuje
jeden model. Všetky akcie ktoré sa vzťahujú na niektorý model sa
vykonajú na práve aktívnom okne modelu. Naraz môže byť aktívne
len jedno okno a teda aj model. Ak sa akcia vzťahuje iba na stav
modelu ale je aktívne okno definície modelu tak sa akcia nevykoná.
Platí to aj opačným smerom teda akcia určená pre definície
modelu sa nevykoná ak nie je aktívna definícia modelu.</P>
<H2 CLASS="western">Menu</H2>
<UL>
<LI><P STYLE="font-weight: normal; line-height: 100%">Súbor
obsahuje hlavne položky na prácu so súbormi modelov.</P>
<UL>
<LI><P STYLE="font-weight: normal; line-height: 100%">Nový model
zobrazí okno kde je na výber typ vytváraného modelu a jeho
meno. Na výber je synchrónny a asynchrónny model.</P>
<LI><P STYLE="font-weight: normal; line-height: 100%">Nový stav
vytvorí nový stav inicializovaný na východziu hodnotu určenú
modelom. Tento nový stav je priradený k aktívnemu modelu.</P>
<LI><P STYLE="font-weight: normal; line-height: 100%">Otvoriť
model otvorí a načíta model z disku. Dokáže načítať
súbory typu <I>ma, tree a val.</I></P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Ulož model uloží aktuálne aktívnu definíciu modelu</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Ulož obrázok uloží aktuálny obsah stavu modelu vo forme
obrázku na disk.</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Načítaj RLE načíta súbor vo formáte RLE a priradí ho k
aktívnemu synchrónnemu modelu.
</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Nastavenia obsahuje nastavenia programu hlavne ktorá OpenCL
platforma sa má použiť.</P>
</UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Beh ovládanie simulácie a prekladu modelov</P>
<UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Spusti simuláciu v prípade definície modelu túto definíciu
preloží do spustiteľnej podoby prekladačom. V prípade chybnej
definície sa zobrazí upozornenie a do záznamu zapíše chybová
hlásenie z prekladača. V prípade stavu modelu sa spustí
simuláciu modelu v čase.</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Pozastav simuláciu zastaví simuláciu stavu modelu. Nemá
efekt na definíciu.</P>
</UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Okno usporiadanie okien</P>
<UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Dlaždice usporiada okná tak aby vyplnili celú plochu v
dlaždicovom usporiadaní</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Kaskáda usporiada okná do kaskády kedy sú zoradené pod
sebou svojimi titulkovými pruhmi.</P>
</UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Zobraziť zapína zobrazenie panelov nástrojov a konzol</P>
<UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Vyčitiť log vymaže obsah záznamu</P>
</UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Pomoc</P>
<UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Pomocník - zobrazí tuto príručku</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
O programe zobrazí krátky popis programu</P>
</UL>
</UL>
<H2 CLASS="western">Panely nástrojov</H2>
<P STYLE="font-style: normal; font-weight: normal">Pod hlavným menu
sú umiestnené panely nástrojov kde sú umiestnené najčastejšie
používané akcie.</P>
<UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Hlavný panel obsahuje akcie z menu Súbor konkrétne Nový
model, Nový stav, Otvoriť model, Ulož model</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
Ovládanie simulácie tu sú obidve akcie z menu Beh naviac ešte
aj dve polia výberu. Ovláda sa nimi rýchlosť simulácie. Prvé
pole vyberá čas medzi jednotlivými behmi. Kým druhé počet
krokov v jednom behu. Obsah okna stavu sa prekresľuje po každom
behu.</P>
</UL>
<H2 CLASS="western">Konzoly</H2>
<P STYLE="font-style: normal; font-weight: normal">Záznamová kozola
obsahuje chybové hlásenia z prekladača. Lua konzola umožňuje
používať skriptovací jazyk Lua a pomocou skriptov ovládať celý
program.</P>
<H2 CLASS="western">Nastavenia</H2>
<P>V nastaveniach sa dá nastaviť ktorú OpenCL platformu má
program použiť. Taktiež sa dá vybrať ktoré zariadenia sa majú
použiť. Aj keď je možnosť vybrať viacero zariadení vždy sa
použije prvé vybrané. Ak nie je vybrané žiadne použije sa prvé
zariadenie z danej platformy. Dôvodom bola snaha implementovať
spúšťanie modelov na viacerých zariadeniach súčasne.</P>
<P>Voľba použitia OpenCL/OpenGL interoperability zapína zdieľanie
textúry používanej pri vykresľovaní. Takto netreba dáta
kopírovať cez hostiteľa takže je vykresľovanie rýchlejšie.
</P>
<H2 CLASS="western">Vstupné súbory</H2>
<P STYLE="font-style: normal"><B>MA</B></P>
<P STYLE="font-style: normal; font-weight: normal">MA súbory sú
súbory definujúce asynchrónne modely pomocou formalizmu Cell-DEVS.
Definícia modelu je rozdelená do sekcií. Každá sekcia je
označená svojím názvom uvedeným v hranatých zátvorkách. Ako
prvá je uvedená top sekcia ktorá obsahuje zoznam všetkých
komponentov modelu teda atomické modeli alebo celulárne. Cellula
vie iba celulárne a aj to iba jeden. Nevie simulovať modeli zložené
z atomických alebo viacerých celulárnych modelov.</P>
<P STYLE="font-style: normal; font-weight: normal">V top sekcii bude
teda vždy uvedený názov jednej komponenty celulárneho automatu.
Príklad top sekcie:</P>
<P STYLE="margin-top: 0.5cm; background: transparent; border: 1px solid #000000; padding: 0.25cm 0.05cm; font-style: normal; page-break-before: auto; page-break-after: auto">
<FONT FACE="FreeMono, monospace">[top]<BR>components : sectionname</FONT></P>
<P STYLE="font-weight: normal"><SPAN STYLE="font-style: normal">Potom
nasleduje sekcia definujúca vlastnosti celulárneho modelu. Každá
vlastnosť sa definuje dvojicou </SPAN><SPAN STYLE="font-style: normal"><B>názovvlastnosti
: hodnota </B></SPAN><SPAN STYLE="font-style: normal">oddelené
dvojbodkou</SPAN><I><B>. </B></I><SPAN STYLE="font-style: normal">Tučným
je</SPAN> <SPAN STYLE="font-style: normal">uvedený formát v ktorom
sa má uvádzať hodnota. Vlastnosti ktoré je možné definovať sú
nasledovné:</SPAN></P>
<UL>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
border sú možné dve hodnoty. Wrapped a nowrapped. Standartne
sa berie nowrapped.</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
initialvalue východzia hodnota ktorá sa použije ako stav
všetkých buniek ak sa neurčí pomocou VAL súboru.</P>
<LI><P STYLE="line-height: 100%"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">neighbors
tu sa definujú susedia bunky. </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>sectionname(N,M)</B></SPAN>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">kde
N a M sú dve celé čísla určujúce relatívnu polohu suseda.
Každý sused je treba definovať samostatne.</SPAN></SPAN></P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
localtransition názov prechodovej funkcie. Tú treba následne
definovať ako samostatnú sekciu prechodových previdiel.</P>
<LI><P STYLE="line-height: 100%"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">zone
tu sa dokáže definovať inú prechodovú funkciu ako je
štandardne určená v localtransition. Je možné definovať jednu
bunku </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>transitionfunctionname
{ (N,M) }</B></SPAN> <SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">alebo
obdĺžnikovú oblasť</SPAN></SPAN> <SPAN STYLE="font-style: normal"><B>transitionfunctionname
{ (N,M)..(K,L) }</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.
N,M,K a L sú celé kladné čísla.</SPAN></SPAN></P>
<LI><P STYLE="line-height: 100%"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">dim
rozmery modelovaného priestoru. </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>(N,M)
</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">kde
N a M sú celé kladné čísla. Tieto určujú počet buniek v
modeli.</SPAN></SPAN></P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
width alternatívny spôsob zápisu rozmeru modelu. Treba uviesť
len jedno číslo určujúce šírku simulovaného modelu.</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
heigtht rovnako ako width len určuje výšku.</P>
<LI><P STYLE="font-style: normal; font-weight: normal; line-height: 100%">
timewindow kvôli použitej synchronizačnej metóde je potrebné
určiť minimálne oneskorenie ktoré môže nastať v prechodových
pravidlách.</P>
</UL>
<P><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Nasledujú
sekcie prechodových funkcií. Každá funkcia má uvedený svoj
názov a za ním nasledujú prechodové pravidlá. Formát pravidiel
je nasledovný </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>rule
: result delay { condition }</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.</SPAN></SPAN></P>
<P><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Result
a delay možu byť jednoduché konštanty alebo aj matematické
výrazy. Tieto výrazy môžu pozostávať z matematických operácií
pomocou základných operátorov operátorov „</SPAN></SPAN><SPAN STYLE="font-style: normal"><B>+-*/</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.
operátory sú asociatívne teda násobenie a delenie majú prednosť
pred sčítaním a násobením.</SPAN></SPAN></P>
<P><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Podmienka
pozostáva z logického výrazu kde sa dajú použiť relačné
operátory „</SPAN></SPAN><SPAN STYLE="font-style: normal"><B>&gt;
&lt; &lt;= &gt;= != =</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">alebo
logické operátory „</SPAN></SPAN><SPAN STYLE="font-style: normal"><B>and
or xor imp eqv not“</B></SPAN></P>
<P><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Vo
všetkých výrazoch sa dá odvolávať na susedné bunky pomocou
odkazu </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>(N,M)</B></SPAN>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">kde
N aj M sú celé čísla. Podrobný popis gramatiky je v príručke k
Cell-DEVS.</SPAN></SPAN></P>
<P STYLE="font-style: normal"><B>VAL</B></P>
<P STYLE="font-style: normal; font-weight: normal">Súbory obsahujúce
začiatočné hodnoty pre stav asynchrónneho modelu. Každá hodnota
bunky je na samostatnom riadku. Najprv je vektor súradníc bunky
nasledovaná rovná sa a hodnotou bunky. Ako hodnotu je možné
použiť číslo alebo znak '?' reprezentujúci nedefinovanú hodnotu
ho Príklad obsahu súboru:</P>
<P STYLE="margin-top: 0.5cm; background: transparent; border: 1px solid #000000; padding: 0.25cm 0.05cm; font-style: normal; page-break-before: auto; page-break-after: auto">
<FONT FACE="FreeMono, monospace">(0,1)=4<BR>(2,8)=-1.75<BR>(5,3)=?</FONT></P>
<P STYLE="font-style: normal"><B>TREE</B></P>
<P><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Definícia
synchrónneho modelu vo forme stromu. Ako prvé je v súbore
hlavička. Tá pozostáva z troch riadkov určujúca počet stavov,
susedov a uzlov. Počet stavov môže byť medzi 1až 256. Počet
susedov je 4 alebo 8. Počet uzlov je prakticky neobmedzený. Za
touto hlavičkou potom nasleduje zoznam uzlov. Každý uzol je
reprezentovaný jedným riadkom n čísel kde n je o jedna viac ako
je počet stavov. Prvé číslo reprezentuje hĺbku uzla v strome.
Hĺbka je od jednej po m+1 kde m je počet susedov. Pre každý stav
potom nasleduje číslo uzla do ktorého sa prejde ak je sused v
určitom stave. Druhé číslo v riadku teda určuje uzol pre prvý
stav, tretie pre druhý a n-té číslo posledný stav. Pre hĺbku
jedna ostatné čísla predstavujú nový stav bunky a nie číslo
uzla. V súbore je potom jeden uzol úrovne m+1. Podrobnejší popis
modelu je možné nájsť v príručke ku Golly
http://golly.sourceforge.net/Help/formats.html. Tento formát nie je
určený na vytváranie človekom. Na to slúži iný formát TABLE
ktorý je omnoho zrozumiteľnejší pre človeka. Jeho popis je
taktiež v príručke Golly. Existuje taktiž nástroj ktorý
prevedie TABLE na TREE ktorý je pribalený ku Golly. Ten sa taktiež
nachádza na priloženom médiu.</SPAN></SPAN></P>
<P STYLE="font-style: normal"><B>RLE</B></P>
<P STYLE="font-style: normal; font-weight: normal">Formát RLE je je
jednoduchý textový súbor ktorý taktiež používa Golly na
ukladanie stavu modelov. Používa sa jednoduchá RLE kompresia na
ušetrenie priestoru.</P>
</BODY>
</HTML>

View File

@ -2,7 +2,6 @@
#include <QCoreApplication>
#include <QVBoxLayout>
#include <QSplitter>
#include <QtHelp/QHelpContentWidget>
HelpView::HelpView(QWidget *parent) : QDialog(parent)
{
@ -11,30 +10,10 @@ HelpView::HelpView(QWidget *parent) : QDialog(parent)
QVBoxLayout *layout = new QVBoxLayout(this);
helpEngine = new QHelpEngine(QCoreApplication::applicationDirPath()+"/help/help.qhc", this);
helpBrowser = new HelpBrowser(helpEngine, this);
helpBrowser = new QTextBrowser(this);
helpBrowser->resize(500, 400);
QSplitter *spliter = new QSplitter(Qt::Horizontal);
layout->addWidget(spliter);
spliter->insertWidget(0, helpEngine->contentWidget());
spliter->insertWidget(1, helpBrowser);
//helpBrowser->setSource(QUrl("qthelp://com.trolltech.qmake.460/qdoc/qmake-manual.html"));
helpBrowser->setSource(QUrl(":help/prirucka.html"));
layout->addWidget(helpBrowser);
setWindowTitle(trUtf8("Pomoc"));
connect(helpEngine->contentWidget(), SIGNAL(linkActivated(const QUrl&)), helpBrowser, SLOT(setSource(const QUrl&)));
helpEngine->setupData();
}
QVariant HelpBrowser::loadResource(int type, const QUrl &url)
{
if(url.scheme() == "qthelp")return QVariant(helpEngine->fileData(url));
else return QTextBrowser::loadResource(type, url);
}
HelpBrowser::HelpBrowser(QHelpEngine *engine, QWidget *parent) : QTextBrowser(parent)
{
helpEngine = engine;
}

View File

@ -19,22 +19,12 @@
#ifndef _HELPVIEW_H_NOU_
#define _HELPVIEW_H_NOU_
#include <QtHelp/QHelpEngine>
#include <QTextBrowser>
#include <QDialog>
class HelpBrowser : public QTextBrowser
{
QHelpEngine *helpEngine;
public:
HelpBrowser(QHelpEngine *engine, QWidget *parent = 0);
virtual QVariant loadResource(int type, const QUrl &url);
};
class HelpView : public QDialog
{
QHelpEngine *helpEngine;
HelpBrowser *helpBrowser;
QTextBrowser *helpBrowser;
public:
HelpView(QWidget *parent = 0);
};

View File

@ -1,10 +1,11 @@
#define DEVS_statecount(x) DEVS_statecount_function(event_vector, x)
#define DEVS_statecount(x) DEVS_statecount_function(current_state, event_vector, x)
float DEVS_statecount_function(_event *event_vector, float par)
float DEVS_statecount_function(_state current_state, _event *event_vector, float par)
{
float count = 0;
for(int i=0;i<NEIGHBOR;i++)
count += event_vector[i].state == par ? 1 : 0;
count += current_state == par ? 1 : 0;
return count;
}
@ -14,9 +15,9 @@ float DEVS_statecount_function(_event *event_vector, float par)
// without parameter function
#define DEVS_truecount() DEVS_statecount_function(event_vector, 1)
#define DEVS_falsecount() DEVS_statecount_function(event_vector, 0)
#define DEVS_undefcount() DEVS_statecount_function(event_vector, NAN)
#define DEVS_truecount() DEVS_statecount_function(current_state, event_vector, 1)
#define DEVS_falsecount() DEVS_statecount_function(current_state, event_vector, 0)
#define DEVS_undefcount() DEVS_statecount_function(current_state, event_vector, NAN)
#define DEVS_time() current_time
#define DEVS_random() DEVS_random_function(seed)
#define DEVS_randomSign() DEVS_randomSign_function(seed)
@ -26,8 +27,10 @@ float DEVS_cellPos(float a){ return get_global_id(a); }
float DEVS_random_function(_seed *seed)
{
*seed = 1103515245*(*seed) + 12345;
return *seed/UINT_MAX;
int s = *seed;
s = 1103515245*s + 12345;
*seed = s;
return s/UINT_MAX;
}
float DEVS_randomSign_function(uint *seed){ return DEVS_random() > 0.5f ? -1 : 1; }
@ -154,9 +157,14 @@ float DEVS_hip(float a, float b){ return hypot(a, b);}
float DEVS_and(float a, float b)
{
return (isnormal(a) && isnormal(b)) ? (a && b) : ((a==0 || b==0) ? 0 : NAN);
return a && b;
//return (isnormal(a) && isnormal(b)) ? (a && b) : ((a==0 || b==0) ? 0 : NAN);
}
float DEVS_or(float a, float b)
{
return a || b;
//return (isnormal(a)&&isnormal(b) ? (a||b) : (a==1||b==1 ? 1 : NAN));
}
float DEVS_or(float a, float b){ return (isnormal(a)&&isnormal(b) ? (a||b) : (a==1||b==1 ? 1 : NAN));}
float DEVS_xor(float a, float b){ return isnan(a)||isnan(b) ? NAN : (a!=b ? 1 : 0);}
float DEVS_imp(float a, float b)
{

View File

@ -10,11 +10,11 @@ __constant uint colors[] = {0,0,0,0, 255,255,255,0, 255,0,0,0, 0,255,0,0, 0,0,25
// sem pojdu prechodove funkcie funkcie
/*_event transfer_func(_state current_state, _time current_time, _event *event_vector, _seed *seed)
_event transfer_func_old(_state current_state, _time current_time, _event *event_vector, _seed *seed)
{
_event new_event;
if(current_state >= 1.0f && (DEVS_truecount() == 3 || DEVS_truecount() == 2)){ new_event.time = 100; new_event.state = 1; return new_event; }
if(current_state == 0.0f && (DEVS_truecount() == 3)){ new_event.time = 100; new_event.state = 1; return new_event; }
if(true){ new_event.time = 100; new_event.state = 0; return new_event; }
}
*/

View File

@ -32,6 +32,7 @@ __kernel void intermediateStep(__global _cell *cells)
}
_event transfer_func(_state current_state, _time current_time, _event *event_vector, _seed *seed);
_event transfer_func_old(_state current_state, _time current_time, _event *event_vector, _seed *seed);
//posunie frontu o dalsi casovy krok. vracia cas na ktory sa posunul.
_time advance_in_queues(__global _cell *cells, __local size_t *coord, __local int2 *index, _time current_time)

View File

@ -18,7 +18,7 @@ typedef struct
typedef struct
{
_seed seed;
_state state;
_queue queue;
uint seed;
}_cell;

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'cellulamainwindow.h'
**
** Created: Sat May 7 15:35:03 2011
** Created: Sun May 8 18:17:19 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'glwidget.h'
**
** Created: Sat May 7 15:35:03 2011
** Created: Sun May 8 18:17:19 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'newmodeldialog.h'
**
** Created: Sat May 7 15:35:03 2011
** Created: Sun May 8 18:17:19 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'newstatedialog.h'
**
** Created: Sat May 7 15:35:03 2011
** Created: Sun May 8 18:17:19 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'options.h'
**
** Created: Sat May 7 15:35:03 2011
** Created: Sun May 8 18:17:19 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'texteditor.h'
**
** Created: Sat May 7 15:35:03 2011
** Created: Sun May 8 18:17:19 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!

2434
res.cpp

File diff suppressed because it is too large Load Diff

View File

@ -4,5 +4,6 @@
<file>images/glide.svg</file>
<file>cellula_sk.qm</file>
<file>cellula_en.qm</file>
<file>help/prirucka.html</file>
</qresource>
</RCC>