Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
support
operator_vector
adapter_support
Thyra_SerialVectorSpaceConverterBase.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_SERIAL_VECTOR_SPACE_CONVERTED_BASE_HPP
11
#define THYRA_SERIAL_VECTOR_SPACE_CONVERTED_BASE_HPP
12
13
#include "Thyra_VectorSpaceConverterBase.hpp"
14
#include "Thyra_DetachedMultiVectorView.hpp"
15
16
17
namespace
Thyra {
18
19
29
template
<
class
ScalarFrom,
class
ScalarTo>
30
class
SerialVectorSpaceConverterBase
31
:
virtual
public
VectorSpaceConverterBase
<ScalarFrom,ScalarTo>
32
{
33
public
:
34
37
39
virtual
void
convert
(
40
const
MultiVectorBase<ScalarFrom>
&mv_from,
41
MultiVectorBase<ScalarTo>
*mv_to
42
)
const
;
43
45
46
};
47
48
49
// Implementation
50
51
52
template
<
class
ScalarFrom,
class
ScalarTo>
53
void
SerialVectorSpaceConverterBase<ScalarFrom,ScalarTo>::convert
(
54
const
MultiVectorBase<ScalarFrom>
&mv_from,
55
MultiVectorBase<ScalarTo>
*mv_to
56
)
const
57
{
58
#ifdef TEUCHOS_DEBUG
59
TEUCHOS_TEST_FOR_EXCEPT
(mv_to==NULL);
60
#endif
61
ConstDetachedMultiVectorView<ScalarFrom>
emv_from(mv_from);
62
DetachedMultiVectorView<ScalarTo>
emv_to(*mv_to);
63
#ifdef TEUCHOS_DEBUG
64
TEUCHOS_TEST_FOR_EXCEPT
(emv_from.
subDim
() != emv_to.
subDim
());
65
TEUCHOS_TEST_FOR_EXCEPT
(emv_from.
numSubCols
() != emv_to.
numSubCols
());
66
#endif
67
for
( Ordinal j = 0; j < emv_from.
numSubCols
(); ++j ) {
68
for
( Ordinal i = 0; i < emv_from.
subDim
(); ++i ) {
69
emv_to(i,j) = emv_from(i,j);
// ToDo: Make this faster using optimized copy functions?
70
}
71
}
72
}
73
74
75
}
// namespace Thyra
76
77
78
#endif
// THYRA_SERIAL_VECTOR_SPACE_CONVERTED_BASE_HPP
Thyra::ConstDetachedMultiVectorView
Create an explicit non-mutable (const) view of a MultiVectorBase object.
Definition
Thyra_DetachedMultiVectorView.hpp:25
Thyra::ConstDetachedMultiVectorView::numSubCols
Ordinal numSubCols() const
Definition
Thyra_DetachedMultiVectorView.hpp:50
Thyra::ConstDetachedMultiVectorView::subDim
Ordinal subDim() const
Definition
Thyra_DetachedMultiVectorView.hpp:46
Thyra::DetachedMultiVectorView
Create an explicit mutable (non-const) view of a MultiVectorBase object.
Definition
Thyra_DetachedMultiVectorView.hpp:76
Thyra::DetachedMultiVectorView::numSubCols
Ordinal numSubCols() const
Definition
Thyra_DetachedMultiVectorView.hpp:101
Thyra::DetachedMultiVectorView::subDim
Ordinal subDim() const
Definition
Thyra_DetachedMultiVectorView.hpp:97
Thyra::MultiVectorBase
Interface for a collection of column vectors called a multi-vector.
Definition
Thyra_MultiVectorBase_decl.hpp:464
Thyra::SerialVectorSpaceConverterBase
Node base class for converting serial multi-vectors (and vectors) from one scalar type to another.
Definition
Thyra_SerialVectorSpaceConverterBase.hpp:32
Thyra::SerialVectorSpaceConverterBase::convert
virtual void convert(const MultiVectorBase< ScalarFrom > &mv_from, MultiVectorBase< ScalarTo > *mv_to) const
Definition
Thyra_SerialVectorSpaceConverterBase.hpp:53
Thyra::VectorSpaceConverterBase
Base interface for a factory that converts vector space types and vectors and multi-vectors from one ...
Definition
Thyra_VectorSpaceConverterBase.hpp:39
TEUCHOS_TEST_FOR_EXCEPT
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Generated by
1.17.0