def no_of_elements(mesh):
    """
    Calculate the number of elements contained in the given mesh.

    Parameters
    ----------
    mesh : dict
        mesh dict containing
        at least the following keyword
            elements : dict of ndarrays
                Contains array of nodes for elements sorted by element types.

    Returns
    -------
    result : int
        number of elements
    """
    no_elem = 0
    for elem in mesh['elements']:
        no_elem += mesh['elements'][elem].shape[0]
    return no_elem
