Hi, Is there support for spa
Is there support for sparse matrices in OpenFOAM? From what I can tell, Matrix.C constructs only a full matrix, which would require too much of memory in this case.
Sorry to be rude but, well, ob
Sorry to be rude but, well, obviously! If all the matrices were full you could not solve more that several thousand cells. :-)
The class you want is lduMatrix:
Thanks! I was looking at the wrong place.
After looking at the lduMatrix
After looking at the lduMatrix class I am afraid I have some further questions about sparse matrices!
What I want/need to to is to use a sparse matrix format for storage of information, not for solving equations. What I thus would need is the possibility to, in pseudocode, do
sparseMatrix<bool>(large number,large number) A
A(500,5022) = 1;
and, for instance
A(500,5022) = 0;
to delete the element;
and to hopefully do the same for other objects, i.e. sparseMatrix<vector> etc.
Does these type of structures exist in OpenFOAM, or is this something I need to look into creating?
Thanks for your time!
Aha. There's several related
Aha. There's several related issues, (e.g. what do you meand by "delete an element") etc. but, the short answer is no: there isn't a ready-to-use container class of this sort for you.
However, it is easy to make one yourself: make a Map of Maps and re-do the access operators. A Map will allow you to do
myEntry<bool>(large number) A;
A(5022) = true; (equivalent in Map syntax)
without excessive memory, and a 2-D equivalent should do what you need. If you're not hapy with a hashed version of Map in FOAM, you could have a go at using the STL version. This is implemented as a balanced binary tree and you still need to do the 2-D wrapping yourself.
Maps you say! I started buil
Maps you say!
I started building my own sparse class using linked lists, but I am concerned about the cost involved in searching the, possible very large, unordered indexing vectors. I will look into Maps as soon as possible.
Thanks for all help!
|All times are GMT -4. The time now is 20:30.|