12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #ifndef SIMELEMENT__HPP
- #define SIMELEMENT__HPP
- #include <fstream>
- #include <string>
- #include <gsl/gsl_rng.h>
- #include "libcsim.hpp"
- // forward declarations
- class SimLoop;
- class Recorder;
- class BinRecorder;
- class IRngQueue;
- using namespace std;
- enum SimElementType {NONE, seLayer, seConnection, seLearning, seInput, seNormalize};
- static const char* SimElementTypeStrings[6] = {"SimElement", "Layer", "Connection", "Learning", "Input", "Normalize"};
- /*! \brief Klasse SimElement
- * Basisklasse für Layer-, Connection-, Normalisierungs-Objekte
- *
- * Detailed description starts here.
- */
- class SimElement
- {
- protected:
- SimLoop *MainSimLoop; // pointer to SimLoop for getting global settings
- int MacroTimeStep; // default: 1000
- string DataDirectory;
- bool active;
- gsl_rng * gslr; // global random generator
- IRngQueue * mRndNumQueue; // threaded random number queue
- float dt; // time step in ms
- Recorder *rec;
- BinRecorder *BinRec;
- bool resetable;
- public:
- SimElement(SimLoop* _MainSimLoop, int _MacroTimeStep=1000, SimElementType _type=NONE);
- SimElement(SimElementType _type=NONE);
- ~SimElement();
- string Name;
- string SimTag;
- SimElementType seType;
- string seTypeString;
- unsigned int IdNumber;
- virtual int proceede(int =0);
- virtual int prepare(int =0);
- virtual int reset(int t);
- virtual long calcMemoryConsumption();
- void SetResetable(bool value);
- bool Resetable();
- int GetMacroTimeStep();
- int SetMacroTimeStep(int);
- float GetDeltaT();
- void TurnOn();
- void TurnOff();
- bool On();
- void SetSimTag(const char* tag);
- void SetDataDirectory(const char* dirname);
- virtual void SetName(const char*);
- virtual void Hallo();
- virtual int SaveSimInfo();
- virtual int WriteSimInfo(fstream &fw);
- virtual int WriteSimInfo(fstream &fw, const string &ChildInfo);
- virtual string GetSimInfo();
- virtual string GetSimInfo(const string &ChildInfo);
- virtual int StartRecorder(char* RecName="data.txt");
- virtual void SetParameter(ParaType p, double value);
- virtual bool compiledWithMemsave()
- {
- return compiledWithLowMemConfig();
- }
-
- SimLoop* getSimLoop() {return MainSimLoop;};
- };
- #endif // #ifndef SIMELEMENT__HPP
|