Pointer Initialization
Hi,
I am still new in OpenFOAM and I'm having issues initializing a pointer of the type autoPtr<scalar>&. I declared a protected variable and a public function to access the value it is gonna point to in functions that belong to other classes Code:
autoPtr<scalar>& BtTrans_; Code:
template<class CloudType> Now in the constructor of my class I wanted to initialize BtTrans_ like so: Code:
BtTrans_(NULL) Code:
BtTrans_(0.0) error: invalid initialization of non-const reference of type `Foam::autoPtr<double>&’ from an rvalue of type ‘double’ Maybe one of you can help me with his/her thoughts on this issue?! Thanks so much, Stef EDIT: I've found the error. The declaration of BtTrans_ was incorrect. Should have been: Code:
autoPtr<scalar> BtTrans_; Now I have issues assigning the pointer to the variable I want it to point to. How do I do that correctly? Code:
template<class CloudType> The error I'm getting is the following: error: no match for ‘operator=’ in ‘((const Foam::MyEvaporationAS<Foam::ReactingCloud<Foam::Th ermoCloud<Foam::KinematicCloud<Foam::Cloud<Foam::R eactingParcel<Foam::ThermoParcel<Foam::KinematicPa rcel<Foam::particle> > > > > > > >*)this)->Foam::MyEvaporationAS<Foam::ReactingCloud<Foam::T hermoCloud<Foam::KinematicCloud<Foam::Cloud<Foam:: ReactingParcel<Foam::ThermoParcel<Foam::KinematicP arcel<Foam::particle> > > > > > > >::BtTrans_ = & Bt’ |
All times are GMT -4. The time now is 07:13. |