7
#include <libpsio/psio.h>
23
/*! set up buffer info */
26
ints_per_buf_ = IWL_INTS_PER_BUF;
28
bufszc_ = 2 * sizeof(int) + ints_per_buf_ * 4 * sizeof(Label) +
29
ints_per_buf_ * sizeof(Value);
35
IWL::IWL(PSIO *psio, int itap, double cutoff, int oldfile, int readflag):
38
init(psio, itap, cutoff, oldfile, readflag);
41
void IWL::init(PSIO *psio, int itap, double cutoff, int oldfile, int readflag)
45
/*! set up buffer info */
48
ints_per_buf_ = IWL_INTS_PER_BUF;
50
bufszc_ = 2 * sizeof(int) + ints_per_buf_ * 4 * sizeof(Label) +
51
ints_per_buf_ * sizeof(Value);
56
/*! make room in the buffer */
57
// labels_ = (Label *) malloc (4 * ints_per_buf_ * sizeof(Label));
58
// values_ = (Value *) malloc (ints_per_buf_ * sizeof(Value));
59
labels_ = new Label[4 * ints_per_buf_];
60
values_ = new Value[ints_per_buf_];
62
/*! open the output file */
63
/*! Note that we assume that if oldfile isn't set, we O_CREAT the file */
64
psio_->open(itap_, oldfile ? PSIO_OPEN_OLD : PSIO_OPEN_NEW);
65
if (oldfile && (psio_->tocscan(itap_, IWL_KEY_BUF) == NULL)) {
66
fprintf(stderr,"iwl_buf_init: Can't open file %d\n", itap_);
67
psio_->close(itap_,0);
71
/*! go ahead and read a buffer */
72
if (readflag) fetch();
80
** \param Buf Buffer to be initialised
81
** \param itape Filenumber
82
** \param cutoff Cutoff for keeping integral
83
** \param oldfile If ==0 create file
84
** \param readflag If ==1 fetch buffer
86
** Prepare a PSI Buffer according to the Integrals
87
** With Labels format for reading or writing. Important to set
88
** readflag=1 if opening for reading, since other IWL buffer read
89
** routines anticipate that there is already data in the buffer.
91
** David Sherrill, March 1995
92
** Revised 6/26/96 by CDS for new format
95
void iwl_buf_init(struct iwlbuf *Buf, int itape, double cutoff,
96
int oldfile, int readflag)
99
/*! set up buffer info */
101
Buf->bufpos = PSIO_ZERO;
102
Buf->ints_per_buf = IWL_INTS_PER_BUF;
103
Buf->cutoff = cutoff;
104
Buf->bufszc = 2 * sizeof(int) + Buf->ints_per_buf * 4 * sizeof(Label) +
105
Buf->ints_per_buf * sizeof(Value);
110
/*! make room in the buffer */
111
Buf->labels = (Label *) malloc (4 * Buf->ints_per_buf * sizeof(Label));
112
Buf->values = (Value *) malloc (Buf->ints_per_buf * sizeof(Value));
114
/*! open the output file */
115
/*! Note that we assume that if oldfile isn't set, we O_CREAT the file */
116
psio_open(Buf->itap, oldfile ? PSIO_OPEN_OLD : PSIO_OPEN_NEW);
117
if (oldfile && (psio_tocscan(Buf->itap, IWL_KEY_BUF) == NULL)) {
118
fprintf(outfile,"iwl_buf_init: Can't open file %d\n", Buf->itap);
119
psio_close(Buf->itap,0);
123
/*! go ahead and read a buffer */
124
if (readflag) iwl_buf_fetch(Buf);
b'\\ No newline at end of file'