![]() |
Hex
2.2
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 "hex-arrays.h"#include "hex-special.h"#include "hex-interpolate.h"#include "db.h"#include "quantities.h"
Functions | |
| void | hex_initialize (const char *dbname) |
| void | hex_initialize_ (const char *dbname) |
| Initialize the environment. More... | |
| void | hex_new () |
| void | hex_new_ () |
| Create new database. More... | |
| void | hex_import (const char *sqlname) |
| void | hex_import_ (const char *sqlname) |
| Import SQL batch file. More... | |
| void | hex_update () |
| void | hex_update_ () |
| Update integral and complete cross section. More... | |
| void | hex_optimize () |
| void | hex_optimize_ () |
| Optimize the SQLite database file. More... | |
| void | hex_dump (const char *dumpfile) |
| void | hex_dump_ (const char *dumpfile) |
| Dump contents of the T-matrix table. More... | |
| int | hex_run (std::vector< std::string > const &vars, std::map< std::string, std::string > const &sdata) |
Variables | |
| sqlitepp::session | db |
| eUnit | Eunits = eUnit_Ry |
| lUnit | Lunits = lUnit_au |
| aUnit | Aunits = aUnit_deg |
| void hex_dump | ( | const char * | dumpfile | ) |
| void hex_dump_ | ( | const char * | dumpname | ) |
The output can be used to construct an equivalent table. The corresponding code is
| void hex_import | ( | const char * | sqlname | ) |
| void hex_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.
| sqlname | Zero-terminated character string. |
| void hex_initialize | ( | const char * | dbname | ) |
| void hex_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.
| dbname | Zero-terminated character string. |
| void hex_new | ( | ) |
| void hex_new_ | ( | ) |
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 hex_optimize | ( | ) |
| void hex_optimize_ | ( | ) |
Reduces the occupied space using the VACUUM statement.
| int hex_run | ( | std::vector< std::string > const & | vars, |
| std::map< std::string, std::string > const & | sdata | ||
| ) |
Run the computations.
| void hex_update | ( | ) |
| void hex_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 |
1.8.13