Epetra Package Browser (Single Doxygen Collection) Development
Epetra_IntSerialDenseVector.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ************************************************************************
00004 // 
00005 //               Epetra: Linear Algebra Services Package 
00006 //                 Copyright 2011 Sandia Corporation
00007 // 
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00039 // 
00040 // ************************************************************************
00041 //@HEADER
00042 */
00043 
00044 #ifndef EPETRA_INTSERIALDENSEVECTOR_H
00045 #define EPETRA_INTSERIALDENSEVECTOR_H
00046 
00047 #include "Epetra_Object.h" 
00048 #include "Epetra_IntSerialDenseMatrix.h"
00049 
00051 
00086 //=========================================================================
00087 class EPETRA_LIB_DLL_EXPORT Epetra_IntSerialDenseVector : public Epetra_IntSerialDenseMatrix{
00088 
00089   public:
00090   
00092 
00097   Epetra_IntSerialDenseVector();
00098   
00100 
00109   Epetra_IntSerialDenseVector(int Length_in);
00110 
00112 
00122   Epetra_IntSerialDenseVector(Epetra_DataAccess CV_in, int* Values_in, int Length_in);
00123   
00125   
00126   Epetra_IntSerialDenseVector(const Epetra_IntSerialDenseVector& Source);
00127   
00129 
00139   int Size(int Length_in) {return(Epetra_IntSerialDenseMatrix::Shape(Length_in, 1));};
00140   
00142 
00153   int Resize(int Length_in) {return(Epetra_IntSerialDenseMatrix::Reshape(Length_in, 1));};
00154 
00156   virtual ~Epetra_IntSerialDenseVector ();
00157 
00158   //bring the base-class operator() into the current scope, in order to tell the
00159   //compiler that we intend to overload it, rather than hide it.
00160   using Epetra_IntSerialDenseMatrix::operator();
00161 
00163 
00169     int& operator () (int Index);
00170 
00172 
00178     const int& operator () (int Index) const;
00179 
00181 
00187     int& operator [] (int Index);
00188 
00190 
00196     const int& operator [] (int Index) const;
00197     
00199 
00205   int Random();
00206 
00208   int Length() const {return(M_);};
00209 
00211   int* Values() {return(A_);};
00212 
00214   const int* Values() const {return(A_);};
00215 
00217   Epetra_DataAccess CV() const {return(CV_);};
00218 
00220 
00226     Epetra_IntSerialDenseVector& operator = (const Epetra_IntSerialDenseVector& Source);
00227 
00229 
00230 
00231   virtual void Print(ostream& os) const;
00233 
00235 
00236 
00237   //Bring the base-class MakeViewOf method into the current scope so that the
00238   //compiler knows we intend to overload it, rather than hide it.
00239   using Epetra_IntSerialDenseMatrix::MakeViewOf;
00240 
00242 
00258   int MakeViewOf(const Epetra_IntSerialDenseVector& Source);
00260 };
00261 
00262 // inlined definitions of op() and op[]
00263 //=========================================================================
00264 inline int& Epetra_IntSerialDenseVector::operator() (int Index) {
00265 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00266   if(Index >= M_ || Index < 0) 
00267     throw ReportError("Index = " + toString(Index) + 
00268                       " Out of Range 0 - " + toString(M_-1),-1);
00269 #endif
00270   return(A_[Index]);
00271 }
00272 //=========================================================================
00273 inline const int& Epetra_IntSerialDenseVector::operator() (int Index) const {
00274 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00275   if(Index >= M_ || Index < 0) 
00276     throw ReportError("Index = " + toString(Index) + 
00277                       " Out of Range 0 - " + toString(M_-1),-1);
00278 #endif
00279    return(A_[Index]);
00280 }
00281 //=========================================================================
00282 inline int& Epetra_IntSerialDenseVector::operator [] (int Index) {
00283 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00284   if(Index >= M_ || Index < 0) 
00285     throw ReportError("Index = " + toString(Index) + 
00286                       " Out of Range 0 - " + toString(M_-1),-1);
00287 #endif
00288    return(A_[Index]);
00289 }
00290 //=========================================================================
00291 inline const int& Epetra_IntSerialDenseVector::operator [] (int Index) const {
00292 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00293   if(Index >= M_ || Index < 0) 
00294     throw ReportError("Index = " + toString(Index) + 
00295                       " Out of Range 0 - " + toString(M_-1),-1);
00296 #endif
00297    return(A_[Index]);
00298 }
00299 //=========================================================================
00300 
00301 #endif /* EPETRA_INTSERIALDENSEVECTOR_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines