AbstractCellBasedWriter.cpp
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
00028
00029
00030
00031
00032
00033
00034
00035 #include "AbstractCellBasedWriter.hpp"
00036 #include "SimulationTime.hpp"
00037
00038 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00039 AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::AbstractCellBasedWriter(const std::string& rFileName)
00040 : mFileName(rFileName)
00041 {
00042 }
00043
00044 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00045 AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::~AbstractCellBasedWriter()
00046 {
00047 }
00048
00049 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00050 void AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::CloseFile()
00051 {
00052 mpOutStream->close();
00053 }
00054
00055 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00056 void AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::OpenOutputFile(OutputFileHandler& rOutputFileHandler)
00057 {
00058 mpOutStream = rOutputFileHandler.OpenOutputFile(mFileName);
00059 }
00060
00061 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00062 void AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::OpenOutputFileForAppend(OutputFileHandler& rOutputFileHandler)
00063 {
00064 mpOutStream = rOutputFileHandler.OpenOutputFile(mFileName, std::ios::app);
00065 }
00066
00067 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00068 void AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::WriteTimeStamp()
00069 {
00070 *mpOutStream << SimulationTime::Instance()->GetTime() << "\t";
00071 }
00072
00073 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00074 void AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::WriteNewline()
00075 {
00076 *mpOutStream << "\n";
00077 }
00078
00079 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00080 void AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::SetFileName(std::string fileName)
00081 {
00082 mFileName = fileName;
00083 }
00084
00085 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00086 std::string AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>::GetFileName()
00087 {
00088 return mFileName;
00089 }
00090
00091
00092 template class AbstractCellBasedWriter<1,1>;
00093 template class AbstractCellBasedWriter<1,2>;
00094 template class AbstractCellBasedWriter<2,2>;
00095 template class AbstractCellBasedWriter<1,3>;
00096 template class AbstractCellBasedWriter<2,3>;
00097 template class AbstractCellBasedWriter<3,3>;