• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Albany_Catalyst_EpetraDataArray.hpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2013 Kitware Inc.                     //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 #ifndef ALBANY_CATALYST_EPETRADATAARRAY
00008 #define ALBANY_CATALYST_EPETRADATAARRAY
00009 
00010 #include "vtkMappedDataArray.h"
00011 
00012 #include <Epetra_Vector.h>
00013 
00014 namespace Albany {
00015 namespace Catalyst {
00016 
00017 class EpetraDataArray: public vtkMappedDataArray<double>
00018 {
00019 public:
00020   vtkAbstractTypeMacro(EpetraDataArray, vtkMappedDataArray<double>)
00021   vtkMappedDataArrayNewInstanceMacro(EpetraDataArray)
00022   static EpetraDataArray *New();
00023   virtual void PrintSelf(ostream &os, vtkIndent indent);
00024 
00025   void SetEpetraVector(const Epetra_Vector &vector);
00026 
00027   // Reimplemented virtuals -- see superclasses for descriptions:
00028   void Initialize();
00029   void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
00030   void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
00031   void Squeeze();
00032   vtkArrayIterator *NewIterator();
00033   vtkIdType LookupValue(vtkVariant value);
00034   void LookupValue(vtkVariant value, vtkIdList *ids);
00035   vtkVariant GetVariantValue(vtkIdType idx);
00036   void ClearLookup();
00037   double* GetTuple(vtkIdType i);
00038   void GetTuple(vtkIdType i, double *tuple);
00039   vtkIdType LookupTypedValue(ValueType value);
00040   void LookupTypedValue(ValueType value, vtkIdList *ids);
00041   ValueType GetValue(vtkIdType idx);
00042   ValueType& GetValueReference(vtkIdType idx);
00043   void GetTupleValue(vtkIdType idx, ValueType *t);
00044 
00045   // This container is read only. These methods do nothing but print a warning.
00046   int Allocate(vtkIdType sz, vtkIdType ext);
00047   int Resize(vtkIdType numTuples);
00048   void SetNumberOfTuples(vtkIdType number);
00049   void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source);
00050   void SetTuple(vtkIdType i, const float *source);
00051   void SetTuple(vtkIdType i, const double *source);
00052   void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source);
00053   void InsertTuple(vtkIdType i, const float *source);
00054   void InsertTuple(vtkIdType i, const double *source);
00055   void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds,
00056                     vtkAbstractArray *source);
00057   vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source);
00058   vtkIdType InsertNextTuple(const float *source);
00059   vtkIdType InsertNextTuple(const double *source);
00060   void DeepCopy(vtkAbstractArray *aa);
00061   void DeepCopy(vtkDataArray *da);
00062   void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
00063                         vtkAbstractArray* source,  double* weights);
00064   void InterpolateTuple(vtkIdType i, vtkIdType id1, vtkAbstractArray *source1,
00065                         vtkIdType id2, vtkAbstractArray *source2, double t);
00066   void SetVariantValue(vtkIdType idx, vtkVariant value);
00067   void RemoveTuple(vtkIdType id);
00068   void RemoveFirstTuple();
00069   void RemoveLastTuple();
00070   void SetTupleValue(vtkIdType i, const ValueType *t);
00071   void InsertTupleValue(vtkIdType i, const ValueType *t);
00072   vtkIdType InsertNextTupleValue(const ValueType *t);
00073   void SetValue(vtkIdType idx, ValueType value);
00074   vtkIdType InsertNextValue(ValueType v);
00075   void InsertValue(vtkIdType idx, ValueType v);
00076 
00077 protected:
00078   EpetraDataArray();
00079   ~EpetraDataArray();
00080 
00081   const Epetra_Vector *Data;
00082 
00083 private:
00084   EpetraDataArray(const EpetraDataArray&); // Not implemented.
00085   void operator=(const EpetraDataArray&);  // Not implemented.
00086 
00087   vtkIdType Lookup(double val, vtkIdType startIdx);
00088 
00089   double TmpDouble;
00090 };
00091 
00092 inline EpetraDataArray::ValueType EpetraDataArray::GetValue(vtkIdType idx)
00093 {
00094   return (*this->Data)[idx];
00095 }
00096 
00097 inline EpetraDataArray::ValueType &
00098 EpetraDataArray::GetValueReference(vtkIdType idx)
00099 {
00100   // Bad bad bad. VTK has no concept of 'const', so we'll just cross our fingers
00101   // that no one writes to the returned reference.
00102   return *const_cast<double*>(&(*this->Data)[idx]);
00103 }
00104 
00105 inline void
00106 EpetraDataArray::GetTupleValue(vtkIdType idx, EpetraDataArray::ValueType *t)
00107 {
00108   *t = (*this->Data)[idx];
00109 }
00110 
00111 } // end namespace Catalyst
00112 } // end namespace Albany
00113 
00114 #endif // ALBANY_CATALYST_EPETRADATAARRAY

Generated on Wed Mar 26 2014 18:36:36 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1