Exemplo n.º 1
0
 def __init__(self, factory, inputs, physical_names, reader, reader_kwargs,
              coordinates_transform, mesh_size_coefficients):
     if factory == 'occ':
         factory_object = gmsh.model.occ
     else:
         factory_object = gmsh.model.geo
     primitives = list()
     for i, path in enumerate(inputs):
         result = check_file(path)
         reader_kwargs["path"] = result['path']
         points, polygons = readers[reader](**reader_kwargs)
         print('Transform coordinates')
         points = transform_coordinates(points, coordinates_transform)
         print('last point: {}'.format(points[-1]))
         print('Evaluate groups')
         groups_points, groups_polygons = evaluate_groups(points, polygons)
         print('Number of groups points: {}\nNumber of groups polygons: {}'.
               format([len(x) for x in groups_points],
                      [len(x) for x in groups_polygons]))
         print('Groups: {}'.format(len(groups_points)))
         print('Check closed volumes')
         result = check_closed_volume(polygons, groups_polygons)
         print('Closed volumes {}'.format(sum(result)))
         print(result)
         # Leave only closed volumes
         closed_groups_points = list(
             itertools.compress(groups_points, result))
         closed_groups_polygons = list(
             itertools.compress(groups_polygons, result))
         print('Evaluate sizes')
         sizes = evaluate_groups_points_mesh_sizes(points, polygons,
                                                   closed_groups_polygons)
         print(sizes)
         print('Correct sizes by coefficient')
         k = mesh_size_coefficients[i]
         print('Coefficient: {}'.format(k))
         sizes = [k * x for x in sizes]
         print(sizes)
         print('Create closed volumes only')
         vs = create_volumes(factory_object, points, polygons,
                             closed_groups_points, closed_groups_polygons,
                             sizes)
         name = physical_names[i]
         p = Primitive(factory, physical_name=name, inner_volumes=vs)
         primitives.append(p)
     Complex.__init__(self, factory, primitives)
Exemplo n.º 2
0
 def __init__(self, factory, transform_data, tunnel_type, args, string_args,
              array_args, string_array_args):
     """
     :param str factory: see Primitive
     :param list transform_data: see Primitive
     :param int tunnel_type: type for type_factory
     :param list args: float/int arguments
     :param list string_args: string arguments
     :param list of list array_args: arrays of float/int arguments
     :param list of list string_array_args: arrays of string arguments
     """
     if factory == 'occ':
         factory_object = gmsh.model.occ
     else:
         factory_object = gmsh.model.geo
     primitives = list()
     kwargs = locals()
     type_factory[tunnel_type](factory_object, primitives, kwargs)
     Complex.__init__(self, factory, primitives)
Exemplo n.º 3
0
    def __init__(self, factory, indices, transform_data, complex_origins,
                 complex_inputs_paths):
        """

        :param str factory: see Primitive
        :param list of list of int indices:
        :param list of float transform_data:
        :param list of list of float complex_origins:
        :param list of str complex_inputs_paths:
        """
        from complex_factory import ComplexFactory
        primitives = list()
        for i, index in enumerate(indices):
            print(i)
            print(index)
            complex_origin = complex_origins[i]
            x = transform_data[0] + complex_origin[0]
            y = transform_data[1] + complex_origin[1]
            z = transform_data[2] + complex_origin[2]
            path = complex_inputs_paths[i]
            result = check_file(path)
            with open(result['path']) as f:
                input_data = json.load(f)
            complex_type = input_data['metadata']['class_name']
            input_data['arguments']['factory'] = factory
            if complex_type in [
                    Cylinder.__name__, DividedCylinder.__name__,
                    ComplexPrimitive.__name__, Matrix.__name__
            ]:
                complex_transform_data = input_data['arguments'][
                    'transform_data']
                if complex_transform_data is not None:
                    complex_transform_data[0] = x
                    complex_transform_data[1] = y
                    complex_transform_data[2] = z
                else:
                    complex_transform_data = [x, y, z]
                input_data['arguments'][
                    'transform_data'] = complex_transform_data
            c = ComplexFactory.new(input_data)
            primitives.extend(c.primitives)
        Complex.__init__(self, factory, primitives)
Exemplo n.º 4
0
 def __init__(self, factory, inputs):
     from complex_factory import ComplexFactory
     if factory == 'occ':
         factory_object = gmsh.model.occ
     else:
         factory_object = gmsh.model.geo
     primitives = list()
     for i in inputs:
         result = check_file(i)
         with open(result['path']) as f:
             input_data = json.load(f)
             input_data['arguments']['factory'] = factory
         c = ComplexFactory.new(input_data)
         primitives.extend(c.primitives)
     Complex.__init__(self, factory, primitives)
     print('Synchronize')
     factory_object.synchronize()
     print('Evaluate')
     self.evaluate_coordinates()
     self.evaluate_bounding_box()
     print('Self Boolean')
     complex_self(factory_object, self)
