/[escript]/branches/complex/escriptcore/src/Data.h
ViewVC logotype

Diff of /branches/complex/escriptcore/src/Data.h

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

revision 5880 by jfenwick, Wed Jan 20 07:23:48 2016 UTC revision 5881 by jfenwick, Thu Jan 21 04:21:25 2016 UTC
# Line 2450  C_TensorBinaryOperation(Data const &arg_ Line 2450  C_TensorBinaryOperation(Data const &arg_
2450    DataTypes::ShapeType shape1 = arg_1_Z.getDataPointShape();    DataTypes::ShapeType shape1 = arg_1_Z.getDataPointShape();
2451    int size0 = arg_0_Z.getDataPointSize();    int size0 = arg_0_Z.getDataPointSize();
2452    int size1 = arg_1_Z.getDataPointSize();    int size1 = arg_1_Z.getDataPointSize();
2453      
2454      // We will require that the functions all take the same type
2455      if ((typeid(typename BinaryFunction::first_argument_type)!=typeid(typename BinaryFunction::second_argument_type))
2456           || (typeid(typename BinaryFunction::first_argument_type)!=typeid(typename BinaryFunction::result_type)))
2457      {
2458          throw DataException("Error - Functional used by C_TensorBinaryOperation must use consistent types.");
2459      }
2460      
2461      
2462    // Declare output Data object    // Declare output Data object
2463    Data res;    Data res;
2464    
2465    if (shape0 == shape1) {    if (shape0 == shape1) {
2466      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {
2467        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataConstant output        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataConstant output
2468        const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));
2469        const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(0));
2470        double *ptr_2 = &(res.getDataAtOffsetRW(0));        typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(0));
2471    
2472        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2473      }      }
# Line 2477  C_TensorBinaryOperation(Data const &arg_ Line 2486  C_TensorBinaryOperation(Data const &arg_
2486    
2487        // Prepare offset into DataConstant        // Prepare offset into DataConstant
2488        int offset_0 = tmp_0->getPointOffset(0,0);        int offset_0 = tmp_0->getPointOffset(0,0);
2489        const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2490    
2491        // Get the pointers to the actual data        // Get the pointers to the actual data
2492        const double *ptr_1 = &(tmp_1->getDefaultValueRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDefaultValueRO(0));
2493        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
2494    
2495        // Compute a result for the default        // Compute a result for the default
2496        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
# Line 2490  C_TensorBinaryOperation(Data const &arg_ Line 2499  C_TensorBinaryOperation(Data const &arg_
2499        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
2500        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2501          tmp_2->addTag(i->first);          tmp_2->addTag(i->first);
2502          const double *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));          const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));
2503          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
2504    
2505          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2506        }        }
# Line 2513  C_TensorBinaryOperation(Data const &arg_ Line 2522  C_TensorBinaryOperation(Data const &arg_
2522          for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {          for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
2523            int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);
2524            int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);
2525            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2526            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2527            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2528            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2529          }          }
2530        }        }
# Line 2536  C_TensorBinaryOperation(Data const &arg_ Line 2545  C_TensorBinaryOperation(Data const &arg_
2545        // Prepare offset into DataConstant        // Prepare offset into DataConstant
2546        int offset_1 = tmp_1->getPointOffset(0,0);        int offset_1 = tmp_1->getPointOffset(0,0);
2547    
2548        const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));        const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2549        // Get the pointers to the actual data        // Get the pointers to the actual data
2550        const double *ptr_0 = &(tmp_0->getDefaultValueRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDefaultValueRO(0));
2551        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
2552        // Compute a result for the default        // Compute a result for the default
2553        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2554        // Compute a result for each tag        // Compute a result for each tag
# Line 2547  C_TensorBinaryOperation(Data const &arg_ Line 2556  C_TensorBinaryOperation(Data const &arg_
2556        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
2557        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2558          tmp_2->addTag(i->first);          tmp_2->addTag(i->first);
2559          const double *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));
2560          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
2561          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2562        }        }
2563    
# Line 2566  C_TensorBinaryOperation(Data const &arg_ Line 2575  C_TensorBinaryOperation(Data const &arg_
2575        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2576    
2577        // Get the pointers to the actual data        // Get the pointers to the actual data
2578        const double *ptr_0 = &(tmp_0->getDefaultValueRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDefaultValueRO(0));
2579        const double *ptr_1 = &(tmp_1->getDefaultValueRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDefaultValueRO(0));
2580        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
2581    
2582        // Compute a result for the default        // Compute a result for the default
2583        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
# Line 2586  C_TensorBinaryOperation(Data const &arg_ Line 2595  C_TensorBinaryOperation(Data const &arg_
2595        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();
2596        for (i=lookup_2.begin();i!=lookup_2.end();i++) {        for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2597    
2598          const double *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));
2599          const double *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));          const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));
2600          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
2601    
2602          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2603        }        }
# Line 2608  C_TensorBinaryOperation(Data const &arg_ Line 2617  C_TensorBinaryOperation(Data const &arg_
2617        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2618        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2619          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
2620          const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2621          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2622            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2623            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2624            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2625            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2626            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2627          }          }
2628        }        }
# Line 2636  C_TensorBinaryOperation(Data const &arg_ Line 2645  C_TensorBinaryOperation(Data const &arg_
2645            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2646            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2647    
2648            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2649            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2650            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2651    
2652    
2653            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
# Line 2660  C_TensorBinaryOperation(Data const &arg_ Line 2669  C_TensorBinaryOperation(Data const &arg_
2669        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2670        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2671          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);
2672          const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));          const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2673          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2674            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2675            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2676            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2677            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2678            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1, ptr_2, operation);
2679          }          }
2680        }        }
# Line 2689  C_TensorBinaryOperation(Data const &arg_ Line 2698  C_TensorBinaryOperation(Data const &arg_
2698            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2699            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2700            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2701            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2702            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2703            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2704            tensor_binary_operation(size0*numDataPointsPerSample_0, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size0*numDataPointsPerSample_0, ptr_0, ptr_1, ptr_2, operation);
2705  //       }  //       }
2706        }        }
# Line 2704  C_TensorBinaryOperation(Data const &arg_ Line 2713  C_TensorBinaryOperation(Data const &arg_
2713    } else if (0 == rank0) {    } else if (0 == rank0) {
2714      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {
2715        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());      // DataConstant output        res = Data(0.0, shape1, arg_1_Z.getFunctionSpace());      // DataConstant output
2716        const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));
2717        const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(0));
2718        double *ptr_2 = &(res.getDataAtOffsetRW(0));        typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(0));
2719        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2720      }      }
2721      else if (arg_0_Z.isConstant()   && arg_1_Z.isTagged()) {      else if (arg_0_Z.isConstant()   && arg_1_Z.isTagged()) {
# Line 2724  C_TensorBinaryOperation(Data const &arg_ Line 2733  C_TensorBinaryOperation(Data const &arg_
2733    
2734        // Prepare offset into DataConstant        // Prepare offset into DataConstant
2735        int offset_0 = tmp_0->getPointOffset(0,0);        int offset_0 = tmp_0->getPointOffset(0,0);
2736        const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2737    
2738        const double *ptr_1 = &(tmp_1->getDefaultValueRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDefaultValueRO(0));
2739        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
2740    
2741        // Compute a result for the default        // Compute a result for the default
2742        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
# Line 2736  C_TensorBinaryOperation(Data const &arg_ Line 2745  C_TensorBinaryOperation(Data const &arg_
2745        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
2746        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2747          tmp_2->addTag(i->first);          tmp_2->addTag(i->first);
2748          const double *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));          const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));
2749          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
2750          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2751        }        }
2752    
# Line 2753  C_TensorBinaryOperation(Data const &arg_ Line 2762  C_TensorBinaryOperation(Data const &arg_
2762        int numSamples_1 = arg_1_Z.getNumSamples();        int numSamples_1 = arg_1_Z.getNumSamples();
2763        int numDataPointsPerSample_1 = arg_1_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_1 = arg_1_Z.getNumDataPointsPerSample();
2764        int offset_0 = tmp_0->getPointOffset(0,0);        int offset_0 = tmp_0->getPointOffset(0,0);
2765        const double *ptr_src = &(arg_0_Z.getDataAtOffsetRO(offset_0));        const typename decltype(operation)::first_argument_type *ptr_src = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2766        double ptr_0 = ptr_src[0];        typename decltype(operation)::first_argument_type ptr_0 = ptr_src[0];
2767        int size = size1*numDataPointsPerSample_1;        int size = size1*numDataPointsPerSample_1;
2768        res.requireWrite();        res.requireWrite();
2769        #pragma omp parallel for private(sampleNo_1) schedule(static)        #pragma omp parallel for private(sampleNo_1) schedule(static)
2770        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {        for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
 //        for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {  
2771            int offset_1 = tmp_1->getPointOffset(sampleNo_1,0);            int offset_1 = tmp_1->getPointOffset(sampleNo_1,0);
2772            int offset_2 = tmp_2->getPointOffset(sampleNo_1,0);            int offset_2 = tmp_2->getPointOffset(sampleNo_1,0);
2773  //          const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2774            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
           double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));  
