00001 #ifndef SHEWCHUKMESHREADER_H 00002 #define SHEWCHUKMESHREADER_H 00003 00004 #include "SundanceDefs.h" 00005 00006 #include "MeshReader.h" 00007 00008 #include "Expr.h" 00009 00010 00011 namespace Sundance 00012 { 00013 00014 using namespace TSF; 00015 using std::string; 00016 00017 using std::ostream; 00018 00019 /** \ingroup UserLevelGeometry 00020 * Reads a 2D mesh that is stored in Jonathan Shewchuk's Triangle format. 00021 */ 00022 00023 class ShewchukMeshReader : public MeshReaderBase 00024 { 00025 public: 00026 /** Construct a ShewchukMeshReader for reading from a given file */ 00027 ShewchukMeshReader(const string& filename) 00028 : filename_(filename), hasMesh_(false) {;} 00029 00030 /** read a mesh from the reader's file */ 00031 virtual Mesh getMesh() const ; 00032 00033 Expr getNodalField(const TSFArray<int>& atributeIndices) const; 00034 00035 Expr getElementalField(const TSFArray<int>& atributeIndices) const; 00036 00037 private: 00038 string filename_; 00039 mutable Mesh mesh_; 00040 00041 mutable bool hasMesh_; 00042 mutable TSFArray<TSFArray<double> > cellAttributes_; 00043 mutable TSFArray<TSFArray<double> > pointAttributes_; 00044 }; 00045 00046 00047 } 00048 #endif