CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   PtrList and List (http://www.cfd-online.com/Forums/openfoam-programming-development/124315-ptrlist-list.html)

Geon-Hong October 1, 2013 22:44

PtrList and List
 
Dear Foamers,

Recently I have peered the OpenFOAM source codes to understand the data structures used in it.

Meanwhile, a fundamental question has come up : "why does the OpenFOAM frequently use PtrList instead of List?"

I think it may not be the case of OpenFOAM only but also C++ language.

One thing that I can guess is that it can handle large data efficiently by using the pointers instead of objects directly. But I don't have any other idea of advantages of using PtrList over List.

Please somebody help me with this problem!

Thank you very much.

Best regards,
Geon-Hong.

wyldckat October 6, 2013 14:36

Greetings Geon-Hong,
Quote:

Originally Posted by Geon-Hong (Post 454600)
One thing that I can guess is that it can handle large data efficiently by using the pointers instead of objects directly. But I don't have any other idea of advantages of using PtrList over List.

Yes, I would say that's pretty much the reason why.

In addition, OpenFOAM uses pointers a lot, so much that it has the "tmp" mechanism: http://openfoamwiki.net/index.php/OpenFOAM_guide/tmp

Best regards,
Bruno


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