Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

ElementTmpFile.h

Go to the documentation of this file.
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __ELEMENT_TMP_FILE_H
00005 #define __ELEMENT_TMP_FILE_H
00006 
00007 #include <stdio.h>
00008 
00009 namespace dolfin {
00010 
00011   class ElementBlock;
00012 
00016   
00017   class ElementTmpFile {
00018   public:
00019 
00021     ElementTmpFile();
00022 
00024     ~ElementTmpFile();
00025 
00027     void write(const ElementBlock& block);
00028 
00029     // Read an element block from the file
00030     void read(ElementBlock& block, real t);
00031 
00032     // Read first element block from the file
00033     void readFirst(ElementBlock& block);
00034 
00035     // Read last element block from the file
00036     void readLast(ElementBlock& block);
00037 
00039     bool empty() const;
00040    
00041   private:
00042 
00043     // Step forward in file to given time
00044     bool searchForward(real t);
00045 
00046     // Step backward in file to given time
00047     bool searchBackward(real t);
00048 
00049     // Read head of current block (and return)
00050     bool readHead(unsigned int& size, real& t0, real &t1);
00051 
00052     // Read tail of current block (and return)
00053     bool readTail(unsigned int& size);
00054     
00055     // Read block starting at the current position
00056     void readBlock(ElementBlock& block);
00057       
00058     // Compute size of block in bytes
00059     unsigned int bytes(const ElementBlock& block);
00060 
00061     // Pointer to the temporary file
00062     FILE* fp;
00063     
00064     // True if the file is empty
00065     bool _empty;
00066 
00067   };
00068 
00069 }
00070 
00071 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.