Hex  1.0
Hydrogen-electron collision solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions | Variables
hex-db.cpp File Reference
#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"
Include dependency graph for hex-db.cpp:


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)


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

Function Documentation

void avail ( )

Prints highest partial waves for consecutive energy ranges per initial state. Example:

1 0 0 0.05 0.6 3
1 0 0 0.65 0.85 4
1 0 0 0.8501 0.89 3
1 0 0 0.8905 0.97 0
1 0 0 1.2 5.0 6
1 0 0 5.2 40.0 9
1 0 0 40.0 40.0 9
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

* sqlite> .mode insert
* sqlite> select * from tmat
void import ( const char *  sqlname)

The effect of this function should be equivalent to direct use of sqlite3 program:

* sqlite3 hex.db < batchfile.sql

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

* Variable::initialize (sqlitepp::session & db)

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.

Variable Documentation

aUnit Aunits = aUnit_deg
sqlitepp::session db
eUnit Eunits = eUnit_Ry
lUnit Lunits = lUnit_au
VariableList vlist