![]() |
Hex
1.0
Hydrogen-electron collision solver
|
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <fstream>
#include <sqlitepp/sqlitepp.hpp>
#include "arrays.h"
#include "complex.h"
#include "hex-db.h"
#include "special.h"
#include "interpolate.h"
#include "variables.h"
Functions | |
void | initialize (const char *dbname) |
Initialize the environment. More... | |
void | create_new_database () |
Create new database. More... | |
void | import (const char *sqlname) |
Import SQL batch file. More... | |
void | update () |
Update integral and complete cross section. More... | |
void | optimize () |
Optimize the SQLite database file. More... | |
void | avail () |
Print data summary. More... | |
void | dump (const char *dumpfile) |
Dump contents of the T-matrix table. More... | |
int | run (std::vector< std::string > const &vars, std::map< std::string, std::string > const &sdata) |
Variables | |
sqlitepp::session | db |
VariableList | vlist |
forward declaration of the variable list "vlist" More... | |
eUnit | Eunits = eUnit_Ry |
lUnit | Lunits = lUnit_au |
aUnit | Aunits = aUnit_deg |
void avail | ( | ) |
Prints highest partial waves for consecutive energy ranges per initial state. Example:
void create_new_database | ( | ) |
This will create the necessary table structure in a new empty database. It is necessary to call initialize first, so that the databse file is created and opened. The tables are created by the call to
for every registered variable. The return value is a vector of SQL statement which are executed.
void dump | ( | const char * | dumpname | ) |
The output can be used to construct an equivalent table. The corresponding code is
void import | ( | const char * | sqlname | ) |
The effect of this function should be equivalent to direct use of sqlite3 program:
The function uses one line at a time and splits the lines into statements on semicolons. For this reason it does not allow multi-line statements. The statements produced by computational modules have always one statement per line.
void initialize | ( | const char * | dbname | ) |
The function will open existing database with path specified in "dbname". If the database does not exist, a new empty database will be created. Also, all registered variables will be given chance to initialize by the function
This can be used to register special functions needed later in the SQL statements. For example the variable IntegralCrossSection registeres two functions: the simple square root and a more complicated numerical integrator that uses ClenshawCurtis quadrature.
The function "initialize" also disables journalling to speed up insertion of data.
void optimize | ( | ) |
Reduces the occupied space using the VACUUM statement.
int run | ( | std::vector< std::string > const & | vars, |
std::map< std::string, std::string > const & | sdata | ||
) |
Run the computations.
void update | ( | ) |
This function is used after import of T-matrices. All variables will be given chance to update themselves using the function
which returns SQL statement that should do the update. If a variable uses other variables besides T-matrices for its update, it must be inserted to VariableList AFTER those variables, because the order of update is set by the order in the list.
sqlitepp::session db |
VariableList vlist |