CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Accessing a member function in a class (https://www.cfd-online.com/Forums/openfoam/60974-accessing-member-function-class.html)

fabianpk June 14, 2006 04:52

Hello, I'm trying to access t
 
Hello,
I'm trying to access the dragmodel of the spray, when I'm in the spray class (more precisely I'm in sprayFunctions.H). I have written a member function which has parcel and cell as input. To access mass of droplet for instance, I just did:

parceli.m();

but I have had problems accessing the Cd function of the dragModel class. I don't think I should need to initialize it, since that should have been made in the constructor of spray?

I typed

scalar Cd = drag_.Cd(ReynoldsNumber,fraction);

but then I get:

error: 'const class Foam::autoPtr<foam::dragmodel>' has no member named 'Cd'

What can I do about this?

/Fabian

fabianpk June 14, 2006 09:16

If someone is interested, I fo
 
If someone is interested, I found out that it's done by:

scalar CD = (*this).drag().Cd(ReDrop,0.0);


/Fabian

hjasak June 14, 2006 09:20

Or a bit prettier: scalar C
 
Or a bit prettier:

scalar CD = this->drag().Cd(ReDrop,0.0);

Hrv


All times are GMT -4. The time now is 10:12.