include/qcquantumsystem.h

00001 /***************************************************************************
00002  *   Quantum Construct (qC++)                                                                  *
00003  *   The Quantum Physics Computational Library                                         *
00004  *   Copyright (C) 2005 by Shekhar S. Chandra                                      *
00005  *   Shekhar.Chandra@sci.monash,edu.au                                     *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /*
00023         Ver Info - QCQuantumSystem.h
00024         1.0.0 - Original Implementation
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 }

Generated on Sat May 13 13:22:48 2006 for Quantum Construct (qC++) by  doxygen 1.4.6-NO