2775            tensor_binary_operation(size, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size, ptr_0, ptr_1, ptr_2, operation);
   
 //        }  
2776        }        }
2777    
2778      }      }
# Line 2786  C_TensorBinaryOperation(Data const &arg_ Line 2791  C_TensorBinaryOperation(Data const &arg_
2791    
2792        // Prepare offset into DataConstant        // Prepare offset into DataConstant
2793        int offset_1 = tmp_1->getPointOffset(0,0);        int offset_1 = tmp_1->getPointOffset(0,0);
2794        const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));        const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2795    
2796        // Get the pointers to the actual data        // Get the pointers to the actual data
2797        const double *ptr_0 = &(tmp_0->getDefaultValueRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDefaultValueRO(0));
2798        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
2799    
2800    
2801        // Compute a result for the default        // Compute a result for the default
# Line 2800  C_TensorBinaryOperation(Data const &arg_ Line 2805  C_TensorBinaryOperation(Data const &arg_
2805        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
2806        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2807          tmp_2->addTag(i->first);          tmp_2->addTag(i->first);
2808          const double *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));
2809          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
2810    
2811          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2812        }        }
# Line 2821  C_TensorBinaryOperation(Data const &arg_ Line 2826  C_TensorBinaryOperation(Data const &arg_
2826        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
2827    
2828        // Get the pointers to the actual data        // Get the pointers to the actual data
2829        const double *ptr_0 = &(tmp_0->getDefaultValueRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDefaultValueRO(0));
2830        const double *ptr_1 = &(tmp_1->getDefaultValueRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDefaultValueRO(0));
2831        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
2832    
2833        // Compute a result for the default        // Compute a result for the default
2834        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);        tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
# Line 2840  C_TensorBinaryOperation(Data const &arg_ Line 2845  C_TensorBinaryOperation(Data const &arg_
2845        // Compute a result for each tag        // Compute a result for each tag
2846        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();
2847        for (i=lookup_2.begin();i!=lookup_2.end();i++) {        for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2848          const double *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));
2849          const double *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));          const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));
2850          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
2851    
2852          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);          tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2853        }        }
# Line 2863  C_TensorBinaryOperation(Data const &arg_ Line 2868  C_TensorBinaryOperation(Data const &arg_
2868        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2869        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2870          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
2871          const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2872          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2873            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2874            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2875            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2876            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2877            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2878          }          }
2879        }        }
# Line 2890  C_TensorBinaryOperation(Data const &arg_ Line 2895  C_TensorBinaryOperation(Data const &arg_
2895          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2896            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2897            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2898            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2899            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2900            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2901            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2902          }          }
2903        }        }
# Line 2914  C_TensorBinaryOperation(Data const &arg_ Line 2919  C_TensorBinaryOperation(Data const &arg_
2919        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2920        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2921          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);
2922          const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));          const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2923          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2924            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2925            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2926            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2927            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2928            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2929          }          }
2930        }        }
# Line 2943  C_TensorBinaryOperation(Data const &arg_ Line 2948  C_TensorBinaryOperation(Data const &arg_
2948            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2949            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
2950            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
2951            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2952            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
2953            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
2954            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);            tensor_binary_operation(size1, ptr_0[0], ptr_1, ptr_2, operation);
2955          }          }
2956        }        }
# Line 2958  C_TensorBinaryOperation(Data const &arg_ Line 2963  C_TensorBinaryOperation(Data const &arg_
2963    } else if (0 == rank1) {    } else if (0 == rank1) {
2964      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {      if (arg_0_Z.isConstant()   && arg_1_Z.isConstant()) {
2965        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataConstant output        res = Data(0.0, shape0, arg_1_Z.getFunctionSpace());      // DataConstant output
2966        const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));
2967        const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(0));
2968        double *ptr_2 = &(res.getDataAtOffsetRW(0));        typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(0));
2969        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
2970      }      }
2971      else if (arg_0_Z.isConstant()   && arg_1_Z.isTagged()) {      else if (arg_0_Z.isConstant()   && arg_1_Z.isTagged()) {
# Line 2978  C_TensorBinaryOperation(Data const &arg_ Line 2983  C_TensorBinaryOperation(Data const &arg_
2983    
2984        // Prepare offset into DataConstant        // Prepare offset into DataConstant
2985        int offset_0 = tmp_0->getPointOffset(0,0);        int offset_0 = tmp_0->getPointOffset(0,0);
2986        const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
2987    
2988        //Get the pointers to the actual data        //Get the pointers to the actual data
2989        const double *ptr_1 = &(tmp_1->getDefaultValueRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDefaultValueRO(0));
2990        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
2991    
2992        // Compute a result for the default        // Compute a result for the default
2993        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
# Line 2991  C_TensorBinaryOperation(Data const &arg_ Line 2996  C_TensorBinaryOperation(Data const &arg_
2996        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
2997        for (i=lookup_1.begin();i!=lookup_1.end();i++) {        for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2998          tmp_2->addTag(i->first);          tmp_2->addTag(i->first);
2999          const double *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));          const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));
3000          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
3001          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3002        }        }
3003      }      }
# Line 3013  C_TensorBinaryOperation(Data const &arg_ Line 3018  C_TensorBinaryOperation(Data const &arg_
3018          for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {          for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
3019            int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_1 = tmp_1->getPointOffset(sampleNo_1,dataPointNo_1);
3020            int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);            int offset_2 = tmp_2->getPointOffset(sampleNo_1,dataPointNo_1);
3021            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
3022            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
3023            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
3024            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3025          }          }
3026        }        }
# Line 3036  C_TensorBinaryOperation(Data const &arg_ Line 3041  C_TensorBinaryOperation(Data const &arg_
3041    
3042        // Prepare offset into DataConstant        // Prepare offset into DataConstant
3043        int offset_1 = tmp_1->getPointOffset(0,0);        int offset_1 = tmp_1->getPointOffset(0,0);
3044        const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));        const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
3045        // Get the pointers to the actual data        // Get the pointers to the actual data
3046        const double *ptr_0 = &(tmp_0->getDefaultValueRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDefaultValueRO(0));
3047        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
3048        // Compute a result for the default        // Compute a result for the default
3049        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3050        // Compute a result for each tag        // Compute a result for each tag
# Line 3047  C_TensorBinaryOperation(Data const &arg_ Line 3052  C_TensorBinaryOperation(Data const &arg_
3052        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
3053        for (i=lookup_0.begin();i!=lookup_0.end();i++) {        for (i=lookup_0.begin();i!=lookup_0.end();i++) {
3054          tmp_2->addTag(i->first);          tmp_2->addTag(i->first);
3055          const double *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));
3056          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
3057          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3058        }        }
3059    
# Line 3067  C_TensorBinaryOperation(Data const &arg_ Line 3072  C_TensorBinaryOperation(Data const &arg_
3072        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());        DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
3073    
3074        // Get the pointers to the actual data        // Get the pointers to the actual data
3075        const double *ptr_0 = &(tmp_0->getDefaultValueRO(0));        const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDefaultValueRO(0));
3076        const double *ptr_1 = &(tmp_1->getDefaultValueRO(0));        const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDefaultValueRO(0));
3077        double *ptr_2 = &(tmp_2->getDefaultValueRW(0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
3078    
3079        // Compute a result for the default        // Compute a result for the default
3080        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);        tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
# Line 3086  C_TensorBinaryOperation(Data const &arg_ Line 3091  C_TensorBinaryOperation(Data const &arg_
3091        // Compute a result for each tag        // Compute a result for each tag
3092        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();        const DataTagged::DataMapType& lookup_2=tmp_2->getTagLookup();
3093        for (i=lookup_2.begin();i!=lookup_2.end();i++) {        for (i=lookup_2.begin();i!=lookup_2.end();i++) {
3094          const double *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));
3095          const double *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));          const typename decltype(operation)::second_argument_type *ptr_1 = &(tmp_1->getDataByTagRO(i->first,0));
3096          double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));          typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
3097          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);          tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3098        }        }
3099    
# Line 3108  C_TensorBinaryOperation(Data const &arg_ Line 3113  C_TensorBinaryOperation(Data const &arg_
3113        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
3114        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3115          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
3116          const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));          const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
3117          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3118            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
3119            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
3120            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
3121            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
3122            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3123          }          }
3124        }        }
# Line 3129  C_TensorBinaryOperation(Data const &arg_ Line 3134  C_TensorBinaryOperation(Data const &arg_
3134        int numSamples_0 = arg_0_Z.getNumSamples();        int numSamples_0 = arg_0_Z.getNumSamples();
3135        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();        int numDataPointsPerSample_0 = arg_0_Z.getNumDataPointsPerSample();
3136        int offset_1 = tmp_1->getPointOffset(0,0);        int offset_1 = tmp_1->getPointOffset(0,0);
3137        const double *ptr_src = &(arg_1_Z.getDataAtOffsetRO(offset_1));        const typename decltype(operation)::second_argument_type *ptr_src = &(arg_1_Z.getDataAtOffsetRO(offset_1));
3138        double ptr_1 = ptr_src[0];        typename decltype(operation)::second_argument_type ptr_1 = ptr_src[0];
3139        int size = size0 * numDataPointsPerSample_0;        int size = size0 * numDataPointsPerSample_0;
3140        res.requireWrite();        res.requireWrite();
3141        #pragma omp parallel for private(sampleNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0) schedule(static)
3142        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
 //        for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {  
