Epetra Package Browser (Single Doxygen Collection) Development
Epetra_LongLongSerialDenseVector.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_LONGLONGSERIALDENSEVECTOR_H
00045 #define EPETRA_LONGLONGSERIALDENSEVECTOR_H
00046 
00047 #include "Epetra_ConfigDefs.h"
00048 #include "Epetra_Object.h"
00049 #include "Epetra_LongLongSerialDenseMatrix.h"
00050 
00051 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00052 
00054 
00089 //=========================================================================
00090 class EPETRA_LIB_DLL_EXPORT Epetra_LongLongSerialDenseVector : public Epetra_LongLongSerialDenseMatrix{
00091 
00092   public:
00093 
00095 
00100   Epetra_LongLongSerialDenseVector();
00101 
00103 
00112   Epetra_LongLongSerialDenseVector(int Length_in);
00113 
00115 
00125   Epetra_LongLongSerialDenseVector(Epetra_DataAccess CV_in, long long* Values_in, int Length_in);
00126 
00128 
00129   Epetra_LongLongSerialDenseVector(const Epetra_LongLongSerialDenseVector& Source);
00130 
00132 
00142   int Size(int Length_in) {return(Epetra_LongLongSerialDenseMatrix::Shape(Length_in, 1));};
00143 
00145 
00156   int Resize(int Length_in) {return(Epetra_LongLongSerialDenseMatrix::Reshape(Length_in, 1));};
00157 
00159   virtual ~Epetra_LongLongSerialDenseVector ();
00160 
00161   //bring the base-class operator() into the current scope, in order to tell the
00162   //compiler that we intend to overload it, rather than hide it.
00163   using Epetra_LongLongSerialDenseMatrix::operator();
00164 
00166 
00172     long long& operator () (int Index);
00173 
00175 
00181     const long long& operator () (int Index) const;
00182 
00184 
00190     long long& operator [] (int Index);
00191 
00193 
00199     const long long& operator [] (int Index) const;
00200 
00202 
00208   int Random();
00209 
00211   int Length() const {return(M_);};
00212 
00214   long long* Values() {return(A_);};
00215 
00217   const long long* Values() const {return(A_);};
00218 
00220   Epetra_DataAccess CV() const {return(CV_);};
00221 
00223 
00229     Epetra_LongLongSerialDenseVector& operator = (const Epetra_LongLongSerialDenseVector& Source);
00230 
00232 
00233 
00234   virtual void Print(std::ostream& os) const;
00236 
00238 
00239 
00240   //Bring the base-class MakeViewOf method into the current scope so that the
00241   //compiler knows we intend to overload it, rather than hide it.
00242   using Epetra_LongLongSerialDenseMatrix::MakeViewOf;
00243 
00245 
00261   int MakeViewOf(const Epetra_LongLongSerialDenseVector& Source);
00263 };
00264 
00265 // inlined definitions of op() and op[]
00266 //=========================================================================
00267 inline long long& Epetra_LongLongSerialDenseVector::operator() (int Index) {
00268 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00269   if(Index >= M_ || Index < 0)
00270     throw ReportError("Index = " + toString(Index) +
00271                       " Out of Range 0 - " + toString(M_-1),-1);
00272 #endif
00273   return(A_[Index]);
00274 }
00275 //=========================================================================
00276 inline const long long& Epetra_LongLongSerialDenseVector::operator() (int Index) const {
00277 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00278   if(Index >= M_ || Index < 0)
00279     throw ReportError("Index = " + toString(Index) +
00280                       " Out of Range 0 - " + toString(M_-1),-1);
00281 #endif
00282    return(A_[Index]);
00283 }
00284 //=========================================================================
00285 inline long long& Epetra_LongLongSerialDenseVector::operator [] (int Index) {
00286 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00287   if(Index >= M_ || Index < 0)
00288     throw ReportError("Index = " + toString(Index) +
00289                       " Out of Range 0 - " + toString(M_-1),-1);
00290 #endif
00291    return(A_[Index]);
00292 }
00293 //=========================================================================
00294 inline const long long& Epetra_LongLongSerialDenseVector::operator [] (int Index) const {
00295 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK
00296   if(Index >= M_ || Index < 0)
00297     throw ReportError("Index = " + toString(Index) +
00298                       " Out of Range 0 - " + toString(M_-1),-1);
00299 #endif
00300    return(A_[Index]);
00301 }
00302 //=========================================================================
00303 
00304 #endif // EPETRA_NO_64BIT_GLOBAL_INDICES
00305 
00306 #endif /* EPETRA_LONGLONGSERIALDENSEVECTOR_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines