General finite element description for non-uniform and discontinuous beam elements