void IntegrationValues2<Scalar>::
evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & in_node_coordinates)
{
    if (int_rule->cv_type != "none") {
        evaluateValuesCV(in_node_coordinates);
    }
    else {
        getCubature(in_node_coordinates);
        evaluateRemainingValues(in_node_coordinates);
    }
}
  void IntegrationValues2<Scalar>::
  evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim>& in_node_coordinates,
                 const PHX::MDField<Scalar,Cell,IP,Dim>& other_ip_coordinates)
  {
    if (int_rule->cv_type == "none") {

       getCubature(in_node_coordinates);

    {
      // Determine the permutation.
      std::vector<size_type> permutation(other_ip_coordinates.dimension(1));
      permuteToOther(ip_coordinates, other_ip_coordinates, permutation);
      // Apply the permutation to the cubature arrays.
      MDFieldArrayFactory af(prefix, alloc_arrays);
      const size_type num_ip = dyn_cub_points.dimension(0);
      {
        const size_type num_dim = dyn_side_cub_points.dimension(1);
        DblArrayDynamic old_dyn_side_cub_points = af.template buildArray<double,IP,Dim>(
          "old_dyn_side_cub_points", num_ip, num_dim);
        old_dyn_side_cub_points.deep_copy(dyn_side_cub_points);
        for (size_type ip = 0; ip < num_ip; ++ip)
          if (ip != permutation[ip])
            for (size_type dim = 0; dim < num_dim; ++dim)
              dyn_side_cub_points(ip, dim) = old_dyn_side_cub_points(permutation[ip], dim);
      }
      {
        const size_type num_dim = dyn_cub_points.dimension(1);
        DblArrayDynamic old_dyn_cub_points = af.template buildArray<double,IP,Dim>(
          "old_dyn_cub_points", num_ip, num_dim);
        old_dyn_cub_points.deep_copy(dyn_cub_points);
        for (size_type ip = 0; ip < num_ip; ++ip)
          if (ip != permutation[ip])
            for (size_type dim = 0; dim < num_dim; ++dim)
              dyn_cub_points(ip, dim) = old_dyn_cub_points(permutation[ip], dim);
      }
      {
        DblArrayDynamic old_dyn_cub_weights = af.template buildArray<double,IP>(
          "old_dyn_cub_weights", num_ip);
        old_dyn_cub_weights.deep_copy(dyn_cub_weights);
        for (size_type ip = 0; ip < dyn_cub_weights.dimension(0); ++ip)
          if (ip != permutation[ip])
            dyn_cub_weights(ip) = old_dyn_cub_weights(permutation[ip]);
      }
      {
        const size_type num_cells = ip_coordinates.dimension(0), num_ip = ip_coordinates.dimension(1),
          num_dim = ip_coordinates.dimension(2);
        Array_CellIPDim old_ip_coordinates = af.template buildStaticArray<Scalar,Cell,IP,Dim>(
          "old_ip_coordinates", num_cells, num_ip, num_dim);
        Kokkos::deep_copy(old_ip_coordinates.get_static_view(), ip_coordinates.get_static_view());
        for (size_type cell = 0; cell < num_cells; ++cell)
          for (size_type ip = 0; ip < num_ip; ++ip)
            if (ip != permutation[ip])
              for (size_type dim = 0; dim < num_dim; ++dim)
                ip_coordinates(cell, ip, dim) = old_ip_coordinates(cell, permutation[ip], dim);
      }
      // All subsequent calculations inherit the permutation.
    }

       evaluateRemainingValues(in_node_coordinates);
    }

    else {

       getCubatureCV(in_node_coordinates);
    
      // Determine the permutation.
      std::vector<size_type> permutation(other_ip_coordinates.dimension(1));
      permuteToOther(ip_coordinates, other_ip_coordinates, permutation);

      // Apply the permutation to the cubature arrays.
      MDFieldArrayFactory af(prefix, alloc_arrays);
      const size_type num_ip = dyn_cub_points.dimension(0);
      {
        const size_type num_cells = ip_coordinates.dimension(0), num_ip = ip_coordinates.dimension(1),
          num_dim = ip_coordinates.dimension(2);
        Array_CellIPDim old_ip_coordinates = af.template buildStaticArray<Scalar,Cell,IP,Dim>(
          "old_ip_coordinates", num_cells, num_ip, num_dim);
        Kokkos::deep_copy(old_ip_coordinates.get_static_view(), ip_coordinates.get_static_view());
        Array_CellIPDim old_weighted_normals = af.template buildStaticArray<Scalar,Cell,IP,Dim>(
            "old_weighted_normals", num_cells, num_ip, num_dim);
        Array_CellIP old_weighted_measure = af.template buildStaticArray<Scalar,Cell,IP>(
            "old_weighted_measure", num_cells, num_ip);
        if (int_rule->cv_type == "side") 
           Kokkos::deep_copy(old_weighted_normals.get_static_view(), weighted_normals.get_static_view());
        else 
           Kokkos::deep_copy(old_weighted_measure.get_static_view(), weighted_measure.get_static_view());
        for (size_type cell = 0; cell < num_cells; ++cell)
        {
          for (size_type ip = 0; ip < num_ip; ++ip)
          {
            if (ip != permutation[ip]) {
              if (int_rule->cv_type == "boundary" || int_rule->cv_type == "volume") 
                  weighted_measure(cell, ip) = old_weighted_measure(cell, permutation[ip]);
              for (size_type dim = 0; dim < num_dim; ++dim)
              {
                ip_coordinates(cell, ip, dim) = old_ip_coordinates(cell, permutation[ip], dim);
                if (int_rule->cv_type == "side") 
                  weighted_normals(cell, ip, dim) = old_weighted_normals(cell, permutation[ip], dim);
                
              }
            }
          }
        }
      }

      evaluateValuesCV(in_node_coordinates);
    }
  }