[pooma-dev] Sparse Engine
Sergei Mingaleev
smino at tkm.physik.uni-karlsruhe.de
Fri Sep 26 12:21:49 UTC 2003
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: smino at tkm.physik.uni-karlsruhe.de
Web: http://www-tkm.physik.uni-karlsruhe.de/~smino/
http://wwwrsphysse.anu.edu.au/nonlinear/sfm/
------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SparseEngine.h
Type: text/x-c++
Size: 4262 bytes
Desc: SparseEngine.h
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20030926/54ecc45a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SparseEngine2.h
Type: text/x-c++
Size: 12399 bytes
Desc: SparseEngine2.h
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20030926/54ecc45a/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SparseEngine4.h
Type: text/x-c++
Size: 8033 bytes
Desc: SparseEngine4.h
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20030926/54ecc45a/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SparseOperators.h
Type: text/x-c++
Size: 1119 bytes
Desc: SparseOperators.h
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20030926/54ecc45a/attachment-0003.bin>
More information about the pooma-dev
mailing list