class Brain

This is the core of the brain.

Public Fields

[more]int flag
Simulation parameters parsed from the input file to control the simulation behavior
[more]double TotalTime
total time to run the program - seconds - input from user
[more]int CycleCount
Ticks to run.
[more]int TimeStep
Current timestep of the DoThink loop
[more]int ReportTime
Time to do Rich's status reports?
[more]int StartTime
Actual time in seconds when the program started the main loop - not used
[more]int nCells
Number of neurons on this node
[more]Cell** Cells
List of pointers referencing all Cells on this node
[more]double* CellPosition[3]
Cell Coordinates.
[more]int nStimulus
Number of stimulus objects currently defined
[more]Stimulus* StimList
Linked list of Stimulus objects
[more]int nReports
Number of report objects currently defined
[more]Report* RptList
Linked List of Reports objects
[more]int nSynapseDef
Number of Synapse Definitions
[more]SynapseDef** SynapseDefs
List of pointers to Synapse Definitions
[more]bool SaveFlag
If set to true, the state of all brain objects should be written to a file at end of timestep
[more]bool ResetFlag
If set to true, the state of all brain objects should be read and reset based on file
[more]double SaveTime
Automatically save brain state to file when it reaches this time
[more]char* SaveFile
Name of file to save to when automatically saving
[more]int HostPort
port for automatically connecting reports/stims/and the brain
[more]int Port
port for receiving outside commands
[more]char* HostName
hostname where this Brain will recv commands from
[more]int sd
socket descriptor opened if taking runtime commands
[more]FILE* input
FILE Pointer to use instead of sd
[more]char* pendingCommands
Pointer to hold pending commands meant for later timesteps
[more]int pendingLength
length of pendingCommands
[more]MPI_Comm commandComm
Communicator for distributing runtime commands
[more]MPI_Group commandGroup
Group for distributing runtime commands

Public Methods

[more]void Save(char* )
Save the current state of the brain to a file.
[more]void LoadArrays( char* filename )
Restore data that was kept in the arrays structure.
[more]void Load(char* filename, char* nothing )
Load a brain and its last state from a file.
[more]int CommandCheck()
Checks for any runtime commands and distributes them among all nodes.
[more]int CommandParse( char* commandBuffer )
Takes the command buffer and breaks it up into individual words (separated by spaces and/or tabs) and calls CommandExec on individual commands (seperated by semi-colon).
[more]int CommandExec( vector<char* > &result )
When a command is parsed, this function determines which other function to call that will perform the required action.
[more]int CommandHebbian( vector<char*> &result )
Changes the Hebbian learning mode of the specified Synapse Format SetHebbian <syanpse type> < NONE | BOTH | +HEBBIAN | -HEBBIAN >
[more]int CommandExit( vector<char*> &result )
User has requested the simulator to terminate.
[more]int CommandStim( vector<char*> &result )
User wants to add another start/end pair to an existing stimulus.
[more]int CommandReport( vector<char*> &result )
User wants to add another start/end pair to an existing report.
[more]int CommandSave( vector<char*> &result )
Port Command to instruct brain state to be written at current timestep.
[more]FILE* setupPort()
If this brain is to receive dynamic commands, the port based communication needs to be setup before the doThink loop gets underway.


Documentation

This is the core of the brain. It contains lists of the objects, such as Cells, that the brain contains (which in turn may contain other lists of their internal components). The code is basically a loop that runs through the Stimulus, Cell, and Report lists every timestep, and calls them to do whatever they do.
oint flag
Simulation parameters parsed from the input file to control the simulation behavior

odouble TotalTime
total time to run the program - seconds - input from user

oint CycleCount
Ticks to run. Note: TimeStep values must be int, since negative values are used as flags

oint TimeStep
Current timestep of the DoThink loop

oint ReportTime
Time to do Rich's status reports?

oint StartTime
Actual time in seconds when the program started the main loop - not used

oint nCells
Number of neurons on this node

oCell** Cells
List of pointers referencing all Cells on this node

odouble* CellPosition[3]
Cell Coordinates. Only used if synaptic distances turned on. Can be freed to save memory

oint nStimulus
Number of stimulus objects currently defined

oStimulus* StimList
Linked list of Stimulus objects

oint nReports
Number of report objects currently defined

oReport* RptList
Linked List of Reports objects

oint nSynapseDef
Number of Synapse Definitions

oSynapseDef** SynapseDefs
List of pointers to Synapse Definitions

obool SaveFlag
If set to true, the state of all brain objects should be written to a file at end of timestep

obool ResetFlag
If set to true, the state of all brain objects should be read and reset based on file

odouble SaveTime
Automatically save brain state to file when it reaches this time

ochar* SaveFile
Name of file to save to when automatically saving

oint HostPort
port for automatically connecting reports/stims/and the brain

oint Port
port for receiving outside commands

ochar* HostName
hostname where this Brain will recv commands from

oint sd
socket descriptor opened if taking runtime commands

oFILE* input
FILE Pointer to use instead of sd

