|
From: | Sergei Mingaleev |
Subject: | Re: [pooma-dev] Sparse Engine |
Date: | Fri, 26 Sep 2003 14:21:49 +0200 |
Hello, Jean: >> John and I are starting to write a sparse engine -- for sparse storage of >> our material-dependent fields. >> .... >> only demonstrates how to build the engine, not an array or a field. Could >> someone please show us how to move forward with this example to building a >> complete array and field version? I has written some time ago a simple version of the SparseEngine - see it attached. At the momemnt the Engine works only with 2D and 4D arrays, and it cannot be parallelized. I don't really like it - it should be completely rewritten - but may be, it could be useful for you as an example? The main file: SparseEngine.h All other files are included from the main file: SparseEngine2.h - support for 2D Arrays. SparseEngine4.h - support for 4D Arrays. SparseOperators.h - some operators. The program starts with: #define SPL_DEBUG_SPARSE #include "SparseEngine.h" The Sparse Array can be created as usually: Array<2,Sparse> A(I,J); I have not tried, but I guess, it should work with Field class, too. The SparseEngine contains some specific functions, which can be accessed as demonstrated in the example below: #ifdef SPL_DEBUG_SPARSE A.engine().pack(); // compactify the Sparse Array... cout << "Sparse Array Filling = " << int(100*(1.0-A.engine().free()/(double)(A.engine().size()))) << " %" << endl; #endif There are predefined constants: #define SPARSE_TOLERANCE 1e-10 #define SPARSITY_LEVEL 0.5 Before I tried to define these constants in the SparseEngine constructors and initialize() functions, but it worked badly - the problem is that constructors and initializators of Arrays have some restrictive assumptions concerning the corresponding functions of Engines. Best wishes, Sergei. -- ---- --- --- --- --- --- --- --- --- --- --- Dr. Sergei Mingaleev Institut fur Theorie der Kondensierten Materie Universitat Karlsruhe, 76128 Karlsruhe, Germany ------------------------------------------------------ Phone: +49-(721)-608-2136 Fax: +49-(721)-608-7779 E-mail: address@hidden Web: http://www-tkm.physik.uni-karlsruhe.de/~smino/ http://wwwrsphysse.anu.edu.au/nonlinear/sfm/ ------------------------------------------------------
SparseEngine.h
Description: SparseEngine.h
SparseEngine2.h
Description: SparseEngine2.h
SparseEngine4.h
Description: SparseEngine4.h
SparseOperators.h
Description: SparseOperators.h
[Prev in Thread] | Current Thread | [Next in Thread] |