def CreateOptimizationAlgorithm(optimization_settings, analyzer, communicator, model_part_controller):
    algorithm_name = optimization_settings["optimization_algorithm"]["name"].GetString()

    if algorithm_name == "steepest_descent":
        return AlgorithmSteepestDescent(optimization_settings,
                                        analyzer,
                                        communicator,
                                        model_part_controller)
    elif algorithm_name == "penalized_projection":
        return AlgorithmPenalizedProjection(optimization_settings,
                                            analyzer,
                                            communicator,
                                            model_part_controller)
    elif algorithm_name == "trust_region":
        return AlgorithmTrustRegion(optimization_settings,
                                    analyzer,
                                    communicator,
                                    model_part_controller)
    elif algorithm_name == "bead_optimization":
        return AlgorithmBeadOptimization(optimization_settings,
                                         analyzer,
                                         communicator,
                                         model_part_controller)
    else:
        raise NameError("The following optimization algorithm is not supported by the algorithm factory: " + algorithm_name)
Beispiel #2
0
def CreateAlgorithm(OptimizationModelPart, Analyzer, OptimizationSettings):
    AlgorithmName = OptimizationSettings["optimization_algorithm"][
        "name"].GetString()

    DesignSurface = GetDesignSurfaceFromOptimizationModelPart(
        OptimizationModelPart, OptimizationSettings)
    DampingRegions = GetDampingRegionsFromOptimizationModelPart(
        OptimizationModelPart, OptimizationSettings)

    Mapper = mapper_factory.CreateMapper(DesignSurface, OptimizationSettings)
    Communicator = communicator_factory.CreateCommunicator(
        OptimizationSettings)
    DataLogger = optimization_data_logger_factory.CreateDataLogger(
        OptimizationModelPart, DesignSurface, Communicator,
        OptimizationSettings)

    if AlgorithmName == "steepest_descent":
        return AlgorithmSteepestDescent(DesignSurface, DampingRegions,
                                        Analyzer, Mapper, Communicator,
                                        DataLogger, OptimizationSettings)
    elif AlgorithmName == "penalized_projection":
        return AlgorithmPenalizedProjection(DesignSurface, DampingRegions,
                                            Analyzer, Mapper, Communicator,
                                            DataLogger, OptimizationSettings)
    else:
        raise NameError(
            "The following optimization algorithm not supported by the algorithm driver (name may be misspelled): "
            + AlgorithmName)
def CreateAlgorithm( designSurface, listOfDampingRegions, analyzer, mapper, communicator, optimizationSettings ):

    optimizationAlgorithm = optimizationSettings["optimization_algorithm"]["name"].GetString()

    if optimizationAlgorithm == "steepest_descent":
        return AlgorithmSteepestDescent( designSurface, listOfDampingRegions, analyzer, mapper, communicator, optimizationSettings )
    elif optimizationAlgorithm == "penalized_projection":
        return AlgorithmPenalizedProjection( designSurface, listOfDampingRegions, analyzer, mapper, communicator, optimizationSettings )  
    else:
        raise NameError("The following optimization algorithm not supported by the algorithm driver (name may be misspelled): " + optimizationAlgorithm)              

# # ==============================================================================