Example #1
0
    def factory(type, parameters, mass):

        if type == "random":
            return Random_thinning_algorithm.Random_thinning_algorithm(
                parameters.reduction_percent)
        if type == "number_conservative":
            return Number_conservative_thinning_algorithm.Number_conservative_thinning_algorithm(
                parameters.reduction_percent)
        if type == "energy_conservative":
            return Energy_conservative_thinning_algorithm.Energy_conservative_thinning_algorithm(
                parameters.reduction_percent, mass)
        if type == "kmeans":
            divisions = [16, 40]
            return k_means_clustering_algorithm.K_means_clustering_algorithm(
                parameters.reduction_percent, parameters.max_iterations,
                parameters.tolerance, divisions)
        if type == "kmeans_avg":
            divisions = [32, 60]
            return k_means_merge_average_algorithm.K_means_merge_average_algorithm(
                parameters.reduction_percent, parameters.max_iterations,
                parameters.tolerance, divisions)
        if type == "voronoi":
            return Voronoi_algorithm.VoronoiMergingAlgorithm(
                parameters.tolerance)
        if type == "voronoi_prob":
            voronoi_parameters = Voronoi_probabilistic_algorithm.Voronoi_probabilistic_algorithm_parameters\
                (parameters.reduction_percent, parameters.ratio_left_particles)
            return Voronoi_probabilistic_algorithm.Voronoi_probabilistic_algorithm(
                voronoi_parameters)
        if type == "leveling":
            return Leveling_thinning_algorithm.Leveling_thinning_algorithm(
                parameters.leveling_coefficient)

        if type == "vranic": pass
        assert 0, "Bad type_algoritm: " + type
Example #2
0
def energy_conservative_thinning_algorithm(hdf_file_name,
                                           hdf_file_reduction_name,
                                           reduction_percent):
    parameters = Energy_conservative_thinning_algorithm.Energy_conservative_thinning_algorithm_parameters(
        reduction_percent)
    base_reduction_function(hdf_file_name, hdf_file_reduction_name,
                            "energy_conservative", parameters)
Example #3
0
    if args.algorithm == 'voronoi':
        tolerance = [args.momentum_tol, args.momentum_pos]
        parameters = Voronoi_algorithm.VoronoiMergingAlgorithmParameters(tolerance)
        base_reduction_function(args.hdf, args.hdf_re, "voronoi", parameters)

    elif args.algorithm == 'random':
        parameters = Random_thinning_algorithm.Random_thinning_algorithm_parameters(args.reduction_percent)
        base_reduction_function(args.hdf, args.hdf_re, "random", parameters)

    elif args.algorithm == 'number_conservative':
        parameters = Number_conservative_thinning_algorithm.Number_conservative_thinning_algorithm_parameters(args.reduction_percent)
        base_reduction_function(args.hdf, args.hdf_re, "number_conservative", parameters)

    elif args.algorithm == 'energy_conservative':
        parameters = Energy_conservative_thinning_algorithm.Energy_conservative_thinning_algorithm_parameters(args.reduction_percent)
        base_reduction_function(args.hdf, args.hdf_re, "energy_conservative", parameters)

    elif args.algorithm == 'kmeans':
        parameters = k_means_clustering_algorithm.K_means_clustering_algorithm_parameters(args.reduction_percent)
        base_reduction_function(args.hdf, args.hdf_re, "kmeans", parameters)

    elif args.algorithm == 'kmeans_avg':
        parameters = k_means_merge_average_algorithm.K_means_merge_average_algorithm_parameters(args.reduction_percent)
        base_reduction_function(args.hdf, args.hdf_re, "kmeans_avg", parameters)

    elif args.algorithm == 'vranic_algorithm':
        Vranic_algorithm_algorithm(args.hdf, args.hdf_re, args.momentum_tol, args.particles_type)

    elif args.algorithm == 'leveling':
        parameters = Leveling_thinning_algorithm.Leveling_thinning_algorithm_parameters(args.leveling_coefficient)
    elif args.algorithm == 'voronoi_prob':
        divide_particles = 20
        parameters = Voronoi_probabilistic_algorithm.Voronoi_probabilistic_algorithm_parameters(1. - args.ratio_deleted_particles, divide_particles)
        base_reduction_function(args.hdf, args.hdf_re, "voronoi_prob", parameters, args.iteration)

    elif args.algorithm == 'random':
        parameters = Random_thinning_algorithm.Random_thinning_algorithm_parameters(args.ratio_deleted_particles)
        base_reduction_function(args.hdf, args.hdf_re, "random", parameters, args.iteration)

    elif args.algorithm == 'number_conservative':
        parameters = Number_conservative_thinning_algorithm.Number_conservative_thinning_algorithm_parameters(args.ratio_deleted_particles)
        base_reduction_function(args.hdf, args.hdf_re, "number_conservative", parameters, args.iteration)

    elif args.algorithm == 'energy_conservative':
        parameters = Energy_conservative_thinning_algorithm.Energy_conservative_thinning_algorithm_parameters(args.ratio_deleted_particles)
        base_reduction_function(args.hdf, args.hdf_re, "energy_conservative", parameters, args.iteration)

    elif args.algorithm == 'kmeans':
        parameters = k_means_clustering_algorithm.K_means_clustering_algorithm_parameters(args.ratio_deleted_particles)
        base_reduction_function(args.hdf, args.hdf_re, "kmeans", parameters, args.iteration)

    elif args.algorithm == 'kmeans_avg':
        parameters = k_means_merge_average_algorithm.K_means_merge_average_algorithm_parameters(args.reduction_percent)
        base_reduction_function(args.hdf, args.hdf_re, "kmeans_avg", parameters, args.iteration)

    elif args.algorithm == 'leveling':
        parameters = Leveling_thinning_algorithm.Leveling_thinning_algorithm_parameters(args.leveling_coefficient)
        base_reduction_function(args.hdf, args.hdf_re, "leveling", parameters, args.iteration)

    elif args.algorithm == 'vranic':