27#ifndef DUMUX_IO_CONTAINER_HH
28#define DUMUX_IO_CONTAINER_HH
47template<
typename Container>
49 const std::string& filename,
50 int floatPrecision = 6)
52 std::ofstream outfile(filename, std::ios::out);
53 outfile << std::scientific << std::setprecision(floatPrecision);
54 std::ostream_iterator<typename Container::value_type> it(outfile,
"\n");
55 std::copy(v.begin(),v.end(), it);
65template<
typename Container>
69 std::ifstream infile(filename, std::ios::in);
70 std::istream_iterator<typename Container::value_type> it(infile);
71 std::copy(it, std::istream_iterator<typename Container::value_type>(), std::back_inserter(v));
void writeContainerToFile(const Container &v, const std::string &filename, int floatPrecision=6)
Writes a container to file.
Definition: container.hh:48
Container readFileToContainer(const std::string &filename)
Read a simple text file into a container.
Definition: container.hh:66