ochar* pendingCommands
Pointer to hold pending commands meant for later timesteps

oint pendingLength
length of pendingCommands

oMPI_Comm commandComm
Communicator for distributing runtime commands

oMPI_Group commandGroup
Group for distributing runtime commands

ovoid Save(char* )
Save the current state of the brain to a file. Recursively saves data from each subobject of the brain - cells, compartments, channels, etc. does not save reports or stimulus; these will be defined new when the brain is loaded.

ovoid LoadArrays( char* filename )
Restore data that was kept in the arrays structure. This should be done first and separately, so that the data can be ready and available for the rest of loading that will be done later.
Parameters:
filename - name of save file containing all ncs data

ovoid Load(char* filename, char* nothing )
Load a brain and its last state from a file. Recursively creates and loads data into substructures - cells, compartments, channels, etc.
Parameters:
filename - name of save file containing all ncs data
nothing - character pointer to be used as a place holder, will eventually be removed when it is no longer needed

oint CommandCheck()
Checks for any runtime commands and distributes them among all nodes.
Returns:
integer to indicate result of command receipt and any subsequent execution

oint CommandParse( char* commandBuffer )
Takes the command buffer and breaks it up into individual words (separated by spaces and/or tabs) and calls CommandExec on individual commands (seperated by semi-colon). If commands meant for different timesteps are read in at the same time, they will be separated by newlines.
Parameters:
commandBuffer - charater string containing the received command
Returns:
result code of the last executed command

oint CommandExec( vector<char* > &result )
When a command is parsed, this function determines which other function to call that will perform the required action.
Parameters:
commandBuffer - charater string containing the received command
Returns:
result code of the executed command

oint CommandHebbian( vector<char*> &result )
Changes the Hebbian learning mode of the specified Synapse Format SetHebbian <syanpse type> < NONE | BOTH | +HEBBIAN | -HEBBIAN >
Parameters:
result - all words parsed from command buffer. Should contain information to locate synapse and the new mode it should be set.
Returns:
0 on success, -1 on failure

oint CommandExit( vector<char*> &result )
User has requested the simulator to terminate. All reports will be flushed and closed and ncs will break out of the DoThink loop so that it can shut down properly. Hopefully.
Parameters:
result - all words parsed from command buffer. Not needed in this function, but passed for consistency
Returns:
integer value 15 to notify the DoThink loop it should call break.

oint CommandStim( vector<char*> &result )
User wants to add another start/end pair to an existing stimulus. format: APPENDSTIM [-flags] <stim type> <TStart> [TStop] flags are optional, but must all be included as the second item. If no flags are needed, then the stim type can go immediatly after the command. Currently implemented flags include: a : Automatic Time Stop. If this flag is specified, then the TStop argument should not be sent because the stimulus will be made to last 2.5 milliseconds. t : Timesteps will be sent. Instead of taking TStart (and TStop, if applicable ) and multiplying by FSV, the values sent are used directly. s : Seconds will be sent (default). After receiving TStart (and TStop, if applicable ) they will be multiplied by FSV to calculate the appropriate TimeStep. Multiple stim types can be affected if desired by following the final parameter with white space (i.e. space or tab) then another set of parameters. ex. APPENDSTIM -a Stim1 3.4 Stim2 3.4 ex. APPENDSTIM -t Stim1 34000 35000 Stim2 34000 37000
Parameters:
result - all words parsed from command buffer. Should contain flags, name of stimuli and start/end time pairs (in seconds by default)
Returns:
0 on success, -1 on failure

oint CommandReport( vector<char*> &result )
User wants to add another start/end pair to an existing report. format: APPENDREPORT [-flags] <report type> <TStart> [TStop] flags are optional, but must all be included as the second item. If no flags are needed, then the stim type can go immediatly after the command. Currently implemented flags include: a : Automatic Time Stop. If this flag is specified, then the TStop argument should not be sent because the report will be made to last 2.5 milliseconds. t : Timesteps will be sent. Instead of taking TStart (and TStop, if applicable ) and multiplying by FSV, the values sent are used directly. s : Seconds will be sent (default). After receiving TStart (and TStop, if applicable ) they will be multiplied by FSV to calculate the appropriate TimeStep.
Parameters:
result - all words parsed from command buffer. Should contain flags, name of report and start/end time pairs (in seconds)
Returns:
0 on success, -1 on failure

oint CommandSave( vector<char*> &result )
Port Command to instruct brain state to be written at current timestep. Format: SAVE [filename] filename is optional as long as a save file was given in the input file already. When a filename is confirmed to exist, either in the command or from the input file, the Save function is called.
Parameters:
result - all words parsed from command buffer. Should contain just "SAVE" and a filename if applicable @result 0 on success, -1 on failure (i.e. no valid filename found)

oFILE* setupPort()
If this brain is to receive dynamic commands, the port based communication needs to be setup before the doThink loop gets underway. This function will setup that communication for either a specify host/port or use a server's auto port capabilities if Port is -1.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.