3143            int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
3144            int offset_2 = tmp_2->getPointOffset(sampleNo_0,0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,0);
3145            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
3146  //          const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
           double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));  
3147            tensor_binary_operation(size, ptr_0, ptr_1, ptr_2, operation);            tensor_binary_operation(size, ptr_0, ptr_1, ptr_2, operation);
 //        }  
3148        }        }
3149    
3150    
# Line 3162  C_TensorBinaryOperation(Data const &arg_ Line 3164  C_TensorBinaryOperation(Data const &arg_
3164        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)        #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
3165        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {        for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3166          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);          int offset_1 = tmp_1->getPointOffset(sampleNo_0,0);
3167          const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));          const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
3168          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {          for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3169            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3170            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
3171            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
3172            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
3173            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3174          }          }
3175        }        }
# Line 3191  C_TensorBinaryOperation(Data const &arg_ Line 3193  C_TensorBinaryOperation(Data const &arg_
3193            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3194            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_1 = tmp_1->getPointOffset(sampleNo_0,dataPointNo_0);
3195            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);            int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
3196            const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));            const typename decltype(operation)::first_argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
3197            const double *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));            const typename decltype(operation)::second_argument_type *ptr_1 = &(arg_1_Z.getDataAtOffsetRO(offset_1));
3198            double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));            typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
3199            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);            tensor_binary_operation(size0, ptr_0, ptr_1[0], ptr_2, operation);
3200          }          }
3201        }        }
# Line 3230  C_TensorUnaryOperation(Data const &arg_0 Line 3232  C_TensorUnaryOperation(Data const &arg_0
3232    const DataTypes::ShapeType& shape0 = arg_0_Z.getDataPointShape();    const DataTypes::ShapeType& shape0 = arg_0_Z.getDataPointShape();
3233    int size0 = arg_0_Z.getDataPointSize();    int size0 = arg_0_Z.getDataPointSize();
3234    
3235      // Sanity check on the types of the function
3236      if (typeid(typename UnaryFunction::argument_type)!=typeid(typename UnaryFunction::result_type))
3237      {
3238          throw DataException("Error - Types for C_TensorUnaryOperation must be consistent");
3239      }
3240      
3241    // Declare output Data object    // Declare output Data object
3242    Data res;    Data res;
3243    
3244    if (arg_0_Z.isConstant()) {    if (arg_0_Z.isConstant()) {
3245      res = Data(0.0, shape0, arg_0_Z.getFunctionSpace());      // DataConstant output      res = Data(0.0, shape0, arg_0_Z.getFunctionSpace());      // DataConstant output
3246      const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));      const typename UnaryFunction::argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(0));
3247      double *ptr_2 = &(res.getDataAtOffsetRW(0));      typename UnaryFunction::result_type *ptr_2 = &(res.getDataAtOffsetRW(0));
3248      tensor_unary_operation(size0, ptr_0, ptr_2, operation);      tensor_unary_operation(size0, ptr_0, ptr_2, operation);
3249    }    }
3250    else if (arg_0_Z.isTagged()) {    else if (arg_0_Z.isTagged()) {
# Line 3250  C_TensorUnaryOperation(Data const &arg_0 Line 3258  C_TensorUnaryOperation(Data const &arg_0
3258      DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());      DataTagged* tmp_2=dynamic_cast<DataTagged*>(res.borrowData());
3259    
3260      // Get the pointers to the actual data      // Get the pointers to the actual data
3261      const double *ptr_0 = &(tmp_0->getDefaultValueRO(0));      const typename decltype(operation)::argument_type *ptr_0 = &(tmp_0->getDefaultValueRO(0));
3262      double *ptr_2 = &(tmp_2->getDefaultValueRW(0));      typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDefaultValueRW(0));
3263      // Compute a result for the default      // Compute a result for the default
3264      tensor_unary_operation(size0, ptr_0, ptr_2, operation);      tensor_unary_operation(size0, ptr_0, ptr_2, operation);
3265      // Compute a result for each tag      // Compute a result for each tag
# Line 3259  C_TensorUnaryOperation(Data const &arg_0 Line 3267  C_TensorUnaryOperation(Data const &arg_0
3267      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
3268      for (i=lookup_0.begin();i!=lookup_0.end();i++) {      for (i=lookup_0.begin();i!=lookup_0.end();i++) {
3269        tmp_2->addTag(i->first);        tmp_2->addTag(i->first);
3270        const double *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));        const typename decltype(operation)::argument_type *ptr_0 = &(tmp_0->getDataByTagRO(i->first,0));
3271        double *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));        typename decltype(operation)::result_type *ptr_2 = &(tmp_2->getDataByTagRW(i->first,0));
3272        tensor_unary_operation(size0, ptr_0, ptr_2, operation);        tensor_unary_operation(size0, ptr_0, ptr_2, operation);
3273      }      }
3274    
# Line 3277  C_TensorUnaryOperation(Data const &arg_0 Line 3285  C_TensorUnaryOperation(Data const &arg_0
3285      #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)      #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
3286      for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {      for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3287      dataPointNo_0=0;      dataPointNo_0=0;
 //      for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {  
3288          int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);          int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3289          int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);          int offset_2 = tmp_2->getPointOffset(sampleNo_0,dataPointNo_0);
3290          const double *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));          const typename decltype(operation)::argument_type *ptr_0 = &(arg_0_Z.getDataAtOffsetRO(offset_0));
3291          double *ptr_2 = &(res.getDataAtOffsetRW(offset_2));          typename decltype(operation)::result_type *ptr_2 = &(res.getDataAtOffsetRW(offset_2));
3292          tensor_unary_operation(size0*numDataPointsPerSample_0, ptr_0, ptr_2, operation);          tensor_unary_operation(size0*numDataPointsPerSample_0, ptr_0, ptr_2, operation);
 //      }  
3293      }      }
3294    }    }
3295    else {    else {

Legend:
Removed from v.5880  
changed lines
  Added in v.5881

  ViewVC Help
Powered by ViewVC 1.1.26