uggridfactory.hh

Go to the documentation of this file.
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002 // vi: set et ts=8 sw=4 sts=4:
00003 
00004 #ifndef DUNE_UGGRID_FACTORY_HH
00005 #define DUNE_UGGRID_FACTORY_HH
00006 
00012 #include <vector>
00013 
00014 #include <dune/common/fvector.hh>
00015 
00016 #include <dune/grid/common/boundarysegment.hh>
00017 #include <dune/grid/common/gridfactory.hh>
00018 #include <dune/grid/uggrid.hh>
00019 
00020 namespace Dune {
00021 
00022 
00158     template <int dimworld>
00159     class GridFactory<UGGrid<dimworld> > : public GridFactoryInterface<UGGrid<dimworld> > {
00160 
00162         typedef typename UGGrid<dimworld>::ctype ctype;
00163 
00164         // UGGrid only in 2d and 3d
00165         dune_static_assert(dimworld==2 || dimworld || 3, "UGGrid only in 2d and 3d");
00166 
00167     public:
00168 
00170         GridFactory();
00171 
00182         GridFactory(UGGrid<dimworld>* grid);
00183         
00185         ~GridFactory();
00186 
00188         virtual void insertVertex(const FieldVector<ctype,dimworld>& pos);
00189 
00194         virtual void insertElement(const GeometryType& type,
00195                                    const std::vector<unsigned int>& vertices);
00196 
00203         void insertBoundarySegment(const std::vector<unsigned int>& vertices);
00204 
00209         void insertBoundarySegment(const std::vector<unsigned int>& vertices,
00210                                    const shared_ptr<BoundarySegment<dimworld> > boundarySegment);
00211 
00212 
00217         virtual UGGrid<dimworld>* createGrid();
00218 
00219     private:
00220 
00221         // Initialize the grid structure in UG
00222         void createBegin();
00223 
00224         // Pointer to the grid being built
00225         UGGrid<dimworld>* grid_;
00226 
00227         // True if the factory allocated the grid itself, false if the
00228         // grid was handed over from the outside
00229         bool factoryOwnsGrid_;
00230 
00232         std::vector<array<int, dimworld*2-2> > boundarySegmentVertices_;
00233 
00236         std::vector<unsigned char> elementTypes_;
00237 
00240         std::vector<unsigned int> elementVertices_;
00241 
00243         std::vector<FieldVector<double, dimworld> > vertexPositions_;
00244 
00245     };
00246 
00247 }
00248 
00249 #endif

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].