escript  Revision_
DataExpanded.h
Go to the documentation of this file.
00001 
00002 /*****************************************************************************
00003 *
00004 * Copyright (c) 2003-2014 by University of Queensland
00005 * http://www.uq.edu.au
00006 *
00007 * Primary Business: Queensland, Australia
00008 * Licensed under the Open Software License version 3.0
00009 * http://www.opensource.org/licenses/osl-3.0.php
00010 *
00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
00012 * Development 2012-2013 by School of Earth Sciences
00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
00014 *
00015 *****************************************************************************/
00016 
00017 
00018 #if !defined escript_DataExpanded_20040323_H
00019 #define escript_DataExpanded_20040323_H
00020 #include "system_dep.h"
00021 
00022 #include "DataReady.h"
00023 #include "DataBlocks2D.h"
00024 
00025 namespace escript {
00026 
00027 //
00028 // Forward declarations of other Data types.
00029 class DataConstant;
00030 class DataTagged;
00031 
00044 class DataExpanded : public DataReady {
00045 
00046 typedef DataReady parent;
00047 
00048  public:
00049 
00064   ESCRIPT_DLL_API
00065   DataExpanded(const WrappedArray& value,
00066                const FunctionSpace& what);
00067 
00076   ESCRIPT_DLL_API
00077   DataExpanded(const DataExpanded& other,
00078                const DataTypes::RegionType& region);
00079 
00092   ESCRIPT_DLL_API
00093   DataExpanded(const FunctionSpace& what,
00094                const DataTypes::ShapeType &shape,
00095                const DataTypes::ValueType &data);
00096 
00097            
00098   ESCRIPT_DLL_API
00099   DataExpanded(const FunctionSpace& what,
00100                const DataTypes::ShapeType &shape,
00101                const double data);         
00102            
00108   ESCRIPT_DLL_API
00109   DataExpanded(const DataExpanded& other);
00110 
00116   ESCRIPT_DLL_API
00117   DataExpanded(const DataConstant& other);
00118 
00124   ESCRIPT_DLL_API
00125   DataExpanded(const DataTagged& other);
00126 
00131   ESCRIPT_DLL_API
00132   virtual
00133   ~DataExpanded();
00134 
00135   ESCRIPT_DLL_API
00136   bool
00137   isExpanded() const 
00138   {
00139     return true;
00140   };
00141 
00142   ESCRIPT_DLL_API
00143   bool
00144   actsExpanded() const
00145   {
00146     return true;
00147   }
00148 
00152   ESCRIPT_DLL_API
00153   bool
00154   hasNaN() const;
00155 
00160   ESCRIPT_DLL_API
00161   virtual
00162   std::string
00163   toString() const;
00164 
00168   ESCRIPT_DLL_API
00169   virtual
00170   DataAbstract*
00171   deepCopy();
00172 
00173 
00178   ESCRIPT_DLL_API
00179   virtual
00180   void
00181   dump(const std::string fileName) const;
00182 
00183 
00189   ESCRIPT_DLL_API
00190   virtual int
00191   matrixInverse(DataAbstract* out) const;
00192 
00197   ESCRIPT_DLL_API
00198   virtual
00199   void
00200   setToZero();
00201 
00211   ESCRIPT_DLL_API
00212   virtual
00213   DataTypes::ValueType::size_type
00214   getPointOffset(int sampleNo,
00215                  int dataPointNo) const;
00216 
00217   ESCRIPT_DLL_API
00218   virtual
00219   DataTypes::ValueType::size_type
00220   getPointOffset(int sampleNo,
00221                  int dataPointNo);
00222 
00228   ESCRIPT_DLL_API
00229   DataTypes::ValueType&
00230   getVectorRW();
00231 
00232   ESCRIPT_DLL_API
00233   const DataTypes::ValueType&
00234   getVectorRO() const;
00235 
00236 
00237 
00242   ESCRIPT_DLL_API
00243   virtual
00244   ValueType::size_type
00245   getLength() const;
00246 
00254   ESCRIPT_DLL_API
00255   virtual
00256   DataAbstract*
00257   getSlice(const DataTypes::RegionType& region) const;
00258 
00266   ESCRIPT_DLL_API
00267   virtual
00268   void
00269   setSlice(const DataAbstract* value,
00270            const DataTypes::RegionType& region);
00271 
00284   void  
00285   setTaggedValue(int tagKey,
00286              const DataTypes::ShapeType& pointshape,
00287                  const DataTypes::ValueType& value,
00288          int dataOffset=0);
00289 
00290 
00291 
00299   ESCRIPT_DLL_API
00300   virtual void
00301   symmetric(DataAbstract* ev);
00302 
00310   ESCRIPT_DLL_API
00311   virtual void
00312   nonsymmetric(DataAbstract* ev);
00313 
00322   ESCRIPT_DLL_API
00323   virtual void
00324   trace(DataAbstract* ev, int axis_offset);
00325 
00333   ESCRIPT_DLL_API
00334   virtual void
00335   transpose(DataAbstract* ev, int axis_offset);
00336 
00345   ESCRIPT_DLL_API
00346   virtual void
00347   swapaxes(DataAbstract* ev, int axis0, int axis1);
00348 
00349 
00357   ESCRIPT_DLL_API
00358   virtual void
00359   eigenvalues(DataAbstract* ev);
00360 
00372   ESCRIPT_DLL_API
00373   virtual void
00374   eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
00375 
00382   ESCRIPT_DLL_API
00383   virtual void
00384   reorderByReferenceIDs(int *reference_ids);
00385 
00386 //   /**
00387 //   \brief Fill the object with random values
00388 // 
00389 //   \param seed - random seed
00390 //   */
00391 //   ESCRIPT_DLL_API
00392 //   void randomFill(long seed);
00393 
00394  protected:
00395 
00396  private:
00397 
00412   void
00413   initialise(int noSamples,
00414              int noDataPointsPerSample);
00415 
00425   void
00426   copy(const DataConstant& value);
00427 
00428 
00429 
00437   void
00438   copy(const WrappedArray& value);
00439 
00440 
00452   ESCRIPT_DLL_API
00453   virtual void
00454   copyToDataPoint(const int sampleNo, const int dataPointNo, const double value);
00455 
00456 
00465   ESCRIPT_DLL_API
00466   virtual void
00467   copyToDataPoint(const int sampleNo, const int dataPointNo, const WrappedArray& value);
00468 
00469   //
00470   // The main data storage array, a 2D array of data blocks.
00471   // noSamples * noDataPointsPerSample
00472   DataBlocks2D m_data;
00473 
00474 };
00475 
00476 } // end of namespace
00477 
00478 #endif