dune-grid  2.2.0
boundaryseg.hh
Go to the documentation of this file.
00001 #ifndef DUNE_DGF_BOUNDARYSEGBLOCK_HH
00002 #define DUNE_DGF_BOUNDARYSEGBLOCK_HH
00003 
00004 #include <cassert>
00005 #include <iostream>
00006 #include <string>
00007 #include <vector>
00008 #include <map>
00009 
00010 #include <dune/grid/io/file/dgfparser/parser.hh>
00011 #include <dune/grid/io/file/dgfparser/blocks/basic.hh>
00012 
00013 
00014 namespace Dune
00015 {    
00016 
00017   namespace dgf    
00018   {
00019     class BoundarySegBlock 
00020     : public BasicBlock
00021     {
00022       int dimworld;                    // the dimension of the vertices (is given  from user)
00023       bool goodline;                   // active line describes a vertex
00024       std :: vector< unsigned int > p; // active vertex
00025       int bndid;
00026       typedef DGFBoundaryParameter::type BoundaryParameter;
00027       BoundaryParameter parameter; 
00028       bool simplexgrid;
00029 
00030      public:
00031       typedef DGFEntityKey< unsigned int> EntityKey;
00032       typedef std::pair < int, BoundaryParameter > BndParam;
00033 
00034       // initialize vertex block and get first vertex
00035       BoundarySegBlock ( std :: istream &in, int pnofvtx,
00036                          int pdimworld, bool psimplexgrid );
00037 
00038       // some information
00039       int get( std :: map< EntityKey, BndParam > & facemap,
00040                bool fixedsize,
00041                int vtxoffset
00042              );
00043 
00044       bool ok() 
00045       {
00046         return goodline;
00047       }
00048 
00049       int nofbound() 
00050       {
00051         return noflines();
00052       }
00053 
00054     private:
00055       bool next();
00056 
00057       // get coordinates of active vertex
00058       int operator[] (int i) 
00059       {
00060         assert(ok());
00061         assert(linenumber()>=0);
00062         assert(0<=i && i<dimworld+1);
00063         return p[i];
00064       }
00065 
00066       int size() 
00067       {
00068         return p.size();
00069       }
00070 
00071     };   
00072     
00073   } // end namespace dgf
00074 
00075 } // end namespace Dune
00076 
00077 #endif