00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDenseArray.h,v $ 00005 00006 ------------------------------------------------------------------------- 00007 Copyright 2008 Sandia Corporation. 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 00012 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00013 All rights reserved. 00014 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00015 00016 This software is distributed WITHOUT ANY WARRANTY; without even 00017 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00018 PURPOSE. See the above copyright notice for more information. 00019 00020 =========================================================================*/ 00021 00048 #ifndef __vtkDenseArray_h 00049 #define __vtkDenseArray_h 00050 00051 #include "vtkArrayCoordinates.h" 00052 #include "vtkObjectFactory.h" 00053 #include "vtkTypedArray.h" 00054 #include "vtkTypeTemplate.h" 00055 00056 template<typename T> 00057 class vtkDenseArray : 00058 public vtkTypeTemplate<vtkDenseArray<T>, vtkTypedArray<T> > 00059 { 00060 public: 00061 using vtkTypedArray<T>::GetValue; 00062 using vtkTypedArray<T>::SetValue; 00063 00064 static vtkDenseArray<T>* New(); 00065 void PrintSelf(ostream &os, vtkIndent indent); 00066 00067 // vtkArray API 00068 vtkArrayExtents GetExtents(); 00069 vtkIdType GetNonNullSize(); 00070 void GetCoordinatesN(const vtkIdType n, vtkArrayCoordinates& coordinates); 00071 vtkArray* DeepCopy(); 00072 00073 // vtkTypedArray API 00074 const T& GetValue(const vtkArrayCoordinates& coordinates); 00075 const T& GetValueN(const vtkIdType n); 00076 void SetValue(const vtkArrayCoordinates& coordinates, const T& value); 00077 void SetValueN(const vtkIdType n, const T& value); 00078 00079 // vtkDenseArray API 00080 00082 void Fill(const T& value); 00083 00086 T& operator[](const vtkArrayCoordinates& coordinates); 00087 00090 const T* GetStorage() const; 00091 00094 T* GetStorage(); 00095 00096 protected: 00097 vtkDenseArray(); 00098 ~vtkDenseArray(); 00099 00100 private: 00101 vtkDenseArray(const vtkDenseArray&); // Not implemented 00102 void operator=(const vtkDenseArray&); // Not implemented 00103 00104 void InternalResize(const vtkArrayExtents& extents); 00105 void InternalSetDimensionLabel(vtkIdType i, const vtkStdString& label); 00106 vtkStdString InternalGetDimensionLabel(vtkIdType i); 00107 vtkIdType MapCoordinates(const vtkArrayCoordinates& coordinates); 00108 00109 typedef vtkDenseArray<T> ThisT; 00110 00112 vtkArrayExtents Extents; 00113 00115 vtkstd::vector<vtkStdString> DimensionLabels; 00116 00119 vtkstd::vector<T> Storage; 00120 00123 vtkstd::vector<vtkIdType> Strides; 00124 }; 00125 00126 #include "vtkDenseArray.txx" 00127 00128 #endif 00129