def grids(self): types = self.gridtypes x = [] for i in range(self.dim): if types[i] == 0: x.append(Vector(c.c_void_p(lib.get_numeric_gridGriddedField5(int(i), self.__data__)))) else: x.append(ArrayOfString(c.c_void_p(lib.get_string_gridGriddedField5(int(i), self.__data__)))) return x
assert not gf5 assert not gf6 assert gf1.OK assert gf2.OK assert gf3.OK assert gf4.OK assert gf5.OK assert gf6.OK gf1.grids = [Vector([1,2,3])] assert not gf1.OK gf1.data = Vector([5,4,3]) assert gf1.OK gf2.grids = [Vector([1,2,3]), ArrayOfString([String("Hej"), String("hopp")])] assert not gf2.OK gf2.data = Matrix([[1, 2], [3, 4], [5, 6]]) assert gf2.OK gf3.data = Tensor3(np.zeros((5, 3, 2))) assert not gf3 assert not gf3.OK gf3.grids = [Vector(np.linspace(0, 1, 5)), Vector(np.linspace(0, 1, 3)), Vector(Vector(np.linspace(0, 1, 2)))] assert gf3.OK gf4.data = Tensor4(np.zeros((5, 3, 2, 4))) assert not gf4 assert not gf4.OK gf4.grids = [Vector(np.linspace(0, 1, 5)), Vector(np.linspace(0, 1, 3)), Vector(np.linspace(0, 1, 2)), Vector(np.linspace(0, 1, 4))] assert gf4.OK
def list_of_workspace_variables(): x = ArrayOfString(c.c_void_p(lib.get_list_of_all_workspace_classes())) x.__delete__ = True return x