/[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

revision 3317 by caltinay, Thu Oct 28 00:50:41 2010 UTC revision 4286 by caltinay, Thu Mar 7 04:28:11 2013 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2010 by University of Queensland  * Copyright (c) 2003-2013 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * http://www.uq.edu.au
 * http://www.uq.edu.au/esscc  
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
8  * Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
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)
12    * Development since 2012 by School of Earth Sciences
13    *
14    *****************************************************************************/
15    
16    
17  #include "DataLazy.h"  #include "DataLazy.h"
# Line 59  A special operation, IDENTITY, stores an Line 61  A special operation, IDENTITY, stores an
61  This means that all "internal" nodes in the structure are instances of DataLazy.  This means that all "internal" nodes in the structure are instances of DataLazy.
62    
63  Each operation has a string representation as well as an opgroup - eg G_IDENTITY, G_BINARY, ...  Each operation has a string representation as well as an opgroup - eg G_IDENTITY, G_BINARY, ...
64  Note that IDENITY is not considered a unary operation.  Note that IDENTITY is not considered a unary operation.
65    
66  I am avoiding calling the structure formed a tree because it is not guaranteed to be one (eg c=a+a).  I am avoiding calling the structure formed a tree because it is not guaranteed to be one (eg c=a+a).
67  It must however form a DAG (directed acyclic graph).  It must however form a DAG (directed acyclic graph).
# Line 68  I will refer to individual DataLazy obje Line 70  I will refer to individual DataLazy obje
70  Each node also stores:  Each node also stores:
71  - m_readytype \in {'E','T','C','?'} ~ indicates what sort of DataReady would be produced if the expression was  - m_readytype \in {'E','T','C','?'} ~ indicates what sort of DataReady would be produced if the expression was
72      evaluated.      evaluated.
73  - m_buffsrequired ~ the larged number of samples which would need to be kept simultaneously in order to  - m_buffsrequired ~ the large number of samples which would need to be kept simultaneously in order to
74      evaluate the expression.      evaluate the expression.
75  - m_samplesize ~ the number of doubles stored in a sample.  - m_samplesize ~ the number of doubles stored in a sample.
76    
# Line 193  resultFS(DataAbstract_ptr left, DataAbst Line 195  resultFS(DataAbstract_ptr left, DataAbst
195    FunctionSpace r=right->getFunctionSpace();    FunctionSpace r=right->getFunctionSpace();
196    if (l!=r)    if (l!=r)
197    {    {
198      if (r.probeInterpolation(l))      signed char res=r.getDomain()->preferredInterpolationOnDomain(r.getTypeCode(), l.getTypeCode());
199        if (res==1)
200      {      {
201      return l;      return l;
202      }      }
203      if (l.probeInterpolation(r))      if (res==-1)
204      {      {
205      return r;      return r;
206      }      }
# Line 1213  DataLazy::resolveNodeReduction(int tid, Line 1216  DataLazy::resolveNodeReduction(int tid,
1216    
1217    roffset=m_samplesize*tid;    roffset=m_samplesize*tid;
1218    unsigned int ndpps=getNumDPPSample();    unsigned int ndpps=getNumDPPSample();
1219    unsigned int psize=DataTypes::noValues(getShape());    unsigned int psize=DataTypes::noValues(m_left->getShape());
1220    double* result=&(m_samples[roffset]);    double* result=&(m_samples[roffset]);
1221    switch (m_op)    switch (m_op)
1222    {    {
# Line 1386  DataLazy::resolveNodeCondEval(int tid, i Line 1389  DataLazy::resolveNodeCondEval(int tid, i
1389      throw DataException("Programmer error - resolveNodeCondEval should only be called on CONDEVAL nodes.");      throw DataException("Programmer error - resolveNodeCondEval should only be called on CONDEVAL nodes.");
1390    }    }
1391    size_t subroffset;    size_t subroffset;
   size_t offset;  
   
1392    
1393    const ValueType* maskres=m_mask->resolveNodeSample(tid, sampleNo, subroffset);    const ValueType* maskres=m_mask->resolveNodeSample(tid, sampleNo, subroffset);
1394    const ValueType* srcres=0;    const ValueType* srcres=0;
# Line 1403  DataLazy::resolveNodeCondEval(int tid, i Line 1404  DataLazy::resolveNodeCondEval(int tid, i
1404    // Now we need to copy the result    // Now we need to copy the result
1405    
1406    roffset=m_samplesize*tid;    roffset=m_samplesize*tid;
   offset=roffset;  
1407    for (int i=0;i<m_samplesize;++i)    for (int i=0;i<m_samplesize;++i)
1408    {    {
1409      m_samples[roffset+i]=(*srcres)[subroffset+i];        m_samples[roffset+i]=(*srcres)[subroffset+i];  
# Line 1549  LAZYDEBUG(cout << "Right res["<< rroffse Line 1549  LAZYDEBUG(cout << "Right res["<< rroffse
1549    
1550    
1551    roffset=m_samplesize*tid;    roffset=m_samplesize*tid;
1552    double* resultp=&(m_samples[roffset]);        // results are stored at the vector offset we recieved    double* resultp=&(m_samples[roffset]);        // results are stored at the vector offset we received
1553    switch(m_op)    switch(m_op)
1554    {    {
1555      case ADD:      case ADD:
# Line 1611  LAZYDEBUG(cout << "m_samplesize=" << m_s Line 1611  LAZYDEBUG(cout << "m_samplesize=" << m_s
1611  LAZYDEBUG(cout << "outputshape=" << DataTypes::shapeToString(getShape()) << endl;)  LAZYDEBUG(cout << "outputshape=" << DataTypes::shapeToString(getShape()) << endl;)
1612  LAZYDEBUG(cout << "DPPS=" << m_right->getNumDPPSample() <<"."<<endl;)  LAZYDEBUG(cout << "DPPS=" << m_right->getNumDPPSample() <<"."<<endl;)
1613    
1614    double* resultp=&(m_samples[offset]);     // results are stored at the vector offset we recieved    double* resultp=&(m_samples[offset]);     // results are stored at the vector offset we received
1615    switch(m_op)    switch(m_op)
1616    {    {
1617      case PROD:      case PROD:

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

  ViewVC Help
Powered by ViewVC 1.1.26