Thyra Package Browser (Single Doxygen Collection) Version of the Day
OperatorSolveHelpers.hpp
Go to the documentation of this file.
00001 #include "Thyra_DefaultSpmdVectorSpace.hpp"
00002 #include "Thyra_DetachedMultiVectorView.hpp"
00003 
00004 
00005 namespace Thyra {
00006 
00007 
00008 //
00009 // Helper code and declarations
00010 //
00011 
00012 
00013 using Teuchos::as;
00014 using Teuchos::null;
00015 using Teuchos::RCP;
00016 using Teuchos::inOutArg;
00017 
00018 
00022 template<class Scalar>
00023 RCP<MultiVectorBase<Scalar> >
00024 createNonsingularMultiVector(const RCP<const VectorSpaceBase<Scalar> > &vs)
00025 {
00026   using Teuchos::as;
00027   const RCP<MultiVectorBase<Scalar> > M = createMembers(vs, vs);
00028   assign(M.ptr(), as<Scalar>(0.0));
00029   {
00030     DetachedMultiVectorView<Scalar> M_detached_view(*M);
00031     const RTOpPack::SubMultiVectorView<Scalar> M_smvv = M_detached_view.smv(); 
00032     const Scalar
00033       one = as<Scalar>(1.0),
00034       two = as<Scalar>(2.0),
00035       four = as<Scalar>(4.0);
00036     for (int i = 0; i < M_smvv.subDim(); ++i) {
00037       if (i > 0) M_smvv(i, i-1) = one;
00038       M_smvv(i, i) = four;
00039       if (i < M_smvv.subDim() - 1) M_smvv(i, i+1) = two;
00040     }
00041   }
00042   return M;
00043 }
00044 
00045 
00046 } // namespace Thyra
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines