OpenCAEPoro
v0.5.0
A simulator for multicomponent porous media flow
|
Supply basic tools used to input files. More...
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "OCPConst.hpp"
Go to the source code of this file.
Macros | |
#define | ParamCheck1(exp) |
TODO: Replace it with error log. More... | |
Functions | |
constexpr long long | Map_Str2Int (const char *mystr, const USI &len) |
OCP_BOOL | ReadLine (ifstream &ifs, vector< string > &result) |
void | DealDefault (vector< string > &result) |
template<typename T > | |
void | DealData (const vector< string > &vbuf, vector< OCP_USI > &obj, vector< T > ®ion) |
Supply basic tools used to input files.
Copyright (C) 2021–present by the OpenCAEPoro team. All rights reserved.
Definition in file UtilInput.hpp.
#define ParamCheck1 | ( | exp | ) |
TODO: Replace it with error log.
Definition at line 28 of file UtilInput.hpp.
void DealData | ( | const vector< string > & | vbuf, |
vector< OCP_USI > & | obj, | ||
vector< T > & | region | ||
) |
DealData change a series of product of integers into two arrays. For example, 8*1 16*2 8*3 16*4 -> obj <8, 16, 8, 16> & val <1, 2, 3, 4>.
Definition at line 59 of file UtilInput.hpp.
void DealDefault | ( | vector< string > & | result | ) |
DealDefault is used to deal with the expression with asterisk, for example m*n -> <n,...,n> size m , m* -> <DEFAULT,..., DEFAULT> size m.
Definition at line 50 of file UtilInput.cpp.
|
inlineconstexpr |
Map_str2int is used to map string to integer, which used to match the keyword efficiently in input file in the switch structure.
Definition at line 34 of file UtilInput.hpp.
OCP_BOOL ReadLine | ( | ifstream & | ifs, |
vector< string > & | result | ||
) |
ReadLine is the core function while inputting the file. It will capture the next line which is meanningful, for example, not blank line or comments, and then gets rid of some useless characters such as space, commas. Finally, the segments of rest string will be stored in result. And if return OCP_FALSE, it indicates we have reach the end of file.
Definition at line 14 of file UtilInput.cpp.