CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Can someone please explain this (

jaswi July 3, 2007 08:07

Dear OpenFoam Users I am ne
Dear OpenFoam Users

I am new to c++ programming. I have been looking the source code of OpenFOAM. I am unable to understand the src/OpenFOAM/primitives/pTraits/pTraits.H
I have added my dounts next to the lines i do not understand, please take a look.

This is what it contains :
#ifndef pTraits_H
#define pTraits_H

namespace Foam

class Istream; // <-- what does it means here

--> Next it defines a template class pTraits with template argument <class>. I am confused about what is class primitive !! as in the definition [: public primitive ] indicates that class pTraits is also inherited from primitive .

class pTraits
public primitive // <--- indicate inheritance ??


pTraits(Istream& is) // <-- is this a constructor

} // End namespace Foam


Can anybody tell what is primitive and from where it comes !!!

Thanks alot

With Best Regards

hjasak July 3, 2007 08:14

You did pick a hard place to s
You did pick a hard place to start: this is advanced templating you are looking at and I bet there is VERY few people on the forum who can actually answer this question properly.


class pTraits

means a pTraits class is a template, and we will use a primitive as the template keyword.

Now it gets tricky, with template specialisation for raw types and the "curiously recurring template pattern". Trust me, right now you don't need to know.


jaswi July 3, 2007 08:19

Thanks Hrv for the answer.
Thanks Hrv for the answer.

I take your word and keep away from that for a while.

I sent you an email last week. Please find some time to take a look at that. That was about the Turbulence modelling w.r.t. interface capturing model.

With Best Regards

All times are GMT -4. The time now is 00:43.