Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_VectorSpaceBase_decl.hpp
1// @HEADER
2// ***********************************************************************
3//
4// Thyra: Interfaces and Support for Abstract Numerical Algorithms
5// Copyright (2004) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38//
39// ***********************************************************************
40// @HEADER
41
42#ifndef THYRA_VECTOR_SPACE_BASE_DECL_HPP
43#define THYRA_VECTOR_SPACE_BASE_DECL_HPP
44
45#include "Thyra_OperatorVectorTypes.hpp"
46#include "Teuchos_Describable.hpp"
47
48
49namespace Thyra {
50
51
57template<class Scalar>
58RCP<const VectorSpaceBase<Scalar> >
60
61
69template<class Scalar>
72 const RCP<const VectorSpaceBase<Scalar> > &vs,
73 const std::string &label=""
74 );
75
76
81template<class Scalar>
83createMember( const VectorSpaceBase<Scalar> &vs, const std::string &label="" );
84
85
93template<class Scalar>
96 const RCP<const VectorSpaceBase<Scalar> > &vs, int numMembers,
97 const std::string &label=""
98 );
99
100
108template<class Scalar>
111 const RCP<const VectorSpaceBase<Scalar> > &vs,
112 const RCP<const VectorSpaceBase<Scalar> > &domain,
113 const std::string &label=""
114 );
115
116
121template<class Scalar>
124 const VectorSpaceBase<Scalar> &vs, int numMembers,
125 const std::string &label=""
126 );
127
128
136template<class Scalar>
139 const RCP<const VectorSpaceBase<Scalar> > &vs,
141 const std::string &label=""
142 );
143
144
149template<class Scalar>
152 const VectorSpaceBase<Scalar> &vs,
154 const std::string &label=""
155 );
156
157
165template<class Scalar>
168 const RCP<const VectorSpaceBase<Scalar> > &vs,
170 const std::string &label=""
171 );
172
173
178template<class Scalar>
181 const VectorSpaceBase<Scalar> &vs,
183 const std::string &label=""
184 );
185
186
194template<class Scalar>
197 const RCP<const VectorSpaceBase<Scalar> > &vs,
199 const std::string &label=""
200 );
201
202
207template<class Scalar>
210 const VectorSpaceBase<Scalar> &vs,
212 const std::string &label=""
213 );
214
215
223template<class Scalar>
226 const RCP<const VectorSpaceBase<Scalar> > &vs,
228 const std::string &label=""
229 );
230
231
236template<class Scalar>
239 const VectorSpaceBase<Scalar> &vs,
241 const std::string &label=""
242 );
243
244
298template<class Scalar>
299class VectorSpaceBase : virtual public Teuchos::Describable {
300public:
301
304
310 virtual Ordinal dim() const = 0;
311
335 virtual bool isCompatible( const VectorSpaceBase<Scalar>& vecSpc ) const = 0;
336
345
358 virtual Scalar scalarProd(
359 const VectorBase<Scalar>& x, const VectorBase<Scalar>& y
360 ) const = 0;
361
389 const ArrayView<Scalar> &scalarProds_out
390 ) const
391 {
392 scalarProdsImpl(X, Y, scalarProds_out);
393 }
394
396
399
406 virtual bool isEuclidean() const;
407
452 virtual bool hasInCoreView(
453 const Range1D &rng = Range1D(),
454 const EViewType viewType = VIEW_TYPE_DETACHED,
455 const EStrideType strideType = STRIDE_TYPE_NONUNIT
456 ) const;
457
470
472
473#ifndef DOXYGEN_COMPILE
474
475#ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
476
479
481 createMember<>(
482 const RCP<const VectorSpaceBase<Scalar> > &vs,
483 const std::string &label
484 );
485
487 createMembers<>(
488 const RCP<const VectorSpaceBase<Scalar> > &vs,
489 int numMembers, const std::string &label
490 );
491
493 createMemberView<>(
494 const RCP<const VectorSpaceBase<Scalar> > &vs,
496 const std::string &label
497 );
498
500 createMemberView<>(
501 const RCP<const VectorSpaceBase<Scalar> > &vs,
503 const std::string &label
504 );
505
507 createMembersView<>(
508 const RCP<const VectorSpaceBase<Scalar> > &vs,
510 const std::string &label
511 );
512
514 createMembersView<>(
515 const RCP<const VectorSpaceBase<Scalar> > &vs,
517 const std::string &label
518 );
519
521
522#endif // DOXYGEN_COMPILE
523
524#endif // TEMPLATE_FRIENDS_NOT_SUPPORTED
525
526#ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
527protected:
528#endif
529
532
559
587 createMembers(int numMembers) const = 0;
588
620 virtual RCP<VectorBase<Scalar> >
622
646
680
710 const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv ) const = 0;
711
712
713 public:
714
749
780
782
783protected:
784
788 virtual void scalarProdsImpl(
791 ) const = 0;
792
793public:
794
795private:
796
797 // Not defined and not to be called
799 operator=(const VectorSpaceBase<Scalar>&);
800
801};
802
803
804} // end namespace Thyra
805
806
807#endif // THYRA_VECTOR_SPACE_BASE_DECL_HPP
Interface for a collection of column vectors called a multi-vector.
Abstract interface for finite-dimensional dense vectors.
Abstract interface for objects that represent a space for vectors.
RCP< MultiVectorBase< Scalar > > createMembers(const VectorSpaceBase< Scalar > &vs, int numMembers, const std::string &label="")
Calls createMembers(Teuchos::rcp(&vs,false),numMembers).
virtual RCP< const MultiVectorBase< Scalar > > createCachedMembersView(const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv) const
Create a (possibly) cached multi-vector member that is a const view of raw multi-vector data....
virtual RCP< const VectorSpaceBase< Scalar > > clone() const
Clone this object (if supported).
RCP< const VectorBase< Scalar > > createMemberView(const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::ConstSubVectorView< Scalar > &raw_v, const std::string &label="")
Create a vector member that is a const view of raw data.
RCP< const VectorBase< Scalar > > createMemberView(const VectorSpaceBase< Scalar > &vs, const RTOpPack::ConstSubVectorView< Scalar > &raw_v, const std::string &label="")
Calls createMemberView(Teuchos::rcp(&vs,false),raw_v).
virtual RCP< MultiVectorBase< Scalar > > createCachedMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv) const
Create a (possibly) cached multi-vector member that is a non-const view of raw multi-vector data....
RCP< const MultiVectorBase< Scalar > > createMembersView(const VectorSpaceBase< Scalar > &vs, const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv, const std::string &label="")
Calls createMembersView(Teuchos::rcp(&vs,false),raw_mv).
RCP< const MultiVectorBase< Scalar > > createMembersView(const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv, const std::string &label="")
Create a multi-vector member that is a const view of raw data.
virtual bool hasInCoreView(const Range1D &rng=Range1D(), const EViewType viewType=VIEW_TYPE_DETACHED, const EStrideType strideType=STRIDE_TYPE_NONUNIT) const
Returns true if this->acquireDetachedView(rng,...) returns a direct view of the range of data request...
void scalarProds(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const
Return the scalar product of each column in two multi-vectors in the vector space.
virtual RCP< VectorBase< Scalar > > createMember() const =0
Create a vector member from the vector space.
RCP< const VectorSpaceBase< Scalar > > makeHaveOwnership(const RCP< const VectorSpaceBase< Scalar > > &vs)
Helper function that clones a VectorSpaceBase object if the RCP does not have ownership.
RCP< VectorBase< Scalar > > createMemberView(const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::SubVectorView< Scalar > &raw_v, const std::string &label="")
Create a vector member that is a non-const view of raw data.
virtual RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const =0
Create a set of vector members (a MultiVectorBase) from the vector space.
virtual Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const =0
Return the scalar product of two vectors in the vector space.
virtual RCP< VectorBase< Scalar > > createMemberView(const RTOpPack::SubVectorView< Scalar > &raw_v) const =0
Create a vector member that is a non-const view of raw vector data.
virtual Ordinal dim() const =0
Return the dimension of the vector space.
virtual RCP< const VectorSpaceFactoryBase< Scalar > > smallVecSpcFcty() const =0
Return a VectorSpaceFactoryBase object for the creation of (usually serial) vector spaces with a smal...
virtual RCP< const VectorBase< Scalar > > createMemberView(const RTOpPack::ConstSubVectorView< Scalar > &raw_v) const =0
Create a vector member that is a const view of raw vector data.
RCP< MultiVectorBase< Scalar > > createMembersView(const VectorSpaceBase< Scalar > &vs, const RTOpPack::SubMultiVectorView< Scalar > &raw_mv, const std::string &label="")
Calls createMembersView(Teuchos::rcp(&vs,false),raw_mv).
virtual bool isEuclidean() const
Return if this vector space has a Euclidean (identity) basis in which case the scalar product is the ...
RCP< VectorBase< Scalar > > createMemberView(const VectorSpaceBase< Scalar > &vs, const RTOpPack::SubVectorView< Scalar > &raw_v, const std::string &label="")
Calls createMemberView(Teuchos::rcp(&vs,false),raw_v).
RCP< MultiVectorBase< Scalar > > createMembersView(const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::SubMultiVectorView< Scalar > &raw_mv, const std::string &label="")
Create a multi-vector member that is a non-const view of raw data.
RCP< VectorBase< Scalar > > createMember(const RCP< const VectorSpaceBase< Scalar > > &vs, const std::string &label="")
Create a vector member from the vector space.
virtual bool isCompatible(const VectorSpaceBase< Scalar > &vecSpc) const =0
Compare the compatibility of two vector spaces.
virtual RCP< MultiVectorBase< Scalar > > createMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv) const =0
Create a multi-vector member that is a non-const view of raw multi-vector data.
RCP< MultiVectorBase< Scalar > > createMembers(const RCP< const VectorSpaceBase< Scalar > > &vs, const RCP< const VectorSpaceBase< Scalar > > &domain, const std::string &label="")
Create a set of vector members (a MultiVectorBase) from the vector space.
RCP< MultiVectorBase< Scalar > > createMembers(const RCP< const VectorSpaceBase< Scalar > > &vs, int numMembers, const std::string &label="")
Create a set of vector members (a MultiVectorBase) from the vector space.
virtual void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds) const =0
virtual RCP< const MultiVectorBase< Scalar > > createMembersView(const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv) const =0
Create a multi-vector member that is a const view of raw multi-vector data.
RCP< VectorBase< Scalar > > createMember(const VectorSpaceBase< Scalar > &vs, const std::string &label="")
Calls createMember(Teuchos::rcp(&vs,false)).
EStrideType
Determine if data is unit stride or non-unit stride.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Teuchos::Range1D Range1D
@ STRIDE_TYPE_NONUNIT
The stride between elements in an array is greater than or equal to one.
@ VIEW_TYPE_DETACHED
The view is a detached copy of the data.