Real
component(const SymmTensor & symm_tensor, unsigned int index, RealVectorValue & direction)
{
    direction.zero();
    if (index < 3)
        direction(index) = 1.0;

    else if (index == 3)//xy
    {
        direction(0) = std::sqrt(0.5);
        direction(1) = direction(0);
    }
    else if (index == 4)//yz
    {
        direction(1) = std::sqrt(0.5);
        direction(2) = direction(1);
    }
    else if (index == 5)//zx
    {
        direction(0) = std::sqrt(0.5);
        direction(2) = direction(0);
    }
    return symm_tensor.component(index);
}
Real
MaterialTensorCalculator::getTensorQuantity(const SymmTensor & tensor,
                                            const Point * curr_point,
                                            RealVectorValue &direction)
{
  direction.zero();
  Real value = 0.0;

  switch (_quantity)
  {
    case 0:
      value = MaterialTensorCalculatorTools::component(tensor, _index, direction);
      break;

    case 1:
      value = MaterialTensorCalculatorTools::vonMisesStress(tensor);
      break;

    case 2:
      value = MaterialTensorCalculatorTools::equivalentPlasticStrain(tensor);
      break;

    case 3:
      value = MaterialTensorCalculatorTools::hydrostatic(tensor);
      break;

    case 4:
      value = MaterialTensorCalculatorTools::directionValueTensor(tensor, _direction);
      break;

    case 5:
      value = MaterialTensorCalculatorTools::hoopStress(tensor, _p1, _p2, curr_point, direction);
      break;

    case 6:
      value = MaterialTensorCalculatorTools::radialStress(tensor, _p1, _p2, curr_point, direction);
      break;

    case 7:
      value = MaterialTensorCalculatorTools::axialStress(tensor, _p1, _p2, direction);
      break;

    case 8:
      value = MaterialTensorCalculatorTools::maxPrinciple(tensor, direction);
      break;

    case 9:
      value = MaterialTensorCalculatorTools::midPrinciple(tensor, direction);
      break;

    case 10:
      value = MaterialTensorCalculatorTools::minPrinciple(tensor, direction);
      break;

    case 11:
      value = MaterialTensorCalculatorTools::firstInvariant(tensor);
      break;

    case 12:
      value = MaterialTensorCalculatorTools::secondInvariant(tensor);
      break;

    case 13:
      value = MaterialTensorCalculatorTools::thirdInvariant(tensor);
      break;

    case 14:
      value = MaterialTensorCalculatorTools::triaxialityStress(tensor);
      break;

    case 15:
      value = MaterialTensorCalculatorTools::volumetricStrain(tensor);
      break;

    default:
    mooseError("Unknown quantity in MaterialTensorAux: " + _quantity_moose_enum.operator std::string());
  }
  return value;
}