Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_LongLongSerialDenseVector.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_LONGLONGSERIALDENSEVECTOR_H
45 #define EPETRA_LONGLONGSERIALDENSEVECTOR_H
46 
47 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include "Epetra_ConfigDefs.h"
56 #include "Epetra_Object.h"
58 
59 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
60 
62 
97 //=========================================================================
99 
100  public:
101 
103 
109 
111 
120  Epetra_LongLongSerialDenseVector(int Length_in);
121 
123 
133  Epetra_LongLongSerialDenseVector(Epetra_DataAccess CV_in, long long* Values_in, int Length_in);
134 
136 
138 
140 
150  int Size(int Length_in) {return(Epetra_LongLongSerialDenseMatrix::Shape(Length_in, 1));};
151 
153 
164  int Resize(int Length_in) {return(Epetra_LongLongSerialDenseMatrix::Reshape(Length_in, 1));};
165 
168 
169  //bring the base-class operator() into the current scope, in order to tell the
170  //compiler that we intend to overload it, rather than hide it.
171  using Epetra_LongLongSerialDenseMatrix::operator();
172 
174 
180  long long& operator () (int Index);
181 
183 
189  const long long& operator () (int Index) const;
190 
192 
198  long long& operator [] (int Index);
199 
201 
207  const long long& operator [] (int Index) const;
208 
210 
216  int Random();
217 
219  int Length() const {return(M_);};
220 
222  long long* Values() {return(A_);};
223 
225  const long long* Values() const {return(A_);};
226 
228  Epetra_DataAccess CV() const {return(CV_);};
229 
231 
238 
240 
241  virtual void Print(std::ostream& os) const;
244 
246 
247 
248  //Bring the base-class MakeViewOf method into the current scope so that the
249  //compiler knows we intend to overload it, rather than hide it.
251 
253 
269  int MakeViewOf(const Epetra_LongLongSerialDenseVector& Source);
271 };
272 
273 // inlined definitions of op() and op[]
274 //=========================================================================
275 inline long long& Epetra_LongLongSerialDenseVector::operator() (int Index) {
276 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
277  if(Index >= M_ || Index < 0)
278  throw ReportError("Index = " + toString(Index) +
279  " Out of Range 0 - " + toString(M_-1),-1);
280 #endif
281  return(A_[Index]);
282 }
283 //=========================================================================
284 inline const long long& Epetra_LongLongSerialDenseVector::operator() (int Index) const {
285 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
286  if(Index >= M_ || Index < 0)
287  throw ReportError("Index = " + toString(Index) +
288  " Out of Range 0 - " + toString(M_-1),-1);
289 #endif
290  return(A_[Index]);
291 }
292 //=========================================================================
294 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
295  if(Index >= M_ || Index < 0)
296  throw ReportError("Index = " + toString(Index) +
297  " Out of Range 0 - " + toString(M_-1),-1);
298 #endif
299  return(A_[Index]);
300 }
301 //=========================================================================
302 inline const long long& Epetra_LongLongSerialDenseVector::operator [] (int Index) const {
303 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
304  if(Index >= M_ || Index < 0)
305  throw ReportError("Index = " + toString(Index) +
306  " Out of Range 0 - " + toString(M_-1),-1);
307 #endif
308  return(A_[Index]);
309 }
310 //=========================================================================
311 
312 #endif // EPETRA_NO_64BIT_GLOBAL_INDICES
313 
314 #endif /* EPETRA_LONGLONGSERIALDENSEVECTOR_H */
long long & operator[](int Index)
Element access function.
int MakeViewOf(const Epetra_LongLongSerialDenseMatrix &Source)
Reset an existing LongLongSerialDenseMatrix to point to another Matrix.
Epetra_DataAccess CV() const
Returns the data access mode of the this vector.
long long * Values()
Returns pointer to the values in vector.
int Length() const
Returns length of vector.
int Size(int Length_in)
Set length of a Epetra_LongLongSerialDenseVector object; init values to zero.
const long long * Values() const
Returns const pointer to the values in vector.
std::string toString(const int &x) const
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
int Random()
Set matrix values to random numbers.
long long & operator()(int Index)
Element access function.
int Shape(int NumRows, int NumCols)
Set dimensions of a Epetra_LongLongSerialDenseMatrix object; init values to zero. ...
int Reshape(int NumRows, int NumCols)
Reshape a Epetra_LongLongSerialDenseMatrix object.
Epetra_LongLongSerialDenseMatrix & operator=(const Epetra_LongLongSerialDenseMatrix &Source)
Copy from one matrix to another.
long long * operator[](int ColIndex)
Column access function.
long long & operator()(int RowIndex, int ColIndex)
Element access function.
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
virtual void Print(std::ostream &os) const
Print service methods; defines behavior of ostream &lt;&lt; operator.
Epetra_DataAccess
int Resize(int Length_in)
Resize a Epetra_LongLongSerialDenseVector object.
Epetra_LongLongSerialDenseMatrix: A class for constructing and using general dense integer matrices...