Epetra_IntSerialDenseVector.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006               Epetra: Linear Algebra Services Package 
00007                 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_INTSERIALDENSEVECTOR_H
00033 #define EPETRA_INTSERIALDENSEVECTOR_H
00034 
00035 #include "Epetra_Object.h" 
00036 #include "Epetra_IntSerialDenseMatrix.h"
00037 
00039 
00074 //=========================================================================
00075 class Epetra_IntSerialDenseVector : public Epetra_IntSerialDenseMatrix{
00076 
00077   public:
00078   
00080 
00085   Epetra_IntSerialDenseVector();
00086   
00088 
00097   Epetra_IntSerialDenseVector(int Length_in);
00098 
00100 
00110   Epetra_IntSerialDenseVector(Epetra_DataAccess CV_in, int* Values_in, int Length_in);
00111   
00113   
00114   Epetra_IntSerialDenseVector(const Epetra_IntSerialDenseVector& Source);
00115   
00117 
00127   int Size(int Length_in) {return(Epetra_IntSerialDenseMatrix::Shape(Length_in, 1));};
00128   
00130 
00141   int Resize(int Length_in) {return(Epetra_IntSerialDenseMatrix::Reshape(Length_in, 1));};
00142 
00144   virtual ~Epetra_IntSerialDenseVector ();
00145 
00146   //bring the base-class operator() into the current scope, in order to tell the
00147   //compiler that we intend to overload it, rather than hide it.
00148   using Epetra_IntSerialDenseMatrix::operator();
00149 
00151 
00157     int& operator () (int Index);
00158 
00160 
00166     const int& operator () (int Index) const;
00167 
00169 
00175     int& operator [] (int Index);
00176 
00178 
00184     const int& operator [] (int Index) const;
00185     
00187 
00193   int Random();
00194 
00196   int Length() const {return(M_);};
00197 
00199   int* Values() {return(A_);};
00200 
00202   const int* Values() const {return(A_);};
00203 
00205   Epetra_DataAccess CV() const {return(CV_);};
00206 
00208 
00214     Epetra_IntSerialDenseVector& operator = (const Epetra_IntSerialDenseVector& Source);
00215 
00217 
00218 
00219   virtual void Print(ostream& os) const;
00221 
00223 
00224 
00225   //Bring the base-class MakeViewOf method into the current scope so that the
00226   //compiler knows we intend to overload it, rather than hide it.
00227   using Epetra_IntSerialDenseMatrix::MakeViewOf;
00228 
00230 
00246   int MakeViewOf(const Epetra_IntSerialDenseVector& Source);
00248 };
00249 
00250 // inlined definitions of op() and op[]
00251 //=========================================================================
00252 inline int& Epetra_IntSerialDenseVector::operator() (int Index) {
00253 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00254   if(Index >= M_ || Index < 0) 
00255     throw ReportError("Index = " + toString(Index) + 
00256                       " Out of Range 0 - " + toString(M_-1),-1);
00257 #endif
00258   return(A_[Index]);
00259 }
00260 //=========================================================================
00261 inline const int& Epetra_IntSerialDenseVector::operator() (int Index) const {
00262 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00263   if(Index >= M_ || Index < 0) 
00264     throw ReportError("Index = " + toString(Index) + 
00265                       " Out of Range 0 - " + toString(M_-1),-1);
00266 #endif
00267    return(A_[Index]);
00268 }
00269 //=========================================================================
00270 inline int& Epetra_IntSerialDenseVector::operator [] (int Index) {
00271 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00272   if(Index >= M_ || Index < 0) 
00273     throw ReportError("Index = " + toString(Index) + 
00274                       " Out of Range 0 - " + toString(M_-1),-1);
00275 #endif
00276    return(A_[Index]);
00277 }
00278 //=========================================================================
00279 inline const int& Epetra_IntSerialDenseVector::operator [] (int Index) const {
00280 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00281   if(Index >= M_ || Index < 0) 
00282     throw ReportError("Index = " + toString(Index) + 
00283                       " Out of Range 0 - " + toString(M_-1),-1);
00284 #endif
00285    return(A_[Index]);
00286 }
00287 //=========================================================================
00288 
00289 #endif /* EPETRA_INTSERIALDENSEVECTOR_H */

Generated on Wed May 12 21:41:05 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7