コード例 #1
0
 def cylindrical_in(x, y, z, V):
     rho, phi, z = to_cylindrical((x, y, z), mode='radians')
     variables.update(dict(rho=rho, phi=phi, z=z, V=V))
     v1 = safe_eval_compiled(compiled1, variables)
     v2 = safe_eval_compiled(compiled2, variables)
     v3 = safe_eval_compiled(compiled3, variables)
     return out_coordinates(v1, v2, v3)
コード例 #2
0
 def carthesian_in(x, y, z, V):
     variables.update(dict(x=x, y=y, z=z, V=V))
     v1 = safe_eval_compiled(compiled1, variables, allowed_names = safe_names_np)
     v2 = safe_eval_compiled(compiled2, variables, allowed_names = safe_names_np)
     v3 = safe_eval_compiled(compiled3, variables, allowed_names = safe_names_np)
     if not isinstance(v1, np.ndarray):
         v1 = np.full_like(x, v1)
     if not isinstance(v2, np.ndarray):
         v2 = np.full_like(x, v2)
     if not isinstance(v3, np.ndarray):
         v3 = np.full_like(x, v3)
     return out_coordinates(v1, v2, v3)
コード例 #3
0
 def spherical_in(x, y, z, V):
     rho, phi, theta = to_spherical_np((x, y, z), mode='radians')
     variables.update(dict(rho=rho, phi=phi, theta=theta, V=V))
     v1 = safe_eval_compiled(compiled1, variables, allowed_names = safe_names_np)
     v2 = safe_eval_compiled(compiled2, variables, allowed_names = safe_names_np)
     v3 = safe_eval_compiled(compiled3, variables, allowed_names = safe_names_np)
     if not isinstance(v1, np.ndarray):
         v1 = np.full_like(x, v1)
     if not isinstance(v2, np.ndarray):
         v2 = np.full_like(x, v2)
     if not isinstance(v3, np.ndarray):
         v3 = np.full_like(x, v3)
     return out_coordinates(v1, v2, v3)
コード例 #4
0
        def function(u, v):
            variables.update(dict(u=u, v=v))
            v1 = safe_eval_compiled(compiled1, variables, allowed_names = safe_names_np)
            v2 = safe_eval_compiled(compiled2, variables, allowed_names = safe_names_np)
            v3 = safe_eval_compiled(compiled3, variables, allowed_names = safe_names_np)

            if not isinstance(v1, np.ndarray):
                v1 = np.full_like(u, v1)
            if not isinstance(v2, np.ndarray):
                v2 = np.full_like(u, v2)
            if not isinstance(v3, np.ndarray):
                v3 = np.full_like(u, v3)

            return np.array(out_coordinates(v1, v2, v3)).T
コード例 #5
0
 def spherical(x, y, z, V):
     rho, phi, theta = to_spherical((x, y, z), mode='radians')
     variables.update(dict(rho=rho, phi=phi, theta=theta, V=V))
     r = safe_eval_compiled(compiled, variables)
     if not isinstance(r, np.ndarray):
         r = np.full_like(x, r)
     return r
コード例 #6
0
 def cylindrical(x, y, z, V):
     rho, phi, z = to_cylindrical_np((x, y, z), mode='radians')
     variables.update(dict(rho=rho, phi=phi, z=z, V=V))
     r = safe_eval_compiled(compiled, variables, allowed_names = safe_names_np)
     if not isinstance(r, np.ndarray):
         r = np.full_like(x, r)
     return r
コード例 #7
0
def eval_compiled_spreadsheet(compiled_src_dict,
                              row_names,
                              order,
                              variables,
                              allowed_names=None):
    result = compiled_src_dict.copy()
    named_accessors = {
        name: SvSpreadsheetRowAccessor(result, name)
        for name in row_names
    }
    variables = variables.copy()
    variables.update(named_accessors)
    col_names = list(list(compiled_src_dict.values())[0].keys())
    for row_name, col_name in order:
        compiled = compiled_src_dict[row_name][col_name]
        if compiled:
            item_variables = variables.copy()
            column_accessors = {
                name: compiled_src_dict[row_name][name]
                for name in col_names
            }
            item_variables.update(column_accessors)
            value = safe_eval_compiled(compiled, item_variables, allowed_names)
            result[row_name][col_name] = value
    return result
コード例 #8
0
 def carthesian(x, y, z, V):
     variables.update(dict(x=x, y=y, z=z, V=V))
     r = safe_eval_compiled(compiled,
                            variables,
                            allowed_names=safe_names_np)
     if not isinstance(r, np.ndarray):
         r = np.full_like(x, r)
     return r
コード例 #9
0
 def function(t):
     variables.update(dict(t=t))
     v1 = safe_eval_compiled(compiled1, variables)
     v2 = safe_eval_compiled(compiled2, variables)
     v3 = safe_eval_compiled(compiled3, variables)
     return np.array(out_coordinates(v1, v2, v3))
コード例 #10
0
 def carthesian_in(x, y, z, V):
     variables.update(dict(x=x, y=y, z=z, V=V))
     v1 = safe_eval_compiled(compiled1, variables)
     v2 = safe_eval_compiled(compiled2, variables)
     v3 = safe_eval_compiled(compiled3, variables)
     return out_coordinates(v1, v2, v3)
コード例 #11
0
 def spherical(x, y, z, V):
     rho, phi, theta = to_spherical((x, y, z), mode='radians')
     variables.update(dict(rho=rho, phi=phi, theta=theta, V=V))
     return safe_eval_compiled(compiled, variables)
コード例 #12
0
 def cylindrical(x, y, z, V):
     rho, phi, z = to_cylindrical((x, y, z), mode='radians')
     variables.update(dict(rho=rho, phi=phi, z=z, V=V))
     return safe_eval_compiled(compiled, variables)
コード例 #13
0
 def carthesian(x, y, z, V):
     variables.update(dict(x=x, y=y, z=z, V=V))
     return safe_eval_compiled(compiled, variables)
コード例 #14
0
 def function(x, y, z, V):
     variables = dict(x=x, y=y, z=z, V=V)
     return safe_eval_compiled(compiled, variables)
コード例 #15
0
 def function(x, y, z, V):
     variables = dict(x=x, y=y, z=z, V=V)
     v1 = safe_eval_compiled(compiled1, variables)
     v2 = safe_eval_compiled(compiled2, variables)
     v3 = safe_eval_compiled(compiled3, variables)
     return v1, v2, v3