Skip to content
Snippets Groups Projects
Select Git revision
  • 0faa015aa66e5efa8ad76cacdfc9cb37f6bf51f8
  • master default protected
  • v2.0-dev protected
  • zikeliml/Task-96-dotExporterForAST
  • zikeliml/124-rework-tutorials
  • fma
  • fhennig/v2.0-deprecations
  • holzer-master-patch-46757
  • 66-absolute-access-is-probably-not-copied-correctly-after-_eval_subs
  • gpu_bufferfield_fix
  • hyteg
  • vectorization_sqrt_fix
  • target_dh_refactoring
  • const_fix
  • improved_comm
  • gpu_liveness_opts
  • release/1.3.7 protected
  • release/1.3.6 protected
  • release/2.0.dev0 protected
  • release/1.3.5 protected
  • release/1.3.4 protected
  • release/1.3.3 protected
  • release/1.3.2 protected
  • release/1.3.1 protected
  • release/1.3 protected
  • release/1.2 protected
  • release/1.1.1 protected
  • release/1.1 protected
  • release/1.0.1 protected
  • release/1.0 protected
  • release/0.4.4 protected
  • last/Kerncraft
  • last/OpenCL
  • last/LLVM
  • release/0.4.3 protected
  • release/0.4.2 protected
36 results

test_pickle_support.py

Blame
  • simplificationfactory.py 1.62 KiB
    import sympy as sp
    from lbmpy.innerloopsplit import create_lbm_split_groups
    from lbmpy.methods.cumulantbased import CumulantBasedLbMethod
    from pystencils.simp import apply_to_all_assignments, \
        subexpression_substitution_in_main_assignments, sympy_cse, add_subexpressions_for_divisions
    
    
    def create_simplification_strategy(lb_method, cse_pdfs=False, cse_global=False, split_inner_loop=False):
        from pystencils.simp import SimplificationStrategy
        from lbmpy.methods.momentbased import MomentBasedLbMethod
        from lbmpy.methods.momentbasedsimplifications import replace_second_order_velocity_products, \
            factor_density_after_factoring_relaxation_times, factor_relaxation_rates, cse_in_opposing_directions, \
            replace_common_quadratic_and_constant_term, replace_density_and_velocity
    
        s = SimplificationStrategy()
    
        expand = apply_to_all_assignments(sp.expand)
    
        if isinstance(lb_method, MomentBasedLbMethod):
            s.add(expand)
            s.add(replace_second_order_velocity_products)
            s.add(expand)
            s.add(factor_relaxation_rates)
            s.add(replace_density_and_velocity)
            s.add(replace_common_quadratic_and_constant_term)
            s.add(factor_density_after_factoring_relaxation_times)
            s.add(subexpression_substitution_in_main_assignments)
            if split_inner_loop:
                s.add(create_lbm_split_groups)
        elif isinstance(lb_method, CumulantBasedLbMethod):
            s.add(expand)
            s.add(factor_relaxation_rates)
    
        s.add(add_subexpressions_for_divisions)
    
        if cse_pdfs:
            s.add(cse_in_opposing_directions)
        if cse_global:
            s.add(sympy_cse)
    
        return s