CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   data structure question (https://www.cfd-online.com/Forums/main/79508-data-structure-question.html)

dshawul August 25, 2010 17:58

data structure question
 
Hi
After writing a SIMPLE solver on unstructured collocated grid, I realized I made a bad design decision. The vertices, facets and cell lists are interlinked with pointers, and all the data for a cell is at one place. That means I have u,v,w and other scalar terms like T (temperature or whatever) for a cell at the same place. That is what good c++ code should do ,but now I suspect that it is better to have a field for each variable separately (like u[100],v[100] etc..) so that different operations can be done separately. When the scalar transport equation is solved for u, we don't need T for example, good for cache I suppose..
Before I go on doing that I want to know which method is being used by fastest cfd solvers.
I have the following
Code:

struct Field {
    union {
        struct {
            Vector U;
            Scalar p;
            Scalar T;
            Scalar pp;
        };
        Scalar f[6];
    };
};

and am going to change it in to the following for 100 cells
Code:

Vector U[100];
Scalar T[100];
...

thanks in advance
P.S : Is there a programming sub-forum where this kind of posts belong ?


All times are GMT -4. The time now is 02:20.