Escript  Revision_4320
DataExpanded.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 
17 #if !defined escript_DataExpanded_20040323_H
18 #define escript_DataExpanded_20040323_H
19 #include "system_dep.h"
20 
21 #include "DataReady.h"
22 #include "DataBlocks2D.h"
23 
24 namespace escript {
25 
26 //
27 // Forward declarations of other Data types.
28 class DataConstant;
29 class DataTagged;
30 
43 class DataExpanded : public DataReady {
44 
45 typedef DataReady parent;
46 
47  public:
48 
64  DataExpanded(const WrappedArray& value,
65  const FunctionSpace& what);
66 
76  DataExpanded(const DataExpanded& other,
77  const DataTypes::RegionType& region);
78 
92  DataExpanded(const FunctionSpace& what,
93  const DataTypes::ShapeType &shape,
94  const DataTypes::ValueType &data);
95 
96 
98  DataExpanded(const FunctionSpace& what,
99  const DataTypes::ShapeType &shape,
100  const double data);
101 
108  DataExpanded(const DataExpanded& other);
109 
116  DataExpanded(const DataConstant& other);
117 
124  DataExpanded(const DataTagged& other);
125 
131  virtual
132  ~DataExpanded();
133 
135  bool
136  isExpanded() const
137  {
138  return true;
139  };
140 
142  bool
143  actsExpanded() const
144  {
145  return true;
146  }
147 
152  bool
153  hasNaN() const;
154 
160  virtual
161  std::string
162  toString() const;
163 
168  virtual
169  DataAbstract*
170  deepCopy();
171 
172 
178  virtual
179  void
180  dump(const std::string fileName) const;
181 
182 
189  virtual int
190  matrixInverse(DataAbstract* out) const;
191 
197  virtual
198  void
199  setToZero();
200 
211  virtual
213  getPointOffset(int sampleNo,
214  int dataPointNo) const;
215 
217  virtual
219  getPointOffset(int sampleNo,
220  int dataPointNo);
221 
229  getVectorRW();
230 
232  const DataTypes::ValueType&
233  getVectorRO() const;
234 
235 
236 
242  virtual
244  getLength() const;
245 
254  virtual
255  DataAbstract*
256  getSlice(const DataTypes::RegionType& region) const;
257 
266  virtual
267  void
268  setSlice(const DataAbstract* value,
269  const DataTypes::RegionType& region);
270 
283  void
284  setTaggedValue(int tagKey,
285  const DataTypes::ShapeType& pointshape,
286  const DataTypes::ValueType& value,
287  int dataOffset=0);
288 
289 
290 
299  virtual void
300  symmetric(DataAbstract* ev);
301 
310  virtual void
312 
322  virtual void
323  trace(DataAbstract* ev, int axis_offset);
324 
333  virtual void
334  transpose(DataAbstract* ev, int axis_offset);
335 
345  virtual void
346  swapaxes(DataAbstract* ev, int axis0, int axis1);
347 
348 
357  virtual void
359 
372  virtual void
373  eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
374 
382  virtual void
383  reorderByReferenceIDs(int *reference_ids);
384 
391  void randomFill(long seed);
392 
393  protected:
394 
395  private:
396 
411  void
412  initialise(int noSamples,
413  int noDataPointsPerSample);
414 
424  void
425  copy(const DataConstant& value);
426 
427 
428 
436  void
437  copy(const WrappedArray& value);
438 
439 
452  virtual void
453  copyToDataPoint(const int sampleNo, const int dataPointNo, const double value);
454 
455 
465  virtual void
466  copyToDataPoint(const int sampleNo, const int dataPointNo, const WrappedArray& value);
467 
468  //
469  // The main data storage array, a 2D array of data blocks.
470  // noSamples * noDataPointsPerSample
472 
473 };
474 
475 } // end of namespace
476 
477 #endif