Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_MultiVectorAllocator.hpp
1// @HEADER
2// *****************************************************************************
3// Thyra: Interfaces and Support for Abstract Numerical Algorithms
4//
5// Copyright 2004 NTESS and the Thyra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef THYRA_MULTI_VECTOR_ALLOCATOR_HPP
11#define THYRA_MULTI_VECTOR_ALLOCATOR_HPP
12
13#include "Thyra_VectorSpaceBase.hpp"
14#include "Teuchos_Assert.hpp"
15
16namespace Thyra {
17
21template<class Scalar>
23public:
25 MultiVectorAllocator() : numMembers_(0) {}
29 MultiVectorAllocator( const Teuchos::RCP<const VectorSpaceBase<Scalar> > &vs, int numMembers )
30 : vs_(vs), numMembers_(numMembers)
31 {
32#ifdef TEUCHOS_DEBUG
33 TEUCHOS_TEST_FOR_EXCEPTION( vs.get()==NULL, std::logic_error, "Error!" );
34#endif
35 }
37 const ptr_t allocate() const { return vs_->createMembers(numMembers_); } // required!
38private:
40 int numMembers_;
41};
42
43} // namespace Thyra
44
45#endif // THYRA_MULTI_VECTOR_ALLOCATOR_HPP
Allocator class to be used with Teuchos::AbstractFactoryStd to create MultiVectorBase objects of a gi...
Teuchos::RCP< MultiVectorBase< Scalar > > ptr_t
MultiVectorAllocator(const Teuchos::RCP< const VectorSpaceBase< Scalar > > &vs, int numMembers)
Abstract interface for objects that represent a space for vectors.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)