I think you need to .get() the naked pointer from the AutoPtr, and cast that to the desired type.
-- John On Wed, Dec 30, 2009 at 9:35 PM, Andrea Hawkins <[email protected]> wrote: > Hello- > > I'm thinking my question may be basic C++, so sorry if it is, but at this > point I think I might be having trouble with libMesh syntax as well. > > Anyway, I have a TransientNonlinearImplicitSystem & system, and this has as > a member an AutoPtr<NonlinearSolver<Number> > nonlinear_solver. Since I'm > using PETSc, this is actually getting initiated as an > AutoPtr<PetscNonlinearSolver<Number> >. Now, I'm trying to access the SNES > object in PETSc, and the PetscNonlinearSolver class has the member function > snes() to return this, but to get to that I need to do a dynamic_cast of > nonlinear_solver. But for some reason the line > > PetscNonlinearSolver<Number>* p_solver = > dynamic_cast<PetscNonlinearSolver<Number>*>(&system.nonlinear_solver); > > is giving me the error that the expression system.nonlinear_solver must have > class type. I usually get this when I misuse . and ->, but I've tried > various things and I can't get anything to work. > So, now I'm wondering if there is something specifically about it being an > AutoPtr that is giving me troubles. > > Any thoughts? > > Thank you so much in advance! > Andrea > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Libmesh-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/libmesh-users > ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
