Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
interfaces
operator_vector
fundamental
Thyra_OperatorVectorTypes.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_OPERATOR_VECTOR_TYPES_HPP
43
#define THYRA_OPERATOR_VECTOR_TYPES_HPP
44
45
#include "Thyra_ConfigDefs.hpp"
46
#include "RTOpPack_Types.hpp"
47
#include "
Teuchos_Range1D.hpp
"
48
#include "
Teuchos_RCP.hpp
"
49
#include "Teuchos_FancyOStream.hpp"
50
#include "
Teuchos_Array.hpp
"
51
#include "Teuchos_ArrayRCP.hpp"
52
#include "Teuchos_ArrayView.hpp"
53
#include "Teuchos_Tuple.hpp"
54
#include "
Teuchos_ParameterList.hpp
"
55
#include "
Teuchos_ScalarTraits.hpp
"
56
#include "
Teuchos_TypeNameTraits.hpp
"
57
58
59
namespace
Thyra {
60
61
// Using declarations from Teuchos
62
67
using
Teuchos::Ptr;
72
using
Teuchos::RCP;
77
using
Teuchos::Array;
82
using
Teuchos::ArrayView;
87
using
Teuchos::ArrayRCP;
92
using
Teuchos::Tuple;
97
typedef
Teuchos::Range1D
Range1D
;
102
using
Teuchos::FancyOStream
;
107
using
Teuchos::ParameterList
;
112
using
Teuchos::ScalarTraits
;
117
using
Teuchos::typeName
;
122
using
Teuchos::TypeNameTraits
;
127
typedef
Teuchos::Ordinal Ordinal;
128
129
134
enum
EConj {
135
NONCONJ_ELE
136
,CONJ_ELE
137
};
138
139
144
inline
145
const
char
*
toString
(EConj conj)
146
{
147
switch
(conj) {
148
case
NONCONJ_ELE:
return
"NONCONJ_ELE"
;
149
case
CONJ_ELE:
return
"CONJ_ELE"
;
150
default
:
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
151
}
152
// return "BAD"; // Should never be called!
153
}
154
155
160
enum
EOpTransp {
162
NOTRANS
,
166
CONJ,
168
TRANS,
172
CONJTRANS
173
};
174
175
180
inline
181
const
char
*
toString
(EOpTransp transp)
182
{
183
switch
(transp) {
184
case
NOTRANS
:
return
"NOTRANS"
;
185
case
CONJ:
return
"CONJ"
;
186
case
TRANS:
return
"TRANS"
;
187
case
CONJTRANS:
return
"CONJTRANS"
;
188
default
:
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
189
}
190
// return "BAD"; // Should never be called!
191
}
192
193
199
inline
200
EOpTransp
real_trans
(EOpTransp transp)
201
{
202
switch
(transp) {
203
case
NOTRANS
:
return
NOTRANS
;
204
case
CONJ:
return
NOTRANS
;
205
case
TRANS:
return
TRANS;
206
case
CONJTRANS:
return
TRANS;
207
default
:
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
208
}
209
// return NOTRANS; // Will never be called!
210
}
211
212
217
inline
218
EOpTransp
not_trans
( EOpTransp transp )
219
{
220
switch
(transp) {
221
case
NOTRANS
:
return
TRANS;
222
case
CONJ:
return
CONJTRANS;
223
case
TRANS:
return
CONJ;
224
case
CONJTRANS:
return
NOTRANS
;
225
default
:
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
226
}
227
// return NOTRANS; // Will never be called!
228
}
229
230
235
inline
236
EOpTransp
trans_trans
( EOpTransp trans1, EOpTransp trans2 )
237
{
238
if
( trans1 == trans2 )
239
return
NOTRANS
;
240
if
( trans1 ==
NOTRANS
)
241
return
trans2;
242
if
( trans2 ==
NOTRANS
)
243
return
trans1;
244
if
( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) )
245
return
CONJTRANS;
246
if
( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) )
247
return
CONJ;
248
if
( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) )
249
return
TRANS;
250
else
251
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
252
// return NOTRANS; // Will never be executed!
253
}
254
255
260
inline
261
EConj
transToConj
( EOpTransp trans )
262
{
263
switch
(trans) {
264
case
NOTRANS
:
return
NONCONJ_ELE;
265
case
CONJ:
return
CONJ_ELE;
266
case
TRANS:
return
NONCONJ_ELE;
267
case
CONJTRANS:
return
CONJ_ELE;
268
default
:
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
269
}
270
// return NONCONJ_ELE; // Will never be called!
271
}
272
277
inline
278
EOpTransp
applyConjToTrans
( EConj conj )
279
{
280
switch
(conj) {
281
case
NONCONJ_ELE:
return
NOTRANS
;
282
case
CONJ_ELE:
return
CONJ;
283
default
:
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
284
}
285
// return NOTRANS; // Will never be called!
286
}
287
288
293
inline
294
EOpTransp
applyTransposeConjToTrans
( EConj conj )
295
{
296
switch
(conj) {
297
case
NONCONJ_ELE:
return
TRANS;
298
case
CONJ_ELE:
return
CONJTRANS;
299
default
:
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
300
}
301
// return NOTRANS; // Will never be called!
302
}
303
309
enum
EViewType
{
310
VIEW_TYPE_DIRECT
311
,
VIEW_TYPE_DETACHED
312
};
313
314
319
enum
EStrideType
{
321
STRIDE_TYPE_UNIT
,
323
STRIDE_TYPE_NONUNIT
324
};
325
326
327
namespace
Exceptions {
328
329
335
class
UnInitialized :
public
std::logic_error
336
{
public
: UnInitialized(
const
std::string& what_arg)
337
: std::logic_error(what_arg) {}};
338
339
344
class
IncompatibleVectorSpaces :
public
std::logic_error
345
{
public
:
346
IncompatibleVectorSpaces(
const
std::string& what_arg)
347
: std::logic_error(what_arg) {}
348
};
349
350
355
class
OpNotSupported :
public
std::logic_error
356
{
public
: OpNotSupported(
const
std::string& what_arg)
357
: std::logic_error(what_arg) {}};
358
359
360
}
// namespace Exceptions
361
362
363
// Fundamental ANA operator/vector interface classes
364
365
366
template
<
class
Scalar>
class
VectorSpaceFactoryBase
;
367
template
<
class
Scalar>
class
VectorSpaceBase
;
368
template
<
class
Scalar>
class
LinearOpBase
;
369
template
<
class
Scalar>
class
MultiVectorBase
;
370
template
<
class
Scalar>
class
VectorBase
;
371
372
373
}
// end namespace Thyra
374
375
376
#endif
// THYRA_OPERATOR_VECTOR_TYPES_HPP
Teuchos_Array.hpp
Teuchos_ParameterList.hpp
Teuchos_RCP.hpp
Teuchos_Range1D.hpp
Teuchos_ScalarTraits.hpp
Teuchos_TypeNameTraits.hpp
Teuchos::ParameterList
Teuchos::Range1D
Teuchos::TypeNameTraits
Thyra::LinearOpBase
Base class for all linear operators.
Definition
Thyra_LinearOpBase_decl.hpp:191
Thyra::MultiVectorBase
Interface for a collection of column vectors called a multi-vector.
Definition
Thyra_MultiVectorBase_decl.hpp:496
Thyra::VectorBase
Abstract interface for finite-dimensional dense vectors.
Definition
Thyra_VectorBase.hpp:147
Thyra::VectorSpaceBase
Abstract interface for objects that represent a space for vectors.
Definition
Thyra_VectorSpaceBase_decl.hpp:299
Thyra::VectorSpaceFactoryBase
Abstract interface for objects that can create vector spaces of a specified dimension.
Definition
Thyra_VectorSpaceFactoryBase.hpp:62
TEUCHOS_TEST_FOR_EXCEPT
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Thyra::toString
const char * toString(EOpTransp transp)
Return a string name for a EOpTransp value.
Definition
Thyra_OperatorVectorTypes.hpp:181
Thyra::EStrideType
EStrideType
Determine if data is unit stride or non-unit stride.
Definition
Thyra_OperatorVectorTypes.hpp:319
Thyra::applyTransposeConjToTrans
EOpTransp applyTransposeConjToTrans(EConj conj)
Convert from EConj to EOpTransp for forward apply.
Definition
Thyra_OperatorVectorTypes.hpp:294
Thyra::NOTRANS
NOTRANS
Type for the dimension of a vector space. `**/ typedef Teuchos::Ordinal Ordinal;.
Definition
Thyra_OperatorVectorTypes.hpp:162
Thyra::transToConj
EConj transToConj(EOpTransp trans)
Convert from EOpTransp to EConj.
Definition
Thyra_OperatorVectorTypes.hpp:261
Thyra::EViewType
EViewType
Determines if a view is a direct view of data or a detached copy of data.
Definition
Thyra_OperatorVectorTypes.hpp:309
Thyra::applyConjToTrans
EOpTransp applyConjToTrans(EConj conj)
Convert from EConj to EOpTransp for forward apply.
Definition
Thyra_OperatorVectorTypes.hpp:278
Thyra::Range1D
Teuchos::Range1D Range1D
Definition
Thyra_OperatorVectorTypes.hpp:97
Thyra::not_trans
EOpTransp not_trans(EOpTransp transp)
Perform a not operation on an EOpTransp value.
Definition
Thyra_OperatorVectorTypes.hpp:218
Thyra::real_trans
EOpTransp real_trans(EOpTransp transp)
Return NOTRANS or TRANS for real scalar valued operators and this also is used for determining struct...
Definition
Thyra_OperatorVectorTypes.hpp:200
Thyra::trans_trans
EOpTransp trans_trans(EOpTransp trans1, EOpTransp trans2)
Combine two transpose arguments.
Definition
Thyra_OperatorVectorTypes.hpp:236
Thyra::STRIDE_TYPE_UNIT
@ STRIDE_TYPE_UNIT
The stride between elements in an array is one.
Definition
Thyra_OperatorVectorTypes.hpp:321
Thyra::STRIDE_TYPE_NONUNIT
@ STRIDE_TYPE_NONUNIT
The stride between elements in an array is greater than or equal to one.
Definition
Thyra_OperatorVectorTypes.hpp:323
Thyra::VIEW_TYPE_DIRECT
@ VIEW_TYPE_DIRECT
The view is a direct view of data and no copies are made.
Definition
Thyra_OperatorVectorTypes.hpp:310
Thyra::VIEW_TYPE_DETACHED
@ VIEW_TYPE_DETACHED
The view is a detached copy of the data.
Definition
Thyra_OperatorVectorTypes.hpp:311
Teuchos::typeName
std::string typeName(const T &t)
Teuchos::FancyOStream
basic_FancyOStream< char > FancyOStream
Teuchos::ScalarTraits
Generated by
1.17.0