27#ifndef DUMUX_IO_CONTAINER_HH
28#define DUMUX_IO_CONTAINER_HH
36#include <dune/common/exceptions.hh>
49template<
typename Container>
51 const std::string& filename,
52 int floatPrecision = 6)
54 std::ofstream outfile(filename, std::ios::out);
55 outfile << std::scientific << std::setprecision(floatPrecision);
56 std::ostream_iterator<typename Container::value_type> it(outfile,
"\n");
57 std::copy(v.begin(),v.end(), it);
66template<
typename Container>
70 std::istream_iterator<typename Container::value_type> it(stream);
71 std::copy(it, std::istream_iterator<typename Container::value_type>(), std::back_inserter(v));
83template<
typename Container>
86 std::ifstream infile(filename, std::ios::in);
88 DUNE_THROW(Dune::IOError,
"Could not open file: " << filename);
89 return readStreamToContainer<Container>(infile);
void writeContainerToFile(const Container &v, const std::string &filename, int floatPrecision=6)
Writes a container to file.
Definition: container.hh:50
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Container readFileToContainer(const std::string &filename)
Read a simple text file into a container.
Definition: container.hh:84
Container readStreamToContainer(std::istream &stream)
Read an input stream into a container.
Definition: container.hh:67