~ubuntu-branches/ubuntu/precise/psicode/precise

« back to all changes in this revision

Viewing changes to src/lib/libdpd/file4_mat_irrep_row_rd.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*! \file
 
2
    \ingroup DPD
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cstdio>
 
6
#include <libpsio/psio.h>
 
7
#include <libqt/qt.h>
 
8
#include "dpd.h"
 
9
 
 
10
extern "C" {
 
11
 
 
12
int dpd_file4_mat_irrep_row_rd(dpdfile4 *File, int irrep, int row)
 
13
{
 
14
  int coltot, my_irrep, seek_block;
 
15
  psio_address row_ptr, next_address;
 
16
 
 
17
  if(File->incore) return 0;  /* We already have this data in core */
 
18
 
 
19
#ifdef DPD_TIMER
 
20
  timer_on("f4_rowrd");
 
21
#endif
 
22
 
 
23
  my_irrep = File->my_irrep;
 
24
 
 
25
  row_ptr = File->lfiles[irrep];
 
26
  coltot = File->params->coltot[irrep^my_irrep];
 
27
 
 
28
  /* Advance file pointer to current row --- careful about overflows! */
 
29
  if(coltot) {
 
30
    seek_block = DPD_BIGNUM/(coltot * sizeof(double)); /* no. of rows for which we can compute the address */
 
31
    if(seek_block < 1) {
 
32
      fprintf(stderr, "\nLIBDPD Error: each row of %s is too long to compute an address.\n",File->label);
 
33
      dpd_error("dpd_file4_mat_irrep_row_rd", stderr);
 
34
    }
 
35
    for(; row > seek_block; row -= seek_block)
 
36
      row_ptr = psio_get_address(row_ptr, seek_block*coltot*sizeof(double));
 
37
    row_ptr = psio_get_address(row_ptr, row*coltot*sizeof(double));
 
38
  }
 
39
 
 
40
  if(coltot) 
 
41
      psio_read(File->filenum, File->label, (char *) File->matrix[irrep][0],
 
42
                coltot*sizeof(double), row_ptr, &next_address);
 
43
 
 
44
#ifdef DPD_TIMER
 
45
  timer_off("f4_rowrd");
 
46
#endif
 
47
 
 
48
  return 0;
 
49
 
 
50
}
 
51
 
 
52
} /* extern "C" */