12#ifndef DUMUX_PORE_NETWORK_DGF_WRITER_HH
13#define DUMUX_PORE_NETWORK_DGF_WRITER_HH
25template<
class Gr
idView,
class Gr
idData>
26void writeDgf(
const std::string& fileName,
const GridView& gridView,
const GridData& gridData)
28 const auto someElement = *(elements(gridView).begin());
29 const auto someVertex = *(vertices(gridView).begin());
30 const auto numVertexParams = gridData.
parameters(someVertex).size();
31 const auto numElementParams = gridData.
parameters(someElement).size();
33 std::ofstream dgfFile(fileName);
34 dgfFile <<
"DGF\nVertex % Coordinates, volumes and boundary flags of the pore bodies\nparameters " << numVertexParams <<
"\n";
35 dgfFile <<
"% Vertex parameters: ";
38 dgfFile <<
"\n% Element parameters: ";
43 for (
const auto& vertex : vertices(gridView))
45 dgfFile << vertex.geometry().center() <<
" ";
47 const auto& params = gridData.
parameters(vertex);
48 for (
int i = 0; i < params.size(); ++i)
52 if (i < params.size() - 1)
59 dgfFile <<
"#\nSIMPLEX % Connections of the pore bodies (pore throats)\nparameters " << numElementParams <<
"\n";
61 for (
const auto& element : elements(gridView))
63 dgfFile << gridView.indexSet().subIndex(element, 0, 1) <<
" ";
64 dgfFile << gridView.indexSet().subIndex(element, 1, 1) <<
" ";
66 const auto& params = gridData.
parameters(element);
67 for (
int i = 0; i < params.size(); ++i)
71 if (i < params.size() - 1)
Class for grid data attached to dgf or gmsh grid files.
Definition: porenetwork/griddata.hh:44
const std::vector< std::string > & vertexParameterNames() const
Returns the names of the vertex parameters.
Definition: porenetwork/griddata.hh:289
const std::vector< std::string > & elementParameterNames() const
Returns the names of the element parameters.
Definition: porenetwork/griddata.hh:295
const std::vector< double > & parameters(const Vertex &vertex) const
Call the parameters function of the DGF grid pointer if available for vertex data.
Definition: porenetwork/griddata.hh:86
void writeDgf(const std::string &fileName, const GridView &gridView, const GridData &gridData)
Write pore-network grids with attached data to dgf file.
Definition: dgfwriter.hh:26
Definition: discretization/porenetwork/fvelementgeometry.hh:24