/[escript]/branches/clazy/escriptcore/src/DataLazy.cpp
ViewVC logotype

Diff of /branches/clazy/escriptcore/src/DataLazy.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/escript/src/DataLazy.cpp revision 4286 by caltinay, Thu Mar 7 04:28:11 2013 UTC trunk/escriptcore/src/DataLazy.cpp revision 5863 by jfenwick, Wed Jan 13 02:25:48 2016 UTC
# Line 1  Line 1 
1    
2  /*****************************************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2013 by University of Queensland  * Copyright (c) 2003-2016 by The University of Queensland
5  * http://www.uq.edu.au  * http://www.uq.edu.au
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
# Line 9  Line 9 
9  * http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
10  *  *
11  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12  * Development since 2012 by School of Earth Sciences  * Development 2012-2013 by School of Earth Sciences
13    * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
17    #define ESNEEDPYTHON
18    #include "esysUtils/first.h"
19    
20  #include "DataLazy.h"  #include "DataLazy.h"
21  #include "esysUtils/Esys_MPI.h"  #include "esysUtils/Esys_MPI.h"
# Line 822  DataLazy::~DataLazy() Line 825  DataLazy::~DataLazy()
825    For reasons of efficiency do not call this method on DataExpanded nodes.    For reasons of efficiency do not call this method on DataExpanded nodes.
826  */  */
827  DataReady_ptr  DataReady_ptr
828  DataLazy::collapseToReady()  DataLazy::collapseToReady() const
829  {  {
830    if (m_readytype=='E')    if (m_readytype=='E')
831    { // this is more an efficiency concern than anything else    { // this is more an efficiency concern than anything else
# Line 977  DataLazy::collapseToReady() Line 980  DataLazy::collapseToReady()
980     the purpose of using DataLazy in the first place).     the purpose of using DataLazy in the first place).
981  */  */
982  void  void
983  DataLazy::collapse()  DataLazy::collapse() const
984  {  {
985    if (m_op==IDENTITY)    if (m_op==IDENTITY)
986    {    {
# Line 1016  LAZYDEBUG(cout << " result=      " << re Line 1019  LAZYDEBUG(cout << " result=      " << re
1019  // The result will be stored in m_samples  // The result will be stored in m_samples
1020  // The return value is a pointer to the DataVector, offset is the offset within the return value  // The return value is a pointer to the DataVector, offset is the offset within the return value
1021  const DataTypes::ValueType*  const DataTypes::ValueType*
1022  DataLazy::resolveNodeSample(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeSample(int tid, int sampleNo, size_t& roffset) const
1023  {  {
1024  LAZYDEBUG(cout << "Resolve sample " << toString() << endl;)  LAZYDEBUG(cout << "Resolve sample " << toString() << endl;)
1025      // collapse so we have a 'E' node or an IDENTITY for some other type      // collapse so we have a 'E' node or an IDENTITY for some other type
# Line 1065  if (&x<stackend[omp_get_thread_num()]) Line 1068  if (&x<stackend[omp_get_thread_num()])
1068  }  }
1069    
1070  const DataTypes::ValueType*  const DataTypes::ValueType*
1071  DataLazy::resolveNodeUnary(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeUnary(int tid, int sampleNo, size_t& roffset) const
1072  {  {
1073      // we assume that any collapsing has been done before we get here      // we assume that any collapsing has been done before we get here
1074      // since we only have one argument we don't need to think about only      // since we only have one argument we don't need to think about only
# Line 1197  DataLazy::resolveNodeUnary(int tid, int Line 1200  DataLazy::resolveNodeUnary(int tid, int
1200    
1201    
1202  const DataTypes::ValueType*  const DataTypes::ValueType*
1203  DataLazy::resolveNodeReduction(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeReduction(int tid, int sampleNo, size_t& roffset) const
1204  {  {
1205      // we assume that any collapsing has been done before we get here      // we assume that any collapsing has been done before we get here
1206      // since we only have one argument we don't need to think about only      // since we only have one argument we don't need to think about only
# Line 1249  DataLazy::resolveNodeReduction(int tid, Line 1252  DataLazy::resolveNodeReduction(int tid,
1252  }  }
1253    
1254  const DataTypes::ValueType*  const DataTypes::ValueType*
1255  DataLazy::resolveNodeNP1OUT(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeNP1OUT(int tid, int sampleNo, size_t& roffset) const
1256  {  {
1257      // we assume that any collapsing has been done before we get here      // we assume that any collapsing has been done before we get here
1258      // since we only have one argument we don't need to think about only      // since we only have one argument we don't need to think about only
# Line 1294  DataLazy::resolveNodeNP1OUT(int tid, int Line 1297  DataLazy::resolveNodeNP1OUT(int tid, int
1297  }  }
1298    
1299  const DataTypes::ValueType*  const DataTypes::ValueType*
1300  DataLazy::resolveNodeNP1OUT_P(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeNP1OUT_P(int tid, int sampleNo, size_t& roffset) const
1301  {  {
1302      // we assume that any collapsing has been done before we get here      // we assume that any collapsing has been done before we get here
1303      // since we only have one argument we don't need to think about only      // since we only have one argument we don't need to think about only
# Line 1342  DataLazy::resolveNodeNP1OUT_P(int tid, i Line 1345  DataLazy::resolveNodeNP1OUT_P(int tid, i
1345    
1346    
1347  const DataTypes::ValueType*  const DataTypes::ValueType*
1348  DataLazy::resolveNodeNP1OUT_2P(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeNP1OUT_2P(int tid, int sampleNo, size_t& roffset) const
1349  {  {
1350    if (m_readytype!='E')    if (m_readytype!='E')
1351    {    {
# Line 1378  DataLazy::resolveNodeNP1OUT_2P(int tid, Line 1381  DataLazy::resolveNodeNP1OUT_2P(int tid,
1381  }  }
1382    
1383  const DataTypes::ValueType*  const DataTypes::ValueType*
1384  DataLazy::resolveNodeCondEval(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeCondEval(int tid, int sampleNo, size_t& roffset) const
1385  {  {
1386    if (m_readytype!='E')    if (m_readytype!='E')
1387    {    {
# Line 1422  DataLazy::resolveNodeCondEval(int tid, i Line 1425  DataLazy::resolveNodeCondEval(int tid, i
1425  // For example, 2+Vector.  // For example, 2+Vector.
1426  // In this case each double within the point is treated individually  // In this case each double within the point is treated individually
1427  const DataTypes::ValueType*  const DataTypes::ValueType*
1428  DataLazy::resolveNodeBinary(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeBinary(int tid, int sampleNo, size_t& roffset) const
1429  {  {
1430  LAZYDEBUG(cout << "Resolve binary: " << toString() << endl;)  LAZYDEBUG(cout << "Resolve binary: " << toString() << endl;)
1431    
# Line 1579  LAZYDEBUG(cout << "Result res[" << roffs Line 1582  LAZYDEBUG(cout << "Result res[" << roffs
1582  // have already been collapsed to IDENTITY. So we must have at least one expanded child.  // have already been collapsed to IDENTITY. So we must have at least one expanded child.
1583  // unlike the other resolve helpers, we must treat these datapoints separately.  // unlike the other resolve helpers, we must treat these datapoints separately.
1584  const DataTypes::ValueType*  const DataTypes::ValueType*
1585  DataLazy::resolveNodeTProd(int tid, int sampleNo, size_t& roffset)  DataLazy::resolveNodeTProd(int tid, int sampleNo, size_t& roffset) const
1586  {  {
1587  LAZYDEBUG(cout << "Resolve TensorProduct: " << toString() << endl;)  LAZYDEBUG(cout << "Resolve TensorProduct: " << toString() << endl;)
1588    
# Line 1638  LAZYDEBUG(cout << DataTypes::pointToStri Line 1641  LAZYDEBUG(cout << DataTypes::pointToStri
1641    
1642    
1643  const DataTypes::ValueType*  const DataTypes::ValueType*
1644  DataLazy::resolveSample(int sampleNo, size_t& roffset)  DataLazy::resolveSample(int sampleNo, size_t& roffset) const
1645  {  {
1646  #ifdef _OPENMP  #ifdef _OPENMP
1647      int tid=omp_get_thread_num();      int tid=omp_get_thread_num();
# Line 2094  DataLazy::setToZero() Line 2097  DataLazy::setToZero()
2097  //   m_readytype='C';  //   m_readytype='C';
2098  //   m_buffsRequired=1;  //   m_buffsRequired=1;
2099    
2100    privdebug=privdebug;  // to stop the compiler complaining about unused privdebug    (void)privdebug;  // to stop the compiler complaining about unused privdebug
2101    throw DataException("Programmer error - setToZero not supported for DataLazy (DataLazy objects should be read only).");    throw DataException("Programmer error - setToZero not supported for DataLazy (DataLazy objects should be read only).");
2102  }  }
2103    

Legend:
Removed from v.4286  
changed lines
  Added in v.5863

  ViewVC Help
Powered by ViewVC 1.1.26