00001 // Display.cpp: implementation of the CDisplay class. 00002 // 00004 00005 #include<iostream> 00006 #include<ios> 00007 #include<fstream> 00008 #include<iomanip> 00009 #include "Cell.h" 00010 #include "Components.h" 00011 #include "Geometry.h" 00012 #include "DNA.h" 00013 #include "Display.h" 00014 00016 // Construction/Destruction 00018 using namespace std; 00019 ofstream to("results4thfeb.dat"); 00020 00021 CDisplay::CDisplay(CCell *pCell) 00022 { 00023 m_pCell=pCell; 00024 } 00025 00026 //Default constructor, not to be used 00027 CDisplay::CDisplay() 00028 { 00029 00030 } 00031 00032 CDisplay::~CDisplay() 00033 { 00034 00035 } 00036 00037 //Copy constructor 00038 CDisplay::CDisplay(const CDisplay &rDisp, CCell *pCell) 00039 { 00040 m_pCell=pCell; 00041 } 00042 00043 void CDisplay::WarningMessage(int Warn) 00044 { 00045 switch(Warn) 00046 { 00047 case 1: 00048 to << endl << "Warning: Volume does not equal mass/density"; 00049 case 2: 00050 to << endl << "Warning: Width is in trouble"; 00051 case 3: 00052 to << endl << "Warning, KCOUNTP high"; 00053 } 00054 } 00055 00056 void CDisplay::ErrorMessage(int Err) 00057 { 00058 switch(Err) 00059 { 00060 case 1: 00061 to << endl << "Error: Negative concentration"; 00062 exit(1); 00063 case 2: 00064 to << endl << "Error: Gamma function can't evaluate"; 00065 exit(2); 00066 } 00067 } 00068 00069 void CDisplay::PrintComponents() 00070 { 00071 static bool LabelFlag=0; 00072 if(LabelFlag=1) 00073 { //Print labels for first use 00074 to << "T "; 00075 for(int i=0;i<NBIOVARS;++i) 00076 to << "Y[" << i << "] "; 00077 LabelFlag=1; 00078 } 00079 to << endl << m_pCell->TotalTime << " "; 00080 for(int i=0;i<NBIOVARS;++i) 00081 to << m_pCell->GetComponents()->GetY(i) << " "; 00082 } 00083 00084 void CDisplay::PrintGeometry() 00085 { 00086 static bool LabelFlag=0; 00087 if(!LabelFlag) 00088 { 00089 to << "T V W L SL[0]"; //Print labels for first use 00090 LabelFlag=1; 00091 } 00092 to << endl << m_pCell->TotalTime << " " 00093 << m_pCell->GetGeometry()->GetVolume() << " " << m_pCell->GetGeometry()->GetWidth() 00094 << " " << m_pCell->GetGeometry()->CL << " " << m_pCell->GetGeometry()->SL[0]; 00095 }