![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __ELEMENT_DATA_H 00005 #define __ELEMENT_DATA_H 00006 00007 #include <dolfin/NewList.h> 00008 #include <dolfin/Element.h> 00009 #include <dolfin/ElementTmpFile.h> 00010 00011 namespace dolfin { 00012 00013 class ODE; 00014 class ElementBlock; 00015 00024 00025 class ElementData { 00026 public: 00027 00029 ElementData(int N); 00030 00032 ~ElementData(); 00033 00035 Element* createElement(Element::Type type, unsigned int q, unsigned int index, 00036 real t0, real t1); 00037 00039 Element* element(unsigned int i, real t); 00040 00042 Element* first(unsigned int i); 00043 00045 Element* last(unsigned int i); 00046 00048 void shift(); 00049 00051 void save(); 00052 00054 void dropLast(); 00055 00057 unsigned int size() const; 00058 00060 bool within(real t) const; 00061 00062 private: 00063 00064 // Create a new block 00065 void createBlock(); 00066 00067 // Find block for given time 00068 ElementBlock* findBlock(real t); 00069 00070 // Find first block 00071 ElementBlock* findFirst(); 00072 00073 // Find last block 00074 ElementBlock* findLast(); 00075 00076 // Update interval 00077 void update(real t0, real t1); 00078 00079 // Check if a new block does not fit into memory 00080 bool memoryFull(); 00081 00082 // Drop the last block (the one furthest from given interval) 00083 void dropBlock(real t0, real t1); 00084 00085 //--- Element data --- 00086 00087 // Size of system; 00088 int N; 00089 00090 // List of element blocks 00091 NewList<ElementBlock*> blocks; 00092 typedef NewList<ElementBlock*>::iterator BlockIterator; 00093 00094 // Current block 00095 ElementBlock* current; 00096 00097 // Interval 00098 real t0, t1; 00099 00100 // True if element data is empty 00101 bool empty; 00102 00103 // Cache size 00104 unsigned int cache_size; 00105 00106 // File for temporary storage of element data 00107 ElementTmpFile tmpfile; 00108 00109 }; 00110 00111 } 00112 00113 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.