void IntegrationValues2<Scalar>::
evaluateRemainingValues(const PHX::MDField<Scalar,Cell,NODE,Dim>& in_node_coordinates)
{
    Intrepid2::CellTools<Scalar> cell_tools;

    // copy the dynamic data structures into the static data structures
    {
        size_type num_ip = dyn_cub_points.dimension(0);
        size_type num_dims = dyn_cub_points.dimension(1);

        for (size_type ip = 0; ip < num_ip;  ++ip) {
            cub_weights(ip) = dyn_cub_weights(ip);
            for (size_type dim = 0; dim < num_dims; ++dim)
                cub_points(ip,dim) = dyn_cub_points(ip,dim);
        }
    }

    if (int_rule->isSide()) {
        const size_type num_ip = dyn_cub_points.dimension(0), num_side_dims = dyn_side_cub_points.dimension(1);
        for (size_type ip = 0; ip < num_ip; ++ip)
            for (size_type dim = 0; dim < num_side_dims; ++dim)
                side_cub_points(ip,dim) = dyn_side_cub_points(ip,dim);
    }

    {
        size_type num_cells = in_node_coordinates.dimension(0);
        size_type num_nodes = in_node_coordinates.dimension(1);
        size_type num_dims = in_node_coordinates.dimension(2);

        for (size_type cell = 0; cell < num_cells;  ++cell) {
            for (size_type node = 0; node < num_nodes; ++node) {
                for (size_type dim = 0; dim < num_dims; ++dim) {
                    node_coordinates(cell,node,dim) =
                        in_node_coordinates(cell,node,dim);
                }
            }
        }
    }

    cell_tools.setJacobian(jac, cub_points, node_coordinates,
                           *(int_rule->topology));

    cell_tools.setJacobianInv(jac_inv, jac);

    cell_tools.setJacobianDet(jac_det, jac);

    if (!int_rule->isSide()) {
        Intrepid2::FunctionSpaceTools::
        computeCellMeasure<Scalar>(weighted_measure, jac_det, cub_weights);
    }
    else if(int_rule->spatial_dimension==3) {
        Intrepid2::FunctionSpaceTools::
        computeFaceMeasure<Scalar>(weighted_measure, jac, cub_weights,int_rule->side,*int_rule->topology);
    }
    else if(int_rule->spatial_dimension==2) {
        Intrepid2::FunctionSpaceTools::
        computeEdgeMeasure<Scalar>(weighted_measure, jac, cub_weights,int_rule->side,*int_rule->topology);
    }
    else TEUCHOS_ASSERT(false);

    // Shakib contravarient metric tensor
    for (size_type cell = 0; cell < contravarient.dimension(0); ++cell) {
        for (size_type ip = 0; ip < contravarient.dimension(1); ++ip) {

            // zero out matrix
            for (size_type i = 0; i < contravarient.dimension(2); ++i)
                for (size_type j = 0; j < contravarient.dimension(3); ++j)
                    covarient(cell,ip,i,j) = 0.0;

            // g^{ij} = \frac{\parital x_i}{\partial \chi_\alpha}\frac{\parital x_j}{\partial \chi_\alpha}
            for (size_type i = 0; i < contravarient.dimension(2); ++i) {
                for (size_type j = 0; j < contravarient.dimension(3); ++j) {
                    for (size_type alpha = 0; alpha < contravarient.dimension(2); ++alpha) {
                        covarient(cell,ip,i,j) += jac(cell,ip,i,alpha) * jac(cell,ip,j,alpha);
                    }
                }
            }

        }
    }

    Intrepid2::RealSpaceTools<Scalar>::inverse(contravarient, covarient);

    // norm of g_ij
    for (size_type cell = 0; cell < contravarient.dimension(0); ++cell) {
        for (size_type ip = 0; ip < contravarient.dimension(1); ++ip) {
            norm_contravarient(cell,ip) = 0.0;
            for (size_type i = 0; i < contravarient.dimension(2); ++i) {
                for (size_type j = 0; j < contravarient.dimension(3); ++j) {
                    norm_contravarient(cell,ip) += contravarient(cell,ip,i,j) * contravarient(cell,ip,i,j);
                }
            }
            norm_contravarient(cell,ip) = std::sqrt(norm_contravarient(cell,ip));
        }
    }
}
  inline
  void panzer::IntegrationValues<Scalar,Array>::
    evaluateValues(const NodeCoordinateArray& in_node_coordinates)
  {
    int num_space_dim = int_rule->topology->getDimension();
    if (int_rule->isSide() && num_space_dim==1) {
       std::cout << "WARNING: 0-D quadrature rule ifrastructure does not exist!!! Will not be able to do "
                 << "non-natural integration rules.";
       return; 
    }
    
    Intrepid::CellTools<Scalar> cell_tools;
    
    if (!int_rule->isSide())
      intrepid_cubature->getCubature(cub_points, cub_weights);
    else {
      intrepid_cubature->getCubature(side_cub_points, cub_weights);
      
      cell_tools.mapToReferenceSubcell(cub_points, 
				       side_cub_points,
				       int_rule->spatial_dimension-1,
				       int_rule->side, 
				       *(int_rule->topology));
    }


    {
      typedef typename 
	panzer::ArrayTraits<Scalar,NodeCoordinateArray>::size_type size_type;

      size_type num_cells = in_node_coordinates.dimension(0);
      size_type num_nodes = in_node_coordinates.dimension(1);
      size_type num_dims = in_node_coordinates.dimension(2);
     
      for (size_type cell = 0; cell < num_cells;  ++cell) {
	for (size_type node = 0; node < num_nodes; ++node) {
	  for (size_type dim = 0; dim < num_dims; ++dim) {
	    node_coordinates(cell,node,dim) = 
	      in_node_coordinates(cell,node,dim);
	  }
	}
      }
    }

    cell_tools.setJacobian(jac, cub_points, node_coordinates, 
			   *(int_rule->topology));
    
    cell_tools.setJacobianInv(jac_inv, jac);
    
    cell_tools.setJacobianDet(jac_det, jac);
    
    if (!int_rule->isSide()) {
       Intrepid::FunctionSpaceTools::
         computeCellMeasure<Scalar>(weighted_measure, jac_det, cub_weights);
    }
    else if(int_rule->spatial_dimension==3) {
       Intrepid::FunctionSpaceTools::
         computeFaceMeasure<Scalar>(weighted_measure, jac, cub_weights,int_rule->side,*int_rule->topology);
    }
    else if(int_rule->spatial_dimension==2) {
       Intrepid::FunctionSpaceTools::
         computeEdgeMeasure<Scalar>(weighted_measure, jac, cub_weights,int_rule->side,*int_rule->topology);
    }
    else TEUCHOS_ASSERT(false);
    
    // Shakib contravarient metric tensor
    typedef typename 
      panzer::ArrayTraits<Scalar,Array>::size_type size_type;

    for (size_type cell = 0; cell < contravarient.dimension(0); ++cell) {
      for (size_type ip = 0; ip < contravarient.dimension(1); ++ip) {

	// zero out matrix
	for (size_type i = 0; i < contravarient.dimension(2); ++i)
	  for (size_type j = 0; j < contravarient.dimension(3); ++j)
	    covarient(cell,ip,i,j) = 0.0;
	   
	// g^{ij} = \frac{\parital x_i}{\partial \chi_\alpha}\frac{\parital x_j}{\partial \chi_\alpha}
	for (size_type i = 0; i < contravarient.dimension(2); ++i) {
	  for (size_type j = 0; j < contravarient.dimension(3); ++j) {
	    for (size_type alpha = 0; alpha < contravarient.dimension(2); ++alpha) {
	      covarient(cell,ip,i,j) += jac(cell,ip,i,alpha) * jac(cell,ip,j,alpha);
	    }
	  }
	}

	

      }
    }

    Intrepid::RealSpaceTools<Scalar>::inverse(contravarient, covarient);

    /*
    for (std::size_t cell = 0; cell < contravarient.dimension(0); ++cell) {
      std::cout << "cell = " << cell << std::endl;
      for (std::size_t ip = 0; ip < contravarient.dimension(1); ++ip) {
      std::cout << "  ip = " << ip << std::endl;
	for (std::size_t i = 0; i < contravarient.dimension(2); ++i) {
	  for (std::size_t j = 0; j < contravarient.dimension(2); ++j) {
	    std::cout << "contravarient(" << i << "," << j << ") = " << contravarient(cell,ip,i,j) << std::endl;
	  }
	}
      }
    }
    */

    // norm of g_ij
    for (size_type cell = 0; cell < contravarient.dimension(0); ++cell) {
      for (size_type ip = 0; ip < contravarient.dimension(1); ++ip) {
	norm_contravarient(cell,ip) = 0.0;
	for (size_type i = 0; i < contravarient.dimension(2); ++i) {
	  for (size_type j = 0; j < contravarient.dimension(3); ++j) {
	    norm_contravarient(cell,ip) += contravarient(cell,ip,i,j) * contravarient(cell,ip,i,j);
	  }
	}
	norm_contravarient(cell,ip) = std::sqrt(norm_contravarient(cell,ip));
      }
    }

    // IP coordinates
    {
      cell_tools.mapToPhysicalFrame(ip_coordinates, cub_points, node_coordinates, *(int_rule->topology));
    }

  }