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 #ifndef QCQUANTUMSYSTEM_H
00028 #define QCQUANTUMSYSTEM_H
00029
00030 #include <string>
00031
00032 #include "qcevolve.h"
00033 #include "qcsteadystate.h"
00034 #include "qcparameter.h"
00035
00047 template <typename T, int rank>
00048 class QCQuantumSystem
00049 {
00050 public:
00051
00057 QCQuantumSystem(void);
00061 virtual ~QCQuantumSystem(void);
00063
00064
00070 virtual void setSize(int noOfRows, int noOfCols)
00071 { if(ptrField != NULL) ptrField->setSize(noOfRows,noOfCols); }
00075 void resize(int &noOfRows, int &noOfCols)
00076 { if(ptrField != NULL) ptrField->resize(noOfRows,noOfCols); }
00080 void setDeltaT(parameterType value)
00081 { Evolve.setTimeStep(value); }
00085 void setDeltaX(parameterType value)
00086 { deltaX = value; }
00090 void setDeltaY(parameterType value)
00091 { deltaY = value; }
00095 void setDeltaR(parameterType value)
00096 { deltaR = value; }
00100 void setXOffset(int value)
00101 { xOffset = value; }
00105 void setYOffset(int value)
00106 { yOffset = value; }
00110 void setTolerance(parameterType value)
00111 { SteadyState.setTolerance(value); }
00115 void setFileName(string name)
00116 { outFileName = name; }
00117
00121 int getNoOfRows();
00125 int getNoOfColumns();
00129 parameterType getDeltaT()
00130 { return Evolve.getTimeStep(); }
00134 parameterType getDeltaX()
00135 { return deltaX; }
00139 parameterType getDeltaY()
00140 { return deltaY; }
00144 parameterType getDeltaR()
00145 { return deltaR; }
00149 parameterType getXOffset()
00150 { return xOffset; }
00154 parameterType getYOffset()
00155 { return yOffset; }
00159 parameterType getTolerance()
00160 { return SteadyState.getTolerance(); }
00164 string getFileName()
00165 { return outFileName; }
00169 const char* getFileNameCSTR()
00170 { return outFileName.c_str(); }
00174 virtual void writeImage(int shot, string filePrefix, string extension);
00178 Array<T,rank>* accessData()
00179 { return ptrField->accessArray(); }
00181
00182 protected:
00183 QCEvolve Evolve;
00184 QCSteadyState SteadyState;
00185 QCField<T,rank> *ptrField;
00186 QCParameter SystemParameters;
00187 parameterType deltaX;
00188 parameterType deltaY;
00189 parameterType deltaR;
00190 int xOffset;
00191 int yOffset;
00192 string outFileName;
00193 };
00194 #endif
00195
00196 template <typename T, int rank>
00197 QCQuantumSystem<T,rank>::QCQuantumSystem(void)
00198 {
00199 ptrField = NULL;
00200 }
00201
00202 template <typename T, int rank>
00203 QCQuantumSystem<T,rank>::~QCQuantumSystem(void)
00204 {
00205 delete ptrField;
00206 }
00207
00208 template <typename T, int rank>
00209 int QCQuantumSystem<T,rank>::getNoOfRows()
00210 {
00211 if(ptrField != NULL)
00212 return ptrField->noOfRows();
00213 else
00214 return 0;
00215 }
00216
00217 template <typename T, int rank>
00218 int QCQuantumSystem<T,rank>::getNoOfColumns()
00219 {
00220 if(ptrField != NULL)
00221 return ptrField->noOfColumns();
00222 else
00223 return 0;
00224 }
00225
00226 template <typename T, int rank>
00227 void QCQuantumSystem<T,rank>::writeImage(int shot, string filePrefix, string extension)
00228 {
00229 char digit = static_cast<char> (shot + 48);
00230 string filename = filePrefix + digit + extension;
00231
00232 ptrField->writeToFile(filename.c_str());
00233 }