ergo
grid_reader.cc File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include "dft_common.h"
#include "grid_reader.h"
#include "grid_stream.h"
#include "grid_hicu.h"
#include "grid_matrix.h"

Classes

class  FullMatrixWrapper
class  SparseMatrixWrapper
struct  DftGridReader

Defines

#define GRID_BASE_NAME   "ERGO-grid"
#define GRID_PATT_NAME   "ERGO-patt"

Functions

Dft::MatrixcreateGridMatrix (const Dft::FullMatrix &mat)
Dft::MatrixcreateGridMatrix (const Dft::SparseMatrix &mat)
static char * grid_get_fname (const char *base, int filenum)
void grid_set_tmpdir (const char *tmpdir)
void grid_free_files ()
 Frees all the cached data if any.
static void grid_atexit (void)
bool grid_is_ready ()
static void grid_open_stream (const struct GridGenMolInfo &molInfo, const Dft::GridParams &gss, Dft::SparsePattern *pattern, DftGridReader *reader)
static void grid_open_cartesian (const BasisInfoStruct &bis, const Dft::GridParams &gss, const Dft::Matrix *dmat, Dft::SparsePattern *pattern, DftGridReader *reader)
DftGridReadergrid_open_full (const struct GridGenMolInfo *mol_info, const Dft::GridParams &gss, Dft::SparsePattern *pattern, const Dft::Matrix *dmat, const BasisInfoStruct &bis)
 Returns a handle to a grid file.
int grid_getchunk_blocked (DftGridReader *rawgrid, int maxlen, int *nBlocks, int *shlBlocks, real(*coor)[3], real *weight)
 grid_getchunk_blocked() reads grid data also with screening information if only nblocks and shlblocks are provided.
void grid_close (DftGridReader *rawgrid)
 Closes the shared grid handle that is specifed as the argument.

Variables

std::string grid_tmpdir
static FILE * grid_file = NULL
static int grid_file_open_count = 0
static char * grid_file_name = NULL
static char * patt_file_name = NULL
static pthread_mutex_t grid_mutex = PTHREAD_MUTEX_INITIALIZER
static pthread_mutex_t grdone_mutex = PTHREAD_MUTEX_INITIALIZER
static int grid_atexit_registered = 0
static const int MY_MPI_NUM = 0

Define Documentation

#define GRID_BASE_NAME   "ERGO-grid"
#define GRID_PATT_NAME   "ERGO-patt"

Function Documentation

Dft::Matrix* createGridMatrix ( const Dft::FullMatrix mat)
Dft::Matrix* createGridMatrix ( const Dft::SparseMatrix &  mat)
static void grid_atexit ( void  ) [static]

References grid_free_files().

Referenced by grid_open_full().

void grid_close ( DftGridReader rawgrid)

Closes the shared grid handle that is specifed as the argument.

References grid_mutex, grid_file_open_count, and grid_file.

Referenced by dft_integrate(), XCEvaluator::XCEvaluator(), and grid_test_synchronisation().

void grid_free_files ( )
static char* grid_get_fname ( const char *  base,
int  filenum 
) [static]

References grid_tmpdir.

Referenced by grid_open_stream(), and grid_open_cartesian().

int grid_getchunk_blocked ( DftGridReader rawgrid,
int  maxlen,
int *  nBlocks,
int *  shlBlocks,
real(*)  coor[3],
real weight 
)

grid_getchunk_blocked() reads grid data also with screening information if only nblocks and shlblocks are provided.

Parameters:
rawgridshared grid handle.
maxlenthe upper limit on the grid point chunk length.
nBlockswill contain number of active b.f. blocks. May be NULL if uninteresting.
shlBlockspointer to the shell block range.
coorarray with grid point coordinates.
weightarray with grid point weights.
Returns:
number of read grid points. -1 on end-of-file.

References grid_mutex, and DftGridReader::f.

Referenced by dft_integrate(), and grid_test_synchronisation().

bool grid_is_ready ( )

References grid_file_name.

Referenced by XCEvaluator::XCEvaluator().

static void grid_open_cartesian ( const BasisInfoStruct bis,
const Dft::GridParams gss,
const Dft::Matrix dmat,
Dft::SparsePattern *  pattern,
DftGridReader reader 
) [static]
DftGridReader* grid_open_full ( const struct GridGenMolInfo mol_info,
const Dft::GridParams gss,
Dft::SparsePattern *  pattern,
const Dft::Matrix dmat,
const BasisInfoStruct bis 
)

Returns a handle to a grid file.

Sets the sparse pattern if passed. Observe that sparse pattern must be passed the first time to get generated. Otherwise, subsequent calls will not be able to set it.

References dal_new, grid_atexit_registered, grid_atexit(), Dft::GridParams::gridType, grid_open_stream(), and grid_open_cartesian().

Referenced by dft_integrate(), XCEvaluator::XCEvaluator(), and grid_test_synchronisation().

void grid_set_tmpdir ( const char *  tmpdir)

References grid_tmpdir.

Referenced by es_run(), main(), test_small(), and test_mol().


Variable Documentation

pthread_mutex_t grdone_mutex = PTHREAD_MUTEX_INITIALIZER [static]
int grid_atexit_registered = 0 [static]

Referenced by grid_open_full().

FILE* grid_file = NULL [static]
pthread_mutex_t grid_mutex = PTHREAD_MUTEX_INITIALIZER [static]
std::string grid_tmpdir

Referenced by grid_get_fname(), and grid_set_tmpdir().

const int MY_MPI_NUM = 0 [static]
char* patt_file_name = NULL [static]