00001 #ifndef MatlabVECTORWRITER_H 00002 #define MatlabVECTORWRITER_H 00003 00004 #include "SundanceDefs.h" 00005 #include "FieldWriterBase.h" 00006 #include "TSFSmartPtr.h" 00007 #include <fstream> 00008 00009 namespace Sundance 00010 { 00011 00012 using namespace TSF; 00013 using std::string; 00014 using std::ostream; 00015 00016 /** */ 00017 class MatlabVectorWriter : public FieldWriterBase 00018 { 00019 public: 00020 /** open a Matlab writer that will write to a file */ 00021 MatlabVectorWriter(const string& filename); 00022 00023 virtual ~MatlabVectorWriter(); 00024 00025 /** write a field, tagging it with the given string as a name */ 00026 virtual void writeField(const string& name, 00027 const Expr& expr) const ; 00028 00029 /** write a mesh in Matlab format */ 00030 virtual void writeMesh(const Mesh& mesh) const ; 00031 00032 /** write a comment */ 00033 virtual void writeCommentLine(const string& line) const ; 00034 private: 00035 00036 00037 mutable ostream* os_; 00038 bool deleteStream_; 00039 mutable bool meshHasBeenWritten_; 00040 }; 00041 } 00042 00043 #endif 00044