escript  Revision_
Data.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
20 #ifndef __ESCRIPT_DATA_H__
21 #define __ESCRIPT_DATA_H__
22 
23 #include "system_dep.h"
24 #include "DataAbstract.h"
25 #include "DataException.h"
26 #include "DataTypes.h"
27 #include "EsysMPI.h"
28 #include "FunctionSpace.h"
29 #include "DataVectorOps.h"
30 #include <algorithm>
31 #include <string>
32 #include <sstream>
33 
34 #include <boost/python/object.hpp>
35 #include <boost/python/tuple.hpp>
36 #include <boost/math/special_functions/bessel.hpp>
37 
38 #ifndef ESCRIPT_MAX_DATA_RANK
39 #define ESCRIPT_MAX_DATA_RANK 4
40 #endif
41 
42 namespace escript {
43 
44 //
45 // Forward declaration for various implementations of Data.
46 class DataConstant;
47 class DataTagged;
48 class DataExpanded;
49 class DataLazy;
50 
64 class Data {
65 
66  public:
67 
77  Data();
78 
84  Data(const Data& inData);
85 
92  Data(const Data& inData,
93  const FunctionSpace& what);
94 
98  Data(const DataTypes::RealVectorType& value,
99  const DataTypes::ShapeType& shape,
100  const FunctionSpace& what,
101  bool expanded);
102 
114  Data(DataTypes::real_t value,
115  const DataTypes::ShapeType& dataPointShape,
116  const FunctionSpace& what,
117  bool expanded);
118 
130  explicit
131  Data(DataTypes::cplx_t value,
132  const DataTypes::ShapeType& dataPointShape,
133  const FunctionSpace& what,
134  bool expanded);
135 
143  Data(const Data& inData,
144  const DataTypes::RegionType& region);
145 
146 
157  Data(const WrappedArray& w, const FunctionSpace& what,
158  bool expanded);
159 
160 
170  Data(const boost::python::object& value,
171  const Data& other);
172 
193  Data(boost::python::object value,
194  boost::python::object par1=boost::python::object(),
195  boost::python::object par2=boost::python::object(),
196  boost::python::object par3=boost::python::object());
197 
198 
199 
200 
201 
206  explicit Data(DataAbstract* underlyingdata);
207 
211  explicit Data(DataAbstract_ptr underlyingdata);
212 
217  ~Data();
218 
222  void
223  copy(const Data& other);
224 
228  Data
229  copySelf() const;
230 
231 
235  Data
236  delay();
237 
241  void
242  delaySelf();
243 
244 
254  void
255  setProtection();
256 
262  bool
263  isProtected() const;
264 
265 
270  const boost::python::object
271  getValueOfDataPointAsTuple(int dataPointNo);
272 
277  void
278  setValueOfDataPointToPyObject(int dataPointNo, const boost::python::object& py_object);
279 
284  void
285  setValueOfDataPointToArray(int dataPointNo, const boost::python::object&);
286 
291  void
292  setValueOfDataPoint(int dataPointNo, const DataTypes::real_t);
293 
294  void
295  setValueOfDataPointC(int dataPointNo, const DataTypes::cplx_t);
296 
297 
301  const boost::python::object
302  getValueOfGlobalDataPointAsTuple(int procNo, int dataPointNo);
303 
304 
308  void
309  setTupleForGlobalDataPoint(int id, int proc, boost::python::object);
310 
316  int
317  getTagNumber(int dpno);
318 
319 
324  std::string
325  toString() const;
326 
331  void
332  expand();
333 
340  void
341  tag();
342 
347  void
348  resolve();
349 
355  bool
356  hasNaN();
357 
361  void
363 
367  void
369 
373  void
374  replaceNaNPython(boost::python::object obj);
375 
376  bool
377  hasInf();
378 
379  void
381 
382  void
384 
385  void
386  replaceInfPython(boost::python::object obj);
387 
388 
396  void
397  requireWrite();
398 
404  bool
405  isExpanded() const;
406 
412  bool
413  actsExpanded() const;
414 
415 
420  bool
421  isTagged() const;
422 
427  bool
428  isConstant() const;
429 
433  bool
434  isLazy() const;
435 
439  bool
440  isReady() const;
441 
447  bool
448  isEmpty() const;
449 
454  bool
455  isComplex() const;
456 
461  inline
462  const FunctionSpace&
464  {
465  return m_data->getFunctionSpace();
466  }
467 
472  inline
475  {
476  // This is exposed to Python as [Data object].getX()
477  return m_data->getFunctionSpace().getX();
478  }
479 
484  inline
485 // const AbstractDomain&
487  getDomain() const
488  {
489  return getFunctionSpace().getDomain();
490  }
491 
492 
498  inline
499 // const AbstractDomain&
500  Domain_ptr
502  {
504  }
505 
510  inline
511  unsigned int
513  {
514  return m_data->getRank();
515  }
516 
521  inline
522  int
524  {
526  }
531  inline
532  int
534  {
535  return m_data->getNumSamples();
536  }
537 
542  inline
543  int
545  {
546  return m_data->getNumDPPSample();
547  }
548 
554  inline
555  bool numSamplesEqual(int numDataPointsPerSample, int numSamples) const
556  {
557  return (isEmpty() ||
558  (numDataPointsPerSample==getNumDataPointsPerSample() && numSamples==getNumSamples()));
559  }
560 
566  inline
567  bool isDataPointShapeEqual(int rank, const int* dimensions) const
568  {
569  if (isEmpty())
570  return true;
571  const DataTypes::ShapeType givenShape(&dimensions[0],&dimensions[rank]);
572  return (getDataPointShape()==givenShape);
573  }
574 
579  int
580  getNoValues() const
581  {
582  return m_data->getNoValues();
583  }
584 
585 
590  void
591  dump(const std::string fileName) const;
592 
599  const boost::python::object
600  toListOfTuples(bool scalarastuple=true);
601 
602 
610  const DataTypes::real_t*
612 
613  const DataTypes::cplx_t*
615 
616 
626 
629 
630 
631 
638  const DataTypes::real_t*
639  getDataRO(DataTypes::real_t dummy=0) const;
640 
641  const DataTypes::cplx_t*
642  getDataRO(DataTypes::cplx_t dummy) const;
643 
644 
645 
652  inline
655  {
656  return m_data->getSampleDataByTag(tag, dummy);
657  }
658 
659  inline
662  {
663  return m_data->getSampleDataByTag(tag, dummy);
664  }
665 
666 
674  getDataPointRO(int sampleNo, int dataPointNo);
675 
683  getDataPointRW(int sampleNo, int dataPointNo);
684 
685 
686 
691  inline
693  getDataOffset(int sampleNo,
694  int dataPointNo)
695  {
696  return m_data->getPointOffset(sampleNo,dataPointNo);
697  }
698 
703  inline
704  const DataTypes::ShapeType&
706  {
707  return m_data->getShape();
708  }
709 
714  const boost::python::tuple
715  getShapeTuple() const;
716 
721  long
722  getShapeProduct() const;
723 
724 
730  int
731  getDataPointSize() const;
732 
738  getLength() const;
739 
744  bool
745  hasNoSamples() const
746  {
747  return m_data->getNumSamples()==0;
748  }
749 
758  void
759  setTaggedValueByName(std::string name,
760  const boost::python::object& value);
761 
771  void
772  setTaggedValue(int tagKey,
773  const boost::python::object& value);
774 
785  void
786  setTaggedValueFromCPP(int tagKey,
787  const DataTypes::ShapeType& pointshape,
788  const DataTypes::RealVectorType& value,
789  int dataOffset=0);
790 
791 
792  void
793  setTaggedValueFromCPP(int tagKey,
794  const DataTypes::ShapeType& pointshape,
795  const DataTypes::CplxVectorType& value,
796  int dataOffset=0);
797 
802  void
803  copyWithMask(const Data& other,
804  const Data& mask);
805 
815  void
816  setToZero();
817 
824  Data
825  interpolate(const FunctionSpace& functionspace) const;
826 
827  Data
830  DataTypes::real_t Cmin, DataTypes::real_t Cstep, bool check_boundaries);
831 
832  Data
834  DataTypes::real_t undef, Data& B, DataTypes::real_t Bmin, DataTypes::real_t Bstep,bool check_boundaries);
835 
836  Data
838  DataTypes::real_t undef,bool check_boundaries);
839 
840 
841  Data
842  interpolateFromTable3DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep,
843  Data& B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, Data& C, DataTypes::real_t Cmin, DataTypes::real_t Cstep, DataTypes::real_t undef,bool check_boundaries);
844 
845 
846  Data
847  interpolateFromTable2DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep,
848  Data& B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, DataTypes::real_t undef,bool check_boundaries);
849 
850  Data
851  interpolateFromTable1DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep,
852  DataTypes::real_t undef,bool check_boundaries);
853 
854  Data
855  nonuniforminterp(boost::python::object in, boost::python::object out, bool check_boundaries);
856 
857  Data
858  nonuniformslope(boost::python::object in, boost::python::object out, bool check_boundaries);
859 
866  Data
867  gradOn(const FunctionSpace& functionspace) const;
868 
869  Data
870  grad() const;
871 
876  boost::python::object
877  integrateToTuple_const() const;
878 
879 
884  boost::python::object
886 
887 
888 
894  Data
895  oneOver() const;
901  Data
902  wherePositive() const;
903 
909  Data
910  whereNegative() const;
911 
917  Data
918  whereNonNegative() const;
919 
925  Data
926  whereNonPositive() const;
927 
933  Data
934  whereZero(DataTypes::real_t tol=0.0) const;
935 
941  Data
942  whereNonZero(DataTypes::real_t tol=0.0) const;
943 
956  Lsup();
957 
959  Lsup_const() const;
960 
961 
974  sup();
975 
977  sup_const() const;
978 
979 
992  inf();
993 
995  inf_const() const;
996 
997 
998 
1004  Data
1005  abs() const;
1006 
1012  Data
1013  phase() const;
1014 
1015 
1021  Data
1022  maxval() const;
1023 
1029  Data
1030  minval() const;
1031 
1039  const boost::python::tuple
1040  minGlobalDataPoint() const;
1041 
1049  const boost::python::tuple
1050  maxGlobalDataPoint() const;
1051 
1052 
1053 
1060  Data
1061  sign() const;
1062 
1068  Data
1069  symmetric() const;
1070 
1076  Data
1077  antisymmetric() const;
1078 
1079 
1085  Data
1086  hermitian() const;
1087 
1093  Data
1094  antihermitian() const;
1095 
1101  Data
1102  trace(int axis_offset) const;
1103 
1109  Data
1110  transpose(int axis_offset) const;
1111 
1118  Data
1119  eigenvalues() const;
1120 
1130  const boost::python::tuple
1131  eigenvalues_and_eigenvectors(const DataTypes::real_t tol=1.e-12) const;
1132 
1138  Data
1139  swapaxes(const int axis0, const int axis1) const;
1140 
1146  Data
1147  erf() const;
1148 
1149 
1155  Data
1156  conjugate() const;
1157 
1158  Data
1159  real() const;
1160 
1161  Data
1162  imag() const;
1163 
1169  Data
1170  sin() const;
1171 
1177  Data
1178  cos() const;
1179 
1185  Data
1186  bessel(int order, DataTypes::real_t (*besselfunc) (int,DataTypes::real_t) );
1187 
1188 
1194  Data
1195  besselFirstKind(int order);
1196 
1202  Data
1203  besselSecondKind(int order);
1204 
1205 
1211  Data
1212  tan() const;
1213 
1219  Data
1220  asin() const;
1221 
1227  Data
1228  acos() const;
1229 
1235  Data
1236  atan() const;
1237 
1243  Data
1244  sinh() const;
1245 
1251  Data
1252  cosh() const;
1253 
1259  Data
1260  tanh() const;
1261 
1267  Data
1268  asinh() const;
1269 
1275  Data
1276  acosh() const;
1277 
1283  Data
1284  atanh() const;
1285 
1291  Data
1292  log10() const;
1293 
1299  Data
1300  log() const;
1301 
1307  Data
1308  exp() const;
1309 
1315  Data
1316  sqrt() const;
1317 
1323  Data
1324  neg() const;
1325 
1332  Data
1333  pos() const;
1334 
1342  Data
1343  powD(const Data& right) const;
1344 
1352  Data
1353  powO(const boost::python::object& right) const;
1354 
1363  Data
1364  rpowO(const boost::python::object& left) const;
1365 
1372  Data& operator+=(const Data& right);
1373  Data& operator+=(const boost::python::object& right);
1374 
1375  Data& operator=(const Data& other);
1376 
1383  Data& operator-=(const Data& right);
1384  Data& operator-=(const boost::python::object& right);
1385 
1392  Data& operator*=(const Data& right);
1393  Data& operator*=(const boost::python::object& right);
1394 
1401  Data& operator/=(const Data& right);
1402  Data& operator/=(const boost::python::object& right);
1403 
1408  Data truedivD(const Data& right);
1409 
1414  Data truedivO(const boost::python::object& right);
1415 
1420  Data rtruedivO(const boost::python::object& left);
1421 
1426  boost::python::object __add__(const boost::python::object& right);
1427 
1428 
1433  boost::python::object __sub__(const boost::python::object& right);
1434 
1439  boost::python::object __rsub__(const boost::python::object& right);
1440 
1445  boost::python::object __mul__(const boost::python::object& right);
1446 
1451  boost::python::object __div__(const boost::python::object& right);
1452 
1457  boost::python::object __rdiv__(const boost::python::object& right);
1458 
1462  Data
1463  matrixInverse() const;
1464 
1469  bool
1470  probeInterpolation(const FunctionSpace& functionspace) const;
1471 
1487  Data
1488  getItem(const boost::python::object& key) const;
1489 
1501  void
1502  setItemD(const boost::python::object& key,
1503  const Data& value);
1504 
1505  void
1506  setItemO(const boost::python::object& key,
1507  const boost::python::object& value);
1508 
1509  // These following public methods should be treated as private.
1510 
1516  template <class UnaryFunction>
1517  inline
1518  void
1519  unaryOp2(UnaryFunction operation);
1520 
1528  Data
1529  getSlice(const DataTypes::RegionType& region) const;
1530 
1539  void
1540  setSlice(const Data& value,
1541  const DataTypes::RegionType& region);
1542 
1547  void
1548  print(void);
1549 
1556  int
1557  get_MPIRank(void) const;
1558 
1565  int
1566  get_MPISize(void) const;
1567 
1573  MPI_Comm
1574  get_MPIComm(void) const;
1575 
1581  DataAbstract*
1582  borrowData(void) const;
1583 
1585  borrowDataPtr(void) const;
1586 
1588  borrowReadyPtr(void) const;
1589 
1590 
1591 
1601 
1604 
1607 
1610 
1611 
1623 
1626 
1627 
1632  size_t
1633  getNumberOfTaggedValues() const;
1634 
1635  /*
1636  * \brief make the data complex
1637  */
1638  void complicate();
1639 
1640  protected:
1641 
1642  private:
1643  void init_from_data_and_fs(const Data& inData,
1644  const FunctionSpace& functionspace);
1645 
1646  template <typename S>
1647  void
1648  maskWorker(Data& other2, Data& mask2, S sentinel);
1649 
1650  template <class BinaryOp>
1652 #ifdef ESYS_MPI
1653  lazyAlgWorker(DataTypes::real_t init, MPI_Op mpiop_type);
1654 #else
1656 #endif
1657 
1659  LsupWorker() const;
1660 
1662  supWorker() const;
1663 
1665  infWorker() const;
1666 
1667  template<typename Scalar>
1668  boost::python::object
1669  integrateWorker() const;
1670 
1671  void
1672  calc_minGlobalDataPoint(int& ProcNo, int& DataPointNo) const;
1673 
1674  void
1675  calc_maxGlobalDataPoint(int& ProcNo, int& DataPointNo) const;
1676 
1677  // For internal use in Data.cpp only!
1678  // other uses should call the main entry points and allow laziness
1679  Data
1680  minval_nonlazy() const;
1681 
1682  // For internal use in Data.cpp only!
1683  Data
1684  maxval_nonlazy() const;
1685 
1686 
1693  inline
1694  void
1695  operandCheck(const Data& right) const
1696  {
1697  return m_data->operandCheck(*(right.m_data.get()));
1698  }
1699 
1705  template <class BinaryFunction>
1706  inline
1708  reduction(BinaryFunction operation,
1709  DataTypes::real_t initial_value) const;
1710 
1718  template <class BinaryFunction>
1719  inline
1720  Data
1721  dp_algorithm(BinaryFunction operation,
1722  DataTypes::real_t initial_value) const;
1723 
1729  void
1730  typeMatchLeft(Data& right) const;
1731 
1737  void
1738  typeMatchRight(const Data& right);
1739 
1745  void
1747  const DataTypes::ShapeType& shape,
1748  const FunctionSpace& what,
1749  bool expanded);
1750 
1751  void
1753  const DataTypes::ShapeType& shape,
1754  const FunctionSpace& what,
1755  bool expanded);
1756 
1757  void
1758  initialise(const WrappedArray& value,
1759  const FunctionSpace& what,
1760  bool expanded);
1761 
1762  void
1763  initialise(const DataTypes::real_t value,
1764  const DataTypes::ShapeType& shape,
1765  const FunctionSpace& what,
1766  bool expanded);
1767 
1768  void
1769  initialise(const DataTypes::cplx_t value,
1770  const DataTypes::ShapeType& shape,
1771  const FunctionSpace& what,
1772  bool expanded);
1773  //
1774  // flag to protect the data object against any update
1776  bool m_lazy;
1777 
1778  //
1779  // pointer to the actual data object
1780 // boost::shared_ptr<DataAbstract> m_data;
1782 
1783 // If possible please use getReadyPtr instead.
1784 // But see warning below.
1785  const DataReady*
1786  getReady() const
1787 {
1788  const DataReady* dr=dynamic_cast<const DataReady*>(m_data.get());
1789  ESYS_ASSERT(dr!=0, "error casting to DataReady.");
1790  return dr;
1791 }
1792 
1793  DataReady*
1795 {
1796  DataReady* dr=dynamic_cast<DataReady*>(m_data.get());
1797  ESYS_ASSERT(dr!=0, "error casting to DataReady.");
1798  return dr;
1799 }
1800 
1801 
1802 // Be wary of using this for local operations since it (temporarily) increases reference count.
1803 // If you are just using this to call a method on DataReady instead of DataAbstract consider using
1804 // getReady() instead
1807 {
1808  DataReady_ptr dr=REFCOUNTNS::dynamic_pointer_cast<DataReady>(m_data);
1809  ESYS_ASSERT(dr.get()!=0, "error casting to DataReady.");
1810  return dr;
1811 }
1812 
1814  getReadyPtr() const
1815 {
1816  const_DataReady_ptr dr=REFCOUNTNS::dynamic_pointer_cast<const DataReady>(m_data);
1817  ESYS_ASSERT(dr.get()!=0, "error casting to DataReady.");
1818  return dr;
1819 }
1820 
1821  // In the isShared() method below:
1822  // A problem would occur if m_data (the address pointed to) were being modified
1823  // while the call m_data->is_shared is being executed.
1824  //
1825  // Q: So why do I think this code can be thread safe/correct?
1826  // A: We need to make some assumptions.
1827  // 1. We assume it is acceptable to return true under some conditions when we aren't shared.
1828  // 2. We assume that no constructions or assignments which will share previously unshared
1829  // will occur while this call is executing. This is consistent with the way Data:: and C are written.
1830  //
1831  // This means that the only transition we need to consider, is when a previously shared object is
1832  // not shared anymore. ie. the other objects have been destroyed or a deep copy has been made.
1833  // In those cases the m_shared flag changes to false after m_data has completed changing.
1834  // For any threads executing before the flag switches they will assume the object is still shared.
1835  bool isShared() const
1836  {
1837 #ifdef SLOWSHARECHECK
1838  return m_data->isShared(); // single threadsafe check for this
1839 #else
1840  return !m_data.unique();
1841 #endif
1842  }
1843 
1845  {
1846  if (isLazy())
1847  {
1848  #ifdef _OPENMP
1849  if (omp_in_parallel())
1850  { // Yes this is throwing an exception out of an omp thread which is forbidden.
1851  throw DataException("Please do not call forceResolve() in a parallel region.");
1852  }
1853  #endif
1854  resolve();
1855  }
1856  }
1857 
1863  {
1864 #ifdef _OPENMP
1865  if (omp_in_parallel())
1866  {
1867  throw DataException("Programming error. Please do not run exclusiveWrite() in multi-threaded sections.");
1868  }
1869 #endif
1870  forceResolve();
1871  if (isShared())
1872  {
1873  DataAbstract* t=m_data->deepCopy();
1875  }
1876 #ifdef EXWRITECHK
1877  m_data->exclusivewritecalled=true;
1878 #endif
1879  }
1880 
1885  {
1886  if (isLazy() || isShared())
1887  {
1888  std::ostringstream oss;
1889  oss << "Programming error. ExclusiveWrite required - please call requireWrite() isLazy=" << isLazy() << " isShared()=" << isShared();
1890  throw DataException(oss.str());
1891  }
1892  }
1893 
1900  void set_m_data(DataAbstract_ptr p);
1901 
1902 
1903  void TensorSelfUpdateBinaryOperation(const Data& right, escript::ES_optype operation);
1904 
1905  friend class DataAbstract; // To allow calls to updateShareStatus
1906  friend class TestDomain; // so its getX will work quickly
1907 #ifdef IKNOWWHATIMDOING
1908  friend Data applyBinaryCFunction(boost::python::object cfunc, boost::python::tuple shape, escript::Data& d, escript::Data& e);
1909 #endif
1910  template <typename S>
1911  friend Data condEvalWorker(escript::Data& mask, escript::Data& trueval, escript::Data& falseval, S sentinel);
1912  friend Data randomData(const boost::python::tuple& shape, const FunctionSpace& what, long seed, const boost::python::tuple& filter);
1913 
1914 };
1915 
1916 
1917 #ifdef IKNOWWHATIMDOING
1918 Data
1919 applyBinaryCFunction(boost::python::object func, boost::python::tuple shape, escript::Data& d, escript::Data& e);
1920 #endif
1921 
1922 Data
1923 condEval(escript::Data& mask, escript::Data& trueval, escript::Data& falseval);
1924 
1925 
1926 
1930 Data randomData(const boost::python::tuple& shape,
1931  const FunctionSpace& what,
1932  long seed, const boost::python::tuple& filter);
1933 
1934 
1935 } // end namespace escript
1936 
1937 
1938 // No, this is not supposed to be at the top of the file
1939 // DataAbstact needs to be declared first, then DataReady needs to be fully declared
1940 // so that I can dynamic cast between them below.
1941 #include "DataReady.h"
1942 #include "DataLazy.h"
1943 #include "DataExpanded.h"
1944 #include "DataConstant.h"
1945 #include "DataTagged.h"
1946 
1947 namespace escript
1948 {
1949 
1950 
1951 
1952 inline
1955 {
1956  if (isLazy())
1957  {
1958  throw DataException("Error, attempt to acquire RW access to lazy data. Please call requireWrite() first.");
1959  }
1960 #ifdef EXWRITECHK
1961  if (!getReady()->exclusivewritecalled)
1962  {
1963  throw DataException("Error, call to Data::getSampleDataRW without a preceeding call to requireWrite/exclusiveWrite.");
1964  }
1965 #endif
1966  return getReady()->getSampleDataRW(sampleNo, dummy);
1967 }
1968 
1969 inline
1972 {
1973  if (isLazy())
1974  {
1975  throw DataException("Error, attempt to acquire RW access to lazy data. Please call requireWrite() first.");
1976  }
1977 #ifdef EXWRITECHK
1978  if (!getReady()->exclusivewritecalled)
1979  {
1980  throw DataException("Error, call to Data::getSampleDataRW without a preceeding call to requireWrite/exclusiveWrite.");
1981  }
1982 #endif
1983  return getReady()->getSampleDataRW(sampleNo, dummy);
1984 }
1985 
1986 
1987 inline
1988 const DataTypes::real_t*
1990 {
1991  DataLazy* l=dynamic_cast<DataLazy*>(m_data.get());
1992  if (l!=0)
1993  {
1994  size_t offset=0;
1995  const DataTypes::RealVectorType* res=l->resolveSample(sampleNo,offset);
1996  return &((*res)[offset]);
1997  }
1998  return getReady()->getSampleDataRO(sampleNo, dummy);
1999 }
2000 
2001 inline
2002 const DataTypes::cplx_t*
2004 {
2005  DataLazy* l=dynamic_cast<DataLazy*>(m_data.get());
2006  if (l!=0)
2007  {
2008  throw DataException("Programming error: complex lazy objects are not supported.");
2009  }
2010  return getReady()->getSampleDataRO(sampleNo, dummy);
2011 }
2012 
2013 
2014 inline
2015 const DataTypes::real_t*
2017 {
2018  if (isLazy())
2019  {
2020  throw DataException("Programmer error - getDataRO must not be called on Lazy Data.");
2021  }
2022  if (getNumSamples()==0)
2023  {
2024  return 0;
2025  }
2026  else
2027  {
2028  return &(getReady()->getTypedVectorRO(0)[0]);
2029  }
2030 }
2031 
2032 inline
2033 const DataTypes::cplx_t*
2035 {
2036  if (isLazy())
2037  {
2038  throw DataException("Programmer error - getDataRO must not be called on Lazy Data.");
2039  }
2040  if (getNumSamples()==0)
2041  {
2042  return 0;
2043  }
2044  else
2045  {
2046  return &(getReady()->getTypedVectorRO(dummy)[0]);
2047  }
2048 }
2049 
2050 
2055 {
2056  return pow(y,x);
2057 }
2058 
2064 Data operator+(const Data& left, const Data& right);
2065 
2071 Data operator-(const Data& left, const Data& right);
2072 
2078 Data operator*(const Data& left, const Data& right);
2079 
2085 Data operator/(const Data& left, const Data& right);
2086 
2093 Data operator+(const Data& left, const boost::python::object& right);
2094 
2101 Data operator-(const Data& left, const boost::python::object& right);
2102 
2109 Data operator*(const Data& left, const boost::python::object& right);
2110 
2117 Data operator/(const Data& left, const boost::python::object& right);
2118 
2125 Data operator+(const boost::python::object& left, const Data& right);
2126 
2133 Data operator-(const boost::python::object& left, const Data& right);
2134 
2141 Data operator*(const boost::python::object& left, const Data& right);
2142 
2149 Data operator/(const boost::python::object& left, const Data& right);
2150 
2151 
2152 
2157 std::ostream& operator<<(std::ostream& o, const Data& data);
2158 
2167 Data
2168 C_GeneralTensorProduct(Data& arg_0,
2169  Data& arg_1,
2170  int axis_offset=0,
2171  int transpose=0);
2172 
2178 inline
2179 Data
2180 Data::truedivD(const Data& right)
2181 {
2182  return *this / right;
2183 }
2184 
2190 inline
2191 Data
2192 Data::truedivO(const boost::python::object& right)
2193 {
2194  Data tmp(right, getFunctionSpace(), false);
2195  return truedivD(tmp);
2196 }
2197 
2203 inline
2204 Data
2205 Data::rtruedivO(const boost::python::object& left)
2206 {
2207  Data tmp(left, getFunctionSpace(), false);
2208  return tmp.truedivD(*this);
2209 }
2210 
2211 
2212 
2220 template <class BinaryFunction>
2221 inline
2223 Data::reduction(BinaryFunction operation, DataTypes::real_t initial_value) const
2224 {
2225  if (isExpanded()) {
2226  DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());
2227  ESYS_ASSERT(leftC!=0, "Programming error - casting to DataExpanded.");
2228 
2229  DataExpanded& data=*leftC;
2230  int i,j;
2231  int numDPPSample=data.getNumDPPSample();
2232  int numSamples=data.getNumSamples();
2233  DataTypes::real_t global_current_value=initial_value;
2234  DataTypes::real_t local_current_value;
2235  const auto& vec=data.getTypedVectorRO(typename BinaryFunction::first_argument_type(0));
2236  const DataTypes::ShapeType& shape=data.getShape();
2237  // calculate the reduction operation value for each data point
2238  // reducing the result for each data-point into the current_value variables
2239  #pragma omp parallel private(local_current_value)
2240  {
2241  local_current_value=initial_value;
2242  #pragma omp for private(i,j) schedule(static)
2243  for (i=0;i<numSamples;i++) {
2244  for (j=0;j<numDPPSample;j++) {
2245  local_current_value=operation(local_current_value,escript::reductionOpVector(vec,shape,data.getPointOffset(i,j),operation,initial_value));
2246 
2247  }
2248  }
2249  #pragma omp critical
2250  global_current_value=operation(global_current_value,local_current_value);
2251  }
2252  return global_current_value;
2253  } else if (isTagged()) {
2254  DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());
2255  ESYS_ASSERT(leftC!=0, "Programming error - casting to DataTagged.");
2256 
2257  DataTagged& data=*leftC;
2258  DataTypes::real_t current_value=initial_value;
2259 
2260  const auto& vec=data.getTypedVectorRO(typename BinaryFunction::first_argument_type(0));
2261  const DataTypes::ShapeType& shape=data.getShape();
2262  const DataTagged::DataMapType& lookup=data.getTagLookup();
2263  const std::list<int> used=data.getFunctionSpace().getListOfTagsSTL();
2264  for (std::list<int>::const_iterator i=used.begin();i!=used.end();++i)
2265  {
2266  int tag=*i;
2267  DataTagged::DataMapType::const_iterator it=lookup.find(tag);
2268  if ((tag==0) || (it==lookup.end())) // check for the default tag
2269  {
2270  current_value=operation(current_value,escript::reductionOpVector(vec,shape,data.getDefaultOffset(),operation,initial_value));
2271  }
2272  else
2273  {
2274  current_value=operation(current_value,escript::reductionOpVector(vec,shape,it->second,operation,initial_value));
2275  }
2276  }
2277  return current_value;
2278  } else if (isConstant()) {
2279  DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());
2280  ESYS_ASSERT(leftC!=0, "Programming error - casting to DataConstant.");
2281  return escript::reductionOpVector(leftC->getTypedVectorRO(typename BinaryFunction::first_argument_type(0)),leftC->getShape(),0,operation,initial_value);
2282  } else if (isEmpty()) {
2283  throw DataException("Error - Operations (algorithm) not permitted on instances of DataEmpty.");
2284  } else if (isLazy()) {
2285  throw DataException("Error - Operations not permitted on instances of DataLazy.");
2286  } else {
2287  throw DataException("Error - Data encapsulates an unknown type.");
2288  }
2289 }
2290 
2299 template <class BinaryFunction>
2300 inline
2301 Data
2302 Data::dp_algorithm(BinaryFunction operation, DataTypes::real_t initial_value) const
2303 {
2304  if (isEmpty()) {
2305  throw DataException("Error - Operations (dp_algorithm) not permitted on instances of DataEmpty.");
2306  }
2307  else if (isExpanded()) {
2309  DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());
2310  DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
2311  ESYS_ASSERT(dataE!=0, "Programming error - casting data to DataExpanded.");
2312  ESYS_ASSERT(resultE!=0, "Programming error - casting result to DataExpanded.");
2313 
2314 
2315 
2316  int i,j;
2317  int numSamples=dataE->getNumSamples();
2318  int numDPPSample=dataE->getNumDPPSample();
2319  // DataArrayView dataView=data.getPointDataView();
2320  // DataArrayView resultView=result.getPointDataView();
2321  const auto& dataVec=dataE->getTypedVectorRO(initial_value);
2322  const DataTypes::ShapeType& shape=dataE->getShape();
2323  auto& resultVec=resultE->getTypedVectorRW(initial_value);
2324  // perform the operation on each data-point and assign
2325  // this to the corresponding element in result
2326  #pragma omp parallel for private(i,j) schedule(static)
2327  for (i=0;i<numSamples;i++) {
2328  for (j=0;j<numDPPSample;j++) {
2329  resultVec[resultE->getPointOffset(i,j)] =
2330  escript::reductionOpVector(dataVec, shape, dataE->getPointOffset(i,j),operation,initial_value);
2331 
2332  }
2333  }
2334  //escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
2335  return result;
2336  }
2337  else if (isTagged()) {
2338  DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
2339  ESYS_ASSERT(dataT!=0, "Programming error - casting data to DataTagged.");
2340  DataTypes::RealVectorType defval(1);
2341  defval[0]=0;
2342  DataTagged* resultT=new DataTagged(getFunctionSpace(), DataTypes::scalarShape, defval, dataT);
2343 
2344 
2345  const DataTypes::ShapeType& shape=dataT->getShape();
2346  const auto& vec=dataT->getTypedVectorRO(initial_value);
2347  const DataTagged::DataMapType& lookup=dataT->getTagLookup();
2348  for (DataTagged::DataMapType::const_iterator i=lookup.begin(); i!=lookup.end(); i++) {
2349  resultT->getDataByTagRW(i->first,0) =
2350  escript::reductionOpVector(vec,shape,dataT->getOffsetForTag(i->first),operation,initial_value);
2351  }
2352  resultT->getTypedVectorRW(initial_value)[resultT->getDefaultOffset()] = escript::reductionOpVector(dataT->getTypedVectorRO(initial_value),dataT->getShape(),dataT->getDefaultOffset(),operation,initial_value);
2353 
2354 
2355 
2356 
2357  //escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
2358  return Data(resultT); // note: the Data object now owns the resultT pointer
2359  }
2360  else if (isConstant()) {
2362  DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
2363  DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
2364  ESYS_ASSERT(dataC!=0, "Programming error - casting data to DataConstant.");
2365  ESYS_ASSERT(resultC!=0, "Programming error - casting result to DataConstant.");
2366 
2367  DataConstant& data=*dataC;
2368  resultC->getTypedVectorRW(initial_value)[0] =
2369  escript::reductionOpVector(data.getTypedVectorRO(initial_value),data.getShape(),0,operation,initial_value);
2370 
2371  //escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
2372  return result;
2373  } else if (isLazy()) {
2374  throw DataException("Error - Operations not permitted on instances of DataLazy.");
2375  } else {
2376  throw DataException("Error - Data encapsulates an unknown type.");
2377  }
2378 }
2379 
2380 
2388 Data
2389 C_TensorBinaryOperation(Data const &arg_0,
2390  Data const &arg_1,
2391  ES_optype operation);
2392 
2393 
2394 Data
2395 C_TensorUnaryOperation(Data const &arg_0,
2396  escript::ES_optype operation,
2397  DataTypes::real_t tol=0);
2398 
2399 } // namespace escript
2400 
2401 #endif // __ESCRIPT_DATA_H__
escript::Data::getReady
const DataReady * getReady() const
Definition: Data.h:1786
escript::tensor_unary_array_operation_real
void tensor_unary_array_operation_real(const size_t size, const IN *arg1, DataTypes::real_t *argRes, escript::ES_optype operation, DataTypes::real_t tol=0)
Definition: ArrayOps.h:684
escript::Data::interpolateFromTable3DP
Data interpolateFromTable3DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, Data &C, DataTypes::real_t Cmin, DataTypes::real_t Cstep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4737
escript::Data::maskWorker
void maskWorker(Data &other2, Data &mask2, S sentinel)
Definition: Data.cpp:954
escript::Data::isReady
bool isReady() const
Return true if this data is ready.
Definition: Data.cpp:1153
escript::DataReady::getDataAtOffsetRO
DataTypes::RealVectorType::const_reference getDataAtOffsetRO(DataTypes::RealVectorType::size_type i) const
get a reference to the beginning of a data point
Definition: DataReady.h:247
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
escript::Data::getNumDataPointsPerSample
int getNumDataPointsPerSample() const
Return the number of data points per sample.
Definition: Data.h:544
escript::MINVAL
@ MINVAL
Definition: ES_optype.h:98
escript::Data::getSlice
Data getSlice(const DataTypes::RegionType &region) const
Return a Data object containing the specified slice of this Data object.
Definition: Data.cpp:3482
escript::Data::isComplex
bool isComplex() const
True if components of this data are stored as complex.
Definition: Data.cpp:1160
escript::FMin
Return the minimum value of the two given values.
Definition: ArrayOps.h:73
escript::Data::borrowData
DataAbstract * borrowData(void) const
return the object produced by the factory, which is a DataConstant or DataExpanded TODO Ownership of ...
Definition: Data.cpp:4621
escript::SIGN
@ SIGN
Definition: ES_optype.h:79
escript::Data::erf
Data erf() const
Return the error function erf of each data point of this Data object.
Definition: Data.cpp:2111
escript::Data::getSampleDataByTag
DataTypes::real_t * getSampleDataByTag(int tag, DataTypes::real_t dummy=0)
Return the sample data for the given tag. If an attempt is made to access data that isn't tagged an e...
Definition: Data.h:654
escript::FunctionSpace::getDomainPython
Domain_ptr getDomainPython() const
Return the function space domain. Internal use only! This gets around some python difficulties by cas...
Definition: FunctionSpace.cpp:109
escript::Data::sign
Data sign() const
Return the sign of each data point of this Data object. -1 for negative values, zero for zero values,...
Definition: Data.cpp:2157
escript::Data::m_lazy
bool m_lazy
Definition: Data.h:1776
escript::DataTypes::shapeToString
std::string shapeToString(const DataTypes::ShapeType &shape)
Return the given shape as a string.
Definition: DataTypes.cpp:117
escript::Data::oneOver
Data oneOver() const
Returns 1./ Data object.
Definition: Data.cpp:1246
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:79
escript::WrappedArray::getEltC
DataTypes::cplx_t getEltC() const
Definition: WrappedArray.h:147
MPI_Op
int MPI_Op
Definition: EsysMPI.h:44
escript::AbstractContinuousDomain::setToIntegrals
virtual void setToIntegrals(std::vector< DataTypes::real_t > &integrals, const escript::Data &arg) const
copies the integrals of the function defined by arg into integrals. arg has to be defined on this....
Definition: AbstractContinuousDomain.cpp:123
escript::DataTagged::getTagLookup
const DataMapType & getTagLookup() const
getTagLookup
Definition: DataTagged.h:776
escript::Data::atanh
Data atanh() const
Return the atanh of each data point of this Data object.
Definition: Data.cpp:2136
escript::Data::infWorker
DataTypes::real_t infWorker() const
Definition: Data.cpp:2580
escript::CONJ
@ CONJ
Definition: ES_optype.h:105
escript::Data::atan
Data atan() const
Return the atan of each data point of this Data object.
Definition: Data.cpp:2082
escript::LZ
@ LZ
Definition: ES_optype.h:87
escript::DataReady::getSampleDataRO
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Definition: DataReady.h:232
escript::Data::rtruedivO
Data rtruedivO(const boost::python::object &left)
Newer style division operator for python.
Definition: Data.h:2205
escript::Data::getDataAtOffsetRO
DataTypes::RealVectorType::const_reference getDataAtOffsetRO(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy)
Return a pointer to the beginning of the datapoint at the specified offset. TODO Eventually these sho...
Definition: Data.cpp:4690
escript::Data::antihermitian
Data antihermitian() const
Return the anti-hermitian part of a matrix which is half the matrix minus its hermitian.
Definition: Data.cpp:2808
escript::Data::setToZero
void setToZero()
set all values to zero
Definition: Data.cpp:815
escript::Data::cos
Data cos() const
Return the cos of each data point of this Data object.
Definition: Data.cpp:2053
escript::DataTagged::addTag
void addTag(int tagKey)
addTag - does not modify the default value for this object. ** Not unit tested **
Definition: DataTagged.cpp:685
escript::Data::Lsup
DataTypes::real_t Lsup()
Return the maximum absolute value of this Data object.
Definition: Data.cpp:2215
FunctionSpaceFactory.h
escript::Data::grad
Data grad() const
Definition: Data.cpp:1350
escript::COSH
@ COSH
Definition: ES_optype.h:71
escript::Data::requireWrite
void requireWrite()
Ensures data is ready for write access. This means that the data will be resolved if lazy and will be...
Definition: Data.cpp:1239
escript::DataLazy::resolveSample
const DataTypes::RealVectorType * resolveSample(int sampleNo, size_t &roffset) const
Compute the value of the expression for the given sample.
Definition: DataLazy.cpp:2336
escript::WrappedArray::getElt
DataTypes::real_t getElt() const
Definition: WrappedArray.h:89
escript::Data::setValueOfDataPoint
void setValueOfDataPoint(int dataPointNo, const DataTypes::real_t)
sets the values of a data-point on this process
Definition: Data.cpp:1655
escript::Data::print
void print(void)
print the data values to stdout. Used for debugging
Definition: Data.cpp:5387
escript::FMax
Return the maximum value of the two given values.
Definition: ArrayOps.h:58
escript::DataReady::getVectorRO
virtual const DataTypes::RealVectorType & getVectorRO() const =0
escript::DataConstant::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataConstant.cpp:872
escript::DataTagged::getDataByTagRW
DataTypes::RealVectorType::reference getDataByTagRW(int tag, DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0)
getDataByTag
Definition: DataTagged.cpp:1017
escript::Data::replaceNaN
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: Data.cpp:2400
escript::Data::whereNonNegative
Data whereNonNegative() const
Return a Data with a 1 for +ive or 0 values and a 0 for -ive values.
Definition: Data.cpp:1275
escript::Data::tan
Data tan() const
Return the tan of each data point of this Data object.
Definition: Data.cpp:2060
escript::Data::tag
void tag()
If possible convert this Data to DataTagged. This will only allow Constant data to be converted to ta...
Definition: Data.cpp:1204
MAKELAZYBIN
#define MAKELAZYBIN(R, X)
Definition: Data.cpp:97
escript::Data::getLength
DataTypes::RealVectorType::size_type getLength() const
Return the number of doubles stored for this Data.
Definition: Data.cpp:1367
escript::DataTagged::getDefaultOffset
DataTypes::RealVectorType::size_type getDefaultOffset() const
Returns the offset in the structure which stores the default value.
Definition: DataTagged.h:738
escript::binaryOpDataEEC
void binaryOpDataEEC(DataExpanded &result, const DataExpanded &left, const DataConstant &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:752
escript::Data::integrateToTuple
boost::python::object integrateToTuple()
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1784
escript::binaryOpDataEEE
void binaryOpDataEEE(DataExpanded &result, const DataExpanded &left, const DataExpanded &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:834
escript::Data::borrowDataPtr
DataAbstract_ptr borrowDataPtr(void) const
Definition: Data.cpp:4628
escript::Data::getDomain
const_Domain_ptr getDomain() const
Return the domain.
Definition: Data.h:487
escript::Data::sinh
Data sinh() const
Return the sinh of each data point of this Data object.
Definition: Data.cpp:2089
escript::Data::abs
Data abs() const
Return the absolute value of each data point of this Data object.
Definition: Data.cpp:2165
escript::Data::setTaggedValueByName
void setTaggedValueByName(std::string name, const boost::python::object &value)
Assign the given value to the tag assocciated with name. Implicitly converts this object to type Data...
Definition: Data.cpp:3577
escript::vectorHasNaN
bool vectorHasNaN(const DataTypes::RealVectorType &in, DataTypes::RealVectorType::size_type inOffset, size_t count)
returns true if the vector contains NaN
Definition: DataVectorOps.h:1473
escript::Data::hasNoSamples
bool hasNoSamples() const
Return true if this object contains no samples. This is not the same as isEmpty()
Definition: Data.h:745
escript::SQRT
@ SQRT
Definition: ES_optype.h:84
escript::Data::getSampleDataRO
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1989
escript::Data::getItem
Data getItem(const boost::python::object &key) const
Returns a slice from this Data object.
Definition: Data.cpp:3468
escript::DataTypes::DataVectorAlt< real_t >::const_reference
const typedef ElementType & const_reference
Definition: DataVectorAlt.h:94
escript::Data::getNoValues
int getNoValues() const
Return the number of values in the shape for this object.
Definition: Data.h:580
escript::DataExpanded::getTypedVectorRW
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataExpanded.cpp:1526
escript::IMAG
@ IMAG
Definition: ES_optype.h:104
escript::DataAbstract_ptr
boost::shared_ptr< DataAbstract > DataAbstract_ptr
Definition: DataAbstract.h:66
escript::SWAP
@ SWAP
Definition: ES_optype.h:97
escript::EXP
@ EXP
Definition: ES_optype.h:83
escript::Data::integrateWorker
boost::python::object integrateWorker() const
escript::DataConstant
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:52
escript::NSYM
@ NSYM
Definition: ES_optype.h:93
escript::Data::swapaxes
Data swapaxes(const int axis0, const int axis1) const
swaps the components axis0 and axis1
Definition: Data.cpp:2665
escript::Data::m_protected
bool m_protected
Definition: Data.h:1775
escript::Data::getDataPointShape
const DataTypes::ShapeType & getDataPointShape() const
Return a reference to the data point shape.
Definition: Data.h:705
escript::DataTagged::getDefaultValueRW
DataTypes::RealVectorType::reference getDefaultValueRW(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0)
getDefaultValue
Definition: DataTagged.h:745
escript::Data::init_from_data_and_fs
void init_from_data_and_fs(const Data &inData, const FunctionSpace &functionspace)
Definition: Data.cpp:430
escript::Data::interpolate
Data interpolate(const FunctionSpace &functionspace) const
Interpolates this onto the given functionspace and returns the result as a Data object.
Definition: Data.cpp:1311
escript::WrappedArray
Definition: WrappedArray.h:32
escript::Data::get_MPIRank
int get_MPIRank(void) const
return the MPI rank number of the local data MPI_COMM_WORLD is assumed and the result of MPI_Comm_siz...
Definition: Data.cpp:5451
escript::Data::exp
Data exp() const
Return the exponential function of each data point of this Data object.
Definition: Data.cpp:2191
escript::DataTypes::DataVectorAlt::size_type
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:92
escript::WrappedArray::isComplex
bool isComplex() const
Definition: WrappedArray.h:71
escript::Data::__mul__
boost::python::object __mul__(const boost::python::object &right)
wrapper for python multiply operation
Definition: Data.cpp:5985
escript::Data::getNumberOfTaggedValues
size_t getNumberOfTaggedValues() const
For tagged Data returns the number of tags with values. For non-tagged data will return 0 (even Data ...
Definition: Data.cpp:5859
escript::Data::minval_nonlazy
Data minval_nonlazy() const
Definition: Data.cpp:2625
escript::Data::sup_const
DataTypes::real_t sup_const() const
Definition: Data.cpp:2250
escript::Data::setTaggedValueFromCPP
void setTaggedValueFromCPP(int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
Assign the given value to the tag. Implicitly converts this object to type DataTagged if it is consta...
Definition: Data.cpp:3634
escript::DataTypes::DataVectorAlt< real_t >
escript::Data::interpolateFromTable2DP
Data interpolateFromTable2DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4747
escript::C_TensorUnaryOperation
Data C_TensorUnaryOperation(Data const &arg_0, escript::ES_optype operation, DataTypes::real_t tol=0)
Definition: Data.cpp:6079
escript::NHER
@ NHER
Definition: ES_optype.h:102
escript::Data::isTagged
bool isTagged() const
Return true if this Data is tagged.
Definition: Data.cpp:1125
escript::binaryOpDataEET
void binaryOpDataEET(DataExpanded &result, const DataExpanded &left, const DataTagged &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:327
escript::Data::besselSecondKind
Data besselSecondKind(int order)
Return the Bessel function of the second kind for each data point of this Data object.
Definition: Data.cpp:1864
MPI_SUM
#define MPI_SUM
Definition: EsysMPI.h:52
escript::SINH
@ SINH
Definition: ES_optype.h:70
escript::operator-
Data operator-(const Data &left, const Data &right)
Operator- Takes two Data objects.
Definition: Data.cpp:3359
escript::transpose
void transpose(const VEC &in, const DataTypes::ShapeType &inShape, typename VEC::size_type inOffset, VEC &ev, const DataTypes::ShapeType &evShape, typename VEC::size_type evOffset, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataVectorOps.h:343
escript::Data::gradOn
Data gradOn(const FunctionSpace &functionspace) const
Calculates the gradient of the data at the data points of functionspace. If functionspace is not pres...
Definition: Data.cpp:1323
escript::TRANS
@ TRANS
Definition: ES_optype.h:95
escript::DataTagged::getDataByTagRO
DataTypes::RealVectorType::const_reference getDataByTagRO(int tag, DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0) const
Definition: DataTagged.cpp:1006
escript::Data::LsupWorker
DataTypes::real_t LsupWorker() const
Definition: Data.cpp:2480
escript::Data::phase
Data phase() const
Return the phase/arg/angular-part of complex values.
Definition: Data.cpp:2023
escript::Data::getDataAtOffsetRW
DataTypes::RealVectorType::reference getDataAtOffsetRW(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy)
Definition: Data.cpp:4682
escript::Data::sup
DataTypes::real_t sup()
Return the maximum value of this Data object.
Definition: Data.cpp:2264
escript::TestDomain
(Testing use only) Provides a domain to wrap a collection of values.
Definition: TestDomain.h:56
escript::const_DataReady_ptr
boost::shared_ptr< const DataReady > const_DataReady_ptr
Definition: DataAbstract.h:74
escript::ATANH
@ ATANH
Definition: ES_optype.h:76
escript::Data::isConstant
bool isConstant() const
Return true if this Data is constant.
Definition: Data.cpp:1139
ESCRIPT_MAX_DATA_RANK
#define ESCRIPT_MAX_DATA_RANK
Definition: Data.h:39
escript::Domain_ptr
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:55
escript::LOG
@ LOG
Definition: ES_optype.h:78
DataLazy.h
escript::Data::initialise
void initialise(const DataTypes::RealVectorType &value, const DataTypes::ShapeType &shape, const FunctionSpace &what, bool expanded)
Construct a Data object of the appropriate type.
Definition: Data.cpp:638
escript::Data::bessel
Data bessel(int order, DataTypes::real_t(*besselfunc)(int, DataTypes::real_t))
Bessel worker function.
Definition: Data.cpp:1871
escript::Data::randomData
friend Data randomData(const boost::python::tuple &shape, const FunctionSpace &what, long seed, const boost::python::tuple &filter)
Create a new Expanded Data object filled with pseudo-random data.
escript::binOpFnPtr
int(* binOpFnPtr)(double *, const double *, const double *, int, int, int)
Definition: Dodgy.h:45
escript::Data::interpolateFromTable1D
Data interpolateFromTable1D(const WrappedArray &table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4765
escript::Data::TensorSelfUpdateBinaryOperation
void TensorSelfUpdateBinaryOperation(const Data &right, escript::ES_optype operation)
Definition: Data.cpp:6531
escript::DataReady::getDataAtOffsetRWC
DataTypes::CplxVectorType::reference getDataAtOffsetRWC(DataTypes::CplxVectorType::size_type i)
Definition: DataReady.h:269
escript::Data::getDataPointSize
int getDataPointSize() const
Return the size of the data point. It is the product of the data point shape dimensions.
Definition: Data.cpp:1360
escript::Data::__add__
boost::python::object __add__(const boost::python::object &right)
wrapper for python add operation
Definition: Data.cpp:5912
escript::SUB
@ SUB
Definition: ES_optype.h:60
escript::binOpFnPtrFromVoidPtr
binOpFnPtr binOpFnPtrFromVoidPtr(void *v)
Definition: Dodgy.cpp:37
escript::Data::Data
Data()
Default constructor. Creates a DataEmpty object.
Definition: Data.cpp:246
escript::Data::interpolateFromTable1DP
Data interpolateFromTable1DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4756
escript::FunctionSpace
Definition: FunctionSpace.h:49
escript::Data::truedivO
Data truedivO(const boost::python::object &right)
Newer style division operator for python.
Definition: Data.h:2192
escript::Data::getDomainPython
Domain_ptr getDomainPython() const
Return the domain. TODO: For internal use only. This should be removed.
Definition: Data.h:501
escript::DataReady::hasInf
virtual bool hasInf() const =0
Return true if data contains Inf or -Inf.
escript::Data::tanh
Data tanh() const
Return the tanh of each data point of this Data object.
Definition: Data.cpp:2103
escript::ACOS
@ ACOS
Definition: ES_optype.h:68
escript::FunctionSpace::getListOfTagsSTL
std::list< int > getListOfTagsSTL() const
Returns an stl list of the tags used in this function space.
Definition: FunctionSpace.cpp:335
escript::binaryOpDataTCT
void binaryOpDataTCT(DataTagged &result, const DataConstant &left, const DataTagged &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:191
escript::makePromote
DataLazy_ptr makePromote(DataLazy_ptr p)
Definition: DataLazy.cpp:115
escript::DataReady
Definition: DataReady.h:50
escript::Data::get_MPIComm
MPI_Comm get_MPIComm(void) const
return the MPI rank number of the local data MPI_COMM_WORLD is assumed and returned.
Definition: Data.cpp:5463
escript::Data::getFunctionSpace
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:463
escript::Data::complicate
void complicate()
Definition: Data.cpp:6057
escript::Data::delaySelf
void delaySelf()
convert the current data into lazy data.
Definition: Data.cpp:797
escript::DataTagged::getVectorRO
const DataTypes::RealVectorType & getVectorRO() const
Definition: DataTagged.cpp:1650
escript::AbsMax
Return the absolute maximum value of the two given values.
Definition: ArrayOps.h:89
escript::DataTagged::DataMapType
std::map< int, int > DataMapType
Definition: DataTagged.h:72
escript::FunctionSpace::getDomain
const_Domain_ptr getDomain() const
Returns the function space domain.
Definition: FunctionSpace.cpp:103
MPI_INT
#define MPI_INT
Definition: EsysMPI.h:46
escript::Data::condEvalWorker
friend Data condEvalWorker(escript::Data &mask, escript::Data &trueval, escript::Data &falseval, S sentinel)
escript::TANH
@ TANH
Definition: ES_optype.h:72
escript::Data::whereZero
Data whereZero(DataTypes::real_t tol=0.0) const
Return a Data with a 1 for 0 values and a 0 for +ive or -ive values.
Definition: Data.cpp:1297
MPI_MAX
#define MPI_MAX
Definition: EsysMPI.h:54
MAKELAZYOPOFF
#define MAKELAZYOPOFF(X, Y)
Definition: Data.cpp:71
escript::C_GeneralTensorProduct
Data C_GeneralTensorProduct(Data &arg_0, Data &arg_1, int axis_offset=0, int transpose=0)
Compute a tensor product of two Data objects.
Definition: Data.cpp:3690
system_dep.h
escript::PHS
@ PHS
Definition: ES_optype.h:110
escript::DataReady::replaceInf
virtual void replaceInf(DataTypes::real_t value)=0
replaces all (+/-)Inf values with value
escript::ERF
@ ERF
Definition: ES_optype.h:73
escript::Data::getNumSamples
int getNumSamples() const
Return the number of samples.
Definition: Data.h:533
escript::NEG
@ NEG
Definition: ES_optype.h:81
escript::Data::powD
Data powD(const Data &right) const
Return the given power of each data point of this Data object.
Definition: Data.cpp:3337
escript::WrappedArray::getRank
unsigned int getRank() const
Definition: WrappedArray.h:77
escript::GZ
@ GZ
Definition: ES_optype.h:86
escript::DataTagged
Simulates a full dataset accessible via sampleNo and dataPointNo.
Definition: DataTagged.h:59
escript::binaryOpDataTTT
void binaryOpDataTTT(DataTagged &result, const DataTagged &left, const DataTagged &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:672
escript::DataAbstract::getNumDPPSample
int getNumDPPSample() const
Return the number of data points per sample.
Definition: DataAbstract.h:626
escript::operator+
Data operator+(const Data &left, const Data &right)
Operator+ Takes two Data objects.
Definition: Data.cpp:3349
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
escript::Data::getDataOffset
DataTypes::RealVectorType::size_type getDataOffset(int sampleNo, int dataPointNo)
Return the offset for the given sample and point within the sample.
Definition: Data.h:693
escript::DataReady::getDataAtOffsetROC
DataTypes::CplxVectorType::const_reference getDataAtOffsetROC(DataTypes::CplxVectorType::size_type i) const
Definition: DataReady.h:262
escript::DataException
Definition: DataException.h:41
escript::Data::toString
std::string toString() const
Write the data as a string. For large amounts of data, a summary is printed.
Definition: Data.cpp:4643
paso::nz
static dim_t nz
Definition: SparseMatrix_saveHB.cpp:52
escript::Data::whereNonPositive
Data whereNonPositive() const
Return a Data with a 1 for -ive or 0 values and a 0 for +ive values.
Definition: Data.cpp:1286
escript::Data::operator=
Data & operator=(const Data &other)
Definition: Data.cpp:3202
escript::Data::forceResolve
void forceResolve()
Definition: Data.h:1844
escript::Data::resolve
void resolve()
If this data is lazy, then convert it to ready data. What type of ready data depends on the expressio...
Definition: Data.cpp:1230
escript::Data::checkExclusiveWrite
void checkExclusiveWrite()
checks if caller can have exclusive write to the object
Definition: Data.h:1884
BinaryDataReadyOps.h
Describes binary operations performed on instances of DataAbstract.
escript::DataConstant::getTypedVectorRW
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataConstant.cpp:865
escript::DataTypes::ShapeType
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:71
DataExpanded.h
escript::Data::powO
Data powO(const boost::python::object &right) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:3330
escript::Data::getShapeTuple
const boost::python::tuple getShapeTuple() const
Return the data point shape as a tuple of integers.
Definition: Data.cpp:724
MAKELAZYBIN2
#define MAKELAZYBIN2(L, R, X)
Definition: Data.cpp:105
escript::Data::getReady
DataReady * getReady()
Definition: Data.h:1794
escript::Data::typeMatchLeft
void typeMatchLeft(Data &right) const
Convert the data type of the RHS to match this.
Definition: Data.cpp:3529
escript::DataTypes
Contains the types to represent Shapes, Regions, RegionLoop ranges and vectors of data as well as the...
Definition: DataTypes.cpp:87
escript::ABS
@ ABS
Definition: ES_optype.h:80
escript::Data::symmetric
Data symmetric() const
Return the symmetric part of a matrix which is half the matrix plus its transpose.
Definition: Data.cpp:2722
EscriptParams.h
escript::DataTypes::fillComplexFromReal
void fillComplexFromReal(const RealVectorType &r, CplxVectorType &c)
copy data from a real vector to a complex vector The complex vector will be resized as needed and any...
escript::DataExpanded::getPointOffset
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const
Return the offset for the given given data point. This returns the offset in bytes for the given poin...
Definition: DataExpanded.cpp:622
escript::DataAbstract::getPointOffset
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const =0
Return the offset for the given sample. This returns the offset for the given point into the containe...
escript::matrix_matrix_product
void matrix_matrix_product(const int SL, const int SM, const int SR, const LEFT *A, const RIGHT *B, RES *C, int transpose)
Definition: ArrayOps.h:564
escript::DataEmpty
Implements the DataAbstract interface for an empty Data object.
Definition: DataEmpty.h:48
escript::DataReady::getSampleDataRW
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample number.
Definition: DataReady.h:218
escript::Data::getSampleDataRW
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1954
escript::Data::operandCheck
void operandCheck(const Data &right) const
Check *this and the right operand are compatible. Throws an exception if they aren't.
Definition: Data.h:1695
escript::Data::toListOfTuples
const boost::python::object toListOfTuples(bool scalarastuple=true)
returns the values of the object as a list of tuples (one for each datapoint).
Definition: Data.cpp:1378
escript::Data::replaceInf
void replaceInf(DataTypes::real_t value)
Definition: Data.cpp:2445
escript::DataReady::resolve
DataReady_ptr resolve()
Return a data object with all points resolved.
Definition: DataReady.cpp:44
escript::Data::real
Data real() const
Definition: Data.cpp:1984
escript::DataTypes::RegionType
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:72
DataAbstract.h
escript::Data::sin
Data sin() const
Return the sin of each data point of this Data object.
Definition: Data.cpp:2046
escript::REAL
@ REAL
Definition: ES_optype.h:103
escript::DataTypes::noValues
int noValues(const ShapeType &shape)
Calculate the number of values in a datapoint with the given shape.
Definition: DataTypes.cpp:91
escript::Data::maxval
Data maxval() const
Return the maximum value of each data point of this Data object.
Definition: Data.cpp:2647
escript::Data::getReadyPtr
const_DataReady_ptr getReadyPtr() const
Definition: Data.h:1814
escript::DataAbstract::getShape
const DataTypes::ShapeType & getShape() const
Return the shape information for the point data.
Definition: DataAbstract.h:656
escript::Data::besselFirstKind
Data besselFirstKind(int order)
Return the Bessel function of the first kind for each data point of this Data object.
Definition: Data.cpp:1857
escript::DataTypes::DataVectorAlt::copyFromArray
void copyFromArray(const WrappedArray &value, size_type copies)
Populates the vector with the data from value. This method currently throws an exception if the speci...
Definition: DataVectorAlt.h:510
escript::Data::acosh
Data acosh() const
Return the acosh of each data point of this Data object.
Definition: Data.cpp:2129
escript::DataAbstract::getNumSamples
int getNumSamples() const
Return the number of samples.
Definition: DataAbstract.h:637
escript::binaryOpDataECE
void binaryOpDataECE(DataExpanded &result, const DataConstant &left, const DataExpanded &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:271
escript::ACOSH
@ ACOSH
Definition: ES_optype.h:75
escript::Data::cosh
Data cosh() const
Return the cosh of each data point of this Data object.
Definition: Data.cpp:2096
escript::MUL
@ MUL
Definition: ES_optype.h:61
escript::DataTagged::getTypedVectorRW
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataTagged.cpp:1669
escript::Data::getDataRO
const DataTypes::real_t * getDataRO(DataTypes::real_t dummy=0) const
Return a pointer to the beginning of the underlying data.
Definition: Data.h:2016
escript::Data::eigenvalues_and_eigenvectors
const boost::python::tuple eigenvalues_and_eigenvectors(const DataTypes::real_t tol=1.e-12) const
Return the eigenvalues and corresponding eigenvcetors of the symmetric part at each data point of thi...
Definition: Data.cpp:2954
escript::DataTagged::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataTagged.cpp:1676
escript::WrappedArray::convertArray
void convertArray() const
Definition: WrappedArray.cpp:531
escript::Data::trace
Data trace(int axis_offset) const
Return the trace of a matrix.
Definition: Data.cpp:2848
escript::Data::setTaggedValue
void setTaggedValue(int tagKey, const boost::python::object &value)
Assign the given value to the tag. Implicitly converts this object to type DataTagged if it is consta...
Definition: Data.cpp:3594
escript::Data::minGlobalDataPoint
const boost::python::tuple minGlobalDataPoint() const
Definition: Data.cpp:2980
escript::Data::typeMatchRight
void typeMatchRight(const Data &right)
Convert the data type of this to match the RHS.
Definition: Data.cpp:3549
Dodgy.h
escript::ADD
@ ADD
Definition: ES_optype.h:59
escript::GEZ
@ GEZ
Definition: ES_optype.h:88
escript::Data::copySelf
Data copySelf() const
Return a pointer to a deep copy of this object.
Definition: Data.cpp:770
escript::Data::isDataPointShapeEqual
bool isDataPointShapeEqual(int rank, const int *dimensions) const
Returns true if the shape matches the vector (dimensions[0],..., dimensions[rank-1])....
Definition: Data.h:567
escript::DataAbstract::getPtr
DataAbstract_ptr getPtr()
Return shared pointer managing this object.
Definition: DataAbstract.cpp:39
escript::Data::set_m_data
void set_m_data(DataAbstract_ptr p)
Modify the data abstract hosted by this Data object For internal use only. Passing a pointer to null ...
Definition: Data.cpp:609
escript::DataExpanded
Give a short description of what DataExpanded does.
Definition: DataExpanded.h:58
escript::Data::isEmpty
bool isEmpty() const
Definition: Data.cpp:1132
escript::Data::getDataPointRO
DataTypes::RealVectorType::const_reference getDataPointRO(int sampleNo, int dataPointNo)
Return a reference into the DataVector which points to the specified data point.
Definition: Data.cpp:4713
escript::Data::replaceInfPython
void replaceInfPython(boost::python::object obj)
Definition: Data.cpp:2465
escript::Data::getNumDataPoints
int getNumDataPoints() const
Return the number of data points.
Definition: Data.h:523
escript::TRACE
@ TRACE
Definition: ES_optype.h:96
escript::LEZ
@ LEZ
Definition: ES_optype.h:89
escript::DIV
@ DIV
Definition: ES_optype.h:62
escript::binaryOpDataTTC
void binaryOpDataTTC(DataTagged &result, const DataTagged &left, const DataConstant &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:520
escript::Data::dump
void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: Data.cpp:5417
escript::Data::numSamplesEqual
bool numSamplesEqual(int numDataPointsPerSample, int numSamples) const
Returns true if the number of data points per sample and the number of samples match the respective a...
Definition: Data.h:555
escript::Data::calc_maxGlobalDataPoint
void calc_maxGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:3093
escript::escriptParams
EscriptParams escriptParams
Definition: EscriptParams.cpp:43
escript::Data::dp_algorithm
Data dp_algorithm(BinaryFunction operation, DataTypes::real_t initial_value) const
Reduce each data-point in this Data object using the given operation. Return a Data object with the s...
Definition: Data.h:2302
escript::Data::getValueOfGlobalDataPointAsTuple
const boost::python::object getValueOfGlobalDataPointAsTuple(int procNo, int dataPointNo)
Return a data point across all processors as a python tuple.
Definition: Data.cpp:1699
escript::DataTagged::getPointOffset
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const
getPointOffset
Definition: DataTagged.cpp:982
DataConstant.h
escript::Data::isShared
bool isShared() const
Definition: Data.h:1835
WrappedArray.h
escript::DataExpanded::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataExpanded.cpp:1532
escript::Data::setItemD
void setItemD(const boost::python::object &key, const Data &value)
Copies slice from value into this Data object.
Definition: Data.cpp:3498
escript::Data::integrateToTuple_const
boost::python::object integrateToTuple_const() const
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1770
escript::binaryOpDataETE
void binaryOpDataETE(DataExpanded &result, const DataTagged &left, const DataExpanded &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:383
escript::operator*
Data operator*(const AbstractSystemMatrix &left, const Data &right)
Definition: AbstractSystemMatrix.cpp:74
escript::Data::getReadyPtr
DataReady_ptr getReadyPtr()
Definition: Data.h:1806
escript::Data::maxGlobalDataPoint
const boost::python::tuple maxGlobalDataPoint() const
Definition: Data.cpp:3083
escript::Data::copyWithMask
void copyWithMask(const Data &other, const Data &mask)
Copy other Data object into this Data object where mask is positive.
Definition: Data.cpp:851
escript::RECIP
@ RECIP
Definition: ES_optype.h:85
escript::ES_optype
ES_optype
Definition: ES_optype.h:41
escript::Data::__rsub__
boost::python::object __rsub__(const boost::python::object &right)
wrapper for python reverse subtract operation
Definition: Data.cpp:5960
escript::Data::transpose
Data transpose(int axis_offset) const
Transpose each data point of this Data object around the given axis.
Definition: Data.cpp:2903
escript::matrixInverseError
void matrixInverseError(int err)
throws an appropriate exception based on failure of matrix_inverse.
Definition: DataVectorOps.cpp:186
V
#define V(_K_, _I_)
Definition: ShapeFunctions.cpp:139
escript::C_TensorBinaryOperation
Data C_TensorBinaryOperation(Data const &arg_0, Data const &arg_1, ES_optype operation)
Compute a tensor operation with two Data objects.
Definition: Data.cpp:6355
escript::Data::delay
Data delay()
produce a delayed evaluation version of this Data.
Definition: Data.cpp:786
escript::FunctionSpaceException
Definition: FunctionSpaceException.h:42
MAKELAZYOP2
#define MAKELAZYOP2(X, Y, Z)
Definition: Data.cpp:79
MPI_DOUBLE
#define MPI_DOUBLE
Definition: EsysMPI.h:47
escript::DataTagged::getDefaultValueRO
DataTypes::RealVectorType::const_reference getDefaultValueRO(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0) const
Definition: DataTagged.h:752
escript::Data::hermitian
Data hermitian() const
Return the hermitian part of a matrix which is half the matrix plus its adjoint.
Definition: Data.cpp:2781
escript::Data::operator*=
Data & operator*=(const Data &right)
Overloaded operator *=.
Definition: Data.cpp:3237
MPI_MIN
#define MPI_MIN
Definition: EsysMPI.h:53
escript::Data::supWorker
DataTypes::real_t supWorker() const
Definition: Data.cpp:2537
escript::Data::whereNegative
Data whereNegative() const
Return a Data with a 1 for -ive values and a 0 for +ive or 0 values.
Definition: Data.cpp:1264
escript::Data::minval
Data minval() const
Return the minimum value of each data point of this Data object.
Definition: Data.cpp:2656
escript::Data::interpolateFromTable2D
Data interpolateFromTable2D(const WrappedArray &table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, bool check_boundaries)
Definition: Data.cpp:4893
AbstractContinuousDomain.h
escript::operator/
Data operator/(const Data &left, const Data &right)
Operator/ Takes two Data objects.
Definition: Data.cpp:3378
escript::Data::getValueOfDataPointAsTuple
const boost::python::object getValueOfDataPointAsTuple(int dataPointNo)
Return the value of a data point as a python tuple.
Definition: Data.cpp:1520
escript::Data::getXFromFunctionSpace
escript::Data getXFromFunctionSpace() const
Returns the spatial locations of the data points.
Definition: Data.h:474
escript::Data::log
Data log() const
Return the natural log of each data point of this Data object.
Definition: Data.cpp:2150
escript::Data::truedivD
Data truedivD(const Data &right)
Newer style division operator for python.
Definition: Data.h:2180
escript::Data::rpowO
Data rpowO(const boost::python::object &left) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:3323
escript::Data::__div__
boost::python::object __div__(const boost::python::object &right)
wrapper for python divide operation
Definition: Data.cpp:6009
escript::Data::borrowReadyPtr
DataReady_ptr borrowReadyPtr(void) const
Definition: Data.cpp:4635
M_PI
#define M_PI
Definition: ArrayOps.h:33
escript::DataReady::setSlice
virtual void setSlice(const DataAbstract *value, const DataTypes::RegionType &region)=0
Copy the specified region from the given object.
FunctionSpaceException.h
escript
Definition: AbstractContinuousDomain.cpp:23
escript::Data::matrixInverse
Data matrixInverse() const
return inverse of matricies.
Definition: Data.cpp:3295
escript::Data::inf
DataTypes::real_t inf()
Return the minimum value of this Data object.
Definition: Data.cpp:2303
escript::Data::wherePositive
Data wherePositive() const
Return a Data with a 1 for +ive values and a 0 for 0 or -ive values.
Definition: Data.cpp:1253
escript::Data::isExpanded
bool isExpanded() const
Return true if this Data is expanded.
Definition: Data.cpp:1111
escript::PROD
@ PROD
Definition: ES_optype.h:94
escript::DataReady::getVectorRW
virtual DataTypes::RealVectorType & getVectorRW()=0
Provide access to underlying storage. Internal use only!
escript::Data::hasInf
bool hasInf()
Definition: Data.cpp:2434
escript::DataTypes::getRelIndex
vec_size_type getRelIndex(const DataTypes::ShapeType &shape, vec_size_type i)
Compute the offset (in 1D vector) of a given subscript with a shape.
Definition: DataTypes.h:262
escript::Data::inf_const
DataTypes::real_t inf_const() const
Definition: Data.cpp:2289
escript::LOG10
@ LOG10
Definition: ES_optype.h:77
escript::Data::nonuniformslope
Data nonuniformslope(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:5308
DataTypes.h
escript::Data::getTagNumber
int getTagNumber(int dpno)
Return the tag number associated with the given data-point.
Definition: Data.cpp:3673
escript::Data::__sub__
boost::python::object __sub__(const boost::python::object &right)
wrapper for python subtract operation
Definition: Data.cpp:5936
escript::Data::operator/=
Data & operator/=(const Data &right)
Overloaded operator /=.
Definition: Data.cpp:3264
escript::Data::antisymmetric
Data antisymmetric() const
Return the antisymmetric part of a matrix which is half the matrix minus its transpose.
Definition: Data.cpp:2745
escript::Data::Lsup_const
DataTypes::real_t Lsup_const() const
Definition: Data.cpp:2205
escript::DataAbstract
Definition: DataAbstract.h:76
escript::SYM
@ SYM
Definition: ES_optype.h:92
MAKELAZYOP
#define MAKELAZYOP(X)
Definition: Data.cpp:63
escript::always_real
bool always_real(escript::ES_optype operation)
Definition: ArrayOps.cpp:66
escript::EscriptParams::getTooManyLines
int getTooManyLines() const
Definition: EscriptParams.h:73
escript::Data::exclusiveWrite
void exclusiveWrite()
if another object is sharing out member data make a copy to work with instead. This code should only ...
Definition: Data.h:1862
escript::DataTagged::getOffsetForTag
DataTypes::RealVectorType::size_type getOffsetForTag(int tag) const
getOffsetForTag
Definition: DataTagged.cpp:995
DataVectorOps.h
Describes binary operations performed on DataVector.
escript::DataReady::getTypedVectorRW
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)=0
These versions use the type system rather than method name to determine return type.
escript::supports_cplx
bool supports_cplx(escript::ES_optype operation)
Definition: ArrayOps.cpp:26
escript::FunctionSpace::getTypeCode
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:95
CHECK_DO_CRES
#define CHECK_DO_CRES
Definition: Data.cpp:113
escript::Data::asinh
Data asinh() const
Return the asinh of each data point of this Data object.
Definition: Data.cpp:2122
escript::Data::setSlice
void setSlice(const Data &value, const DataTypes::RegionType &region)
Copy the specified slice from the given value into this Data object.
Definition: Data.cpp:3514
escript::SIN
@ SIN
Definition: ES_optype.h:64
escript::FunctionSpace::getDim
int getDim() const
Return the number of spatial dimensions of the underlying domain.
Definition: FunctionSpace.h:197
AUTOLAZYON
#define AUTOLAZYON
Definition: Data.cpp:62
escript::EZ
@ EZ
Definition: ES_optype.h:91
escript::FunctionSpace::toString
std::string toString() const
Returns a text description of the function space.
Definition: FunctionSpace.cpp:118
escript::Data::isLazy
bool isLazy() const
Return true if this Data is lazy.
Definition: Data.cpp:1146
escript::function
FunctionSpace function(const AbstractDomain &domain)
Return a function FunctionSpace.
Definition: FunctionSpaceFactory.cpp:57
escript::Data::~Data
~Data()
Destructor.
Definition: Data.cpp:601
escript::Data::whereNonZero
Data whereNonZero(DataTypes::real_t tol=0.0) const
Return a Data with a 0 for 0 values and a 1 for +ive or -ive values.
Definition: Data.cpp:1304
escript::Data::getShapeProduct
long getShapeProduct() const
Returns the product of the data point shapes.
Definition: Data.cpp:745
escript::Data::setTupleForGlobalDataPoint
void setTupleForGlobalDataPoint(int id, int proc, boost::python::object)
Set the value of a global data point.
Definition: Data.cpp:1567
DataTagged.h
escript::Data::setValueOfDataPointToArray
void setValueOfDataPointToArray(int dataPointNo, const boost::python::object &)
sets the values of a data-point from a array-like object on this process
Definition: Data.cpp:1612
escript::binaryOpDataCCC
void binaryOpDataCCC(DataConstant &result, const DataConstant &left, const DataConstant &right, escript::ES_optype operation)
Definition: BinaryDataReadyOps.cpp:66
escript::Data::setValueOfDataPointC
void setValueOfDataPointC(int dataPointNo, const DataTypes::cplx_t)
Definition: Data.cpp:1676
escript::Data::setItemO
void setItemO(const boost::python::object &key, const boost::python::object &value)
Definition: Data.cpp:3490
escript::condEval
Data condEval(escript::Data &mask, escript::Data &trueval, escript::Data &falseval)
Definition: Data.cpp:5648
MPI_Comm
int MPI_Comm
Definition: EsysMPI.h:42
escript::Data::log10
Data log10() const
Return the log to base 10 of each data point of this Data object.
Definition: Data.cpp:2143
escript::DataTagged::addTaggedValue
void addTaggedValue(int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
addTaggedValue
Definition: DataTagged.cpp:608
escript::Data::pos
Data pos() const
Return the identity of each data point of this Data object. Simply returns this object unmodified.
Definition: Data.cpp:2179
escript::DataTypes::DataVectorAlt< real_t >::reference
ElementType & reference
Definition: DataVectorAlt.h:93
escript::Data::__rdiv__
boost::python::object __rdiv__(const boost::python::object &right)
wrapper for python reverse divide operation
Definition: Data.cpp:6033
escript::reductionOpVector
DataTypes::real_t reductionOpVector(const DataTypes::RealVectorType &left, const DataTypes::ShapeType &leftShape, DataTypes::RealVectorType::size_type offset, BinaryFunction operation, DataTypes::real_t initial_value)
Perform the given data point reduction operation on the data point specified by the given offset into...
Definition: DataVectorOps.h:1397
escript::Data::replaceNaNPython
void replaceNaNPython(boost::python::object obj)
replaces all NaN values with value
Definition: Data.cpp:2420
escript::Data::imag
Data imag() const
Definition: Data.cpp:2003
escript::Data::hasNaN
bool hasNaN()
returns return true if data contains NaN.
Definition: Data.cpp:2389
Data.h
escript::Data::actsExpanded
bool actsExpanded() const
Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for...
Definition: Data.cpp:1118
escript::makeNaN
DataTypes::real_t makeNaN()
returns a NaN.
Definition: ArrayOps.h:142
DataReady.h
escript::Data::operator+=
Data & operator+=(const Data &right)
Overloaded operator +=.
Definition: Data.cpp:3174
escript::Data::copy
void copy(const Data &other)
Make this object a deep copy of "other".
Definition: Data.cpp:777
escript::POW
@ POW
Definition: ES_optype.h:63
S
#define S(_J_, _I_)
Definition: ShapeFunctions.cpp:140
escript::DataLazy::resolveTypedSample
const DataTypes::CplxVectorType * resolveTypedSample(int sampleNo, size_t &roffset, DataTypes::cplx_t dummy) const
Definition: DataLazy.cpp:2389
escript::DataConstant::getPointOffset
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const
Return the offset for the given sample. This is a somewhat artificial notion but returns the offset i...
Definition: DataConstant.cpp:354
escript::Data::neg
Data neg() const
Return the negation of each data point of this Data object.
Definition: Data.cpp:2172
escript::DataAbstract::getFunctionSpace
const FunctionSpace & getFunctionSpace() const
Return the function space associated with this Data object.
Definition: DataAbstract.h:649
escript::Data::nonuniforminterp
Data nonuniforminterp(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:5232
escript::Data::getSampleDataByTag
DataTypes::cplx_t * getSampleDataByTag(int tag, DataTypes::cplx_t dummy)
Definition: Data.h:661
escript::Data::getExpandedVectorReference
DataTypes::RealVectorType & getExpandedVectorReference(DataTypes::real_t dummy=0)
Ensures that the Data is expanded and returns its underlying vector Does not check for exclusive writ...
Definition: Data.cpp:5841
escript::DataAbstract::getSlice
virtual DataAbstract * getSlice(const DataTypes::RegionType &region) const =0
Return the given slice from this object.
escript::Data::lazyAlgWorker
DataTypes::real_t lazyAlgWorker(DataTypes::real_t init)
escript::TAN
@ TAN
Definition: ES_optype.h:66
escript::Data::reduction
DataTypes::real_t reduction(BinaryFunction operation, DataTypes::real_t initial_value) const
Perform the specified reduction algorithm on every element of every data point in this Data object ac...
Definition: Data.h:2223
escript::Data::calc_minGlobalDataPoint
void calc_minGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:2997
escript::Data::setValueOfDataPointToPyObject
void setValueOfDataPointToPyObject(int dataPointNo, const boost::python::object &py_object)
sets the values of a data-point from a python object on this process
Definition: Data.cpp:1559
escript::DataTypes::cplx_t
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:82
escript::Data::m_data
DataAbstract_ptr m_data
Definition: Data.h:1781
escript::DataReady::getDataAtOffsetRW
DataTypes::RealVectorType::reference getDataAtOffsetRW(DataTypes::RealVectorType::size_type i)
Definition: DataReady.h:254
escript::Data::acos
Data acos() const
Return the acos of each data point of this Data object.
Definition: Data.cpp:2074
escript::Data::probeInterpolation
bool probeInterpolation(const FunctionSpace &functionspace) const
Returns true if this can be interpolated to functionspace.
Definition: Data.cpp:1317
escript::Data::maxval_nonlazy
Data maxval_nonlazy() const
Definition: Data.cpp:2636
escript::Scalar
Data Scalar(double value, const FunctionSpace &what, bool expanded)
A collection of factory functions for creating Data objects which contain data points of various shap...
Definition: DataFactory.cpp:63
escript::Data::expand
void expand()
Whatever the current Data type make this into a DataExpanded.
Definition: Data.cpp:1180
escript::DataReady_ptr
boost::shared_ptr< DataReady > DataReady_ptr
Definition: DataAbstract.h:71
escript::const_Domain_ptr
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:58
escript::WrappedArray::getShape
const DataTypes::ShapeType & getShape() const
Definition: WrappedArray.h:83
DataEmpty.h
ESYS_ASSERT
#define ESYS_ASSERT(a, b)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false.
Definition: Assert.h:79
escript::randomData
Data randomData(const boost::python::tuple &shape, const FunctionSpace &what, long seed, const boost::python::tuple &filter)
Create a new Expanded Data object filled with pseudo-random data.
Definition: Data.cpp:5872
escript::Data::conjugate
Data conjugate() const
For complex values return the conjugate values. For non-complex data return a copy.
Definition: Data.cpp:1964
escript::DataLazy_ptr
boost::shared_ptr< DataLazy > DataLazy_ptr
Definition: DataLazy.h:57
escript::tensor_unary_array_operation
void tensor_unary_array_operation(const size_t size, const IN *arg1, OUT *argRes, escript::ES_optype operation, DataTypes::real_t tol=0)
Definition: ArrayOps.h:762
escript::Data::unaryOp2
void unaryOp2(UnaryFunction operation)
Perform the given unary operation on every element of every data point in this Data object.
EsysMPI.h
escript::Data::getDataPointRW
DataTypes::RealVectorType::reference getDataPointRW(int sampleNo, int dataPointNo)
Return a reference into the DataVector which points to the specified data point.
Definition: Data.cpp:4729
escript::Data::setProtection
void setProtection()
switches on update protection
Definition: Data.cpp:1166
escript::DataReady::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const =0
escript::Data::asin
Data asin() const
Return the asin of each data point of this Data object.
Definition: Data.cpp:2067
escript::Data::operator-=
Data & operator-=(const Data &right)
Overloaded operator -=.
Definition: Data.cpp:3210
escript::ASIN
@ ASIN
Definition: ES_optype.h:67
escript::Data::interpolateFromTable3D
Data interpolateFromTable3D(const WrappedArray &table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, Data &C, DataTypes::real_t Cmin, DataTypes::real_t Cstep, bool check_boundaries)
Definition: Data.cpp:5049
escript::AbstractContinuousDomain
AbstractContinuousDomain, base class for continuous domains.
Definition: AbstractContinuousDomain.h:60
escript::Data::sqrt
Data sqrt() const
Return the square root of each data point of this Data object.
Definition: Data.cpp:2198
escript::rpow
DataTypes::real_t rpow(DataTypes::real_t x, DataTypes::real_t y)
Definition: Data.h:2054
escript::Data::isProtected
bool isProtected() const
Returns true, if the data object is protected against update.
Definition: Data.cpp:1172
MAKELAZYBINSELF
#define MAKELAZYBINSELF(R, X)
Definition: Data.cpp:87
escript::COS
@ COS
Definition: ES_optype.h:65
escript::ASINH
@ ASINH
Definition: ES_optype.h:74
DataException.h
escript::Data::get_MPISize
int get_MPISize(void) const
return the MPI rank number of the local data MPI_COMM_WORLD is assumed and the result of MPI_Comm_ran...
Definition: Data.cpp:5439
escript::Data::eigenvalues
Data eigenvalues() const
Return the eigenvalues of the symmetric part at each data point of this Data object in increasing val...
Definition: Data.cpp:2927
escript::FunctionSpace::probeInterpolation
bool probeInterpolation(const FunctionSpace &other) const
Definition: FunctionSpace.h:217
escript::ATAN
@ ATAN
Definition: ES_optype.h:69
escript::DataTypes::getSliceRegion
DataTypes::RegionType getSliceRegion(const DataTypes::ShapeType &shape, const bp::object &key)
Definition: DataTypes.cpp:137
escript::MAXVAL
@ MAXVAL
Definition: ES_optype.h:99
escript::FunctionSpace::getTagFromDataPointNo
int getTagFromDataPointNo(DataTypes::dim_t dataPointNo) const
Returns the tag associated with the given data-point number.
Definition: FunctionSpace.cpp:150
escript::DataTypes::scalarShape
static const ShapeType scalarShape
Use this instead of creating empty shape objects for scalars.
Definition: DataTypes.h:75
THROWONCOMPLEX
#define THROWONCOMPLEX
Definition: Data.cpp:55
FunctionSpace.h
escript::NEZ
@ NEZ
Definition: ES_optype.h:90
escript::HER
@ HER
Definition: ES_optype.h:101
escript::operator<<
std::ostream & operator<<(std::ostream &o, const Data &data)
Output operator.
Definition: Data.cpp:3683
escript::DataReady::hasNaN
virtual bool hasNaN() const =0
return true if data contains NaN.
escript::DataReady::replaceNaN
virtual void replaceNaN(DataTypes::real_t value)=0
replaces all NaN values with value
escript::Data::getDataPointRank
unsigned int getDataPointRank() const
Return the rank of the point data.
Definition: Data.h:512
escript::DataLazy
Wraps an expression tree of other DataObjects. The data will be evaluated when required.
Definition: DataLazy.h:62