dune-grid  2.2.0
simplex.hh
Go to the documentation of this file.
00001 #ifndef DUNE_DGF_SIMPLEXBLOCK_HH
00002 #define DUNE_DGF_SIMPLEXBLOCK_HH
00003 
00004 #include <iostream>
00005 #include <vector>
00006 
00007 #include <dune/grid/io/file/dgfparser/blocks/basic.hh>
00008 
00009 namespace Dune
00010 {
00011 
00012   namespace dgf
00013   {
00014     // SimplexBlock
00015     // ------------
00016 
00017     class SimplexBlock
00018     : public BasicBlock
00019     {
00020       unsigned int nofvtx;
00021       int vtxoffset;
00022       int dimgrid;
00023       bool goodline;                 // active line describes a vertex
00024       int nofparams;                 // nof parameters
00025 
00026     public:
00027       SimplexBlock ( std :: istream &in, int pnofvtx, int pvtxoffset, int &pdimgrid );
00028 
00029       int get ( std :: vector< std :: vector< unsigned int > > &simplex,
00030                 std :: vector< std :: vector< double > > &params,
00031                 int &nofp );
00032 
00033       // cubes -> simplex
00034       static int
00035       cube2simplex ( std :: vector< std :: vector< double > > &vtx,
00036                      std :: vector< std :: vector< unsigned int > > &elements,
00037                      std :: vector< std :: vector< double > > &params );
00038 
00039       // some information
00040       bool ok ()
00041       {
00042         return goodline;
00043       }
00044 
00045       int nofsimplex ()
00046       {
00047         return noflines();
00048       }
00049 
00050     private:
00051       // get the dimension of the grid
00052       int getDimGrid ();
00053       // get next simplex
00054       bool next ( std :: vector< unsigned int > &simplex,
00055                   std :: vector< double > &param );
00056     };
00057 
00058   } // end namespace dgf
00059 
00060 } // end namespace Dune
00061 
00062 #endif
00063