Skip to content

Instantly share code, notes, and snippets.

View gidili's full-sized avatar
🐢
Probably eating pizza 🍕

Giovanni Idili gidili

🐢
Probably eating pizza 🍕
View GitHub Profile
First time they open the main page (the petri dish one):
- [ ] we need to have customizable text snippets appearing in the right panel
- [ ] the only button that will be visible will be a "next" button (arrow same as in the previous flow) to go to the next tutorial message
- [ ] at the end of the flow simulation buttons will start appearing as they are introduced to the user
- [ ] once the user finishes the flow all the simulation buttons are visible and we need to persist that they have done so
Post Tutorial flow:
- [ ] simulation buttons always show
- [ ] after this flow is completed we can show random tips / facts as text (from a list) and the user can go to the next / prev
Objects in the file:
/ (Group)
/time (Dataset)
/wormsim (Group)
/wormsim/mechanical (Group)
/wormsim/mechanical/VISUALIZATION_TREE (Group)
/wormsim/mechanical/VISUALIZATION_TREE/transformation (Dataset)
/wormsim/muscle_0 (Group)
/wormsim/muscle_0/mechanical (Group)
/wormsim/muscle_0/mechanical/SIMULATION_TREE (Group)
scene = new THREE.Scene();
// setup lighting etc.
load('/org.wormsim.frontend/resources/files/cuticleNotBent.dae');
load("/org.wormsim.frontend/resources/files/muscles.dae");
load("/org.wormsim.frontend/resources/files/neurons.dae");
function load(daeLocation){
var manager = new THREE.LoadingManager();
/* Ismael Celis 2010
Simplified WebSocket events dispatcher (no channels, no users)
var socket = new FancyWebSocket();
// bind to server events
socket.bind('some_event', function(data){
alert(data.name + ' says: ' + data.message)
});
@gidili
gidili / setActivationSignalExample.java
Created August 9, 2013 13:34
hardcoding activation signals for elastic matter
// set activation signal buffer to test contraction
float[] signals = new float[_elasticBundlesCount];
for(int i = 0; i < _elasticBundlesCount; i++)
{
signals[i] = 0.9f;
}
this.setActivationSignal(signals);
@gidili
gidili / misc_notes
Created July 19, 2013 14:26
Some notes on our algorithmic / architectural choices
SOFA Limitations:
1. not distributed
2. not web-based front-end
SOFA SPH Limitations:
1. SOFA does not support PCISPH
2. SOFA does not support contractile tissue
3. SOFA does not support impermeable membranes
Boyle Model Limitations:
@gidili
gidili / writefile.java
Last active December 19, 2015 14:09
logging a file
Writer test_log = null;
// write txt files
test_log = new FileWriter("test_log.txt");
for(int i=0; i<checkpoint_values.neighborMap.size(); i=i+2 )
{
test_log.write(checkpoint_values.neighborMap.get(i) + "\t" +
checkpoint_values.neighborMap.get(i + 1) + "\r\n");
}
@gidili
gidili / clearBuffers.cl
Created July 7, 2013 01:50
simplified version of clearBuffers function
__kernel void clearBuffers(
__global float2 * neighborMap,
int PARTICLE_COUNT
)
{
int id = get_global_id( 0 );
if( id >= PARTICLE_COUNT )return;
float2 initVector = (float2)( -1, -1);
@gidili
gidili / owOpenCLSolver.h
Last active December 18, 2015 15:49
Snippets to log PCI-SPH states - storing in a gist not to mess up the code in this branch: https://github.com/openworm/Smoothed-Particle-Hydrodynamics/tree/testing_geppetto_config
// read buffer functions inline declarations in owOpenCLSolver.h
void read_position_b( float * positionBuffer ) { copy_buffer_from_device( positionBuffer, position, PARTICLE_COUNT * sizeof( float ) * 4 ); };
void read_sortedPosition_b( float * sortedPositionBuffer ) { copy_buffer_from_device( sortedPositionBuffer, sortedPosition, PARTICLE_COUNT * sizeof( float ) * 4 * 2 ); };
void read_neighborMap_b( float * neighborMapBuffer ) { copy_buffer_from_device( neighborMapBuffer, neighborMap, PARTICLE_COUNT * sizeof( float ) * 2 ); };
void read_velocity_b( float * velocityBuffer ) { copy_buffer_from_device( velocityBuffer, velocity, PARTICLE_COUNT * sizeof( float ) * 4 ); };
void read_acceleration_b( float * accelerationBuffer ) { copy_buffer_from_device( accelerationBuffer, acceleration, PARTICLE_COUNT * sizeof( float ) * 4 * 2); };
void read_sortedVelocity_b( float * sortedVelocityBuffer ) { copy_buffer_from_device( sortedVelocityBuffer, sortedVelocity, PARTICLE_COUNT * sizeof( float ) * 4 ); };
void read_elastic
@gidili
gidili / solveWithDeviceMemory.java
Last active December 17, 2015 02:29
Using only implicit copying - works fine with CPU but not with GPU
public synchronized float[] solveWithDeviceMemory() {
// Allocate native (device) memory for the input data
CLBuffer<Float> bufIn = _context.createFloatBuffer(CLMem.Usage.Input, _input.length);
// Allocate native (device) memory for the output data
CLBuffer<Float> bufOut = _context.createFloatBuffer(CLMem.Usage.Output, _input.length);
// Copy input data directly to device memory
Pointer<Float> ptrIn = bufIn.map(_queue, CLMem.MapFlags.Write);
ptrIn.setFloats(_input);
bufIn.unmap(_queue, ptrIn);