/usr/include/dune/grid/io/file/dgfparser/parser.hh is in libdune-grid-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_DGF_DUNEGRIDFORMATPARSER_HH
#define DUNE_DGF_DUNEGRIDFORMATPARSER_HH
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <dune/grid/io/file/dgfparser/entitykey.hh>
namespace Dune
{
class DGFPrintInfo;
/*! @brief Contains types for additional features
*/
struct DGFBoundaryParameter
{
//! type of additional boundary parameters
typedef std::string type;
//! default constructor
static const type &defaultValue ()
{
static type value;
return value;
}
//! copy from string
static type convert ( const std::string & parameter )
{
return parameter;
}
//! delimiter
static const char delimiter = ':';
};
//! \brief The %DuneGridFormatParser class: reads a DGF file and stores
//! build information in vector structures used by the MacroGrid class.
class DuneGridFormatParser
{
public:
typedef enum {Simplex,Cube,General} element_t;
typedef enum {counterclockwise=1,clockwise=-1} orientation_t;
//! constructor
DuneGridFormatParser ( int rank, int size );
/** \brief check whether a stream is in DUNE grid format
*
* Actually checks whether the stream starts with the keyword 'DGF'.
*
* \param input std::istream to check
*
* \note The stream must support seeking.
*
* \return whether the keyword 'DGF' was found
*/
static bool isDuneGridFormat ( std::istream &input );
/** \brief check whether a file is in dune grid format
*
* This is just a convenience method. It calls isDuneGridFormat
* with a std::ifstream.
*
* \param filename file to check
*
* \return whether the keyword 'DGF' was found
*/
static bool isDuneGridFormat ( const std::string &filename );
/** \brief parse dune grid format from stream
*
* This method actually fills the vtx, element, and bound vectors.
*
* \param input std::istream to read the grid from
* \param[in] dimG dimension of the grid (i.e., Grid::dimension)
* \param[in] dimW dimension of the world (i.e., Grid::dimensionworld)
*
* \note The stream must support seeking.
*
* \returns whether reading succeeded
*/
bool readDuneGrid( std::istream &input, int dimG, int dimW );
//! method to write in Tetgen/Triangle Poly Format
void writeTetgenPoly ( const std::string &, std::string &, std::string & );
void writeTetgenPoly ( std::ostream & out, const bool writeSegments = true );
protected:
void generateBoundaries ( std::istream &, bool );
// call to tetgen/triangle
void generateSimplexGrid ( std::istream & );
void readTetgenTriangle ( const std::string & );
// helper methods
void removeCopies ();
void setOrientation ( int use1, int use2,
orientation_t orientation=counterclockwise );
void setRefinement ( int use1, int use2, int is1=-1, int is2=-1 );
double testTriang ( int snr );
std::vector< double > & getElParam ( int i, std::vector< double > & coord );
std::vector< double > & getVtxParam ( int i, std::vector< double > & coord );
static std::string temporaryFileName ();
// dimension of world and problem: set through the readDuneGrid() method
int dimw, dimgrid;
// vector of vertex coordinates
std::vector < std::vector < double > > vtx;
int nofvtx;
int vtxoffset;
double minVertexDistance; // min. L^1 distance of distinct points
// vector of elements
std :: vector< std :: vector< unsigned int > > elements;
int nofelements;
// vector of boundary segments + identifier
std::vector < std::vector < int > > bound;
int nofbound;
// map to generate and find boundary segments
typedef DGFBoundaryParameter::type BoundaryParameter;
typedef std::pair < int, BoundaryParameter > BndParam;
typedef std::map< DGFEntityKey< unsigned int >, BndParam > facemap_t;
facemap_t facemap;
// true if parameters on a boundary found
bool haveBndParameters;
// set by generator depending on element type wanted
element_t element;
// set by the readDuneGrid method depending
// on what type the elements were generated
bool simplexgrid;
// true if grid is generated using the intervall Block
bool cube2simplex;
// parameters on elements
int nofvtxparams,nofelparams;
std::vector< std::vector< double > > vtxParams,elParams;
// write information about generation process
DGFPrintInfo * info;
std::vector < double > emptyParam_;
private:
int rank_;
int size_;
template< class GridType >
friend struct DGFGridFactory;
template< class GridType >
friend struct DGFBaseFactory;
};
} // end namespace Dune
#endif
|