A direct method to compute the inelastic displacement demand of masonry structures