grel
============
Jun 20, 2018<br />
<h2>Javascript library for relational operations on GPU</h2>

<p>Nodes are like functions which return an output and this output can be connected to another node (function) like an input (argument).</p>
<p>This system is not CPU based, it is entirely on GPU. In fact the relations is handled through Adjacency Matrix for better GPU use and nodes is drawed as single geometry.</p>
<p>If functions act as logical gates, all this gates will be executed at same time.</p>
<p>If you need graphical representation, the own node function can be used to customize it according your needs. (in progress)</p>

<a href="http://stormcolour.appspot.com/grel/demos/basic/">- Basic demo</a><br />
<a href="http://stormcolour.appspot.com/grel/demos/basic/"><img src="demos/_RESOURCES/capture.png" /></a><br />

```javascript
var grel = new GRel({});

grel.nodeLogic(''+
    'foutput0 += (inputArgNodeType == 1.0) ? inputArg0 : 0.0;'
    //'foutput1 += (inputArgType == 1.0) ? inputArg1 : 0.0;'
    //'foutput2 += (inputArgType == 1.0) ? inputArg2 : 0.0;'
    //'foutput3 += (inputArgType == 1.0) ? inputArg3 : 0.0;'
    //'foutput4 += (inputArgType == 1.0) ? inputArg4 : 0.0;'
    //'foutput5 += (inputArgType == 1.0) ? inputArg5 : 0.0;'
);

grel.nodeVertexVisualization(''+
    'nodeVertexColor = vec4(0.0, 0.0, 1.0, 1.0);'+

    'if(nodeType == 0.0 && foutput0 > 0.5) {'+
        'nodeVertexColor = vec4(0.0, 1.0, 0.0, 1.0);'+
    '} else if(nodeType == 0.0 && foutput0 < 0.5) {'+
        'nodeVertexColor = vec4(1.0, 0.0, 0.0, 1.0);'+
    '} else {'+
        'nodeVertexColor = vec4(abs(foutput0), abs(foutput0), abs(foutput0), 1.0);'+
    '}'
);

grel.addNode({  "name": "A",
    "nodeValue": 0.3,
    "nodeType": 1,
    "destination": [-10.0, 0.0, -10.0, 1.0]});

grel.addNode({  "name": "B",
    "nodeValue": 0.3,
    "nodeType": 1,
    "destination": [-10.0, 0.0, 10.0, 1.0]});

grel.addNode({  "name": "C",
    "nodeValue": 0.0,
    "nodeType": 0,
    "destination": [0.0, 0.0, 0.0, 1.0]});

grel.addRelation({  "origin": "A",
    "target": "C"});

grel.addRelation({  "origin": "B",
    "target": "C"});

grel.init();

grel.setValue("A", 0.1);

var render = function() {
     grel.tick();
     requestAnimFrame(render);
};
render();
         
```