npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

greljs

v1.4.3

Published

Javascript library for relational operations on GPU

Readme

grel

Jun 20, 2018

- Basic demo

let code = `
class C() {
    // header code
    float outVal = 0.0;

    // onInputArg code
    onInputArg(inputArg) {
        if(inputArg instanceOf A) {

        }
        if(inputArg==a) {
            outVal = inputArg0;
        }
    }

    // main code
    main() {
        foutput0 = outVal;
    }
}

A a = new A(0.0);
A b = new A(0.0);
C c = new C();`;

grels = new GRelScript({"code": code});

let render = function() {
    grels.tick();
    requestAnimFrame(render);
};
render();
}

A a = new A(0.0);
a.setPosition(0.1, 1.0, 0.0, 1.0);
A b = new A(0.0);
C c = new C();`;
}

A a = new A(0.0);
a.setDestination(0.1, 1.0, 0.0, 1.0);
A b = new A(0.0);
C c = new C();`;
grels = new GRelScript({"code": code,
                        "meshes": [ "../_RESOURCES/meshA.obj"]});
let code = `
class A() {
    onDrawVertex() {
        if(meshId == 0.0) {
            nodeVertexColor = vec4(0.0, 1.0, 0.0, 1.0);
        }
    }
}
class B() {
    onDrawVertex() {
        if(meshId == 1.0) {
            nodeVertexColor = vec4(1.0, 0.0, 0.0, 1.0);
        }
    }
}
class C() {
    float outVal = 0.0;

    onInputArg(inputArg) {
        if(inputArg instanceOf A) {
            outVal = inputArg0;
        }
    }

    onDrawVertex() {
        if(meshId == 2.0) {
            nodeVertexPosition = vec4(nodeVertexPosition.x*0.4, nodeVertexPosition.y*0.4, nodeVertexPosition.z*0.4, 1.0);
            if(foutput0 > 0.0) {
                nodeVertexColor = vec4(0.0, 1.0, 0.0, 1.0);
            } else {
                mat4 mm = rotationMatrix(vec3(1.0,0.0,0.0), (3.1416/2.0)*2.0);
                nodeVertexPosition = nodeVertexPosition*mm;

                nodeVertexColor = vec4(1.0, 0.0, 0.0, 1.0);
            }
        }
    }
                
    main() {
        foutput0 = outVal;
    }
}

A a = new A(0.0);
B b = new B(0.0);
C c = new C();`;

grels = new GRelScript({"code": code,
                        "meshes": [ "../_RESOURCES/meshA.obj",
                                    "../_RESOURCES/meshB.obj",
                                    "../_RESOURCES/meshC.obj"]});

- Logic outside class

float rr = 0.3;
float rrb = 0.3;
float rrc = 0.0;
AB arr[10];
AB arrB[10];
AB arrC[10];
A d = new A(0.2); d.setPosition(-10.0, 0.0, 10.0, 1.0);
for(int n=0;n<3;n++) {
    arr[n] = 0.31+rr; // (it generate extra code. better use it with care)
    arr[n] = 0.27+rr+d;
}
for(int n=0;n<5;n++) {
    rrc = rrc+0.1;
    arrB[n] = 0.51+rrc;
}
for(int n=0;n<10;n++) {
    arr[n].setPosition(-100.0, 0.0, float(n), 1.0); // initial position (setPosition method does not extra code generation)
    arrB[n].setPosition(-70.0, 0.0, float(n), 1.0); // initial position
    arrC[n].setPosition(-30.0, 0.0, float(n), 1.0); // initial position
    arrC[n] = arr[n]+arrB[min(n+2,9)]; // CPU?. it's executed in GPU under the hood! :P (but is better use classes for it)
}
arr[0] = new AB(0.3);
A a = new A(0.0); a.setPosition(-10.0, 0.0, -10.0, 1.0);
A b = new A(0.0); b.setPosition(-10.0, 0.0, -5.0, 1.0);
A c = new A(0.3); c.setPosition(-10.0, 0.0, 5.0, 1.0);

C e = new C(); e.setPosition(10.0, 0.0, -10.0, 1.0);
F f = new F(); f.setPosition(10.0, 0.0, -5.0, 1.0);
F fb = new F(); fb.setPosition(10.0, 0.0, 5.0, 1.0);
F fc = new F(); fc.setPosition(10.0, 0.0, 10.0, 1.0);
F fd = new F(); fd.setPosition(10.0, 0.0, 20.0, 1.0);
F ff = new F(); ff.setPosition(10.0, 0.0, 30.0, 1.0);

A a2 = new A(0.0); a2.setPosition(-10.0, 0.0, 40.0, 1.0);
F f2 = new F(); f2.setPosition(10.0, 0.0, 40.0, 1.0);

c = d;             // set GFunction c with GFunction d (c is the same as c[0] or c.foutput0 (0-4))
e = d;             // set GFunction e with GFunction d
fd = rrb;          // set GFunction fd with real variable rrb
if(a > d) {        // compare two GFunction floats
    e = c;         // set GFunction e with GFunction c
    if(b > 0.5) {  // compare GFunction float with real number
        f = a;     // set GFunction f with GFunction a
        fb = rr;   // set GFunction fb with real variable rr
        fc = 0.4;  // set GFunction fc with real number
        rrb = 0.6; // set real var rrb with real number
        fd = rrb;  // if this is commented fd will keep with initial 0.3 of rrb
    }
}

if(a > 0.0 && a2 > 0.5) {
    f2 = 1.0;
}

// for less internal code you should use the onInputArg event inside classes with an "instanceOf" and
// to handle it in a general form and set the "foutput" depending of status of the input arguments.
ff.onInputArg((inputArg) => { // (it generate much extra code. Use it with care)
    if(inputArg==fd) {
        if(inputArg0 > 0.4) {
            foutput0 = 1.0/2.0;
        }
    }
});

- Two custom geometries with independent logic over one node

- Quantum simulator (in progress)

inputArg - (to use with: (inputArg instanceof node_type)(checked with internal inputArgNodeType) OR with: (inputArg == node_name)(checked with internal inputArgNodeName) inputArg0 inputArg1 inputArg2 inputArg3 inputArg4

WRITE:

foutput0 foutput1 foutput2 foutput3 foutput4

READ-WRITE:

currentPos

WRITE:

foutput0 foutput1 foutput2 foutput3 foutput4

READ-WRITE:

currentPos

foutput0 foutput1 foutput2 foutput3 foutput4 meshId

READ-WRITE:

nodeVertexPosition nodeVertexColor currentPosition

npm install greljs
<script src="../../dist/grel/GRel.class.js"></script>
OR
<script src="../../dist/gbrain/grel.min.js"></script>

Slack Group