dune-grid  2.2.0
boundarywriter.hh
Go to the documentation of this file.
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002 // vi: set et ts=8 sw=2 sts=2:
00003 
00004 #ifndef DUNE_GRID_IO_FILE_VTK_BOUNDARYWRITER_HH
00005 #define DUNE_GRID_IO_FILE_VTK_BOUNDARYWRITER_HH
00006 
00007 #include <string>
00008 
00009 #include <dune/common/shared_ptr.hh>
00010 
00011 #include <dune/grid/io/file/vtk/basicwriter.hh>
00012 #include <dune/grid/io/file/vtk/boundaryiterators.hh>
00013 #include <dune/grid/io/file/vtk/skeletonfunction.hh>
00014 
00015 namespace Dune {
00018 
00019   namespace VTK {
00020 
00021     template<typename GV>
00022     class NonConformingBoundaryWriter
00023       : public NonConformingBoundaryIteratorFactory<GV>,
00024         public BasicWriter<NonConformingBoundaryIteratorFactory<GV> >
00025     {
00026       typedef NonConformingBoundaryIteratorFactory<GV> Factory;
00027       typedef BasicWriter<Factory> Base;
00028 
00029       const GV& gv;
00030 
00031     public:
00032       NonConformingBoundaryWriter(const GV& gv_)
00033         : Factory(gv_), Base(static_cast<const Factory&>(*this)), gv(gv_)
00034       { }
00035 
00036       using Base::addCellData;
00037 
00038       template<typename Func>
00039       void addCellData(const shared_ptr<Func>& p, const std::string& name) {
00040         addCellData(shared_ptr<typename Base::FunctionWriter>
00041                     (new SkeletonFunctionWriter<Func>(p, name)));
00042       }
00043 
00044       template<typename Func>
00045       void addCellData(Func* p, const std::string& name) {
00046         addCellData(shared_ptr<Func>(p), name);
00047       }
00048 
00049       using Base::addPointData;
00050 
00051       template<typename Func>
00052       void addPointData(const shared_ptr<Func>& p, const std::string& name) {
00053         addPointData(shared_ptr<typename Base::FunctionWriter>
00054                      (new SkeletonFunctionWriter<Func>(p, name)));
00055       }
00056 
00057       template<typename Func>
00058       void addPointData(Func* p, const std::string& name) {
00059         addPointData(shared_ptr<Func>(p), name);
00060       }
00061 
00062     };
00063 
00064   } // namespace VTK
00065 
00067 
00068 } // namespace Dune
00069 
00070 #endif // DUNE_GRID_IO_FILE_VTK_BOUNDARYWRITER_HH