FEI Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
base
fei_VectorTraits_CSVec.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
44
#ifndef _fei_VectorTraits_CSVec_hpp_
45
#define _fei_VectorTraits_CSVec_hpp_
46
47
#include <
fei_VectorTraits.hpp
>
48
#include <
fei_CSVec.hpp
>
49
50
namespace
fei
{
51
template
<>
52
struct
VectorTraits
<
CSVec
> {
53
static
const
char
*
typeName
()
54
{
return
(
"CSVec"
); }
55
56
static
int
setValues
(
CSVec
* vec,
int
firstLocalOffset,
57
double
scalar,
bool
isSolnVector=
false
)
58
{
59
set_values
(*vec, scalar);
60
return
(0);
61
}
62
63
static
int
putValuesIn
(
CSVec
* vec,
64
int
firstLocalOffset,
65
int
numValues,
const
int
* indices,
const
double
* values,
66
bool
sum_into,
67
bool
isSolnVector=
false
,
68
int
vectorIndex=0)
69
{
70
if
(sum_into) {
71
for
(
int
i=0; i<numValues; ++i) {
72
if
(indices[i] < 0)
continue
;
73
add_entry
(*vec, indices[i], values[i]);
74
}
75
}
76
else
{
77
for
(
int
i=0; i<numValues; ++i) {
78
if
(indices[i] < 0)
continue
;
79
put_entry
(*vec, indices[i], values[i]);
80
}
81
}
82
83
return
( 0 );
84
}
85
86
static
int
copyOut
(
CSVec
* vec,
87
int
firstLocalOffset,
88
int
numValues,
const
int
* indices,
double
* values,
89
bool
isSolnVector=
false
,
90
int
vectorIndex=0)
91
{
92
for
(
int
i=0; i<numValues; ++i) {
93
try
{
94
values[i] =
get_entry
(*vec, indices[i]);
95
}
96
catch
(...) {}
97
}
98
return
(0);
99
}
100
101
static
int
update
(
CSVec
* vec,
102
double
a,
103
const
CSVec
* x,
104
double
b)
105
{
return
(-1); }
106
107
};
108
}
//namespace fei
109
110
#endif
// _fei_VectorTraits_CSVec_hpp_
111
fei::CSVec
Definition
fei_CSVec.hpp:24
fei_CSVec.hpp
fei_VectorTraits.hpp
fei
Definition
fei_ArrayUtils.hpp:16
fei::put_entry
void put_entry(CSVec &vec, int eqn, double coef)
Definition
fei_CSVec.cpp:39
fei::get_entry
double get_entry(const CSVec &vec, int eqn)
Definition
fei_CSVec.cpp:58
fei::add_entry
void add_entry(CSVec &vec, int eqn, double coef)
Definition
fei_CSVec.hpp:56
fei::set_values
void set_values(CSVec &vec, double scalar)
Definition
fei_CSVec.cpp:101
fei::VectorTraits< CSVec >::putValuesIn
static int putValuesIn(CSVec *vec, int firstLocalOffset, int numValues, const int *indices, const double *values, bool sum_into, bool isSolnVector=false, int vectorIndex=0)
Definition
fei_VectorTraits_CSVec.hpp:63
fei::VectorTraits< CSVec >::update
static int update(CSVec *vec, double a, const CSVec *x, double b)
Definition
fei_VectorTraits_CSVec.hpp:101
fei::VectorTraits< CSVec >::copyOut
static int copyOut(CSVec *vec, int firstLocalOffset, int numValues, const int *indices, double *values, bool isSolnVector=false, int vectorIndex=0)
Definition
fei_VectorTraits_CSVec.hpp:86
fei::VectorTraits< CSVec >::setValues
static int setValues(CSVec *vec, int firstLocalOffset, double scalar, bool isSolnVector=false)
Definition
fei_VectorTraits_CSVec.hpp:56
fei::VectorTraits< CSVec >::typeName
static const char * typeName()
Definition
fei_VectorTraits_CSVec.hpp:53
fei::VectorTraits
Definition
fei_VectorTraits.hpp:52
Generated by
1.17.0