Epetra Package Browser (Single Doxygen Collection)
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Epetra_IntSerialDenseVector.h
Go to the documentation of this file.
1
/*
2
//@HEADER
3
// ************************************************************************
4
//
5
// Epetra: Linear Algebra Services Package
6
// Copyright 2011 Sandia Corporation
7
//
8
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9
// the U.S. Government retains certain rights in this software.
10
//
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are
13
// met:
14
//
15
// 1. Redistributions of source code must retain the above copyright
16
// notice, this list of conditions and the following disclaimer.
17
//
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice, this list of conditions and the following disclaimer in the
20
// documentation and/or other materials provided with the distribution.
21
//
22
// 3. Neither the name of the Corporation nor the names of the
23
// contributors may be used to endorse or promote products derived from
24
// this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
//
38
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39
//
40
// ************************************************************************
41
//@HEADER
42
*/
43
44
#ifndef EPETRA_INTSERIALDENSEVECTOR_H
45
#define EPETRA_INTSERIALDENSEVECTOR_H
46
47
#include "
Epetra_Object.h
"
48
#include "
Epetra_IntSerialDenseMatrix.h
"
49
51
84
85
86
//=========================================================================
87
class
EPETRA_LIB_DLL_EXPORT
Epetra_IntSerialDenseVector
:
public
Epetra_IntSerialDenseMatrix
{
88
89
public
:
90
92
97
Epetra_IntSerialDenseVector
();
98
100
109
Epetra_IntSerialDenseVector
(
int
Length_in);
110
112
122
Epetra_IntSerialDenseVector
(
Epetra_DataAccess
CV_in,
int
* Values_in,
int
Length_in);
123
125
126
Epetra_IntSerialDenseVector
(
const
Epetra_IntSerialDenseVector
& Source);
127
129
139
int
Size
(
int
Length_in) {
return
(
Epetra_IntSerialDenseMatrix::Shape
(Length_in, 1));};
140
142
153
int
Resize
(
int
Length_in) {
return
(
Epetra_IntSerialDenseMatrix::Reshape
(Length_in, 1));};
154
156
virtual
~Epetra_IntSerialDenseVector
();
157
158
//bring the base-class operator() into the current scope, in order to tell the
159
//compiler that we intend to overload it, rather than hide it.
160
using
Epetra_IntSerialDenseMatrix::operator();
161
163
169
int
&
operator ()
(
int
Index);
170
172
178
const
int
&
operator ()
(
int
Index)
const
;
179
181
187
int
&
operator []
(
int
Index);
188
190
196
const
int
&
operator []
(
int
Index)
const
;
197
199
205
int
Random
();
206
208
int
Length
()
const
{
return
(
M_
);};
209
211
int
*
Values
() {
return
(
A_
);};
212
214
const
int
*
Values
()
const
{
return
(
A_
);};
215
217
Epetra_DataAccess
CV
()
const
{
return
(
CV_
);};
218
220
226
Epetra_IntSerialDenseVector
&
operator =
(
const
Epetra_IntSerialDenseVector
& Source);
227
229
230
231
virtual
void
Print
(std::ostream& os)
const
;
233
235
236
237
//Bring the base-class MakeViewOf method into the current scope so that the
238
//compiler knows we intend to overload it, rather than hide it.
239
using
Epetra_IntSerialDenseMatrix::MakeViewOf
;
240
242
257
258
int
MakeViewOf
(
const
Epetra_IntSerialDenseVector
& Source);
260
};
261
262
// inlined definitions of op() and op[]
263
//=========================================================================
264
inline
int
&
Epetra_IntSerialDenseVector::operator()
(
int
Index) {
265
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
266
if
(Index >=
M_
|| Index < 0)
267
throw
ReportError
(
"Index = "
+
toString
(Index) +
268
" Out of Range 0 - "
+
toString
(
M_
-1),-1);
269
#endif
270
return
(
A_
[Index]);
271
}
272
//=========================================================================
273
inline
const
int
&
Epetra_IntSerialDenseVector::operator()
(
int
Index)
const
{
274
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
275
if
(Index >=
M_
|| Index < 0)
276
throw
ReportError
(
"Index = "
+
toString
(Index) +
277
" Out of Range 0 - "
+
toString
(
M_
-1),-1);
278
#endif
279
return
(
A_
[Index]);
280
}
281
//=========================================================================
282
inline
int
&
Epetra_IntSerialDenseVector::operator []
(
int
Index) {
283
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
284
if
(Index >=
M_
|| Index < 0)
285
throw
ReportError
(
"Index = "
+
toString
(Index) +
286
" Out of Range 0 - "
+
toString
(
M_
-1),-1);
287
#endif
288
return
(
A_
[Index]);
289
}
290
//=========================================================================
291
inline
const
int
&
Epetra_IntSerialDenseVector::operator []
(
int
Index)
const
{
292
#ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
293
if
(Index >=
M_
|| Index < 0)
294
throw
ReportError
(
"Index = "
+
toString
(Index) +
295
" Out of Range 0 - "
+
toString
(
M_
-1),-1);
296
#endif
297
return
(
A_
[Index]);
298
}
299
//=========================================================================
300
301
#endif
/* EPETRA_INTSERIALDENSEVECTOR_H */
Epetra_DataAccess
Epetra_DataAccess
Definition
Epetra_DataAccess.h:55
Epetra_IntSerialDenseMatrix.h
Epetra_Object.h
Epetra_IntSerialDenseMatrix::A_
int * A_
Definition
Epetra_IntSerialDenseMatrix.h:358
Epetra_IntSerialDenseMatrix::Shape
int Shape(int NumRows, int NumCols)
Set dimensions of a Epetra_IntSerialDenseMatrix object; init values to zero.
Definition
Epetra_IntSerialDenseMatrix.cpp:162
Epetra_IntSerialDenseMatrix::Epetra_IntSerialDenseMatrix
Epetra_IntSerialDenseMatrix()
Default constructor; defines a zero size object.
Definition
Epetra_IntSerialDenseMatrix.cpp:47
Epetra_IntSerialDenseMatrix::MakeViewOf
int MakeViewOf(const Epetra_IntSerialDenseMatrix &Source)
Reset an existing IntSerialDenseMatrix to point to another Matrix.
Definition
Epetra_IntSerialDenseMatrix.cpp:281
Epetra_IntSerialDenseMatrix::M_
int M_
Definition
Epetra_IntSerialDenseMatrix.h:355
Epetra_IntSerialDenseMatrix::Reshape
int Reshape(int NumRows, int NumCols)
Reshape a Epetra_IntSerialDenseMatrix object.
Definition
Epetra_IntSerialDenseMatrix.cpp:135
Epetra_IntSerialDenseMatrix::operator[]
int * operator[](int ColIndex)
Column access function.
Definition
Epetra_IntSerialDenseMatrix.h:388
Epetra_IntSerialDenseMatrix::Print
virtual void Print(std::ostream &os) const
Print service methods; defines behavior of ostream << operator.
Definition
Epetra_IntSerialDenseMatrix.cpp:346
Epetra_IntSerialDenseMatrix::operator=
Epetra_IntSerialDenseMatrix & operator=(const Epetra_IntSerialDenseMatrix &Source)
Copy from one matrix to another.
Definition
Epetra_IntSerialDenseMatrix.cpp:200
Epetra_IntSerialDenseMatrix::CV_
Epetra_DataAccess CV_
Definition
Epetra_IntSerialDenseMatrix.h:353
Epetra_IntSerialDenseMatrix::Random
int Random()
Set matrix values to random numbers.
Definition
Epetra_IntSerialDenseMatrix.cpp:370
Epetra_IntSerialDenseMatrix::operator()
int & operator()(int RowIndex, int ColIndex)
Element access function.
Definition
Epetra_IntSerialDenseMatrix.h:364
Epetra_IntSerialDenseVector
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
Definition
Epetra_IntSerialDenseVector.h:87
Epetra_IntSerialDenseVector::operator[]
int & operator[](int Index)
Element access function.
Definition
Epetra_IntSerialDenseVector.h:282
Epetra_IntSerialDenseVector::Resize
int Resize(int Length_in)
Resize a Epetra_IntSerialDenseVector object.
Definition
Epetra_IntSerialDenseVector.h:153
Epetra_IntSerialDenseVector::Size
int Size(int Length_in)
Set length of a Epetra_IntSerialDenseVector object; init values to zero.
Definition
Epetra_IntSerialDenseVector.h:139
Epetra_IntSerialDenseVector::CV
Epetra_DataAccess CV() const
Returns the data access mode of the this vector.
Definition
Epetra_IntSerialDenseVector.h:217
Epetra_IntSerialDenseVector::operator()
int & operator()(int Index)
Element access function.
Definition
Epetra_IntSerialDenseVector.h:264
Epetra_IntSerialDenseVector::Values
const int * Values() const
Returns const pointer to the values in vector.
Definition
Epetra_IntSerialDenseVector.h:214
Epetra_IntSerialDenseVector::Length
int Length() const
Returns length of vector.
Definition
Epetra_IntSerialDenseVector.h:208
Epetra_IntSerialDenseVector::Epetra_IntSerialDenseVector
Epetra_IntSerialDenseVector()
Default constructor; defines a zero size object.
Definition
Epetra_IntSerialDenseVector.cpp:46
Epetra_IntSerialDenseVector::Values
int * Values()
Returns pointer to the values in vector.
Definition
Epetra_IntSerialDenseVector.h:211
Epetra_Object::ReportError
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
Definition
Epetra_Object.cpp:103
Epetra_Object::toString
std::string toString(const int &x) const
Definition
Epetra_Object.h:145
Generated by
1.17.0