DSQSS
1.1
|
00001 //###################################################################### 00002 //#### MPI Header Files 00003 //###################################################################### 00004 00005 #ifdef MULTI 00006 #include <mpi.h> 00007 int N_PROC; // the total number of processors 00008 int I_PROC; // the processor id of the current processor 00009 #endif 00010 //#include <iostream.h> 00011 #include <iostream> 00012 #include <stdio.h> 00013 #include <math.h> 00014 #include <stdlib.h> 00015 00016 //###################################################################### 00017 //#### Global Variables 00018 //###################################################################### 00019 00020 FILE* FERR = stdout; 00021 00022 00023 //###################################################################### 00024 //#### Graphics Header Files 00025 //###################################################################### 00026 00027 #ifdef GRAPHIC 00028 #include <eggx.h> 00029 #endif 00030 00031 //###################################################################### 00032 //#### Random Number Generator Header Files 00033 //###################################################################### 00034 00035 #include "random.h" 00036 Random RND; 00037 00038 //###################################################################### 00039 //#### Local Header Files 00040 //###################################################################### 00041 00042 inline void abort(char* s="") { printf("%s\n",s); exit(0); } 00043 00044 #ifdef DEB 00045 bool DEBUG=true; 00046 #else 00047 bool DEBUG=false; 00048 #endif 00049 00050 bool ALERT=false; 00051 00052 #include "name.h" 00053 #include "io.h" 00054 #include "array.h" 00055 #include "link.hpp" 00056 #include "parameter.hpp" 00057 #include "algorithm.hpp" 00058 #include "objects.hpp" 00059 #include "lattice.hpp" 00060 #include "measure.hpp" 00061 00062 //###################################################################### 00063 00064 class Simulation { 00065 00066 private: 00067 00068 int ISET; 00069 int IMCSE; 00070 int IMCSD; 00071 int IMCS; 00072 int ICYC; 00073 00074 int ISETstart; 00075 int IMCSDstart; 00076 int IMCSstart; 00077 00078 double AMP; // the average mean path of the worm per cycle 00079 bool EndOfCycle; // set to be true when the cycle ends 00080 00081 public: 00082 int np; 00083 Simulation(Parameter& P0); 00084 ~Simulation(); 00085 00086 void calc(); 00087 00088 Parameter& P; 00089 Algorithm ALG; 00090 00091 //Algorithm alg[8]; 00092 //Algorithm* alg; 00093 Lattice LAT; 00094 Measurement MSR; 00095 Worm W; 00096 00097 Vertex V4REF; 00098 00099 void reset_counters(); 00100 // === edit rep sakakura === 00101 //void Set(); 00102 void Set(int index); 00103 // === edit rep sakakura === 00104 void Set(); 00105 void set_NCYC(); 00106 00107 // == edit sakakura == 00108 //void CalcRepEx(); 00109 void RepChangeF(Algorithm& A0); 00110 void RepChangeB(double h0); 00111 // == edit sakakura == 00112 00113 void Sweep(); 00114 double Cycle(); 00115 bool PlaceWorm(); 00116 double MoveHead (); 00117 00118 double UP_ONESTEP(); 00119 double DOWN_ONESTEP(); 00120 void Check(); 00121 void dump(); 00122 void dump(const char*); 00123 00124 #ifdef GRAPHIC 00125 int g_win; 00126 void g_init(); 00127 void g_draw(); 00128 void g_clear(); 00129 #endif 00130 00131 #ifdef CHAINJOB 00132 private: 00133 bool isChainjob; 00134 bool isEnd; //true->exit(0); false-> read cjob.bin 00135 char CJOBFILE[32]; 00136 ofstream* cjobout; 00137 ifstream* cjobin; 00138 void BinaryIO(); 00139 void read_cjob(); 00140 void write_cjob(); 00141 void end_cjob(); 00142 void end_job(); 00143 #endif 00144 00145 };