Richards
Solving The Richards equation with temporally periodic surface boundary conditions
Functions
io.h File Reference
#include <string>
#include <vector>
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <iostream>

Go to the source code of this file.

Functions

void print_exit (const char *msg)
 prints a message before quitting the program More...
 
void strip_string (std::string &s)
 removes white space at the beginning and end of a string More...
 
void split_string (char c, std::string &s, std::string &s1, std::string &s2)
 splits a string on the first instance of a specified character More...
 
std::string int_to_string (long i)
 converts an integer into a string
 
void check_file_write (const char *fn)
 checks if a file can be written to
 
template<class T >
void write_array (const char *fn, T *a, long size)
 writes an array to a binary file More...
 
template<class T >
void write_array (const std::string &fn, T *a, long size)
 writes an array to a binary file More...
 
template<class T >
void write_array (const char *fn, std::vector< T > a)
 writes an array to a binary file More...
 
template<class T >
void write_array (const std::string &fn, std::vector< T > a)
 writes an array to a binary file More...
 
void check_file_read (const char *fn)
 checks if a file can be opened for reading More...
 
std::vector< std::vector< std::string > > read_values (const char *fn)
 reads a settings file into a vector of vectors of strings More...
 

Function Documentation

◆ check_file_read()

void check_file_read ( const char *  fn)

checks if a file can be opened for reading

Parameters
[in]fnpath to file to check

Definition at line 62 of file io.cc.

◆ print_exit()

void print_exit ( const char *  msg)

prints a message before quitting the program

Parameters
[in]msga string to print before exiting

Definition at line 5 of file io.cc.

◆ read_values()

std::vector< std::vector< std::string > > read_values ( const char *  fn)

reads a settings file into a vector of vectors of strings

Parameters
[in]fnpath to settings file

Definition at line 72 of file io.cc.

◆ split_string()

void split_string ( char  c,
std::string &  s,
std::string &  s1,
std::string &  s2 
)

splits a string on the first instance of a specified character

Parameters
[in]ccharacter to split on
[in]sstring to split
[out]s1first part of split string
[out]s2second part of split string

Definition at line 27 of file io.cc.

◆ strip_string()

void strip_string ( std::string &  s)

removes white space at the beginning and end of a string

Parameters
[in]sstring to strip of white space

Definition at line 16 of file io.cc.

◆ write_array() [1/4]

template<class T >
void write_array ( const char *  fn,
std::vector< T >  a 
)

writes an array to a binary file

Parameters
[in]fntarget file path
[in]avector of numbers to write

Definition at line 78 of file io.h.

◆ write_array() [2/4]

template<class T >
void write_array ( const char *  fn,
T *  a,
long  size 
)

writes an array to a binary file

Parameters
[in]fntarget file path
[in]aarray of numbers to write
[in]sizelength of array

Definition at line 53 of file io.h.

◆ write_array() [3/4]

template<class T >
void write_array ( const std::string &  fn,
std::vector< T >  a 
)

writes an array to a binary file

Parameters
[in]fntarget file path
[in]avector of numbers to write

Definition at line 88 of file io.h.

◆ write_array() [4/4]

template<class T >
void write_array ( const std::string &  fn,
T *  a,
long  size 
)

writes an array to a binary file

Parameters
[in]fntarget file path
[in]aarray of numbers to write
[in]sizelength of array

Definition at line 68 of file io.h.