Exemplo n.º 5
0
 def __init__(self, factory, inputs):
     from complex_factory import ComplexFactory
     if factory == 'occ':
         factory_object = gmsh.model.occ
     else:
         factory_object = gmsh.model.geo
     # Environment
     result = check_file(inputs[0])
     with open(result['path']) as f:
         input_data = json.load(f)
     e = ComplexFactory.new(input_data)
     # Tunnel
     result = check_file(inputs[-1])
     with open(result['path']) as f:
         input_data = json.load(f)
     t = ComplexFactory.new(input_data)
     print('Synchronize')
     factory_object.synchronize()
     print('Evaluate')
     e.evaluate_coordinates()
     e.evaluate_bounding_box()
     t.evaluate_coordinates()
     t.evaluate_bounding_box()
     print('Boolean')
     # Environment by Tunnel
     complex_by_complex(
         factory_object, e, t,
         sort_function=sort_object_no_shared_no_tool_no_shared)
     primitives = list()
     primitives.extend(e.primitives)
     # Boreholes
     for i in inputs[1:-1]:
         result = check_file(i)
         with open(result['path']) as f:
             input_data = json.load(f)
         c = ComplexFactory.new(input_data)
         primitives.extend(c.primitives)
     Complex.__init__(self, factory, primitives)
Exemplo n.º 6
0
 def __init__(self, ap_guts=[], **kw):
     # Call ancestor init with the remaining keywords
     Complex.__init__(self, **kw)
     self.ap_guts = ap_guts
Exemplo n.º 7
0
 def __init__(self, factory, env_input_path, trench_input_path, origin,
              n_levels, n_tunnels, n_trenches, d_tunnel, d_level, d_trench):
     """
     NKM Eleron 2 var 2 layout
     :param str factory: see Primitive
     :param str env_input_path: Environment input path
     :param str trench_input_path: Trench input path
     :param list of float origin: position [x, y, z] of the first borehole
     :param int n_levels: number of horizontal levels
     :param int n_tunnels: number of tunnels per level
     :param int n_trenches: number of trenches per tunnel
     :param float d_tunnel: tunnel step
     :param float d_level: level step
     :param float d_trench: trench step
     """
     from complex_factory import ComplexFactory
     if factory == 'occ':
         factory_object = gmsh.model.occ
     else:
         factory_object = gmsh.model.geo
     complexes = list()
     print('Boreholes')
     result = check_file(trench_input_path)
     with open(result['path']) as f:
         input_data = json.load(f)
     input_data['arguments']['factory'] = factory
     pprint(input_data)
     n_bs = n_levels * n_tunnels * n_trenches * 2
     cnt = 0
     x0, y0, z0 = origin
     for level in range(n_levels):
         z = z0 + level * d_level
         for tunnel in range(n_tunnels):
             x = x0 + tunnel * d_tunnel
             for trench in range(n_trenches):
                 y = y0 + trench * d_trench
                 # Right
                 cnt += 1
                 print(
                     '{0}/{1} Level {2} Tunnel {3} Trench {4} Right'.format(
                         cnt, n_bs, z, x, y))
                 new_transform = input_data['arguments']['transform_data']
                 new_transform[0] = x + 13.155 + 2.500
                 new_transform[1] = y
                 new_transform[2] = z - 4.400
                 input_data['arguments']['transform_data'] = new_transform
                 t = ComplexFactory.new(input_data)
                 complexes.append(t)
                 # print('Synchronize')
                 # factory_object.synchronize()
                 # print('Evaluate')
                 # for c in complexes:
                 #     c.evaluate_coordinates()
                 # print('Remove Duplicates')
                 # factory_object.removeAllDuplicates()
                 # print('Synchronize')
                 # factory_object.synchronize()
                 # Left
                 cnt += 1
                 print(
                     '{0}/{1} Level {2} Tunnel {3} Trench {4} Left'.format(
                         cnt, n_bs, z, x, y))
                 new_transform[0] = x - 13.155 - 2.500
                 new_transform[1] = y
                 new_transform[2] = z - 4.400
                 input_data['arguments']['transform_data'] = new_transform
                 t2 = ComplexFactory.new(input_data)
                 complexes.append(t2)
                 # print('Synchronize')
                 # factory_object.synchronize()
                 # print('Evaluate')
                 # for c in complexes:
                 #     c.evaluate_coordinates()
                 # print('Remove Duplicates')
                 # factory_object.removeAllDuplicates()
     print('Synchronize')
     factory_object.synchronize()
     print('Evaluate')
     for c in complexes:
         c.evaluate_coordinates()
     print('Remove Duplicates')
     factory_object.removeAllDuplicates()
     print('Synchronize')
     factory_object.synchronize()
     print('Environment')
     result = check_file(env_input_path)
     print(result)
     with open(result['path']) as f:
         input_data = json.load(f)
     input_data['arguments']['factory'] = factory
     input_data['arguments']['inner_volumes'] = list(
         itertools.chain.from_iterable([x.get_volumes()
                                        for x in complexes]))
     pprint(input_data)
     e = ComplexFactory.new(input_data)
     complexes.append(e)
     primitives = list(
         itertools.chain.from_iterable([x.primitives for x in complexes]))
     Complex.__init__(self, factory, primitives)
