dune-grid  2.2.0
amirameshreader.hh
Go to the documentation of this file.
00001 #ifndef DUNE_AMIRAMESH_READER_HH
00002 #define DUNE_AMIRAMESH_READER_HH
00003 
00004 #include <string>
00005 
00006 #include <dune/grid/common/gridfactory.hh>
00007 
00008 #if HAVE_PSURFACE
00009 #include <dune/grid/io/file/amiramesh/psurfaceboundary.hh>
00010 
00011 #if HAVE_AMIRAMESH
00012 #include <amiramesh/AmiraMesh.h>
00013 #else 
00014 // forward declaration so we can at least compile the header without libamiramesh
00015 class AmiraMesh;
00016 #endif
00017 
00018 namespace Dune {
00019    
00024     template<class GridType>
00025     class AmiraMeshReader {
00026         
00028         enum {dim = GridType::dimension};
00029 
00031         static void createDomain(GridFactory<GridType>& factory, const shared_ptr<PSurfaceBoundary<dim-1> >& boundary);
00032 
00034         static void buildGrid(GridFactory<GridType>& factory, AmiraMesh* am);
00035 
00037         static void build2dGrid(GridFactory<GridType>& factory, AmiraMesh* am);
00038 
00039     public:
00040 
00045         static GridType* read(const std::string& filename);
00046 
00052         static void read(GridType& grid, 
00053                           const std::string& filename);
00054 
00074         static GridType* read(const std::string& filename,
00075                          const std::string& domainFilename);
00076 
00095         static shared_ptr<PSurfaceBoundary<GridType::dimension-1> > readPSurfaceBoundary(const std::string& filename);
00096         
00097         static GridType* read(const std::string& filename,
00098                               const shared_ptr<PSurfaceBoundary<dim-1> >& boundary);
00099 
00106         static void read(GridType& grid, 
00107                          const std::string& filename,
00108                          const std::string& domainFilename);
00109 
00110     private:
00120         static void read(GridType& grid, 
00121                          const std::string& filename,
00122                          const shared_ptr<PSurfaceBoundary<dim-1> >& boundary);
00123 
00124     public:
00132         template<class DiscFuncType>
00133         static void readFunction(DiscFuncType& f, const std::string& filename);
00134 
00135     };
00136 
00137 }
00138 
00139 #if HAVE_AMIRAMESH
00140 #include "amiramesh/amirameshreader.cc"
00141 #endif
00142 
00143 #endif // #if HAVE_PSURFACE
00144 #endif