00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifdef USE_HDF5
00048 #ifndef _NSDFWRITER_H
00049
00050 #include "HDF5DataWriter.h"
00051 #include "InputVariable.h"
00052
00067 class NSDFWriter: public HDF5DataWriter
00068 {
00069 public:
00070 NSDFWriter();
00071 ~NSDFWriter();
00072 virtual void flush();
00073
00074 void setEnvironment(string key, string value);
00075
00076 void setModelRoot(string root);
00077 InputVariable *getEventInput(unsigned int index);
00078 void setNumEventInputs(unsigned int num);
00079 unsigned int getNumEventInputs() const;
00080 void setInput(unsigned int index, double value);
00081 void openUniformData(const Eref &eref);
00082 void closeUniformData();
00083 void openEventData(const Eref &eref);
00084 void closeEventData();
00085 herr_t writeEnv();
00086
00087 void process(const Eref &e, ProcPtr p);
00088 void reinit(const Eref &e, ProcPtr p);
00089 NSDFWriter& operator=(const NSDFWriter&other);
00090
00091 static const Cinfo *initCinfo();
00092
00093 protected:
00094 hid_t getEventDataset(string srcPath, string srcField);
00095 void sortOutUniformSources(const Eref& eref);
00096
00097 map <string, string> env_;
00098 vector < hid_t > eventDatasets_;
00099
00100
00101 vector < vector < double > > events_;
00102 vector < InputVariable > eventInputs_;
00103 vector < string > eventSrcFields_;
00104 vector < string > eventSrc_;
00105 map < string, hid_t > eventSrcDataset_;
00106 hid_t eventGroup_;
00107 hid_t uniformGroup_;
00108 hid_t dataGroup_;
00109 hid_t modelGroup_;
00110 hid_t mapGroup_;
00111 map< string, hid_t > classFieldToUniform_;
00112
00113
00114 map< string, pair< hid_t, unsigned int > > uniformSrcDatasetIndex_;
00128
00129
00130
00131 map< string, vector< unsigned int > > classFieldToSrcIndex_;
00132
00133 map< string, unsigned int > objectFieldToIndex_;
00134
00135
00136 vector < pair< string, string > > objectField_;
00137 map< string, vector < string > > classFieldToObjectField_;
00138 vector < string > vars_;
00139
00140 };
00141 #endif // _NSDFWRITER_H
00142 #endif // USE_HDF5
00143
00144
00145