Exemplo n.º 8
0
 def __init__(self,
              factory,
              divide_data,
              point_data,
              transform_data=None,
              curve_types=None,
              curve_data=None,
              transfinite_data=None,
              transfinite_type=None,
              physical_name=None,
              inner_volumes=None,
              surfaces_names=None):
     """
     Primitive object divided into parts for boolean accuracy.
     :param str factory: see Primitive
     :param list of int divide_data: [n_parts_x, n_parts_y, n_parts_z]
     :param list point_data: see Primitive
     :param list of float transform_data: see Primitive
     :param list of int curve_types: see Primitive
     :param list curve_data: see Primitive
     :param list of list of float transfinite_data: see Primitive
     :param int transfinite_type: see Primitive
     :param str physical_name: see Primitive
     :param list of int inner_volumes: see Primitive
     :param list of str surfaces_names: see Primitive
     """
     primitives = list()
     if len(point_data) == 3:
         half_lx = point_data[0] / 2.0
         half_ly = point_data[1] / 2.0
         half_lz = point_data[2] / 2.0
         primitive_lc = None
         new_point_data = [[half_lx, half_ly, -half_lz],
                           [-half_lx, half_ly, -half_lz],
                           [-half_lx, -half_ly, -half_lz],
                           [half_lx, -half_ly, -half_lz],
                           [half_lx, half_ly, half_lz],
                           [-half_lx, half_ly, half_lz],
                           [-half_lx, -half_ly, half_lz],
                           [half_lx, -half_ly, half_lz]]
     elif len(point_data) == 4:
         half_lx = point_data[0] / 2.0
         half_ly = point_data[1] / 2.0
         half_lz = point_data[2] / 2.0
         primitive_lc = point_data[3]
         new_point_data = [[half_lx, half_ly, -half_lz],
                           [-half_lx, half_ly, -half_lz],
                           [-half_lx, -half_ly, -half_lz],
                           [half_lx, -half_ly, -half_lz],
                           [half_lx, half_ly, half_lz],
                           [-half_lx, half_ly, half_lz],
                           [-half_lx, -half_ly, half_lz],
                           [half_lx, -half_ly, half_lz]]
     else:
         primitive_lc = None
         new_point_data = [x[:3] for x in point_data]  # slice lc if exist
     if curve_data is None:
         curve_data = [[]] * 12
     if physical_name is None:
         physical_name = ComplexPrimitive.__name__
     ps_base_points, ps_curves_points = divide_primitive(
         divide_data, new_point_data, curve_data)
     for i, bps in enumerate(ps_base_points):
         if primitive_lc is not None:
             new_point_data = [
                 x + [primitive_lc] for x in ps_base_points[i]
             ]
         else:
             new_point_data = ps_base_points[i]
         new_curve_data = list()
         for cps in ps_curves_points[i]:
             if primitive_lc is not None:
                 new_curve_data.append([x + [primitive_lc] for x in cps])
             else:
                 new_curve_data.append(cps)
         primitives.append(
             Primitive(factory, new_point_data, transform_data, curve_types,
                       new_curve_data, transfinite_data, transfinite_type,
                       physical_name, inner_volumes, surfaces_names))
     Complex.__init__(self, factory, primitives)
Exemplo n.º 9
0
 def __init__(self,
              ap_guts = [],
              **kw):
     # Call ancestor init with the remaining keywords
     Complex.__init__(self, **kw)
     self.ap_guts = ap_guts
