FEI Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
support-Trilinos
fei_Aztec_LSVector.hpp
Go to the documentation of this file.
1
/*
2
// @HEADER
3
// ************************************************************************
4
// FEI: Finite Element Interface to Linear Solvers
5
// Copyright (2005) Sandia Corporation.
6
//
7
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
8
// U.S. Government retains certain rights in this software.
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 Alan Williams (william@sandia.gov)
38
//
39
// ************************************************************************
40
// @HEADER
41
*/
42
43
#ifndef _fei_Aztec_LSVector_hpp_
44
#define _fei_Aztec_LSVector_hpp_
45
46
47
#include <
fei_SharedPtr.hpp
>
48
49
//
50
// This class provides a vector that can be used with the AztecDMSR_matrix
51
// and the AztecDVBR_Matrix.
52
//
53
// An important restriction to note:
54
//
55
// * An Aztec_LSVector can not be constructed until AFTER the AztecDMSR_Matrix
56
// (or AztecDVBR_Matrix) that it is to be used with has been completely
57
// initialized and filled (e.g., A.loadComplete() has been called (which
58
// means, most importantly, that AZ_transform has been called)). This is
59
// because the local data array for an aztec vector must be allocated
60
// with enough extra space to hold 'boundary elements' that are exchanged
61
// with other processors during the calculation of a parallel matrix-vector
62
// product, and we don't know how much memory that requires until after
63
// AZ_transform has been called.
64
//
65
// * Also, the calling code is responsible for keeping track of any
66
// re-ordering that AZ_transform has done. i.e., Aztec_LSVector is just
67
// like a raw array with respect to indexing of entries. If v is an
68
// instantiation of an Aztec_LSVector, then v[9] literally returns the
69
// entry at position 9 (the 10th entry, since indexing is 0-based).
70
//
71
namespace
fei_trilinos
{
72
73
class
Aztec_Map
;
74
76
class
Aztec_LSVector
{
77
public
:
78
// Constructor.
79
Aztec_LSVector
(
fei::SharedPtr<Aztec_Map>
map,
int
* data_org);
80
81
Aztec_LSVector
(
const
Aztec_LSVector
& source);
// copy constructor
82
83
virtual
~Aztec_LSVector
();
84
85
Aztec_LSVector
*
newVector
()
const
;
86
87
// Mathematical functions.
88
double
dotProd
(
const
Aztec_LSVector
& y)
const
;
89
void
scale
(
double
s);
90
void
addVec
(
double
s,
const
Aztec_LSVector
& c);
91
double
norm
()
const
;
92
double
norm1
()
const
;
93
94
// operator=
95
Aztec_LSVector
&
operator =
(
const
Aztec_LSVector
& rhs);
96
97
// Access functions.
98
double
&
operator []
(
int
index);
99
const
double
&
operator []
(
int
index)
const
;
100
101
void
put
(
double
scalar);
102
103
const
double
*
startPointer
()
const
{
return
localCoeffs_
;};
104
105
//Special function
106
bool
readFromFile
(
const
char
*fileName);
107
bool
writeToFile
(
const
char
*fileName)
const
;
108
109
protected
:
110
virtual
void
assign
(
const
Aztec_LSVector
& rhs);
111
112
private
:
113
void
checkInput
();
114
int
inUpdate
(
int
globalIndex,
int
& localIndex)
const
;
115
116
fei::SharedPtr<Aztec_Map>
amap_
;
117
double
*
localCoeffs_
;
// local vector coefficients
118
int
length_
;
119
};
120
121
}
//namespace fei_trilinos
122
123
#endif
fei::SharedPtr
Definition
fei_SharedPtr.hpp:65
fei_trilinos::Aztec_LSVector::checkInput
void checkInput()
fei_trilinos::Aztec_LSVector::norm1
double norm1() const
fei_trilinos::Aztec_LSVector::inUpdate
int inUpdate(int globalIndex, int &localIndex) const
fei_trilinos::Aztec_LSVector::addVec
void addVec(double s, const Aztec_LSVector &c)
fei_trilinos::Aztec_LSVector::put
void put(double scalar)
fei_trilinos::Aztec_LSVector::~Aztec_LSVector
virtual ~Aztec_LSVector()
fei_trilinos::Aztec_LSVector::writeToFile
bool writeToFile(const char *fileName) const
fei_trilinos::Aztec_LSVector::readFromFile
bool readFromFile(const char *fileName)
fei_trilinos::Aztec_LSVector::localCoeffs_
double * localCoeffs_
Definition
fei_Aztec_LSVector.hpp:117
fei_trilinos::Aztec_LSVector::amap_
fei::SharedPtr< Aztec_Map > amap_
Definition
fei_Aztec_LSVector.hpp:116
fei_trilinos::Aztec_LSVector::assign
virtual void assign(const Aztec_LSVector &rhs)
fei_trilinos::Aztec_LSVector::operator[]
double & operator[](int index)
fei_trilinos::Aztec_LSVector::length_
int length_
Definition
fei_Aztec_LSVector.hpp:118
fei_trilinos::Aztec_LSVector::newVector
Aztec_LSVector * newVector() const
fei_trilinos::Aztec_LSVector::Aztec_LSVector
Aztec_LSVector(fei::SharedPtr< Aztec_Map > map, int *data_org)
fei_trilinos::Aztec_LSVector::operator=
Aztec_LSVector & operator=(const Aztec_LSVector &rhs)
fei_trilinos::Aztec_LSVector::startPointer
const double * startPointer() const
Definition
fei_Aztec_LSVector.hpp:103
fei_trilinos::Aztec_LSVector::norm
double norm() const
fei_trilinos::Aztec_LSVector::scale
void scale(double s)
fei_trilinos::Aztec_LSVector::Aztec_LSVector
Aztec_LSVector(const Aztec_LSVector &source)
fei_trilinos::Aztec_LSVector::dotProd
double dotProd(const Aztec_LSVector &y) const
fei_trilinos::Aztec_Map
Definition
fei_Aztec_Map.hpp:62
fei_SharedPtr.hpp
fei_trilinos
Definition
fei_Aztec_BlockMap.hpp:59
Generated by
1.17.0