KratosShapeOptimizationApplication 10.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- KratosMultiphysics/.libs/KratosShapeOptimizationApplication.so +0 -0
- KratosMultiphysics/.libs/libKratosShapeOptimizationCore.dylib +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/TemplateMainKratosShapeOptimization.py +31 -0
- KratosMultiphysics/ShapeOptimizationApplication/__init__.py +19 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_base.py +31 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_bead_optimization.py +412 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_factory.py +62 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_gradient_projection.py +317 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_penalized_projection.py +225 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_relaxed_gradient_projection.py +580 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_shape_fraction_optimization.py +622 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_steepest_descent.py +255 -0
- KratosMultiphysics/ShapeOptimizationApplication/algorithms/algorithm_trust_region.py +657 -0
- KratosMultiphysics/ShapeOptimizationApplication/analyzers/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/analyzers/analyzer_base.py +30 -0
- KratosMultiphysics/ShapeOptimizationApplication/analyzers/analyzer_empty.py +21 -0
- KratosMultiphysics/ShapeOptimizationApplication/analyzers/analyzer_factory.py +310 -0
- KratosMultiphysics/ShapeOptimizationApplication/analyzers/analyzer_internal.py +155 -0
- KratosMultiphysics/ShapeOptimizationApplication/communicator_factory.py +259 -0
- KratosMultiphysics/ShapeOptimizationApplication/custom_ios/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/custom_ios/wrl_io.py +82 -0
- KratosMultiphysics/ShapeOptimizationApplication/custom_ios/wrl_reader.py +119 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/data_logger_factory.py +199 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/design_logger_base.py +28 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/design_logger_gid.py +112 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/design_logger_unv.py +73 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/design_logger_vtk.py +96 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/sensitivity_heatmap_logger.py +91 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_base.py +128 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_bead_optimization.py +79 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_gradient_projection.py +80 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_penalized_projection.py +79 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_relaxed_gradient_projection.py +108 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_shape_fraction_optimization.py +92 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_steepest_descent.py +64 -0
- KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_trust_region.py +100 -0
- KratosMultiphysics/ShapeOptimizationApplication/mapper_factory.py +100 -0
- KratosMultiphysics/ShapeOptimizationApplication/mapping/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/mapping/in_plane_vertex_morphing_mapper.py +140 -0
- KratosMultiphysics/ShapeOptimizationApplication/mapping/sliding_vertex_morphing_mapper.py +378 -0
- KratosMultiphysics/ShapeOptimizationApplication/mesh_controllers/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/mesh_controllers/mesh_controller_base.py +22 -0
- KratosMultiphysics/ShapeOptimizationApplication/mesh_controllers/mesh_controller_basic_updating.py +35 -0
- KratosMultiphysics/ShapeOptimizationApplication/mesh_controllers/mesh_controller_with_solver.py +237 -0
- KratosMultiphysics/ShapeOptimizationApplication/model_part_controller_factory.py +197 -0
- KratosMultiphysics/ShapeOptimizationApplication/optimizer_factory.py +235 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/airfoil_2d_responses.py +189 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/face_angle.py +140 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/mesh_based_packaging.py +70 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/packaging_response_base.py +156 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/plane_based_packaging.py +61 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/response_function_factory.py +40 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/surface_normal_shape_change.py +125 -0
- KratosMultiphysics/ShapeOptimizationApplication/response_functions/total_volume.py +56 -0
- KratosMultiphysics/ShapeOptimizationApplication/utilities/__init__.py +0 -0
- KratosMultiphysics/ShapeOptimizationApplication/utilities/custom_math.py +443 -0
- KratosMultiphysics/ShapeOptimizationApplication/utilities/custom_sensitivity_heatmap.py +235 -0
- KratosMultiphysics/ShapeOptimizationApplication/utilities/custom_timer.py +47 -0
- KratosMultiphysics/ShapeOptimizationApplication/utilities/custom_variable_utilities.py +54 -0
- kratosshapeoptimizationapplication-10.4.4.dist-info/METADATA +31 -0
- kratosshapeoptimizationapplication-10.4.4.dist-info/RECORD +69 -0
- kratosshapeoptimizationapplication-10.4.4.dist-info/WHEEL +6 -0
- kratosshapeoptimizationapplication.dylibs/libKratosCore.dylib +4 -0
- kratosshapeoptimizationapplication.dylibs/libgcc_s.1.1.dylib +0 -0
- kratosshapeoptimizationapplication.dylibs/libgomp.1.dylib +0 -0
- kratosshapeoptimizationapplication.dylibs/libstdc++.6.dylib +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# KratosShapeOptimizationApplication
|
|
3
|
+
#
|
|
4
|
+
# License: BSD License
|
|
5
|
+
# license: ShapeOptimizationApplication/license.txt
|
|
6
|
+
#
|
|
7
|
+
# Main authors: Geiser Armin, https://github.com/armingeiser
|
|
8
|
+
#
|
|
9
|
+
# ==============================================================================
|
|
10
|
+
|
|
11
|
+
# importing the Kratos Library
|
|
12
|
+
import KratosMultiphysics as KM
|
|
13
|
+
|
|
14
|
+
# Import logger base classes
|
|
15
|
+
from KratosMultiphysics.ShapeOptimizationApplication.loggers.value_logger_base import ValueLogger
|
|
16
|
+
|
|
17
|
+
# Import additional libraries
|
|
18
|
+
import csv
|
|
19
|
+
from KratosMultiphysics.ShapeOptimizationApplication.utilities.custom_timer import Timer
|
|
20
|
+
|
|
21
|
+
# ==============================================================================
|
|
22
|
+
class ValueLoggerGradientProjection( ValueLogger ):
|
|
23
|
+
# --------------------------------------------------------------------------
|
|
24
|
+
def InitializeLogging( self ):
|
|
25
|
+
with open(self.complete_log_file_name, 'w') as csvfile:
|
|
26
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
27
|
+
row = []
|
|
28
|
+
row.append("{:>4s}".format("itr"))
|
|
29
|
+
row.append("{:>13s}".format("f"))
|
|
30
|
+
row.append("{:>13s}".format("df_abs[%]"))
|
|
31
|
+
row.append("{:>13s}".format("df_rel[%]"))
|
|
32
|
+
|
|
33
|
+
for itr in range(self.constraints.size()):
|
|
34
|
+
con_type = self.constraints[itr]["type"].GetString()
|
|
35
|
+
row.append("{:>13s}".format("c"+str(itr+1)+": "+con_type))
|
|
36
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_ref"))
|
|
37
|
+
|
|
38
|
+
row.append("{:>13s}".format("step_size"))
|
|
39
|
+
row.append("{:>13s}".format("inf_norm_s"))
|
|
40
|
+
row.append("{:>13s}".format("inf_norm_c"))
|
|
41
|
+
row.append("{:>25s}".format("time_stamp"))
|
|
42
|
+
historyWriter.writerow(row)
|
|
43
|
+
|
|
44
|
+
# --------------------------------------------------------------------------
|
|
45
|
+
def _WriteCurrentValuesToConsole( self ):
|
|
46
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
47
|
+
KM.Logger.Print("")
|
|
48
|
+
KM.Logger.PrintInfo("ShapeOpt", "Current value of objective = ", "{:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
49
|
+
|
|
50
|
+
KM.Logger.PrintInfo("ShapeOpt", "Absolute change of objective = ","{:> .5E}".format(self.history["abs_change_objective"][self.current_index])," [%]")
|
|
51
|
+
KM.Logger.PrintInfo("ShapeOpt", "Relative change of objective = ","{:> .5E}".format(self.history["rel_change_objective"][self.current_index])," [%]\n")
|
|
52
|
+
|
|
53
|
+
for itr in range(self.constraints.size()):
|
|
54
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
55
|
+
KM.Logger.PrintInfo("ShapeOpt", "Value of C"+str(itr+1)+" = ", "{:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
56
|
+
|
|
57
|
+
# --------------------------------------------------------------------------
|
|
58
|
+
def _WriteCurrentValuesToFile( self ):
|
|
59
|
+
with open(self.complete_log_file_name, 'a') as csvfile:
|
|
60
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
61
|
+
row = []
|
|
62
|
+
row.append("{:>4d}".format(self.current_index))
|
|
63
|
+
|
|
64
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
65
|
+
row.append(" {:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
66
|
+
row.append(" {:> .5E}".format(self.history["abs_change_objective"][self.current_index]))
|
|
67
|
+
row.append(" {:> .5E}".format(self.history["rel_change_objective"][self.current_index]))
|
|
68
|
+
|
|
69
|
+
for itr in range(self.constraints.size()):
|
|
70
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
71
|
+
row.append(" {:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
72
|
+
row.append(" {:> .5E}".format(self.communicator.getReferenceValue(constraint_id)))
|
|
73
|
+
|
|
74
|
+
row.append(" {:> .5E}".format(self.history["step_size"][self.current_index]))
|
|
75
|
+
row.append(" {:> .5E}".format(self.history["inf_norm_s"][self.current_index]))
|
|
76
|
+
row.append(" {:> .5E}".format(self.history["inf_norm_c"][self.current_index]))
|
|
77
|
+
row.append("{:>25}".format(Timer().GetTimeStamp()))
|
|
78
|
+
historyWriter.writerow(row)
|
|
79
|
+
|
|
80
|
+
# ==============================================================================
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# KratosShapeOptimizationApplication
|
|
3
|
+
#
|
|
4
|
+
# License: BSD License
|
|
5
|
+
# license: ShapeOptimizationApplication/license.txt
|
|
6
|
+
#
|
|
7
|
+
# Main authors: Baumgaertner Daniel, https://github.com/dbaumgaertner
|
|
8
|
+
# Geiser Armin, https://github.com/armingeiser
|
|
9
|
+
#
|
|
10
|
+
# ==============================================================================
|
|
11
|
+
|
|
12
|
+
# importing the Kratos Library
|
|
13
|
+
import KratosMultiphysics as KM
|
|
14
|
+
|
|
15
|
+
# Import logger base classes
|
|
16
|
+
from KratosMultiphysics.ShapeOptimizationApplication.loggers.value_logger_base import ValueLogger
|
|
17
|
+
|
|
18
|
+
# Import additional libraries
|
|
19
|
+
import csv
|
|
20
|
+
from KratosMultiphysics.ShapeOptimizationApplication.utilities.custom_timer import Timer
|
|
21
|
+
|
|
22
|
+
# ==============================================================================
|
|
23
|
+
class ValueLoggerPenalizedProjection( ValueLogger ):
|
|
24
|
+
# --------------------------------------------------------------------------
|
|
25
|
+
def InitializeLogging( self ):
|
|
26
|
+
with open(self.complete_log_file_name, 'w') as csvfile:
|
|
27
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
28
|
+
row = []
|
|
29
|
+
row.append("{:>4s}".format("itr"))
|
|
30
|
+
row.append("{:>13s}".format("f"))
|
|
31
|
+
row.append("{:>13s}".format("df_abs[%]"))
|
|
32
|
+
row.append("{:>13s}".format("df_rel[%]"))
|
|
33
|
+
|
|
34
|
+
for itr in range(self.constraints.size()):
|
|
35
|
+
con_type = self.constraints[itr]["type"].GetString()
|
|
36
|
+
row.append("{:>13s}".format("c"+str(itr+1)+": "+con_type))
|
|
37
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_ref"))
|
|
38
|
+
|
|
39
|
+
row.append("{:>13s}".format("c_scaling"))
|
|
40
|
+
row.append("{:>13s}".format("step_size"))
|
|
41
|
+
row.append("{:>25s}".format("time_stamp"))
|
|
42
|
+
historyWriter.writerow(row)
|
|
43
|
+
|
|
44
|
+
# --------------------------------------------------------------------------
|
|
45
|
+
def _WriteCurrentValuesToConsole( self ):
|
|
46
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
47
|
+
KM.Logger.Print("")
|
|
48
|
+
KM.Logger.PrintInfo("ShapeOpt", "Current value of objective = ", "{:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
49
|
+
|
|
50
|
+
KM.Logger.PrintInfo("ShapeOpt", "Absolut change of objective = ","{:> .5E}".format(self.history["abs_change_objective"][self.current_index])," [%]")
|
|
51
|
+
KM.Logger.PrintInfo("ShapeOpt", "Relative change of objective = ","{:> .5E}".format(self.history["rel_change_objective"][self.current_index])," [%]\n")
|
|
52
|
+
|
|
53
|
+
for itr in range(self.constraints.size()):
|
|
54
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
55
|
+
KM.Logger.PrintInfo("ShapeOpt", "Value of C"+str(itr+1)+" = ", "{:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
56
|
+
|
|
57
|
+
# --------------------------------------------------------------------------
|
|
58
|
+
def _WriteCurrentValuesToFile( self ):
|
|
59
|
+
with open(self.complete_log_file_name, 'a') as csvfile:
|
|
60
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
61
|
+
row = []
|
|
62
|
+
row.append("{:>4d}".format(self.current_index))
|
|
63
|
+
|
|
64
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
65
|
+
row.append(" {:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
66
|
+
row.append(" {:> .5E}".format(self.history["abs_change_objective"][self.current_index]))
|
|
67
|
+
row.append(" {:> .5E}".format(self.history["rel_change_objective"][self.current_index]))
|
|
68
|
+
|
|
69
|
+
for itr in range(self.constraints.size()):
|
|
70
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
71
|
+
row.append(" {:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
72
|
+
row.append(" {:> .5E}".format(self.communicator.getReferenceValue(constraint_id)))
|
|
73
|
+
|
|
74
|
+
row.append(" {:> .5E}".format(self.history["correction_scaling"][self.current_index]))
|
|
75
|
+
row.append(" {:> .5E}".format(self.history["step_size"][self.current_index]))
|
|
76
|
+
row.append("{:>25}".format(Timer().GetTimeStamp()))
|
|
77
|
+
historyWriter.writerow(row)
|
|
78
|
+
|
|
79
|
+
# ==============================================================================
|
KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_relaxed_gradient_projection.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# KratosShapeOptimizationApplication
|
|
3
|
+
#
|
|
4
|
+
# License: BSD License
|
|
5
|
+
# license: ShapeOptimizationApplication/license.txt
|
|
6
|
+
#
|
|
7
|
+
# Main authors: Ihar Antonau
|
|
8
|
+
#
|
|
9
|
+
# ==============================================================================
|
|
10
|
+
|
|
11
|
+
# importing the Kratos Library
|
|
12
|
+
import KratosMultiphysics as Kratos
|
|
13
|
+
|
|
14
|
+
# Import logger base classes
|
|
15
|
+
from .value_logger_base import ValueLogger
|
|
16
|
+
|
|
17
|
+
# Import additional libraries
|
|
18
|
+
import csv
|
|
19
|
+
from KratosMultiphysics.ShapeOptimizationApplication.utilities.custom_timer import Timer
|
|
20
|
+
|
|
21
|
+
# ==============================================================================
|
|
22
|
+
class ValueLoggerRelaxedGradientProjection( ValueLogger ):
|
|
23
|
+
# --------------------------------------------------------------------------
|
|
24
|
+
def InitializeLogging( self ):
|
|
25
|
+
with open(self.complete_log_file_name, 'w') as csvfile:
|
|
26
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
27
|
+
row = []
|
|
28
|
+
row.append("{:>4s}".format("itr"))
|
|
29
|
+
row.append("{:>13s}".format("f"))
|
|
30
|
+
row.append("{:>13s}".format("df_abs[%]"))
|
|
31
|
+
row.append("{:>13s}".format("df_rel[%]"))
|
|
32
|
+
|
|
33
|
+
for itr in range(self.constraints.size()):
|
|
34
|
+
con_type = self.constraints[itr]["type"].GetString()
|
|
35
|
+
row.append("{:>13s}".format("c"+str(itr+1)+": "+con_type))
|
|
36
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_ref"))
|
|
37
|
+
|
|
38
|
+
row.append("{:>13s}".format("step_size"))
|
|
39
|
+
row.append("{:>13s}".format("inf_norm_p"))
|
|
40
|
+
row.append("{:>13s}".format("inf_norm_c"))
|
|
41
|
+
row.append("{:>13s}".format("projection_norm"))
|
|
42
|
+
|
|
43
|
+
for itr in range(self.constraints.size()):
|
|
44
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_buffer_value"))
|
|
45
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_buffer_size"))
|
|
46
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_buffer_size_factor"))
|
|
47
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_central_buffer_value"))
|
|
48
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_lower_buffer_value"))
|
|
49
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_upper_buffer_value"))
|
|
50
|
+
|
|
51
|
+
row.append("{:>25s}".format("time_stamp"))
|
|
52
|
+
historyWriter.writerow(row)
|
|
53
|
+
|
|
54
|
+
# --------------------------------------------------------------------------
|
|
55
|
+
def _WriteCurrentValuesToConsole( self ):
|
|
56
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
57
|
+
Kratos.Logger.Print("")
|
|
58
|
+
Kratos.Logger.PrintInfo("ShapeOpt", "Current value of objective = ", "{:> .5E}".format(self.history["response_value"]
|
|
59
|
+
[objective_id][self.current_index]))
|
|
60
|
+
|
|
61
|
+
Kratos.Logger.PrintInfo("ShapeOpt", "Absolute change of objective = ","{:> .5E}".format(self.history["abs_change_objective"][self.current_index]),
|
|
62
|
+
" [%]")
|
|
63
|
+
Kratos.Logger.PrintInfo("ShapeOpt", "Relative change of objective = ","{:> .5E}".format(self.history["rel_change_objective"][self.current_index]),
|
|
64
|
+
" [%]\n")
|
|
65
|
+
|
|
66
|
+
for itr in range(self.constraints.size()):
|
|
67
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
68
|
+
Kratos.Logger.PrintInfo("ShapeOpt", f"Value of C{str(itr+1)} = ","{:> .5E}".format(
|
|
69
|
+
self.history["response_value"][constraint_id][self.current_index]))
|
|
70
|
+
|
|
71
|
+
# --------------------------------------------------------------------------
|
|
72
|
+
def _WriteCurrentValuesToFile( self ):
|
|
73
|
+
with open(self.complete_log_file_name, 'a') as csvfile:
|
|
74
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
75
|
+
row = []
|
|
76
|
+
row.append("{:>4d}".format(self.current_index))
|
|
77
|
+
|
|
78
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
79
|
+
row.append(" {:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
80
|
+
row.append(" {:> .5E}".format(self.history["abs_change_objective"][self.current_index]))
|
|
81
|
+
row.append(" {:> .5E}".format(self.history["rel_change_objective"][self.current_index]))
|
|
82
|
+
|
|
83
|
+
for itr in range(self.constraints.size()):
|
|
84
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
85
|
+
row.append(" {:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
86
|
+
row.append(" {:> .5E}".format(self.communicator.getReferenceValue(constraint_id)))
|
|
87
|
+
|
|
88
|
+
row.append(" {:> .5E}".format(self.history["step_size"][self.current_index]))
|
|
89
|
+
row.append(" {:> .5E}".format(self.history["inf_norm_p"][self.current_index]))
|
|
90
|
+
row.append(" {:> .5E}".format(self.history["inf_norm_c"][self.current_index]))
|
|
91
|
+
row.append(" {:> .5E}".format(self.history["projection_norm"][self.current_index]))
|
|
92
|
+
|
|
93
|
+
for itr in range(self.constraints.size()):
|
|
94
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
95
|
+
row.append(" {:> .5E}".format(self.history["c"+str(itr+1)+"_buffer_value"][self.current_index]))
|
|
96
|
+
row.append(" {:> .5E}".format(self.history["c"+str(itr+1)+"_buffer_size"][self.current_index]))
|
|
97
|
+
row.append(" {:> .5E}".format(self.history["c"+str(itr+1)+"_buffer_size_factor"][self.current_index]))
|
|
98
|
+
row.append(" {:> .5E}".format(self.history["c"+str(itr+1)+"_central_buffer_value"][self.current_index] +
|
|
99
|
+
self.communicator.getReferenceValue(constraint_id)))
|
|
100
|
+
row.append(" {:> .5E}".format(self.history["c"+str(itr+1)+"_lower_buffer_value"][self.current_index]
|
|
101
|
+
+ self.communicator.getReferenceValue(constraint_id)))
|
|
102
|
+
row.append(" {:> .5E}".format(self.history["c"+str(itr+1)+"_upper_buffer_value"][self.current_index]
|
|
103
|
+
+ self.communicator.getReferenceValue(constraint_id)))
|
|
104
|
+
|
|
105
|
+
row.append("{:>25}".format(Timer().GetTimeStamp()))
|
|
106
|
+
historyWriter.writerow(row)
|
|
107
|
+
|
|
108
|
+
# ==============================================================================
|
KratosMultiphysics/ShapeOptimizationApplication/loggers/value_logger_shape_fraction_optimization.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# KratosShapeOptimizationApplication
|
|
3
|
+
#
|
|
4
|
+
# License: BSD License
|
|
5
|
+
# license: ShapeOptimizationApplication/license.txt
|
|
6
|
+
#
|
|
7
|
+
# Main authors: Schmölz David, https://github.com/dschmoelz
|
|
8
|
+
#
|
|
9
|
+
# ==============================================================================
|
|
10
|
+
|
|
11
|
+
# importing the Kratos Library
|
|
12
|
+
import KratosMultiphysics as KM
|
|
13
|
+
|
|
14
|
+
# Import logger base classes
|
|
15
|
+
from KratosMultiphysics.ShapeOptimizationApplication.loggers.value_logger_base import ValueLogger
|
|
16
|
+
|
|
17
|
+
# Import additional libraries
|
|
18
|
+
import csv
|
|
19
|
+
from KratosMultiphysics.ShapeOptimizationApplication.utilities.custom_timer import Timer
|
|
20
|
+
|
|
21
|
+
# ==============================================================================
|
|
22
|
+
class ValueLoggerShapeFractionOptimization( ValueLogger ):
|
|
23
|
+
# --------------------------------------------------------------------------
|
|
24
|
+
def InitializeLogging( self ):
|
|
25
|
+
with open(self.complete_log_file_name, 'w') as csvfile:
|
|
26
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
27
|
+
row = []
|
|
28
|
+
row.append("{:>4s}".format("itr"))
|
|
29
|
+
row.append("{:>13s}".format("f"))
|
|
30
|
+
row.append("{:>13s}".format("df_abs[%]"))
|
|
31
|
+
row.append("{:>13s}".format("df_rel[%]"))
|
|
32
|
+
row.append("{:>13s}".format("penalty_value"))
|
|
33
|
+
row.append("{:>13s}".format("penalty_factor"))
|
|
34
|
+
row.append("{:>13s}".format("f_p"))
|
|
35
|
+
row.append("{:>13s}".format("df_rel_p"))
|
|
36
|
+
row.append("{:>13s}".format("shape_fraction"))
|
|
37
|
+
|
|
38
|
+
for itr in range(self.constraints.size()):
|
|
39
|
+
con_type = self.constraints[itr]["type"].GetString()
|
|
40
|
+
row.append("{:>13s}".format("c"+str(itr+1)+": "+con_type))
|
|
41
|
+
row.append("{:>13s}".format("c"+str(itr+1)+"_ref"))
|
|
42
|
+
|
|
43
|
+
row.append("{:>13s}".format("step_size"))
|
|
44
|
+
row.append("{:>13s}".format("inf_norm_s"))
|
|
45
|
+
row.append("{:>13s}".format("inf_norm_c"))
|
|
46
|
+
row.append("{:>25s}".format("time_stamp"))
|
|
47
|
+
historyWriter.writerow(row)
|
|
48
|
+
|
|
49
|
+
# --------------------------------------------------------------------------
|
|
50
|
+
def _WriteCurrentValuesToConsole( self ):
|
|
51
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
52
|
+
KM.Logger.Print("")
|
|
53
|
+
KM.Logger.PrintInfo("ShapeOpt", "Current value of objective = ", "{:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
54
|
+
|
|
55
|
+
KM.Logger.PrintInfo("ShapeOpt", "Absolute change of objective = ","{:> .5E}".format(self.history["abs_change_objective"][self.current_index])," [%]")
|
|
56
|
+
KM.Logger.PrintInfo("ShapeOpt", "Relative change of objective = ","{:> .5E}".format(self.history["rel_change_objective"][self.current_index])," [%]\n")
|
|
57
|
+
|
|
58
|
+
for itr in range(self.constraints.size()):
|
|
59
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
60
|
+
KM.Logger.PrintInfo("ShapeOpt", "Value of C"+str(itr+1)+" = ", "{:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
61
|
+
|
|
62
|
+
# --------------------------------------------------------------------------
|
|
63
|
+
def _WriteCurrentValuesToFile( self ):
|
|
64
|
+
with open(self.complete_log_file_name, 'a') as csvfile:
|
|
65
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
66
|
+
row = []
|
|
67
|
+
row.append("{:>4d}".format(self.current_index))
|
|
68
|
+
|
|
69
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
70
|
+
row.append(" {:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
71
|
+
row.append(" {:> .5E}".format(self.history["abs_change_objective"][self.current_index]))
|
|
72
|
+
row.append(" {:> .5E}".format(self.history["rel_change_objective"][self.current_index]))
|
|
73
|
+
|
|
74
|
+
row.append(" {:> .5E}".format(self.history["penalty_value"][self.current_index]))
|
|
75
|
+
row.append(" {:> .5E}".format(self.history["penalty_factor"][self.current_index]))
|
|
76
|
+
row.append(" {:> .5E}".format(self.history["f_p"][self.current_index]))
|
|
77
|
+
row.append(" {:> .5E}".format(self.history["df_rel_p"][self.current_index]))
|
|
78
|
+
row.append(" {:> .5E}".format(self.history["shape_fraction"][self.current_index]))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
for itr in range(self.constraints.size()):
|
|
82
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
83
|
+
row.append(" {:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
84
|
+
row.append(" {:> .5E}".format(self.communicator.getReferenceValue(constraint_id)))
|
|
85
|
+
|
|
86
|
+
row.append(" {:> .5E}".format(self.history["step_size"][self.current_index]))
|
|
87
|
+
row.append(" {:> .5E}".format(self.history["inf_norm_s"][self.current_index]))
|
|
88
|
+
row.append(" {:> .5E}".format(self.history["inf_norm_c"][self.current_index]))
|
|
89
|
+
row.append("{:>25}".format(Timer().GetTimeStamp()))
|
|
90
|
+
historyWriter.writerow(row)
|
|
91
|
+
|
|
92
|
+
# ==============================================================================
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# KratosShapeOptimizationApplication
|
|
3
|
+
#
|
|
4
|
+
# License: BSD License
|
|
5
|
+
# license: ShapeOptimizationApplication/license.txt
|
|
6
|
+
#
|
|
7
|
+
# Main authors: Baumgaertner Daniel, https://github.com/dbaumgaertner
|
|
8
|
+
# Geiser Armin, https://github.com/armingeiser
|
|
9
|
+
#
|
|
10
|
+
# ==============================================================================
|
|
11
|
+
|
|
12
|
+
# importing the Kratos Library
|
|
13
|
+
import KratosMultiphysics as KM
|
|
14
|
+
|
|
15
|
+
# Import logger base classes
|
|
16
|
+
from KratosMultiphysics.ShapeOptimizationApplication.loggers.value_logger_base import ValueLogger
|
|
17
|
+
|
|
18
|
+
# Import additional libraries
|
|
19
|
+
import csv
|
|
20
|
+
from KratosMultiphysics.ShapeOptimizationApplication.utilities.custom_timer import Timer
|
|
21
|
+
|
|
22
|
+
# ==============================================================================
|
|
23
|
+
class ValueLoggerSteepestDescent( ValueLogger ):
|
|
24
|
+
# --------------------------------------------------------------------------
|
|
25
|
+
def InitializeLogging( self ):
|
|
26
|
+
with open(self.complete_log_file_name, 'w') as csvfile:
|
|
27
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
28
|
+
row = []
|
|
29
|
+
row.append("{:>4s}".format("itr"))
|
|
30
|
+
row.append("{:>13s}".format("f"))
|
|
31
|
+
row.append("{:>13s}".format("df_abs[%]"))
|
|
32
|
+
row.append("{:>13s}".format("df_rel[%]"))
|
|
33
|
+
row.append("{:>13s}".format("norm_df"))
|
|
34
|
+
row.append("{:>13s}".format("step_size"))
|
|
35
|
+
row.append("{:>25s}".format("time_stamp"))
|
|
36
|
+
historyWriter.writerow(row)
|
|
37
|
+
|
|
38
|
+
# --------------------------------------------------------------------------
|
|
39
|
+
def _WriteCurrentValuesToConsole( self ):
|
|
40
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
41
|
+
KM.Logger.Print("")
|
|
42
|
+
KM.Logger.PrintInfo("ShapeOpt", "Current value of objective = ", "{:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
43
|
+
|
|
44
|
+
KM.Logger.PrintInfo("ShapeOpt", "Absolut change of objective = ","{:> .5E}".format(self.history["abs_change_objective"][self.current_index])," [%]")
|
|
45
|
+
KM.Logger.PrintInfo("ShapeOpt", "Relative change of objective = ","{:> .5E}".format(self.history["rel_change_objective"][self.current_index])," [%]\n")
|
|
46
|
+
|
|
47
|
+
# --------------------------------------------------------------------------
|
|
48
|
+
def _WriteCurrentValuesToFile( self ):
|
|
49
|
+
with open(self.complete_log_file_name, 'a') as csvfile:
|
|
50
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
51
|
+
row = []
|
|
52
|
+
row.append("{:>4d}".format(self.current_index))
|
|
53
|
+
|
|
54
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
55
|
+
row.append(" {:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
56
|
+
row.append(" {:> .5E}".format(self.history["abs_change_objective"][self.current_index]))
|
|
57
|
+
row.append(" {:> .5E}".format(self.history["rel_change_objective"][self.current_index]))
|
|
58
|
+
|
|
59
|
+
row.append(" {:> .5E}".format(self.history["norm_objective_gradient"][self.current_index]))
|
|
60
|
+
row.append(" {:> .5E}".format(self.history["step_size"][self.current_index]))
|
|
61
|
+
row.append("{:>25}".format(Timer().GetTimeStamp()))
|
|
62
|
+
historyWriter.writerow(row)
|
|
63
|
+
|
|
64
|
+
# ==============================================================================
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# KratosShapeOptimizationApplication
|
|
3
|
+
#
|
|
4
|
+
# License: BSD License
|
|
5
|
+
# license: ShapeOptimizationApplication/license.txt
|
|
6
|
+
#
|
|
7
|
+
# Main authors: Baumgaertner Daniel, https://github.com/dbaumgaertner
|
|
8
|
+
#
|
|
9
|
+
# ==============================================================================
|
|
10
|
+
|
|
11
|
+
# importing the Kratos Library
|
|
12
|
+
import KratosMultiphysics as KM
|
|
13
|
+
|
|
14
|
+
# Import logger base classes
|
|
15
|
+
from KratosMultiphysics.ShapeOptimizationApplication.loggers.value_logger_base import ValueLogger
|
|
16
|
+
|
|
17
|
+
# Import additional libraries
|
|
18
|
+
import csv
|
|
19
|
+
from KratosMultiphysics.ShapeOptimizationApplication.utilities.custom_timer import Timer
|
|
20
|
+
|
|
21
|
+
# ==============================================================================
|
|
22
|
+
class ValueLoggerTrustRegion( ValueLogger ):
|
|
23
|
+
# --------------------------------------------------------------------------
|
|
24
|
+
def InitializeLogging( self ):
|
|
25
|
+
with open(self.complete_log_file_name, 'w') as csvfile:
|
|
26
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
27
|
+
row = []
|
|
28
|
+
row.append("{:>4s}".format("itr"))
|
|
29
|
+
row.append("{:>13}".format("f"))
|
|
30
|
+
row.append("{:>12s}".format("df_abs[%]"))
|
|
31
|
+
row.append("{:>12s}".format("df_rel[%]"))
|
|
32
|
+
|
|
33
|
+
for itr in range(self.constraints.size()):
|
|
34
|
+
con_type = self.constraints[itr]["type"].GetString()
|
|
35
|
+
row.append("{:>13}".format("c"+str(itr+1)+": "+con_type))
|
|
36
|
+
row.append("{:>13}".format("c"+str(itr+1)+"_ref"))
|
|
37
|
+
row.append("{:>12s}".format("len_C"+str(itr+1)))
|
|
38
|
+
row.append("{:>12s}".format("adj_len_C"+str(itr+1)))
|
|
39
|
+
|
|
40
|
+
row.append("{:>12s}".format("bi_itrs"))
|
|
41
|
+
row.append("{:>12s}".format("bi_err"))
|
|
42
|
+
row.append("{:>17}".format("test_norm_dX_bar"))
|
|
43
|
+
row.append("{:>12s}".format("norm_dX"))
|
|
44
|
+
row.append("{:>12s}".format("step_length"))
|
|
45
|
+
row.append("{:>25s}".format("time_stamp"))
|
|
46
|
+
historyWriter.writerow(row)
|
|
47
|
+
|
|
48
|
+
# --------------------------------------------------------------------------
|
|
49
|
+
def _WriteCurrentValuesToConsole( self ):
|
|
50
|
+
KM.Logger.Print("")
|
|
51
|
+
KM.Logger.Print("-------------------------------------------------------\n")
|
|
52
|
+
|
|
53
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
54
|
+
KM.Logger.PrintInfo("ShapeOpt", "Current value of objective = ", round(self.history["response_value"][objective_id][self.current_index],12))
|
|
55
|
+
|
|
56
|
+
KM.Logger.PrintInfo("ShapeOpt", "Absolut change of objective = ",round(self.history["abs_change_objective"][self.current_index],4)," [%]")
|
|
57
|
+
KM.Logger.PrintInfo("ShapeOpt", "Relative change of objective = ",round(self.history["rel_change_objective"][self.current_index],4)," [%]\n")
|
|
58
|
+
|
|
59
|
+
for itr in range(self.constraints.size()):
|
|
60
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
61
|
+
KM.Logger.PrintInfo("ShapeOpt", "Value of C"+str(itr+1)+" = ", round(self.history["response_value"][constraint_id][self.current_index],12), "\n")
|
|
62
|
+
|
|
63
|
+
KM.Logger.PrintInfo("ShapeOpt", "NormInf3D of dX = ", round(self.history["norm_dX"][self.current_index],6), "\n")
|
|
64
|
+
|
|
65
|
+
KM.Logger.PrintInfo("ShapeOpt", "len_bar_obj = ", round(self.history["len_bar_obj"][self.current_index],6))
|
|
66
|
+
KM.Logger.PrintInfo("ShapeOpt", "adj_len_bar_obj = ", round(self.history["adj_len_bar_obj"][self.current_index],6), "\n")
|
|
67
|
+
|
|
68
|
+
KM.Logger.PrintInfo("ShapeOpt", "len_bar_cons = ", [round(entry, 6) for entry in self.history["len_bar_cons"][self.current_index]])
|
|
69
|
+
KM.Logger.PrintInfo("ShapeOpt", "adj_len_bar_cons = ", [round(entry, 6) for entry in self.history["adj_len_bar_cons"][self.current_index]], "\n")
|
|
70
|
+
|
|
71
|
+
KM.Logger.Print("-------------------------------------------------------")
|
|
72
|
+
|
|
73
|
+
# --------------------------------------------------------------------------
|
|
74
|
+
def _WriteCurrentValuesToFile( self ):
|
|
75
|
+
with open(self.complete_log_file_name, 'a') as csvfile:
|
|
76
|
+
historyWriter = csv.writer(csvfile, delimiter=',',quotechar='|',quoting=csv.QUOTE_MINIMAL)
|
|
77
|
+
row = []
|
|
78
|
+
row.append("{:>4d}".format(self.current_index))
|
|
79
|
+
|
|
80
|
+
objective_id = self.objectives[0]["identifier"].GetString()
|
|
81
|
+
row.append(" {:> .5E}".format(self.history["response_value"][objective_id][self.current_index]))
|
|
82
|
+
row.append(" {:> .5E}".format(self.history["abs_change_objective"][self.current_index]))
|
|
83
|
+
row.append(" {:> .5E}".format(self.history["rel_change_objective"][self.current_index]))
|
|
84
|
+
|
|
85
|
+
for itr in range(self.constraints.size()):
|
|
86
|
+
constraint_id = self.constraints[itr]["identifier"].GetString()
|
|
87
|
+
row.append(" {:> .5E}".format(self.history["response_value"][constraint_id][self.current_index]))
|
|
88
|
+
row.append(" {:> .5E}".format(self.communicator.getReferenceValue(constraint_id)))
|
|
89
|
+
row.append("{:>12f}".format(self.history["len_bar_cons"][self.current_index][itr]))
|
|
90
|
+
row.append("{:>12f}".format(self.history["adj_len_bar_cons"][self.current_index][itr]))
|
|
91
|
+
|
|
92
|
+
row.append("{:>12d}".format(self.history["bi_itrs"][self.current_index]))
|
|
93
|
+
row.append("{:>12f}".format(self.history["bi_err"][self.current_index]))
|
|
94
|
+
row.append("{:>17f}".format(self.history["test_norm_dX_bar"][self.current_index]))
|
|
95
|
+
row.append("{:>12f}".format(self.history["norm_dX"][self.current_index]))
|
|
96
|
+
row.append(" {:>.5E}".format(self.history["step_length"][self.current_index]))
|
|
97
|
+
row.append("{:>25}".format(Timer().GetTimeStamp()))
|
|
98
|
+
historyWriter.writerow(row)
|
|
99
|
+
|
|
100
|
+
# ==============================================================================
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# KratosShapeOptimizationApplication
|
|
3
|
+
#
|
|
4
|
+
# License: BSD License
|
|
5
|
+
# license: ShapeOptimizationApplication/license.txt
|
|
6
|
+
#
|
|
7
|
+
# Main authors: Baumgaertner Daniel, https://github.com/dbaumgaertner
|
|
8
|
+
#
|
|
9
|
+
# ==============================================================================
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Kratos Core and Apps
|
|
13
|
+
import KratosMultiphysics as KM
|
|
14
|
+
import KratosMultiphysics.ShapeOptimizationApplication as KSO
|
|
15
|
+
from .mapping import in_plane_vertex_morphing_mapper, sliding_vertex_morphing_mapper
|
|
16
|
+
|
|
17
|
+
# ==============================================================================
|
|
18
|
+
def CreateMapper(origin_model_part, destination_model_part, mapper_settings):
|
|
19
|
+
default_settings = KM.Parameters("""
|
|
20
|
+
{
|
|
21
|
+
"filter_function_type" : "linear",
|
|
22
|
+
"filter_radius" : 0.000000000001,
|
|
23
|
+
"max_nodes_in_filter_radius" : 10000,
|
|
24
|
+
"matrix_free_filtering" : false,
|
|
25
|
+
"consistent_mapping" : false,
|
|
26
|
+
"improved_integration" : false,
|
|
27
|
+
"integration_method" : "gauss_integration",
|
|
28
|
+
"number_of_gauss_points" : 5,
|
|
29
|
+
"in_plane_morphing" : false,
|
|
30
|
+
"in_plane_morphing_settings" : {},
|
|
31
|
+
"sliding_morphing" : false,
|
|
32
|
+
"sliding_morphing_settings" : {},
|
|
33
|
+
"plane_symmetry" : false,
|
|
34
|
+
"plane_symmetry_settings" : {
|
|
35
|
+
"point" : [0.0, 0.0, 0.0],
|
|
36
|
+
"normal": [0.0, 0.0, 0.0]
|
|
37
|
+
},
|
|
38
|
+
"revolution" : false,
|
|
39
|
+
"revolution_settings" : {
|
|
40
|
+
"point" : [0.0, 0.0, 0.0],
|
|
41
|
+
"normal": [0.0, 0.0, 0.0]
|
|
42
|
+
},
|
|
43
|
+
"adaptive_filter_settings" : {
|
|
44
|
+
"adaptive_filter_method": "curvature_based",
|
|
45
|
+
"radius_function": "analytic",
|
|
46
|
+
"radius_function_parameter": 1,
|
|
47
|
+
"minimum_filter_radius": 1e-3,
|
|
48
|
+
"curvature_limit": 1e-3,
|
|
49
|
+
"filter_radius_smoothing_iterations": 10
|
|
50
|
+
}
|
|
51
|
+
}""")
|
|
52
|
+
|
|
53
|
+
mapper_vertex_morphing_matrix_free = KSO.MapperVertexMorphingMatrixFree
|
|
54
|
+
mapper_vertex_morphing_improved_integration = KSO.MapperVertexMorphingImprovedIntegration
|
|
55
|
+
mapper_vertex_morphing_symmetric = KSO.MapperVertexMorphingSymmetric
|
|
56
|
+
mapper_vertex_morphing = KSO.MapperVertexMorphing
|
|
57
|
+
if mapper_settings.Has("filter_radius") and mapper_settings["filter_radius"].IsString():
|
|
58
|
+
if mapper_settings["filter_radius"].GetString() == "adaptive":
|
|
59
|
+
if mapper_settings.Has("adaptive_filter_method") and mapper_settings["adaptive_filter_method"].GetString() != "curvature_based":
|
|
60
|
+
raise Exception("For now, only \"curvature_based\" is available for \"adaptive_filter_method\".")
|
|
61
|
+
else:
|
|
62
|
+
mapper_vertex_morphing_matrix_free = KSO.MapperVertexMorphingMatrixFreeAdaptiveRadius
|
|
63
|
+
mapper_vertex_morphing_improved_integration = KSO.MapperVertexMorphingImprovedIntegrationAdaptiveRadius
|
|
64
|
+
mapper_vertex_morphing_symmetric = KSO.MapperVertexMorphingSymmetricAdaptiveRadius
|
|
65
|
+
mapper_vertex_morphing = KSO.MapperVertexMorphingAdaptiveRadius
|
|
66
|
+
|
|
67
|
+
if mapper_settings.Has("in_plane_morphing"):
|
|
68
|
+
if mapper_settings["in_plane_morphing"].GetBool():
|
|
69
|
+
raise Exception("\"in_plane_morphing\" is not yet supported with \"adaptive\" filter radius.")
|
|
70
|
+
mapper_settings["filter_radius"].SetDouble(-1.0)
|
|
71
|
+
else:
|
|
72
|
+
raise Exception("\"filter_radius\" either should be double value or \"adaptive\".")
|
|
73
|
+
|
|
74
|
+
mapper_settings.ValidateAndAssignDefaults(default_settings)
|
|
75
|
+
|
|
76
|
+
if mapper_settings["in_plane_morphing"].GetBool():
|
|
77
|
+
return in_plane_vertex_morphing_mapper.InPlaneVertexMorphingMapper(origin_model_part, destination_model_part, mapper_settings)
|
|
78
|
+
elif mapper_settings["sliding_morphing"].GetBool():
|
|
79
|
+
return sliding_vertex_morphing_mapper.SlidingVertexMorphingMapper(origin_model_part, destination_model_part, mapper_settings)
|
|
80
|
+
elif mapper_settings["matrix_free_filtering"].GetBool():
|
|
81
|
+
if mapper_settings["consistent_mapping"].GetBool():
|
|
82
|
+
raise ValueError ("Matrix free mapper has no option to map consistently yet!")
|
|
83
|
+
if mapper_settings["improved_integration"].GetBool():
|
|
84
|
+
raise ValueError ("Matrix free mapper does not yet allow for an improved integration!")
|
|
85
|
+
else:
|
|
86
|
+
return mapper_vertex_morphing_matrix_free(origin_model_part, destination_model_part, mapper_settings)
|
|
87
|
+
else:
|
|
88
|
+
if mapper_settings["revolution"].GetBool() and mapper_settings["plane_symmetry"].GetBool():
|
|
89
|
+
raise RuntimeError("revolution and plane_symmetry can not be combined!")
|
|
90
|
+
|
|
91
|
+
if mapper_settings["improved_integration"].GetBool():
|
|
92
|
+
return mapper_vertex_morphing_improved_integration(origin_model_part, destination_model_part, mapper_settings)
|
|
93
|
+
elif mapper_settings["plane_symmetry"].GetBool():
|
|
94
|
+
return mapper_vertex_morphing_symmetric(origin_model_part, destination_model_part, mapper_settings)
|
|
95
|
+
elif mapper_settings["revolution"].GetBool():
|
|
96
|
+
return mapper_vertex_morphing_symmetric(origin_model_part, destination_model_part, mapper_settings)
|
|
97
|
+
else:
|
|
98
|
+
return mapper_vertex_morphing(origin_model_part, destination_model_part, mapper_settings)
|
|
99
|
+
|
|
100
|
+
# ==============================================================================
|
|
File without changes
|