Canoe
Comprehensive Atmosphere N' Ocean Engine
fileio.hpp File Reference
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <configure.hpp>
#include <athena/athena.hpp>

Go to the source code of this file.

Typedefs

using DataVector = std::map< std::string, std::vector< double > >
 

Functions

bool FileExists (std::string fname)
 test file existance More...
 
bool IsBlankLine (char const *line)
 test a blank line More...
 
bool IsBlankLine (std::string const &line)
 
std::string DecommentFile (std::string fname)
 decomment a file More...
 
int GetNumCols (std::string fname, char c=' ')
 get number of columns in a data table More...
 
int GetNumRows (std::string fname)
 get number of rows in a data table More...
 
void replaceChar (char *buf, char c_old, char c_new)
 replace a character in a string More...
 
char * StripLine (char *line)
 
char * NextLine (char *line, int num, FILE *stream)
 
void read_data_table (char const *fname, double **data, int *rows, int *cols)
 
void ReadDataTable (AthenaArray< Real > *data, std::string fname, char c=' ')
 
DataVector read_data_vector (std::string fname)
 

Typedef Documentation

◆ DataVector

using DataVector = std::map<std::string, std::vector<double> >

Definition at line 43 of file fileio.hpp.

Function Documentation

◆ FileExists()

bool FileExists ( std::string  fname)

test file existance

Definition at line 16 of file fileio.cpp.

◆ IsBlankLine() [1/2]

bool IsBlankLine ( char const *  line)

test a blank line

Definition at line 21 of file fileio.cpp.

◆ IsBlankLine() [2/2]

bool IsBlankLine ( std::string const &  line)

Definition at line 28 of file fileio.cpp.

◆ DecommentFile()

std::string DecommentFile ( std::string  fname)

decomment a file

Definition at line 30 of file fileio.cpp.

◆ GetNumCols()

int GetNumCols ( std::string  fname,
char  c = ' ' 
)

get number of columns in a data table

Definition at line 50 of file fileio.cpp.

◆ GetNumRows()

int GetNumRows ( std::string  fname)

get number of rows in a data table

Definition at line 62 of file fileio.cpp.

◆ replaceChar()

void replaceChar ( char *  buf,
char  c_old,
char  c_new 
)

replace a character in a string

Definition at line 71 of file fileio.cpp.

◆ StripLine()

char* StripLine ( char *  line)

Definition at line 77 of file fileio.cpp.

◆ NextLine()

char* NextLine ( char *  line,
int  num,
FILE *  stream 
)

Definition at line 93 of file fileio.cpp.

◆ read_data_table()

void read_data_table ( char const *  fname,
double **  data,
int *  rows,
int *  cols 
)

Definition at line 10 of file read_data_table.cpp.

◆ ReadDataTable()

void ReadDataTable ( AthenaArray< Real > *  data,
std::string  fname,
char  c = ' ' 
)

Definition at line 35 of file read_data_table.cpp.

◆ read_data_vector()

DataVector read_data_vector ( std::string  fname)

Definition at line 102 of file fileio.cpp.