A versatile numerical approach for calculating the fracture toughness and R-curves of cellular materials