Exemplo n.º 10
0
 def __init__(self, factory, radii, heights, layers_lcs, transform_data,
              layers_physical_names, transfinite_r_data, transfinite_h_data,
              transfinite_phi_data, straight_boundary=None,
              layers_surfaces_names=None, surfaces_names=None,
              volumes_names=None):
     """
     Multilayer cylinder
     Used for axisymmetric objects
     Layers structure:
     h - height
     c - radius
     hM_r1 hM_r2 ... hM_rN
     ...   ...   ... ...
     h2_r1 h2_r2 ... h2_rN
     h1_r1 h1_r2 ... h1_rN
     Bottom center of h1_r1 layer is an origin of the cylinder
     :param str factory: see Primitive
     :param list of float radii: layers outer radii [r1, r2, ..., rN]
     :param list of float heights: layers heights [h1, h2, ..., hM]
     :param list of list of float layers_lcs: characteristic lengths
     of layers
     [[h1_r1, h1_r2, ..., h1_rN], [h2_r1, h2_r2, ..., h2_rN], ...,
     [hM_r1, hM_r2, ..., hM_rN]]
     :param list of float transform_data: relative to cylinder bottom
     (see Primitive)
     :param list of list of str layers_physical_names: physical names
     of layers
     [[h1_r1, h1_r2, ..., h1_rN], [h2_r1, h2_r2, ..., h2_rN], ...,
     [hM_r1, hM_r2, ..., hM_rN]]
     :param list of list of float transfinite_r_data: see Primitive
     [[number of r1 nodes, type, coefficient], [number of r2 nodes, type,
     coefficient], ...]
     :param list of list of float transfinite_h_data: see Primitive
     [[number of h1 nodes, type, coefficient], [number of h2 nodes, type,
     coefficient], ...]
     :param list of float transfinite_phi_data: see Primitive
     [number of circumferential nodes, type, coefficient]
     :param list of int straight_boundary: radii layers form of curves:
     0 - ||
     1 - |)
     2 - )|
     3 - ))
     :param list of list of int layers_surfaces_names:
     :param list of list of str surfaces_names:
     :param list of str volumes_names:
     :return None
     """
     primitives = []
     k = 1 / 3.0  # inner quadrangle part of the first layer radius
     transfinite_types = [0, 0, 0, 1, 3]
     h_cnt = 0.0  # height counter
     if layers_lcs is None:
         layers_lcs = [[1 for _ in radii] for _ in heights]
     if surfaces_names is None:
         surfaces_names = [['NX', 'X', 'NY', 'Y', 'NZ', 'Z']]
     if layers_surfaces_names is None:
         layers_surfaces_names = [[0 for _ in radii] for _ in heights]
     if volumes_names is not None:
         new_layers_physical_names = [[volumes_names[x] for x in y]
                                      for y in layers_physical_names]
         layers_physical_names = new_layers_physical_names
     for i, h in enumerate(heights):
         c = radii[0] / math.sqrt(2.0)
         kc = k * radii[0] / math.sqrt(2.0)
         bottom_h = h_cnt  # primitive bottom h
         top_h = h_cnt + h  # primitive top h
         h_cnt += h
         if straight_boundary is None:
             # Core center
             primitives.append(Primitive(
                 factory,
                 [
                     [kc, kc, bottom_h, layers_lcs[i][0]],
                     [-kc, kc, bottom_h, layers_lcs[i][0]],
                     [-kc, -kc, bottom_h, layers_lcs[i][0]],
                     [kc, -kc, bottom_h, layers_lcs[i][0]],
                     [kc, kc, top_h, layers_lcs[i][0]],
                     [-kc, kc, top_h, layers_lcs[i][0]],
                     [-kc, -kc, top_h, layers_lcs[i][0]],
                     [kc, -kc, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                 [[], [], [], [], [], [], [], [], [], [], [], []],
                 [
                     transfinite_phi_data,
                     transfinite_phi_data,
                     transfinite_h_data[i]
                 ],
                 transfinite_types[0],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Core X
             primitives.append(Primitive(
                 factory,
                 [
                     [c, c, bottom_h, layers_lcs[i][0]],
                     [kc, kc, bottom_h, layers_lcs[i][0]],
                     [kc, -kc, bottom_h, layers_lcs[i][0]],
                     [c, -c, bottom_h, layers_lcs[i][0]],
                     [c, c, top_h, layers_lcs[i][0]],
                     [kc, kc, top_h, layers_lcs[i][0]],
                     [kc, -kc, top_h, layers_lcs[i][0]],
                     [c, -c, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
                 [
                     [], [], [], [],
                     [[0, 0, bottom_h, 1]], [], [], [[0, 0, top_h, 1]],
                     [], [], [], []
                 ],
                 [
                     transfinite_r_data[0],
                     transfinite_phi_data,
                     transfinite_h_data[i]
                 ],
                 transfinite_types[1],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Core Y
             primitives.append(Primitive(
                 factory,
                 [
                     [c, c, bottom_h, layers_lcs[i][0]],
                     [-c, c, bottom_h, layers_lcs[i][0]],
                     [-kc, kc, bottom_h, layers_lcs[i][0]],
                     [kc, kc, bottom_h, layers_lcs[i][0]],
                     [c, c, top_h, layers_lcs[i][0]],
                     [-c, c, top_h, layers_lcs[i][0]],
                     [-kc, kc, top_h, layers_lcs[i][0]],
                     [kc, kc, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                 [
                     [[0, 0, bottom_h, 1]], [[0, 0, top_h, 1]], [], [],
                     [], [], [], [],
                     [], [], [], []
                 ],
                 [
                     transfinite_phi_data,
                     transfinite_r_data[0],
                     transfinite_h_data[i],
                 ],
                 transfinite_types[2],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Core NX
             if transfinite_r_data[0][
                 1] == 0:  # If type is Progression then reverse coefficient
                 rc = 1.0 / transfinite_r_data[0][2]
             else:
                 rc = transfinite_r_data[0][2]
             primitives.append(Primitive(
                 factory,
                 [
                     [-kc, kc, bottom_h, layers_lcs[i][0]],
                     [-c, c, bottom_h, layers_lcs[i][0]],
                     [-c, -c, bottom_h, layers_lcs[i][0]],
                     [-kc, -kc, bottom_h, layers_lcs[i][0]],
                     [-kc, kc, top_h, layers_lcs[i][0]],
                     [-c, c, top_h, layers_lcs[i][0]],
                     [-c, -c, top_h, layers_lcs[i][0]],
                     [-kc, -kc, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
                 [
                     [], [], [], [],
                     [], [[0, 0, bottom_h, 1]], [[0, 0, top_h, 1]], [],
                     [], [], [], []
                 ],
                 [
                     [transfinite_r_data[0][0], transfinite_r_data[0][1],
                      rc],
                     transfinite_phi_data,
                     transfinite_h_data[i]
                 ],
                 transfinite_types[3],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Core NY
             if transfinite_r_data[0][
                 1] == 0:  # If type is Progression then reverse coefficient
                 rc = 1.0 / transfinite_r_data[0][2]
             else:
                 rc = transfinite_r_data[0][2]
             primitives.append(Primitive(
                 factory,
                 [
                     [kc, -kc, bottom_h, layers_lcs[i][0]],
                     [-kc, -kc, bottom_h, layers_lcs[i][0]],
                     [-c, -c, bottom_h, layers_lcs[i][0]],
                     [c, -c, bottom_h, layers_lcs[i][0]],
                     [kc, -kc, top_h, layers_lcs[i][0]],
                     [-kc, -kc, top_h, layers_lcs[i][0]],
                     [-c, -c, top_h, layers_lcs[i][0]],
                     [c, -c, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                 [
                     [], [], [[0, 0, top_h, 1]], [[0, 0, bottom_h, 1]],
                     [], [], [], [],
                     [], [], [], []
                 ],
                 [
                     transfinite_phi_data,
                     [transfinite_r_data[0][0], transfinite_r_data[0][1],
                      rc],
                     transfinite_h_data[i],
                 ],
                 transfinite_types[4],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Layers
             for j in range(1, len(radii)):
                 c1 = radii[j - 1] / math.sqrt(2.0)
                 c2 = radii[j] / math.sqrt(2.0)
                 # Layer X
                 primitives.append(Primitive(
                     factory,
                     [
                         [c2, c2, bottom_h, layers_lcs[i][j]],
                         [c1, c1, bottom_h, layers_lcs[i][j]],
                         [c1, -c1, bottom_h, layers_lcs[i][j]],
                         [c2, -c2, bottom_h, layers_lcs[i][j]],
                         [c2, c2, top_h, layers_lcs[i][j]],
                         [c1, c1, top_h, layers_lcs[i][j]],
                         [c1, -c1, top_h, layers_lcs[i][j]],
                         [c2, -c2, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
                     [
                         [], [], [], [],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [], [], [], []
                     ],
                     [
                         transfinite_r_data[j],
                         transfinite_phi_data,
                         transfinite_h_data[i]
                     ],
                     transfinite_types[1],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
                 # Layer Y
                 primitives.append(Primitive(
                     factory,
                     [
                         [c2, c2, bottom_h, layers_lcs[i][j]],
                         [-c2, c2, bottom_h, layers_lcs[i][j]],
                         [-c1, c1, bottom_h, layers_lcs[i][j]],
                         [c1, c1, bottom_h, layers_lcs[i][j]],
                         [c2, c2, top_h, layers_lcs[i][j]],
                         [-c2, c2, top_h, layers_lcs[i][j]],
                         [-c1, c1, top_h, layers_lcs[i][j]],
                         [c1, c1, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                     [
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [], [], [], [],
                         [], [], [], []
                     ],
                     [
                         transfinite_phi_data,
                         transfinite_r_data[j],
                         transfinite_h_data[i]
                     ],
                     transfinite_types[2],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
                 # Layer NX
                 if transfinite_r_data[j][
                     1] == 0:  # If type is Progression then reverse coefficient
                     rc = 1.0 / transfinite_r_data[j][2]
                 else:
                     rc = transfinite_r_data[j][2]
                 primitives.append(Primitive(
                     factory,
                     [
                         [-c1, c1, bottom_h, layers_lcs[i][j]],
                         [-c2, c2, bottom_h, layers_lcs[i][j]],
                         [-c2, -c2, bottom_h, layers_lcs[i][j]],
                         [-c1, -c1, bottom_h, layers_lcs[i][j]],
                         [-c1, c1, top_h, layers_lcs[i][j]],
                         [-c2, c2, top_h, layers_lcs[i][j]],
                         [-c2, -c2, top_h, layers_lcs[i][j]],
                         [-c1, -c1, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
                     [
                         [], [], [], [],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [], [], [], []
                     ],
                     [
                         [transfinite_r_data[j][0], transfinite_r_data[j][1],
                          rc],
                         transfinite_phi_data,
                         transfinite_h_data[i]
                     ],
                     transfinite_types[3],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
                 # Layer NY
                 if transfinite_r_data[j][
                     1] == 0:  # If type is Progression then reverse coefficient
                     rc = 1.0 / transfinite_r_data[j][2]
                 else:
                     rc = transfinite_r_data[j][2]
                 primitives.append(Primitive(
                     factory,
                     [
                         [c1, -c1, bottom_h, layers_lcs[i][j]],
                         [-c1, -c1, bottom_h, layers_lcs[i][j]],
                         [-c2, -c2, bottom_h, layers_lcs[i][j]],
                         [c2, -c2, bottom_h, layers_lcs[i][j]],
                         [c1, -c1, top_h, layers_lcs[i][j]],
                         [-c1, -c1, top_h, layers_lcs[i][j]],
                         [-c2, -c2, top_h, layers_lcs[i][j]],
                         [c2, -c2, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                     [
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [], [], [], [],
                         [], [], [], []
                     ],
                     [
                         transfinite_phi_data,
                         [transfinite_r_data[j][0], transfinite_r_data[j][1],
                          rc],
                         transfinite_h_data[i]
                     ],
                     transfinite_types[4],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
         else:
             if straight_boundary[0] == 0:
                 curve_types = {
                     'C': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                     'X': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                     'Y': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                     'NX': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                     'NY': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
                 }
             elif straight_boundary[0] == 1:
                 curve_types = {
                     'C': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                     'X': [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
                     'Y': [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                     'NX': [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
                     'NY': [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
                 }
             elif straight_boundary[0] == 2:
                 curve_types = {
                     'C': [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
                     'X': [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
                     'Y': [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                     'NX': [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
                     'NY': [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
                 }
             else:
                 curve_types = {
                     'C': [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
                     'X': [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
                     'Y': [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                     'NX': [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
                     'NY': [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
                 }
             # Core center
             primitives.append(Primitive(
                 factory,
                 [
                     [kc, kc, bottom_h, layers_lcs[i][0]],
                     [-kc, kc, bottom_h, layers_lcs[i][0]],
                     [-kc, -kc, bottom_h, layers_lcs[i][0]],
                     [kc, -kc, bottom_h, layers_lcs[i][0]],
                     [kc, kc, top_h, layers_lcs[i][0]],
                     [-kc, kc, top_h, layers_lcs[i][0]],
                     [-kc, -kc, top_h, layers_lcs[i][0]],
                     [kc, -kc, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 curve_types['C'],
                 [
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, top_h, 1]],
                     [], [], [], []],
                 [
                     transfinite_phi_data,
                     transfinite_phi_data,
                     transfinite_h_data[i]
                 ],
                 transfinite_types[0],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Core X
             primitives.append(Primitive(
                 factory,
                 [
                     [c, c, bottom_h, layers_lcs[i][0]],
                     [kc, kc, bottom_h, layers_lcs[i][0]],
                     [kc, -kc, bottom_h, layers_lcs[i][0]],
                     [c, -c, bottom_h, layers_lcs[i][0]],
                     [c, c, top_h, layers_lcs[i][0]],
                     [kc, kc, top_h, layers_lcs[i][0]],
                     [kc, -kc, top_h, layers_lcs[i][0]],
                     [c, -c, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 curve_types['X'],
                 [
                     [], [], [], [],
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, top_h, 1]],
                     [], [], [], []
                 ],
                 [
                     transfinite_r_data[0],
                     transfinite_phi_data,
                     transfinite_h_data[i]
                 ],
                 transfinite_types[1],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[
                     layers_surfaces_names[i][0]]
             ))
             # Core Y
             primitives.append(Primitive(
                 factory,
                 [
                     [c, c, bottom_h, layers_lcs[i][0]],
                     [-c, c, bottom_h, layers_lcs[i][0]],
                     [-kc, kc, bottom_h, layers_lcs[i][0]],
                     [kc, kc, bottom_h, layers_lcs[i][0]],
                     [c, c, top_h, layers_lcs[i][0]],
                     [-c, c, top_h, layers_lcs[i][0]],
                     [-kc, kc, top_h, layers_lcs[i][0]],
                     [kc, kc, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 curve_types['Y'],
                 [
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, bottom_h, 1]],
                     [], [], [], [],
                     [], [], [], []
                 ],
                 [
                     transfinite_phi_data,
                     transfinite_r_data[0],
                     transfinite_h_data[i],
                 ],
                 transfinite_types[2],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Core NX
             if transfinite_r_data[0][
                 1] == 0:  # If type is Progression then reverse coefficient
                 rc = 1.0 / transfinite_r_data[0][2]
             else:
                 rc = transfinite_r_data[0][2]
             primitives.append(Primitive(
                 factory,
                 [
                     [-kc, kc, bottom_h, layers_lcs[i][0]],
                     [-c, c, bottom_h, layers_lcs[i][0]],
                     [-c, -c, bottom_h, layers_lcs[i][0]],
                     [-kc, -kc, bottom_h, layers_lcs[i][0]],
                     [-kc, kc, top_h, layers_lcs[i][0]],
                     [-c, c, top_h, layers_lcs[i][0]],
                     [-c, -c, top_h, layers_lcs[i][0]],
                     [-kc, -kc, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 curve_types['NX'],
                 [
                     [], [], [], [],
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, top_h, 1]],
                     [], [], [], []
                 ],
                 [
                     [transfinite_r_data[0][0], transfinite_r_data[0][1],
                      rc],
                     transfinite_phi_data,
                     transfinite_h_data[i]
                 ],
                 transfinite_types[3],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Core NY
             if transfinite_r_data[0][
                 1] == 0:  # If type is Progression then reverse coefficient
                 rc = 1.0 / transfinite_r_data[0][2]
             else:
                 rc = transfinite_r_data[0][2]
             primitives.append(Primitive(
                 factory,
                 [
                     [kc, -kc, bottom_h, layers_lcs[i][0]],
                     [-kc, -kc, bottom_h, layers_lcs[i][0]],
                     [-c, -c, bottom_h, layers_lcs[i][0]],
                     [c, -c, bottom_h, layers_lcs[i][0]],
                     [kc, -kc, top_h, layers_lcs[i][0]],
                     [-kc, -kc, top_h, layers_lcs[i][0]],
                     [-c, -c, top_h, layers_lcs[i][0]],
                     [c, -c, top_h, layers_lcs[i][0]]
                 ],
                 transform_data,
                 curve_types['NY'],
                 [
                     [[0, 0, bottom_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, top_h, 1]],
                     [[0, 0, bottom_h, 1]],
                     [], [], [], [],
                     [], [], [], []
                 ],
                 [
                     transfinite_phi_data,
                     [transfinite_r_data[0][0], transfinite_r_data[0][1],
                      rc],
                     transfinite_h_data[i],
                 ],
                 transfinite_types[4],
                 layers_physical_names[i][0],
                 surfaces_names=surfaces_names[layers_surfaces_names[i][0]]
             ))
             # Layers
             for j in range(1, len(radii)):
                 if straight_boundary[j] == 0:
                     curve_types = {
                         'X': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                         'Y': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                         'NX': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                         'NY': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
                     }
                 elif straight_boundary[j] == 1:
                     curve_types = {
                         'X': [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
                         'Y': [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                         'NX': [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
                         'NY': [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
                     }
                 elif straight_boundary[j] == 2:
                     curve_types = {
                         'X': [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
                         'Y': [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                         'NX': [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
                         'NY': [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
                     }
                 else:
                     curve_types = {
                         'X': [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
                         'Y': [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                         'NX': [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
                         'NY': [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
                     }
                 c1 = radii[j - 1] / math.sqrt(2.0)
                 c2 = radii[j] / math.sqrt(2.0)
                 # Layer X
                 primitives.append(Primitive(
                     factory,
                     [
                         [c2, c2, bottom_h, layers_lcs[i][j]],
                         [c1, c1, bottom_h, layers_lcs[i][j]],
                         [c1, -c1, bottom_h, layers_lcs[i][j]],
                         [c2, -c2, bottom_h, layers_lcs[i][j]],
                         [c2, c2, top_h, layers_lcs[i][j]],
                         [c1, c1, top_h, layers_lcs[i][j]],
                         [c1, -c1, top_h, layers_lcs[i][j]],
                         [c2, -c2, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     curve_types['X'],
                     [
                         [], [], [], [],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [], [], [], []
                     ],
                     [
                         transfinite_r_data[j],
                         transfinite_phi_data,
                         transfinite_h_data[i]
                     ],
                     transfinite_types[1],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
                 # Layer Y
                 primitives.append(Primitive(
                     factory,
                     [
                         [c2, c2, bottom_h, layers_lcs[i][j]],
                         [-c2, c2, bottom_h, layers_lcs[i][j]],
                         [-c1, c1, bottom_h, layers_lcs[i][j]],
                         [c1, c1, bottom_h, layers_lcs[i][j]],
                         [c2, c2, top_h, layers_lcs[i][j]],
                         [-c2, c2, top_h, layers_lcs[i][j]],
                         [-c1, c1, top_h, layers_lcs[i][j]],
                         [c1, c1, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     curve_types['Y'],
                     [
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [], [], [], [],
                         [], [], [], []
                     ],
                     [
                         transfinite_phi_data,
                         transfinite_r_data[j],
                         transfinite_h_data[i]
                     ],
                     transfinite_types[2],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
                 # Layer NX
                 if transfinite_r_data[j][
                     1] == 0:  # If type is Progression then reverse coefficient
                     rc = 1.0 / transfinite_r_data[j][2]
                 else:
                     rc = transfinite_r_data[j][2]
                 primitives.append(Primitive(
                     factory,
                     [
                         [-c1, c1, bottom_h, layers_lcs[i][j]],
                         [-c2, c2, bottom_h, layers_lcs[i][j]],
                         [-c2, -c2, bottom_h, layers_lcs[i][j]],
                         [-c1, -c1, bottom_h, layers_lcs[i][j]],
                         [-c1, c1, top_h, layers_lcs[i][j]],
                         [-c2, c2, top_h, layers_lcs[i][j]],
                         [-c2, -c2, top_h, layers_lcs[i][j]],
                         [-c1, -c1, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     curve_types['NX'],
                     [
                         [], [], [], [],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [], [], [], []
                     ],
                     [
                         [transfinite_r_data[j][0],
                          transfinite_r_data[j][1], rc],
                         transfinite_phi_data,
                         transfinite_h_data[i]
                     ],
                     transfinite_types[3],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
                 # Layer NY
                 if transfinite_r_data[j][
                     1] == 0:  # If type is Progression then reverse coefficient
                     rc = 1.0 / transfinite_r_data[j][2]
                 else:
                     rc = transfinite_r_data[j][2]
                 primitives.append(Primitive(
                     factory,
                     [
                         [c1, -c1, bottom_h, layers_lcs[i][j]],
                         [-c1, -c1, bottom_h, layers_lcs[i][j]],
                         [-c2, -c2, bottom_h, layers_lcs[i][j]],
                         [c2, -c2, bottom_h, layers_lcs[i][j]],
                         [c1, -c1, top_h, layers_lcs[i][j]],
                         [-c1, -c1, top_h, layers_lcs[i][j]],
                         [-c2, -c2, top_h, layers_lcs[i][j]],
                         [c2, -c2, top_h, layers_lcs[i][j]]
                     ],
                     transform_data,
                     curve_types['NY'],
                     [
                         [[0, 0, bottom_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, top_h, 1]],
                         [[0, 0, bottom_h, 1]],
                         [], [], [], [],
                         [], [], [], []
                     ],
                     [
                         transfinite_phi_data,
                         [transfinite_r_data[j][0],
                          transfinite_r_data[j][1], rc],
                         transfinite_h_data[i]
                     ],
                     transfinite_types[4],
                     layers_physical_names[i][j],
                     surfaces_names=surfaces_names[
                         layers_surfaces_names[i][j]]
                 ))
     Complex.__init__(self, factory, primitives)
Exemplo n.º 11
0
 def __init__(self,
              factory,
              xs,
              ys,
              zs,
              lcs=None,
              coordinates_type=None,
              transform_data=None,
              txs=None,
              tys=None,
              tzs=None,
              type_map=None,
              inputs=None,
              volumes_map=None,
              volumes_names=None,
              surfaces_map=None,
              surfaces_names=None,
              inputs_map=None):
     """
     Z0:
     Y0: X0 X1 .. XN
     Y1: X0 X1 .. XN
     YM: X0 X1 .. XN
     Z2:
     Y0: X0 X1 .. XN
     Y1: X0 X1 .. XN
     YM: X0 X1 .. XN
     ZP:
     Y0: X0 X1 .. XN
     Y1: X0 X1 .. XN
     YM: X0 X1 .. XN
     :param factory:
     :param xs:
     :param ys:
     :param zs:
     :param lcs:
     :param str coordinates_type: direct or delta
     :param transform_data:
     :param txs:
     :param tys:
     :param tzs:
     :param type_map:
     :param inputs:
     :param volumes_map:
     :param volumes_names:
     :param surfaces_map:
     :param surfaces_names:
     """
     if factory == 'occ':
         factory_object = gmsh.model.occ
     else:
         factory_object = gmsh.model.geo
     if coordinates_type is None or coordinates_type == 'direct':
         nx = len(xs) - 1
         ny = len(ys) - 1
         nz = len(zs) - 1
     elif coordinates_type == 'delta':
         nx = len(xs)
         ny = len(ys)
         nz = len(zs)
     else:
         raise ValueError('coordinates_type: {}'.format(coordinates_type))
     n = nx * ny * nz
     if transform_data is None:
         transform_data = [0, 0, 0]
     if txs is None:
         txs = [[3, 0, 1] for _ in range(nx)]
     if tys is None:
         tys = [[3, 0, 1] for _ in range(ny)]
     if tzs is None:
         tzs = [[3, 0, 1] for _ in range(nz)]
     if lcs is None:
         lcs = [1 for _ in range(n)]
     if type_map is None:
         type_map = [1 for _ in range(n)]
     elif not isinstance(type_map, list):
         type_map = [type_map for _ in range(n)]
     if volumes_names is None:
         volumes_names = ['Matrix']
     if inputs is None:
         inputs = ['input/input_test_complex_primitive.json']
     if inputs_map is None:
         inputs_map = [0 for _ in range(n)]
     if surfaces_names is None:
         surfaces_names = [['NX', 'X', 'NY', 'Y', 'NZ', 'Z']]
     if volumes_map is None:
         volumes_map = [0 for _ in range(n)]
     if surfaces_map is None:
         surfaces_map = [0 for _ in range(n)]
     primitives = list()
     if coordinates_type is None or coordinates_type == 'direct':
         for k in range(nz):
             for j in range(ny):
                 for i in range(nx):
                     gi = i + nx * j + ny * nx * k
                     # print('{}/{}'.format(gi + 1, n))
                     x0 = xs[i] + transform_data[0]
                     x1 = xs[i + 1] + transform_data[0]
                     xc = 0.5 * (x0 + x1)
                     y0 = ys[j] + transform_data[1]
                     y1 = ys[j + 1] + transform_data[1]
                     yc = 0.5 * (y0 + y1)
                     z0 = zs[k] + transform_data[2]
                     z1 = zs[k + 1] + transform_data[2]
                     zc = 0.5 * (z0 + z1)
                     lc = lcs[gi]
                     t = type_map[gi]
                     pn = volumes_names[volumes_map[gi]]
                     sns = surfaces_names[surfaces_map[gi]]
                     inp = inputs[inputs_map[gi]]
                     tx = txs[i]
                     ty = tys[j]
                     tz = tzs[k]
                     kwargs = locals()
                     type_factory[t](factory_object, primitives, kwargs)
     elif coordinates_type == 'delta':
         primitives = list()
         for k in range(nz):
             for j in range(ny):
                 for i in range(nx):
                     gi = i + nx * j + ny * nx * k
                     # print('{}/{}'.format(gi + 1, n))
                     x0 = sum(xs[:i]) + transform_data[0]
                     x1 = sum(xs[:i + 1]) + transform_data[0]
                     xc = 0.5 * (x0 + x1)
                     y0 = sum(ys[:j]) + transform_data[1]
                     y1 = sum(ys[:j + 1]) + transform_data[1]
                     yc = 0.5 * (y0 + y1)
                     z0 = sum(zs[:k]) + transform_data[2]
                     z1 = sum(zs[:k + 1]) + transform_data[2]
                     zc = 0.5 * (z0 + z1)
                     lc = lcs[gi]
                     t = type_map[gi]
                     pn = volumes_names[volumes_map[gi]]
                     sns = surfaces_names[surfaces_map[gi]]
                     inp = inputs[inputs_map[gi]]
                     tx = txs[i]
                     ty = tys[j]
                     tz = tzs[k]
                     kwargs = locals()
                     type_factory[t](factory_object, primitives, kwargs)
     else:
         raise ValueError('coordinates_type: {}'.format(coordinates_type))
     Complex.__init__(self, factory, primitives)