From 79e7a946dd1284a9d6f7354d15685201e8cca342 Mon Sep 17 00:00:00 2001 From: jiri Date: Tue, 24 Oct 2006 22:09:23 +0000 Subject: [PATCH] *** empty log message *** --- fourindex.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/fourindex.h b/fourindex.h index fb11e75..a2c6fb5 100644 --- a/fourindex.h +++ b/fourindex.h @@ -285,6 +285,35 @@ public: void setsymmetry(fourindexsymtype s) {symmetry=s;}; fourindexsymtype getsymmetry() const {return symmetry;} void rewind() const {if(0!=lseek64(fd,0L,SEEK_SET)) {perror("seek error"); laerror("cannot seek in fourindex_ext");} }; + + //file output + void put(const matel4stored x) + { + if(!current) current=buffer; + *current++ = x; + if(current-buffer >= bufsize ) flush(); + } + void put(I i, I j, I k, I l, const T &elem) + { + if(!current) current=buffer; + current->index.indiv.i=i; + current->index.indiv.j=j; + current->index.indiv.k=k; + current->index.indiv.l=l; + current->elem = elem; + ++current; + if(current-buffer >= bufsize ) flush(); + } + void flush() + { + if(current) + { + ssize_t r=write(fd,buffer,(current-buffer)*sizeof(matel4stored)); + if(r!=(current-buffer)*sizeof(matel4stored)) laerror("write error in fourindex_ext"); + } + current=NULL; + } + inline I size() const {return nn;}