ESyS-Particle
4.0.1
|
00001 00002 // // 00003 // Copyright (c) 2003-2011 by The University of Queensland // 00004 // Earth Systems Science Computational Centre (ESSCC) // 00005 // http://www.uq.edu.au/esscc // 00006 // // 00007 // Primary Business: Brisbane, Queensland, Australia // 00008 // Licensed under the Open Software License version 3.0 // 00009 // http://www.opensource.org/licenses/osl-3.0.php // 00010 // // 00012 00013 00014 #ifndef ESYS_LSMVTKXMLWRITER_H 00015 #define ESYS_LSMVTKXMLWRITER_H 00016 00017 #include <Geometry/SimpleParticle.h> 00018 #include <Geometry/BasicInteraction.h> 00019 00020 #include <iostream> 00021 #include <boost/shared_ptr.hpp> 00022 00023 namespace esys 00024 { 00025 namespace lsm 00026 { 00027 class ParticleDataVisitor 00028 { 00029 typedef SimpleParticle Particle; 00030 typedef BasicInteraction Connection; 00031 public: 00032 ParticleDataVisitor(); 00033 00034 void visitSimpleParticle(const Particle &particle); 00035 00036 void visitParticle(const Particle &particle); 00037 00038 void visitBasicInteraction(const Connection &connection); 00039 00040 void visitConnection(const Connection &connection); 00041 00042 size_t getNumParticles() const; 00043 00044 size_t getNumConnections() const; 00045 00046 int getIndex(int particleId) const; 00047 00048 void writeCentrePoints(std::ostream &oStream) const; 00049 00050 void writeRadii(std::ostream &oStream) const; 00051 00052 void writeTags(std::ostream &oStream) const; 00053 00054 void writeIds(std::ostream &oStream) const; 00055 00056 void writeParticleIndexConnections(std::ostream &oStream) const; 00057 00058 void writeConnectionTags(std::ostream &oStream) const; 00059 00060 private: 00061 class Impl; 00062 typedef boost::shared_ptr<Impl> ImplPtr; 00063 ImplPtr m_implPtr; 00064 }; 00065 00069 class VtkXmlWriter 00070 { 00071 public: 00072 VtkXmlWriter(); 00073 00074 virtual ~VtkXmlWriter(); 00075 00076 void setData(const ParticleDataVisitor &particleData); 00077 00078 size_t getNumParticles() const; 00079 00080 size_t getNumConnections() const; 00081 00082 virtual void writePoints(std::ostream &oStream); 00083 virtual void writePointData(std::ostream &oStream); 00084 virtual void writeCells(std::ostream &oStream); 00085 virtual void writeCellData(std::ostream &oStream); 00086 00087 virtual void write(std::ostream &oStream); 00088 00089 virtual void writeToFile(const std::string &fileName); 00090 00091 private: 00092 00093 class Impl; 00094 typedef boost::shared_ptr<Impl> ImplPtr; 00095 ImplPtr m_implPtr; 00096 }; 00097 }; 00098 }; 00099 00100 #endif