24#ifndef DUMUX_PORE_NETWORK_DGF_WRITER_HH
25#define DUMUX_PORE_NETWORK_DGF_WRITER_HH
37template<
class Gr
idView,
class Gr
idData>
38void writeDgf(
const std::string& fileName,
const GridView& gridView,
const GridData& gridData)
40 const auto someElement = *(elements(gridView).begin());
41 const auto someVertex = *(vertices(gridView).begin());
42 const auto numVertexParams = gridData.
parameters(someVertex).size();
43 const auto numElementParams = gridData.
parameters(someElement).size();
45 std::ofstream dgfFile(fileName);
46 dgfFile <<
"DGF\nVertex % Coordinates, volumes and boundary flags of the pore bodies\nparameters " << numVertexParams <<
"\n";
47 dgfFile <<
"% Vertex parameters: ";
50 dgfFile <<
"\n% Element parameters: ";
55 for (
const auto& vertex : vertices(gridView))
57 dgfFile << vertex.geometry().center() <<
" ";
59 const auto& params = gridData.
parameters(vertex);
60 for (
int i = 0; i < params.size(); ++i)
64 if (i < params.size() - 1)
71 dgfFile <<
"#\nSIMPLEX % Connections of the pore bodies (pore throats)\nparameters " << numElementParams <<
"\n";
73 for (
const auto& element : elements(gridView))
75 dgfFile << gridView.indexSet().subIndex(element, 0, 1) <<
" ";
76 dgfFile << gridView.indexSet().subIndex(element, 1, 1) <<
" ";
78 const auto& params = gridData.
parameters(element);
79 for (
int i = 0; i < params.size(); ++i)
83 if (i < params.size() - 1)
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:38
Definition: discretization/porenetwork/fvelementgeometry.hh:33
Class for grid data attached to dgf or gmsh grid files.
Definition: porenetwork/griddata.hh:55
const std::vector< std::string > & vertexParameterNames() const
Returns the names of the vertex parameters.
Definition: porenetwork/griddata.hh:300
const std::vector< std::string > & elementParameterNames() const
Returns the names of the element parameters.
Definition: porenetwork/griddata.hh:306
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:97