[Trilinos-Users] Compilation error when specializing Thyra::initializePrec<Scalar> with [Scalar=double]
Alberto F. Martín-Huertas
amartin at cimne.upc.edu
Wed Nov 2 17:50:44 MDT 2011
Dear Ross,
thanks for your quick response.
I am indeed using the non-member
helper function Thyra::uninitializePrec<double>(...)
when I get the compilation error. If you take a closer
look at the following lines of Thyra_PreconditionerFactoryHelpers.hpp:
00058 template <class Scalar>
00059 void initializePrec(
00060 const PreconditionerFactoryBase<Scalar> &precFactory,
00061 const Teuchos::RCP<const LinearOpBase<Scalar> > &fwdOp,
00062 const Teuchos::Ptr<PreconditionerBase<Scalar> > &prec,
00063 const ESupportSolveUse supportSolveUse =
SUPPORT_SOLVE_UNSPECIFIED
00064 )
00065 {
00066 precFactory.initializePrec(defaultLinearOpSource(fwdOp),
prec.get(),
00067 supportSolveUse);
00068 }
00076 template <class Scalar>
00077 void uninitializePrec(
00078 const PreconditionerFactoryBase<Scalar> &precFactory,
00079 const Teuchos::Ptr<PreconditionerBase<Scalar> > &prec,
00080 const Teuchos::Ptr<Teuchos::RCP<const LinearOpBase<Scalar> > >
&fwdOp = Teuchos::null,
00081 const Teuchos::Ptr<ESupportSolveUse> &supportSolveUse =
Teuchos::null
00082 )
00083 {
00084 Teuchos::RCP<const LinearOpSourceBase<Scalar> > fwdOpSrc;
00085 precFactory.uninitializePrec(prec, Teuchos::outArg(fwdOpSrc),
supportSolveUse);
00086 if (nonnull(fwdOp)) {*fwdOp = fwdOpSrc->getOp();}
00087 }
it can be seen that, on line 66, precFactory.initializePrec is
called with prec.get() while, on line 85, precFactory.unitialized
is called directly with prec instead of prec.get(). Note that
both member functions, i.e., precFactory.initializePrec and
precFactory.unitialized, have
to be called with raw pointers to PreconditionerBase< Scalar >
objects. Therefore, as long as I have understood everything properly,
it seems that the codes for the two helper non-member functions listed
are not consistent.
Best regards,
Alberto.
On Wed, 02 Nov 2011 15:45:43 -0400, Bartlett, Roscoe A. wrote:
> Alberto,
>
>> I am quite sure that this compilation error is due to the fact that
>> the member function
>> Thyra::PreconditionerFactoryBase<double>::uninitializePrec
>> is not properly called on line 0085 of
>> Thyra_PreconditionerFactoryHelpers.hpp.
>> In particular, this line currently is:
>>
>> precFactory.uninitializePrec(prec, Teuchos::outArg(fwdOpSrc),
>> supportSolveUse);
>
> [Bartlett, Roscoe A.]
>
> I think you want:
>
> using Teuchos::outArg; Teuchos::inOutArg;
> ...
> Thyra::uninitializePrec<double>(precFactory, inoutArg(prec),
> outArg(fwdOpSrc), outArg(supportSolveUse));
>
> I would have to see more context to see your types for 'precFactory',
> 'prec', 'fwdOpSrc' and 'supportSolveUse' to know for sure.
>
> The above helper function Thyra::uninitializePrec<>(...) is defined
> in the header Thyra_PreconditionerFactoryHelpers.hpp
>
> Let me know if this does not work for you,
>
> -Ross
>
> P.S. We are not quite fully finished refactoring Thyra to remove raw
> C++ pointers using the convention defined in
> http://www.cs.sandia.gov/~rabartl/TeuchosMemoryManagementSAND.pdf .
> That is part of the confusion. In general, the non-member helpers
> are
> updated before the virtual member functions due to backward
> comparability challenges.
--
Alberto F. Martín-Huertas
Centre Internacional de Mètodes Numèrics a l'Enginyeria (CIMNE)
Parc Mediterrani de la Tecnologia, UPC
Esteve Terrades 5, Building C3, Office 210,
08860 Castelldefels (Barcelona, Spain)
Tel.: (+34) 9341 34223
e-mail: amartin at cimne.upc.edu
________________
IMPORTANT NOTICE
All personal data contained on this mail will be processed
confidentially and registered in a file property of CIMNE in
order to manage corporate communications. You may exercise the rights
of access, rectification, erasure and object by
letter sent to Ed. C1 Campus Norte UPC. Gran Capitán s/n Barcelona.
More information about the Trilinos-Users
mailing list