/[escript]/branches/windows_from_1383_trunk/escript/src/Data.h
ViewVC logotype

Diff of /branches/windows_from_1383_trunk/escript/src/Data.h

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

revision 1327 by matt, Fri Oct 12 07:10:40 2007 UTC revision 1332 by matt, Tue Oct 23 03:28:51 2007 UTC
# Line 533  class Data { Line 533  class Data {
533    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
534                 int dataPointNo)                 int dataPointNo)
535    {    {
536          return m_data->getDataPoint(sampleNo,dataPointNo);                  return m_data->getDataPoint(sampleNo,dataPointNo);
537    }    }
538    
539    /**    /**
# Line 1256  class Data { Line 1256  class Data {
1256    */    */
1257    ESCRIPT_DLL_API    ESCRIPT_DLL_API
1258    void    void
1259      print(void);          print(void);
1260    
1261    /**    /**
1262       \brief       \brief
1263       return the MPI rank number of the local data       return the MPI rank number of the local data
1264           MPI_COMM_WORLD is assumed and the result of MPI_Comm_size()                   MPI_COMM_WORLD is assumed and the result of MPI_Comm_size()
1265           is returned                   is returned
1266    */    */
1267    ESCRIPT_DLL_API    ESCRIPT_DLL_API
1268      int          int
1269      get_MPIRank(void) const;          get_MPIRank(void) const;
1270    
1271    /**    /**
1272       \brief       \brief
1273       return the MPI rank number of the local data       return the MPI rank number of the local data
1274           MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank()                   MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank()
1275           is returned                   is returned
1276    */    */
1277    ESCRIPT_DLL_API    ESCRIPT_DLL_API
1278      int          int
1279      get_MPISize(void) const;          get_MPISize(void) const;
1280    
1281    /**    /**
1282       \brief       \brief
1283       return the MPI rank number of the local data       return the MPI rank number of the local data
1284           MPI_COMM_WORLD is assumed and returned.                   MPI_COMM_WORLD is assumed and returned.
1285    */    */
1286    ESCRIPT_DLL_API    ESCRIPT_DLL_API
1287      MPI_Comm          MPI_Comm
1288      get_MPIComm(void) const;          get_MPIComm(void) const;
1289    
1290    /**    /**
1291       \brief       \brief
1292       return the object produced by the factory, which is a DataConstant or DataExpanded       return the object produced by the factory, which is a DataConstant or DataExpanded
1293    */    */
1294    ESCRIPT_DLL_API    ESCRIPT_DLL_API
1295      DataAbstract*          DataAbstract*
1296      borrowData(void) const;          borrowData(void) const;
1297    
1298   protected:   protected:
1299    
# Line 1543  template <typename BinaryFunction> Line 1543  template <typename BinaryFunction>
1543  ESCRIPT_DLL_API  ESCRIPT_DLL_API
1544  Data  Data
1545  C_TensorBinaryOperation(Data const &arg0,  C_TensorBinaryOperation(Data const &arg0,
1546              Data const &arg1,                          Data const &arg1,
1547              BinaryFunction operation);                          BinaryFunction operation);
1548    
1549  /**  /**
1550    \brief    \brief
# Line 1752  Data::dp_algorithm(BinaryFunction operat Line 1752  Data::dp_algorithm(BinaryFunction operat
1752  template <typename BinaryFunction>  template <typename BinaryFunction>
1753  Data  Data
1754  C_TensorBinaryOperation(Data const &arg_0,  C_TensorBinaryOperation(Data const &arg_0,
1755              Data const &arg_1,                          Data const &arg_1,
1756              BinaryFunction operation)                          BinaryFunction operation)
1757  {  {
1758    // Interpolate if necessary and find an appropriate function space    // Interpolate if necessary and find an appropriate function space
1759    Data arg_0_Z, arg_1_Z;    Data arg_0_Z, arg_1_Z;
# Line 1787  C_TensorBinaryOperation(Data const &arg_ Line 1787  C_TensorBinaryOperation(Data const &arg_
1787    if (shape0 == shape1) {    if (shape0 == shape1) {
1788    
1789      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {
1790        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());  // DataConstant output        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataConstant output
1791        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[0]);        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[0]);
1792        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[0]);        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[0]);
1793        double *ptr_2 = &((res.getPointDataView().getData())[0]);        double *ptr_2 = &((res.getPointDataView().getData())[0]);
# Line 1802  C_TensorBinaryOperation(Data const &arg_ Line 1802  C_TensorBinaryOperation(Data const &arg_
1802        DataTagged* tmp_1=dynamic_cast<DataTagged*>(arg_1_Z.borrowData());        DataTagged* tmp_1=dynamic_cast<DataTagged*>(arg_1_Z.borrowData());
1803    
1804        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
1805        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());  // DataTagged output        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataTagged output
1806        res.tag();        res.tag();
1807        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
1808    
# Line 1821  C_TensorBinaryOperation(Data const &arg_ Line 1821  C_TensorBinaryOperation(Data const &arg_
1821        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();
1822        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory
1823        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
1824      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
1825      DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);          DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);
1826      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
1827      double *ptr_1 = &view_1.getData(0);          double *ptr_1 = &view_1.getData(0);
1828      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
1829      tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
1830        }        }
1831    
1832      }      }
# Line 1843  C_TensorBinaryOperation(Data const &arg_ Line 1843  C_TensorBinaryOperation(Data const &arg_
1843        int offset_0 = tmp_0->getPointOffset(0,0);        int offset_0 = tmp_0->getPointOffset(0,0);
1844        #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)        #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)
1845        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
1846      for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {          for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
1847        int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);
1848        int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);
1849        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
1850        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
1851        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
1852        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
1853      }          }
1854        }        }
1855    
1856      }      }
# Line 1863  C_TensorBinaryOperation(Data const &arg_ Line 1863  C_TensorBinaryOperation(Data const &arg_
1863        DataConstant* tmp_1=dynamic_cast<DataConstant*>(arg_1_Z.borrowData());        DataConstant* tmp_1=dynamic_cast<DataConstant*>(arg_1_Z.borrowData());
1864    
1865        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
1866        res = Data(0.0, shape0, arg_0_Z.getFunctionSpace());  // DataTagged output        res = Data(0.0, shape0, arg_0_Z.getFunctionSpace());      // DataTagged output
1867        res.tag();        res.tag();
1868        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
1869    
# Line 1882  C_TensorBinaryOperation(Data const &arg_ Line 1882  C_TensorBinaryOperation(Data const &arg_
1882        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();
1883        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory
1884        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
1885      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
1886      DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);          DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);
1887      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
1888      double *ptr_0 = &view_0.getData(0);          double *ptr_0 = &view_0.getData(0);
1889      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
1890      tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
1891        }        }
1892    
1893      }      }
# Line 1901  C_TensorBinaryOperation(Data const &arg_ Line 1901  C_TensorBinaryOperation(Data const &arg_
1901    
1902        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
1903        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());
1904        res.tag();    // DataTagged output        res.tag();        // DataTagged output
1905        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
1906    
1907        // Get the views        // Get the views
# Line 1919  C_TensorBinaryOperation(Data const &arg_ Line 1919  C_TensorBinaryOperation(Data const &arg_
1919        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();
1920        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();
1921        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
1922      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue()); // use tmp_2 to get correct shape          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue()); // use tmp_2 to get correct shape
1923        }        }
1924        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
1925      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
1926        }        }
1927        // Compute a result for each tag        // Compute a result for each tag
1928        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();
1929        for (i=lookup_2.begin();i!=lookup_2.end();i++) {        for (i=lookup_2.begin();i!=lookup_2.end();i++) {
1930      DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);          DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);
1931      DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);          DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);
1932      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
1933      double *ptr_0 = &view_0.getData(0);          double *ptr_0 = &view_0.getData(0);
1934      double *ptr_1 = &view_1.getData(0);          double *ptr_1 = &view_1.getData(0);
1935      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
1936      tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
1937        }        }
1938    
1939      }      }
# Line 1950  C_TensorBinaryOperation(Data const &arg_ Line 1950  C_TensorBinaryOperation(Data const &arg_
1950        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
1951        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
1952        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
1953      int offset_0 = tmp_0->getPointOffset(sampleNo_0,0); // They're all the same, so just use #0          int offset_0 = tmp_0->getPointOffset(sampleNo_0,0); // They're all the same, so just use #0
1954      double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);          double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
1955      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
1956        int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
1957        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
1958        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
1959        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
1960        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
1961      }          }
1962        }        }
1963    
1964      }      }
# Line 1975  C_TensorBinaryOperation(Data const &arg_ Line 1975  C_TensorBinaryOperation(Data const &arg_
1975        int offset_1 = tmp_1->getPointOffset(0,0);        int offset_1 = tmp_1->getPointOffset(0,0);
1976        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
1977        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
1978      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
1979        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
1980        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
1981        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
1982        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
1983        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
1984        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
1985      }          }
1986        }        }
1987    
1988      }      }
# Line 1999  C_TensorBinaryOperation(Data const &arg_ Line 1999  C_TensorBinaryOperation(Data const &arg_
1999        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2000        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2001        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2002      int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);
2003      double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);          double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2004      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2005        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2006        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2007        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2008        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2009        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2010      }          }
2011        }        }
2012    
2013      }      }
# Line 2024  C_TensorBinaryOperation(Data const &arg_ Line 2024  C_TensorBinaryOperation(Data const &arg_
2024        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2025        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2026        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2027      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2028        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2029        int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2030        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2031        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2032        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2033        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2034        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2035      }          }
2036        }        }
2037    
2038      }      }
# Line 2043  C_TensorBinaryOperation(Data const &arg_ Line 2043  C_TensorBinaryOperation(Data const &arg_
2043    } else if (0 == rank0) {    } else if (0 == rank0) {
2044    
2045      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {
2046        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());  // DataConstant output        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());      // DataConstant output
2047        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[0]);        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[0]);
2048        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[0]);        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[0]);
2049        double *ptr_2 = &((res.getPointDataView().getData())[0]);        double *ptr_2 = &((res.getPointDataView().getData())[0]);
# Line 2058  C_TensorBinaryOperation(Data const &arg_ Line 2058  C_TensorBinaryOperation(Data const &arg_
2058        DataTagged* tmp_1=dynamic_cast<DataTagged*>(arg_1_Z.borrowData());        DataTagged* tmp_1=dynamic_cast<DataTagged*>(arg_1_Z.borrowData());
2059    
2060        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
2061        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());  // DataTagged output        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());      // DataTagged output
2062        res.tag();        res.tag();
2063        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2064    
# Line 2077  C_TensorBinaryOperation(Data const &arg_ Line 2077  C_TensorBinaryOperation(Data const &arg_
2077        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();
2078        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory
2079        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2080      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
2081      DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);          DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);
2082      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
2083      double *ptr_1 = &view_1.getData(0);          double *ptr_1 = &view_1.getData(0);
2084      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
2085      tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2086        }        }
2087    
2088      }      }
# Line 2099  C_TensorBinaryOperation(Data const &arg_ Line 2099  C_TensorBinaryOperation(Data const &arg_
2099        int offset_0 = tmp_0->getPointOffset(0,0);        int offset_0 = tmp_0->getPointOffset(0,0);
2100        #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)        #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)
2101        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2102      for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {          for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
2103        int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);
2104        int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);
2105        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2106        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2107        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2108        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2109    
2110      }          }
2111        }        }
2112    
2113      }      }
# Line 2120  C_TensorBinaryOperation(Data const &arg_ Line 2120  C_TensorBinaryOperation(Data const &arg_
2120        DataConstant* tmp_1=dynamic_cast<DataConstant*>(arg_1_Z.borrowData());        DataConstant* tmp_1=dynamic_cast<DataConstant*>(arg_1_Z.borrowData());
2121    
2122        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
2123        res = Data(0.0, shape1, arg_0_Z.getFunctionSpace());  // DataTagged output        res = Data(0.0, shape1, arg_0_Z.getFunctionSpace());      // DataTagged output
2124        res.tag();        res.tag();
2125        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2126    
# Line 2139  C_TensorBinaryOperation(Data const &arg_ Line 2139  C_TensorBinaryOperation(Data const &arg_
2139        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();
2140        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory
2141        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2142      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
2143      DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);          DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);
2144      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
2145      double *ptr_0 = &view_0.getData(0);          double *ptr_0 = &view_0.getData(0);
2146      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
2147      tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2148        }        }
2149    
2150      }      }
# Line 2158  C_TensorBinaryOperation(Data const &arg_ Line 2158  C_TensorBinaryOperation(Data const &arg_
2158    
2159        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
2160        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());
2161        res.tag();    // DataTagged output        res.tag();        // DataTagged output
2162        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2163    
2164        // Get the views        // Get the views
# Line 2176  C_TensorBinaryOperation(Data const &arg_ Line 2176  C_TensorBinaryOperation(Data const &arg_
2176        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();
2177        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();
2178        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2179      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue()); // use tmp_2 to get correct shape          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue()); // use tmp_2 to get correct shape
2180        }        }
2181        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2182      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
2183        }        }
2184        // Compute a result for each tag        // Compute a result for each tag
2185        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();
2186        for (i=lookup_2.begin();i!=lookup_2.end();i++) {        for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2187      DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);          DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);
2188      DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);          DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);
2189      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
2190      double *ptr_0 = &view_0.getData(0);          double *ptr_0 = &view_0.getData(0);
2191      double *ptr_1 = &view_1.getData(0);          double *ptr_1 = &view_1.getData(0);
2192      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
2193      tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2194        }        }
2195    
2196      }      }
# Line 2207  C_TensorBinaryOperation(Data const &arg_ Line 2207  C_TensorBinaryOperation(Data const &arg_
2207        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2208        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2209        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2210      int offset_0 = tmp_0->getPointOffset(sampleNo_0,0); // They're all the same, so just use #0          int offset_0 = tmp_0->getPointOffset(sampleNo_0,0); // They're all the same, so just use #0
2211      double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);          double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2212      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2213        int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2214        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2215        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2216        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2217        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2218      }          }
2219        }        }
2220    
2221      }      }
# Line 2232  C_TensorBinaryOperation(Data const &arg_ Line 2232  C_TensorBinaryOperation(Data const &arg_
2232        int offset_1 = tmp_1->getPointOffset(0,0);        int offset_1 = tmp_1->getPointOffset(0,0);
2233        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2234        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2235      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2236        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2237        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2238        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2239        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2240        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2241        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2242      }          }
2243        }        }
2244    
2245    
# Line 2257  C_TensorBinaryOperation(Data const &arg_ Line 2257  C_TensorBinaryOperation(Data const &arg_
2257        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2258        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2259        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2260      int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);
2261      double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);          double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2262      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2263        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2264        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2265        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2266        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2267        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2268      }          }
2269        }        }
2270    
2271      }      }
# Line 2282  C_TensorBinaryOperation(Data const &arg_ Line 2282  C_TensorBinaryOperation(Data const &arg_
2282        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2283        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2284        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2285      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2286        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2287        int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2288        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2289        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2290        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2291        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2292        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2293      }          }
2294        }        }
2295    
2296      }      }
# Line 2301  C_TensorBinaryOperation(Data const &arg_ Line 2301  C_TensorBinaryOperation(Data const &arg_
2301    } else if (0 == rank1) {    } else if (0 == rank1) {
2302    
2303      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {
2304        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());  // DataConstant output        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataConstant output
2305        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[0]);        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[0]);
2306        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[0]);        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[0]);
2307        double *ptr_2 = &((res.getPointDataView().getData())[0]);        double *ptr_2 = &((res.getPointDataView().getData())[0]);
# Line 2316  C_TensorBinaryOperation(Data const &arg_ Line 2316  C_TensorBinaryOperation(Data const &arg_
2316        DataTagged* tmp_1=dynamic_cast<DataTagged*>(arg_1_Z.borrowData());        DataTagged* tmp_1=dynamic_cast<DataTagged*>(arg_1_Z.borrowData());
2317    
2318        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
2319        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());  // DataTagged output        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataTagged output
2320        res.tag();        res.tag();
2321        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2322    
# Line 2335  C_TensorBinaryOperation(Data const &arg_ Line 2335  C_TensorBinaryOperation(Data const &arg_
2335        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();
2336        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory
2337        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2338      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
2339      DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);          DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);
2340      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
2341      double *ptr_1 = &view_1.getData(0);          double *ptr_1 = &view_1.getData(0);
2342      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
2343      tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2344        }        }
2345    
2346      }      }
# Line 2357  C_TensorBinaryOperation(Data const &arg_ Line 2357  C_TensorBinaryOperation(Data const &arg_
2357        int offset_0 = tmp_0->getPointOffset(0,0);        int offset_0 = tmp_0->getPointOffset(0,0);
2358        #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)        #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)
2359        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2360      for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {          for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
2361        int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);
2362        int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);
2363        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2364        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2365        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2366        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2367      }          }
2368        }        }
2369    
2370      }      }
# Line 2377  C_TensorBinaryOperation(Data const &arg_ Line 2377  C_TensorBinaryOperation(Data const &arg_
2377        DataConstant* tmp_1=dynamic_cast<DataConstant*>(arg_1_Z.borrowData());        DataConstant* tmp_1=dynamic_cast<DataConstant*>(arg_1_Z.borrowData());
2378    
2379        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
2380        res = Data(0.0, shape0, arg_0_Z.getFunctionSpace());  // DataTagged output        res = Data(0.0, shape0, arg_0_Z.getFunctionSpace());      // DataTagged output
2381        res.tag();        res.tag();
2382        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2383    
# Line 2396  C_TensorBinaryOperation(Data const &arg_ Line 2396  C_TensorBinaryOperation(Data const &arg_
2396        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();
2397        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory        DataTagged::DataMapType::const_iterator i; // i->first is a tag, i->second is an offset into memory
2398        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2399      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
2400      DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);          DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);
2401      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
2402      double *ptr_0 = &view_0.getData(0);          double *ptr_0 = &view_0.getData(0);
2403      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
2404      tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2405        }        }
2406    
2407      }      }
# Line 2415  C_TensorBinaryOperation(Data const &arg_ Line 2415  C_TensorBinaryOperation(Data const &arg_
2415    
2416        // Prepare a DataTagged output 2        // Prepare a DataTagged output 2
2417        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());
2418        res.tag();    // DataTagged output        res.tag();        // DataTagged output
2419        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2420    
2421        // Get the views        // Get the views
# Line 2433  C_TensorBinaryOperation(Data const &arg_ Line 2433  C_TensorBinaryOperation(Data const &arg_
2433        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();        const DataTagged::DataMapType& lookup_0=tmp_0->getTagLookup();
2434        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();        const DataTagged::DataMapType& lookup_1=tmp_1->getTagLookup();
2435        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2436      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue()); // use tmp_2 to get correct shape          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue()); // use tmp_2 to get correct shape
2437        }        }
2438        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2439      tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());          tmp_2->addTaggedValue(i->first,tmp_2->getDefaultValue());
2440        }        }
2441        // Compute a result for each tag        // Compute a result for each tag
2442        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();
2443        for (i=lookup_2.begin();i!=lookup_2.end();i++) {        for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2444      DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);          DataArrayView view_0 = tmp_0->getDataPointByTag(i->first);
2445      DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);          DataArrayView view_1 = tmp_1->getDataPointByTag(i->first);
2446      DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);          DataArrayView view_2 = tmp_2->getDataPointByTag(i->first);
2447      double *ptr_0 = &view_0.getData(0);          double *ptr_0 = &view_0.getData(0);
2448      double *ptr_1 = &view_1.getData(0);          double *ptr_1 = &view_1.getData(0);
2449      double *ptr_2 = &view_2.getData(0);          double *ptr_2 = &view_2.getData(0);
2450      tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2451        }        }
2452    
2453      }      }
# Line 2464  C_TensorBinaryOperation(Data const &arg_ Line 2464  C_TensorBinaryOperation(Data const &arg_
2464        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2465        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2466        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2467      int offset_0 = tmp_0->getPointOffset(sampleNo_0,0); // They're all the same, so just use #0          int offset_0 = tmp_0->getPointOffset(sampleNo_0,0); // They're all the same, so just use #0
2468      double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);          double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2469      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2470        int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2471        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2472        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2473        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2474        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2475      }          }
2476        }        }
2477    
2478      }      }
# Line 2489  C_TensorBinaryOperation(Data const &arg_ Line 2489  C_TensorBinaryOperation(Data const &arg_
2489        int offset_1 = tmp_1->getPointOffset(0,0);        int offset_1 = tmp_1->getPointOffset(0,0);
2490        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2491        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2492      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2493        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2494        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2495        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2496        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2497        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2498        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2499      }          }
2500        }        }
2501    
2502    
# Line 2514  C_TensorBinaryOperation(Data const &arg_ Line 2514  C_TensorBinaryOperation(Data const &arg_
2514        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2515        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2516        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2517      int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);
2518      double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);          double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2519      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2520        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2521        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2522        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2523        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2524        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2525      }          }
2526        }        }
2527    
2528      }      }
# Line 2539  C_TensorBinaryOperation(Data const &arg_ Line 2539  C_TensorBinaryOperation(Data const &arg_
2539        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
2540        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2541        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2542      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2543        int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2544        int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2545        int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2546        double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);            double *ptr_0 = &((arg_0_Z.getPointDataView().getData())[offset_0]);
2547        double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);            double *ptr_1 = &((arg_1_Z.getPointDataView().getData())[offset_1]);
2548        double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);            double *ptr_2 = &((res.getPointDataView().getData())[offset_2]);
2549        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2550      }          }
2551        }        }
2552    
2553      }      }

Legend:
Removed from v.1327  
changed lines
  Added in v.1332

  ViewVC Help
Powered by ViewVC 1.1.26