A generalization of Castigliano’s theorems for structures with eigenstrains