bool token::is_operator(operator_type op_type) const { if (type == token_type::OPERATOR) { return get_operator_type() == op_type; } return false; }
void NOX::Epetra::DebugTools::writeOperator( std::string baseName, const Epetra_Operator & op, FORMAT_TYPE outFormat ) { NOX_EPETRA_OP_TYPE opTyp = get_operator_type( &op ); if( NONE == opTyp ) return; // Now get (or compute? - could be a user-option ) the matrix switch( opTyp ) { case MATRIX_FREE : Epetra_CrsMatrix * tmpMatrix; tmpMatrix = compute_matrix_using_operator( &op ); writeMatrix( baseName, *tmpMatrix ); delete tmpMatrix; break; case FINITE_DIFFERENCE : case FINITE_DIFFERENCE_COLORNG : writeMatrix( baseName, dynamic_cast<const NOX::Epetra::FiniteDifference &>(op).getUnderlyingMatrix(), outFormat ); break; case CRS_MATRIX : writeMatrix( baseName, dynamic_cast<const Epetra_CrsMatrix &>(op), outFormat ); break; default : std::string msg = "Could not get a valid Matrix from incoming Epetra_Operator."; // of type " + opTyp + "."; throw msg; } return; }