ESYS13
Revision_
|
00001 00002 /******************************************************* 00003 * 00004 * Copyright (c) 2003-2012 by University of Queensland 00005 * Earth Systems Science Computational Center (ESSCC) 00006 * http://www.uq.edu.au/esscc 00007 * 00008 * Primary Business: Queensland, Australia 00009 * Licensed under the Open Software License version 3.0 00010 * http://www.opensource.org/licenses/osl-3.0.php 00011 * 00012 *******************************************************/ 00013 00014 00015 #if !defined escript_Taipan_20050427_H 00016 #define escript_Taipan_20050427_H 00017 #include "system_dep.h" 00018 00019 namespace escript { 00020 00040 class ESCRIPT_DLL_API Taipan { 00041 00042 public: 00043 00044 typedef long size_type; // needs to be parallelised by openmp. It should not take negative values. 00045 // do not assume that it is unsigned though 00046 00060 Taipan(); 00061 00075 ~Taipan(); 00076 00085 double* 00086 new_array(size_type dim, size_type N); 00087 00094 void 00095 delete_array(double* array); 00096 00102 void 00103 release_unused_arrays(); 00104 00109 int 00110 num_arrays(); 00111 00116 int 00117 num_arrays(size_type N); 00118 00123 int 00124 num_free(size_type N); 00125 00130 long 00131 num_elements(); 00132 00137 void 00138 dump_stats(); 00139 00144 void 00145 clear_stats(); 00146 00147 protected: 00148 00149 private: 00153 void operator=(const Taipan& c){} 00154 00155 typedef struct Taipan_StatTable { 00156 int requests; 00157 int frees; 00158 int allocations; 00159 int deallocations; 00160 long allocated_elements; 00161 long deallocated_elements; 00162 long max_tab_size; 00163 } Taipan_StatTable; 00164 00165 Taipan_StatTable* statTable; 00166 00167 typedef struct Taipan_MemTable { 00168 double* array; 00169 size_type dim; 00170 size_type N; 00171 int numThreads; 00172 bool free; 00173 struct Taipan_MemTable* next; 00174 } Taipan_MemTable; 00175 00176 Taipan_MemTable* memTable_Root; 00177 00178 long totalElements; 00179 00180 }; 00181 00182 } // end of namespace 00183 00184 #endif