54 class TsqrAdaptor :
public Teuchos::ParameterListAcceptorDefaultBase {
56 typedef Thyra::MultiVectorBase<Scalar> MV;
57 typedef Scalar scalar_type;
58 typedef int ordinal_type;
59 typedef Teuchos::SerialDenseMatrix<ordinal_type, scalar_type> dense_matrix_type;
60 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
70 throw std::logic_error (
"Thyra adaptor for TSQR not implemented");
76 throw std::logic_error (
"Thyra adaptor for TSQR not implemented");
79 Teuchos::RCP<const Teuchos::ParameterList>
80 getValidParameters ()
const
82 throw std::logic_error (
"Thyra adaptor for TSQR not implemented");
86 setParameterList (
const Teuchos::RCP<Teuchos::ParameterList>& )
88 throw std::logic_error (
"Thyra adaptor for TSQR not implemented");
118 throw std::logic_error (
"Thyra adaptor for TSQR not implemented");
154 const magnitude_type& )
156 throw std::logic_error (
"Thyra adaptor for TSQR not implemented");
170 static Teuchos::RCP<const Teuchos::Comm<int> >
171 getComm (
const MV& X)
175 using Teuchos::rcp_dynamic_cast;
176 using Teuchos::rcp_implicit_cast;
177 typedef Thyra::VectorSpaceBase<Scalar> space_base_type;
178 typedef Thyra::SpmdVectorSpaceBase<Scalar> space_type;
182 RCP<const space_base_type> rangeBase = X.range ();
183 TEUCHOS_TEST_FOR_EXCEPTION(rangeBase.is_null (), std::runtime_error,
"X.range() is null.");
184 RCP<const space_type> range = rcp_dynamic_cast<const space_type> (rangeBase);
185 TEUCHOS_TEST_FOR_EXCEPTION(range.is_null (), std::runtime_error,
"X.range() is not an SpmdVectorSpaceBase.");
196 RCP<const Teuchos::Comm<Thyra::Ordinal> > thyraComm = range->getComm ();
198 RCP<const Teuchos::MpiComm<Thyra::Ordinal> > thyraMpiComm =
199 rcp_dynamic_cast<const Teuchos::MpiComm<Thyra::Ordinal> > (thyraComm);
200 if (thyraMpiComm.is_null ()) {
201 RCP<const Teuchos::SerialComm<Thyra::Ordinal> > thyraSerialComm =
202 rcp_dynamic_cast<const Teuchos::SerialComm<Thyra::Ordinal> > (thyraComm);
203 TEUCHOS_TEST_FOR_EXCEPTION(
204 thyraSerialComm.is_null (), std::runtime_error,
205 "Thyra's communicator is neither an MpiComm nor a SerialComm. "
206 "Sorry, I have no idea what to do with it in that case.");
210 return rcp_implicit_cast<const Teuchos::Comm<int> > (rcp (
new Teuchos::SerialComm<int>));
213 RCP<const Teuchos::OpaqueWrapper<MPI_Comm> > rawMpiComm = thyraMpiComm->getRawMpiComm ();
217 return rcp_implicit_cast<const Teuchos::Comm<int> > (rcp (
new Teuchos::MpiComm<int> (rawMpiComm)));
221 RCP<const Teuchos::SerialComm<Thyra::Ordinal> > thyraSerialComm =
222 rcp_dynamic_cast<const Teuchos::SerialComm<Thyra::Ordinal> > (thyraComm);
223 TEUCHOS_TEST_FOR_EXCEPTION(
224 thyraSerialComm.is_null (), std::runtime_error,
225 "Thyra's communicator is not a SerialComm, and MPI is not enabled, so "
226 "it can't be an MpiComm either. That means it must be some other "
227 "subclass of Comm, about which I don't know. "
228 "Sorry, I have no idea what to do with it in that case.");
232 return rcp_implicit_cast<const Teuchos::Comm<int> > (rcp (
new Teuchos::SerialComm<int>));
249 prepareDistTsqr (
const MV& ) {}
271 prepareTsqr (
const MV& ) {}