-
Notifications
You must be signed in to change notification settings - Fork 12
InputFile
Raul edited this page Jun 25, 2019
·
3 revisions
The InputFile class in utils/InputFile.h allows you to read parameters and options from a file.
The input file must have the following format:
#Lines starting with '#' will be ignored
[option] [argument1] [argument2] ...
You can have an option with no arguments
Additionally you can use the special shell option, which will run the rest of the line as a bash command when encountered and wait for it to finish.
//Creation:
auto sys = make_shared<System>();
InputFile inputFile("options.in", sys);
//Read an option of type float
float cutOff;
inputFile.getOption("cutOff")>>cutOff;
//You can have several arguments for an option
//An additional parameter might be passed (Optional or Required, Optional by default) specifying if the option is necessary or not.
//If required is specified and the option is not found, InputFile will issue a CRITICAL error
real3 L;
inputFile.getOption("boxSize", InputFile::Required)>>L.x>>L.y>>L.z;
//Or none!
bool isOptionPresent = bool(inputFile.getOption("someOption"));
//You can check if an option is present in the file by casting to bool somehow
//i.e
if(!(inputFile.getOption("NotPresentOption"))){
cerr<<"Option not present in the file!!!"<<endl;
}
//Finally you can check if the option not only exists but has the correct number/type of arguments
if(!(inputFile.getOption("someOption")>>anInt>>aFloat>>aString)){
cerr<<"Some parameter missing in the option!"<<endl;
}
getOption
will return an std::istringstream
[1], so you can work with its output as such.
[1] http://www.cplusplus.com/reference/sstream/stringstream/
-
-
1. PairForces
2. NbodyForces
3. ExternalForces
4. BondedForces
5. AngularBondedForces
6. TorsionalBondedForces
7. Poisson (Electrostatics) -
-
MD (Molecular Dynamics)
1. VerletNVT
2. VerletNVE - BD Brownian Dynamics
-
BDHI Brownian Dynamics with Hydrodynamic Interactions
1. EulerMaruyama
1.1 BDHI_Cholesky Brownian displacements through Cholesky factorization.
1.2 BDHI_Lanczos Brownian displacements through Lanczos algorithm.
1.3 BDHI_PSE Positively Split Edwald.
1.4 BDHI_FCM Force Coupling Method. - DPD Dissipative Particle Dynamics
- SPH Smoothed Particle Hydrodynamics
-
Hydrodynamics
1. ICM Inertial Coupling Method.
2. FIB Fluctuating Immerse Boundary.
3. Quasi2D Quasi2D hydrodynamics
-
MD (Molecular Dynamics)
-
- 1. Neighbour Lists
-
1. Programming Tools
2. Utils
-
1. Transverser
2. Functor
3. Potential
-
1. Particle Data
2. Particle Group
3. System
4. Parameter updatable
-
1. Tabulated Function
2. Postprocessing tools
3. InputFile
4. Tests
5. Allocator
6. Temporary memory
7. Immersed Boundary (IBM)
-
1. NBody
2. Neighbour Lists
3. Python wrappers
- 1. Superpunto