diff --git a/generate_images.py b/generate_images.py index 75da7132d028d0712132fa935f75d9f9216c7a5e..7e772b60182b5dacd86cfe301dc435a95495a7c6 100644 --- a/generate_images.py +++ b/generate_images.py @@ -103,6 +103,10 @@ class Image(): # structure if (structure["type"] == "no"): self.I0_structure = self.I0_structure_no + if (structure["type"] == "box"): + self.I0_structure = self.I0_structure_box + self.Xmin = structure["Xmin"] + self.Xmax = structure["Xmax"] elif (structure["type"] == "heart"): if (images["n_dim"] == 2): self.I0_structure = self.I0_structure_heart_2 @@ -201,6 +205,13 @@ class Image(): i[0] = 1. if (g is not None): g[:] = 1. # MG 20180806: gradient is given by texture; here it is just indicator function + def I0_structure_box(self, X, i, g=None): + if numpy.greater_equal(X, self.Xmin) and numpy.less_equal(X, self.Xmax): + i[0] = 1. + else: + i[0] = 0. + if (g is not None): g[:] = 0. # MG 20180806: gradient is given by texture; here it is just indicator function + def I0_structure_heart_2(self, X, i, g=None): self.R = ((X[0]-self.L[0]/2)**2 + (X[1]-self.L[1]/2)**2)**(1./2) if (self.R >= self.Ri) and (self.R <= self.Re):