 };
 
 
+template <class DeviceType>
 void contractFieldFieldTensor(FieldContainer<double> & outputFields,
 			      const FieldContainer<double> &   leftFields,
 			      const FieldContainer<double> &  rightFields,
                               const int compEngine) {
+
+  typedef Kokkos::View<double *****, DeviceType> input_view_t;
+  typedef Kokkos::View<double ***, DeviceType> output_view_t;
+
+  typedef typename input_view_t::HostMirror input_host_t;
+  typedef typename output_view_t::HostMirror output_host_t;
+
 
   // get sizes
   int numCells        = leftFields.dimension(0);


typedef Intrepid::RealSpaceTools<double> rst;

typedef Kokkos::View<double *****> input_view_t;
typedef Kokkos::View<double ***> output_view_t;

typedef input_view_t::HostMirror input_host_t;
typedef output_view_t::HostMirror output_host_t;

template<class LeftViewType, class RightViewType, class OutputViewType>
struct ContractFieldFieldTensorFunctor {
  LeftViewType _leftFields;
  RightViewType _rightFields;
  OutputViewType _outputFields;

    Kokkos::initialize();

    input_view_t kokkosLeft("left_input", numCells, numLeftFields, numPoints, dim1Tensor, dim2Tensor);

    input_view_t kokkosRight("right_input", numCells, numRightFields, numPoints, dim1Tensor, dim2Tensor);
    output_view_t kokkosOut("output", numCells, numLeftFields, numRightFields);

    input_host_t hostLeft = Kokkos::create_mirror_view(kokkosLeft);
    input_host_t hostRight = Kokkos::create_mirror_view(kokkosRight);
    output_host_t hostOut = Kokkos::create_mirror_view(kokkosOut);

    hostRight(1,1,1,1,1) = 5;

    // Copy everything
    for (int cl = 0; cl < numCells; ++cl) {
      for (int lbf = 0; lbf < numLeftFields; ++lbf) {
