definition of a variable in class

I am trying to define a variable in a following class.

Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::EllisLaw::calcNu() const
{

dimensionedScalar current_time(U_.time());
//.value());

const volScalarField& old_visc = U_.mesh().lookupObject<volScalarField>("visco_old" );

}

I want a variable AB which is "old_visc*strain_rate()".

I tried all the definitions for AB. (double, volScalarField etc)
but in all cases it gives compilation error for the definition.

Please respond if any one has some comments what could be the right definition of this variable.


Thanks and regards,
Nilesh
Are you expecting us to somehow know what a 'volScalarField' is, or what strain_rate() returns?
strain_rate() returns a single value of type double. volScalarField is class defined specific to the open source code.
I am trying to define a variable in a following class.


You didn't show us a "following class". I assume this is a member function of the EllisLaw class within the Foam and viscosityModels namespaces, but viscosityModels and Foam could be containing classes, or they could all be namespaces and calcNu is not a member function. I don't have enough information to understand what the class is, where you want to declare the variable, etc.

Possiby what you want, rather than a variable AB, is a funtion AB() that retrieves the old_visc and strain_rate() and returns the product. But I can't tell from the details you gave us.
Topic archived. No new replies allowed.