Neuro-VISOR  0.2.0
Visualize and interact with computational simulations using a virtual reality interface
C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType > Class Template Referenceabstract

Provides an base interface for simulations using a general data type T More...

Inherits C2M2.Simulation.Interactable.

Public Member Functions

abstract ValueType GetValues ()
 Require derived classes to make simulation values available More...
 
void Initialize ()
 
void FixedUpdate ()
 
void StartSimulation ()
 Launch Solve thread More...
 
sealed override float GetSimulationTime ()
 Return the current timestep for the simulation More...
 
void StopSimulation ()
 Stop current Solve thread More...
 
int[] HitToVertices (RaycastHit hit)
 Given a raycast hit, find the hit 3D vertices More...
 
- Public Member Functions inherited from C2M2.Simulation.Interactable
abstract void SetValues (RaycastHit hit)
 Require derived classes to know how to receive an interaction event More...
 

Public Attributes

bool dryRun = false
 Run solve code without visualization or interaction More...
 
bool paused = false
 
RaycastEventManager raycastEventManager = null
 
RaycastPressEvents defaultRaycastEvent = null
 
int time = -1
 
double timeStep = 0.008 * 1e-3
 
double endTime = 1.0
 

Protected Member Functions

abstract VizType BuildVisualization ()
 Simulations must know how to build their visualization and what type the visualization is More...
 
abstract void UpdateVisualization (in ValueType newValues)
 Update the visualization. This will be called once per Update() call More...
 
abstract void SolveStep (int t)
 Method containing simulation code More...
 
virtual void PreSolveStep (int t)
 PreSolveStep is called once per simulation frame, before SolveStep() More...
 
virtual void PostSolveStep (int t)
 PostSolveStep is called once per simulation frame, after SolveStep() More...
 
virtual void OnAwakePre ()
 
virtual void OnAwakePost (VizType viz)
 
virtual void OnStart ()
 
virtual void OnUpdate ()
 
void OnDestroy ()
 
virtual void OnPause ()
 
virtual void OnQuit ()
 
virtual void OnDest ()
 
abstract void PreSolve ()
 Called on the main thread before the Solve thread is launched More...
 
virtual void PostSolve ()
 Called on the solve thread after the simulation for loop is completed More...
 

Protected Attributes

Mutex mutex = new Mutex()
 Provide mutual exclusion to derived classes More...
 
CustomSampler solveStepSampler = null
 

Properties

VizType Viz [get, protected set]
 
int nT = -1 [get, private set]
 

Private Member Functions

void OnApplicationPause (bool pause)
 
void OnApplicationQuit ()
 
void Solve ()
 

Private Attributes

Thread solveThread = null
 Thread that runs simulation code More...
 

Detailed Description

Provides an base interface for simulations using a general data type T

Template Parameters
ValueTypeType of simulation values
VizType
RaycastType
GrabType

Member Function Documentation

◆ BuildVisualization()

abstract VizType C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.BuildVisualization ( )
protectedpure virtual

Simulations must know how to build their visualization and what type the visualization is

See SurfaceSimulation & NeuronSimulation1D or PositionFieldSimulation for examples.

Implemented in C2M2.NeuronalDynamics.Simulation.NDSimulation.

◆ FixedUpdate()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.FixedUpdate ( )

◆ GetSimulationTime()

sealed override float C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.GetSimulationTime ( )
virtual

Return the current timestep for the simulation

Returns

Implements C2M2.Simulation.Interactable.

◆ GetValues()

abstract ValueType C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.GetValues ( )
pure virtual

Require derived classes to make simulation values available

Implemented in C2M2.NeuronalDynamics.Simulation.NDSimulation.

◆ HitToVertices()

int [] C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.HitToVertices ( RaycastHit  hit)

Given a raycast hit, find the hit 3D vertices

◆ Initialize()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.Initialize ( )

Add event child object for interaction scripts to find

◆ OnApplicationPause()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnApplicationPause ( bool  pause)
private

◆ OnApplicationQuit()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnApplicationQuit ( )
private

◆ OnAwakePost()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnAwakePost ( VizType  viz)
protectedvirtual

◆ OnAwakePre()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnAwakePre ( )
protectedvirtual

◆ OnDest()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnDest ( )
protectedvirtual

◆ OnDestroy()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnDestroy ( )
protected

◆ OnPause()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnPause ( )
protectedvirtual

◆ OnQuit()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnQuit ( )
protectedvirtual

◆ OnStart()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnStart ( )
protectedvirtual

◆ OnUpdate()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.OnUpdate ( )
protectedvirtual

◆ PostSolve()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.PostSolve ( )
protectedvirtual

Called on the solve thread after the simulation for loop is completed

◆ PostSolveStep()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.PostSolveStep ( int  t)
protectedvirtual

PostSolveStep is called once per simulation frame, after SolveStep()

Reimplemented in C2M2.NeuronalDynamics.Simulation.NDSimulation.

◆ PreSolve()

abstract void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.PreSolve ( )
protectedpure virtual

Called on the main thread before the Solve thread is launched

This is useful if you need to initialize anything that makes use of Unity calls, which are not available to be called from secondary threads.

Implemented in C2M2.NeuronalDynamics.Simulation.SparseSolverTestv1, and C2M2.NeuronalDynamics.Simulation.ExampleNDSolver.

◆ PreSolveStep()

virtual void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.PreSolveStep ( int  t)
protectedvirtual

PreSolveStep is called once per simulation frame, before SolveStep()

◆ Solve()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.Solve ( )
private

◆ SolveStep()

abstract void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.SolveStep ( int  t)
protectedpure virtual

Method containing simulation code

Launches in its own thread

Implemented in C2M2.NeuronalDynamics.Simulation.SparseSolverTestv1, and C2M2.NeuronalDynamics.Simulation.ExampleNDSolver.

◆ StartSimulation()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.StartSimulation ( )

Launch Solve thread

◆ StopSimulation()

void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.StopSimulation ( )

Stop current Solve thread

◆ UpdateVisualization()

abstract void C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.UpdateVisualization ( in ValueType  newValues)
protectedpure virtual

Update the visualization. This will be called once per Update() call

See SurfaceSimulation & NeuronSimulation1D or PositionFieldSimulation for examples.

Member Data Documentation

◆ defaultRaycastEvent

RaycastPressEvents C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.defaultRaycastEvent = null

◆ dryRun

bool C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.dryRun = false

Run solve code without visualization or interaction

◆ endTime

double C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.endTime = 1.0

◆ mutex

Mutex C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.mutex = new Mutex()
protected

Provide mutual exclusion to derived classes

◆ paused

bool C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.paused = false

◆ raycastEventManager

RaycastEventManager C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.raycastEventManager = null

◆ solveStepSampler

CustomSampler C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.solveStepSampler = null
protected

◆ solveThread

Thread C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.solveThread = null
private

Thread that runs simulation code

◆ time

int C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.time = -1

◆ timeStep

double C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.timeStep = 0.008 * 1e-3

Property Documentation

◆ nT

int C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.nT = -1
getprivate set

◆ Viz

VizType C2M2.Simulation.Simulation< ValueType, VizType, RaycastType, GrabType >.Viz
getprotected set

The documentation for this class was generated from the following file: