00001 #ifndef NodeWRITER_H 00002 #define NodeWRITER_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 NodeWriter : public FieldWriterBase 00018 { 00019 public: 00020 /** open a Node writer that will write to a file */ 00021 NodeWriter(const string& filename); 00022 00023 /** open a Node writer that will write to standard out */ 00024 NodeWriter(); 00025 00026 virtual ~NodeWriter(); 00027 00028 /** write a field, tagging it with the given string as a name */ 00029 virtual void writeField(const string& name, 00030 const Expr& expr) const ; 00031 00032 /** write a mesh in Node format */ 00033 virtual void writeMesh(const Mesh& mesh) const ; 00034 00035 /** write a comment */ 00036 virtual void writeCommentLine(const string& line) const ; 00037 private: 00038 00039 00040 mutable ostream* os_; 00041 bool deleteStream_; 00042 mutable bool meshHasBeenWritten_; 00043 }; 00044 } 00045 00046 #endif 00047