00001
00007
00008
00009
00010
00011 #ifndef OUTPUT_H
00012 #define OUTPUT_H
00013
00014 #include "common.h"
00015
00016 class Vector;
00017 class FloatVector;
00018 class Lattice;
00019
00020
00021 #define FILE_OUTPUT -1
00022 #define END_OF_RUN -2
00023 #define EVAL_MEASURE -3
00024 #define FORCE_OUTPUT -4
00025
00026 #define OUTPUT_SINGLE_FILE 1
00027 #define OUTPUT_MAGIC_NUMBER 123456
00028 #define OUTPUT_FILE_VERSION 1.00
00029
00030 enum OUTPUTFILETYPE {
00031 dcdType,
00032 forcedcdType,
00033 veldcdType,
00034 coorType,
00035 forceType,
00036 velType
00037 };
00038
00039 class Output
00040 {
00041
00042 private:
00043
00044
00045
00046 void output_dcdfile(int, int, FloatVector *, const Lattice *);
00047 void output_veldcdfile(int, int, Vector *);
00048
00049 void output_forcedcdfile(int, int, Vector *);
00050
00051
00052 void output_restart_coordinates(Vector *, int, int);
00053
00054
00055 void output_restart_velocities(int, int, Vector *);
00056
00057
00058 void output_final_coordinates(Vector *, int, int);
00059 void output_final_velocities(int, int, Vector *);
00060 void output_forces(int, int, Vector *);
00061
00062 void scale_vels(Vector *, int, Real);
00063 void write_binary_file(char *, int, Vector *);
00064
00065 public :
00066 Output();
00067 ~Output();
00068 void energy(int, BigReal *);
00069
00070 static int coordinateNeeded(int);
00071 void coordinate(int, int, Vector *, FloatVector *, Lattice &);
00072
00073
00074
00075 static int velocityNeeded(int);
00076 void velocity(int, int, Vector *);
00077
00078
00079 static int forceNeeded(int);
00080 void force(int, int, Vector *);
00081
00082
00083 };
00084
00085 #ifdef MEM_OPT_VERSION
00086 class ParOutput{
00087 private:
00088 void output_veldcdfile_master(int timestep, int n);
00089 void output_veldcdfile_slave(int timestep, int fID, int tID, Vector *vecs);
00090 void output_restart_velocities_master(int timestep, int n);
00091 void output_restart_velocities_slave(int timestep, int fID, int tID, Vector *vecs, int64 offset);
00092 void output_final_velocities_master(int n);
00093 void output_final_velocities_slave(int fID, int tID, Vector *vecs, int64 offset);
00094
00095 void output_forcedcdfile_master(int timestep, int n);
00096 void output_forcedcdfile_slave(int timestep, int fID, int tID, Vector *vecs);
00097 void output_forces_master(int n);
00098 void output_forces_slave(int fID, int tID, Vector *vecs, int64 offset);
00099
00100 void output_dcdfile_master(int timestep, int n, const Lattice *lat);
00101 void output_dcdfile_slave(int timestep, int fID, int tID, FloatVector *fvecs);
00102 void output_restart_coordinates_master(int timestep, int n);
00103 void output_restart_coordinates_slave(int timestep, int fID, int tID, Vector *vecs, int64 offset);
00104 void output_final_coordinates_master(int n);
00105 void output_final_coordinates_slave(int fID, int tID, Vector *vecs, int64 offset);
00106
00107 void write_binary_file_master(char *fname, int n);
00108 void write_binary_file_slave(char *fname, int fID, int tID, Vector *vecs, int64 offset);
00109
00110 #if !OUTPUT_SINGLE_FILE
00111 char *buildFileName(OUTPUTFILETYPE type, int timestep=-9999);
00112 #endif
00113
00114 int dcdFileID;
00115 Bool dcdFirst;
00116 float *dcdX, *dcdY, *dcdZ;
00117
00118 int veldcdFileID;
00119 Bool veldcdFirst;
00120 float *veldcdX, *veldcdY, *veldcdZ;
00121
00122 int forcedcdFileID;
00123 Bool forcedcdFirst;
00124 float *forcedcdX, *forcedcdY, *forcedcdZ;
00125
00126 int outputID;
00127
00128 public:
00129 ParOutput(int oid=-1){
00130 dcdFileID=veldcdFileID=-99999;
00131 forcedcdFileID=-99999;
00132 dcdFirst=veldcdFirst=TRUE;
00133 forcedcdFirst=TRUE;
00134 dcdX=dcdY=dcdZ=veldcdX=veldcdY=veldcdZ=NULL;
00135 forcedcdX=forcedcdY=forcedcdZ=NULL;
00136 outputID=oid;
00137 }
00138 ~ParOutput() {}
00139
00140 void velocityMaster(int timestep, int n);
00141 void velocitySlave(int timestep, int fID, int tID, Vector *vecs);
00142
00143 void forceMaster(int timestep, int n);
00144 void forceSlave(int timestep, int fID, int tID, Vector *vecs);
00145
00146 void coordinateMaster(int timestep, int n, Lattice &lat);
00147 void coordinateSlave(int timestep, int fID, int tID, Vector *vecs, FloatVector *fvecs);
00148 };
00149 #endif
00150
00151 #endif
00152