parameters: (self, origin_settings, destination_settings)
docstring: Transfer matching settings from origin to destination.
  
          If a name in origin matches a name in destination, then the setting is
          validated against the destination.
  
          The typical use is for validating and extracting settings in derived classes:
  
          class A:
              def __init__(self, model_part, a_settings):
                  default_a_settings = Parameters('''{
                      ...
                  }''')
                  a_settings.ValidateAndAssignDefaults(default_a_settings)
          class B(A):
              def __init__(self, model_part, custom_settings):
                  b_settings = Parameters('''{
                      ...
                  }''') # Here the settings contain default values.
                  self.validate_and_transfer_matching_settings(custom_settings, b_settings)
                  super().__init__(model_part, custom_settings)
docstring_summary: Transfer matching settings from origin to destination.
docstring_tokens: Transfer matching settings from origin to destination .
function: def _validate_and_transfer_matching_settings(self, origin_settings, destination_settings):
          """Transfer matching settings from origin to destination.
  
          If a name in origin matches a name in destination, then the setting is
          validated against the destination.
  
          The typical use is for validating and extracting settings in derived classes:
  
          class A:
              def __init__(self, model_part, a_settings):
                  default_a_settings = Parameters('''{
                      ...
                  }''')
                  a_settings.ValidateAndAssignDefaults(default_a_settings)
          class B(A):
              def __init__(self, model_part, custom_settings):
                  b_settings = Parameters('''{
                      ...
                  }''') # Here the settings contain default values.
                  self.validate_and_transfer_matching_settings(custom_settings, b_settings)
                  super().__init__(model_part, custom_settings)
          """
          for name, dest_value in destination_settings.items():
              if origin_settings.Has(name): # Validate and transfer value.
                  orig_value = origin_settings[name]
                  if dest_value.IsDouble() and orig_value.IsDouble():
                      destination_settings[name].SetDouble(origin_settings[name].GetDouble())
                  elif dest_value.IsInt() and orig_value.IsInt():
                      destination_settings[name].SetInt(origin_settings[name].GetInt())
                  elif dest_value.IsBool() and orig_value.IsBool():
                      destination_settings[name].SetBool(origin_settings[name].GetBool())
                  elif dest_value.IsString() and orig_value.IsString():
                      destination_settings[name].SetString(origin_settings[name].GetString())
                  elif dest_value.IsArray() and orig_value.IsArray():
                      if dest_value.size() != orig_value.size():
                          raise Exception('len("' + name + '") != ' + str(dest_value.size()))
                      for i in range(dest_value.size()):
                          if dest_value[i].IsDouble() and orig_value[i].IsDouble():
                              dest_value[i].SetDouble(orig_value[i].GetDouble())
                          elif dest_value[i].IsInt() and orig_value[i].IsInt():
                              dest_value[i].SetInt(orig_value[i].GetInt())
                          elif dest_value[i].IsBool() and orig_value[i].IsBool():
                              dest_value[i].SetBool(orig_value[i].GetBool())
                          elif dest_value[i].IsString() and orig_value[i].IsString():
                              dest_value[i].SetString(orig_value[i].GetString())
                          elif dest_value[i].IsSubParameter() and orig_value[i].IsSubParameter():
                              self._validate_and_transfer_matching_settings(orig_value[i], dest_value[i])
                              if len(orig_value[i].items()) != 0:
                                  raise Exception('Json settings not found in default settings: ' + orig_value[i].PrettyPrintJsonString())
                          else:
                              raise Exception('Unsupported parameter type.')
                  elif dest_value.IsSubParameter() and orig_value.IsSubParameter():
                      self._validate_and_transfer_matching_settings(orig_value, dest_value)
                      if len(orig_value.items()) != 0:
                          raise Exception('Json settings not found in default settings: ' + orig_value.PrettyPrintJsonString())
                  else:
                      raise Exception('Unsupported parameter type.')
                  origin_settings.RemoveValue(name)
function_tokens: def _validate_and_transfer_matching_settings ( self , origin_settings , destination_settings ) : for name , dest_value in destination_settings . items ( ) : if origin_settings . Has ( name ) : # Validate and transfer value. orig_value = origin_settings [ name ] if dest_value . IsDouble ( ) and orig_value . IsDouble ( ) : destination_settings [ name ] . SetDouble ( origin_settings [ name ] . GetDouble ( ) ) elif dest_value . IsInt ( ) and orig_value . IsInt ( ) : destination_settings [ name ] . SetInt ( origin_settings [ name ] . GetInt ( ) ) elif dest_value . IsBool ( ) and orig_value . IsBool ( ) : destination_settings [ name ] . SetBool ( origin_settings [ name ] . GetBool ( ) ) elif dest_value . IsString ( ) and orig_value . IsString ( ) : destination_settings [ name ] . SetString ( origin_settings [ name ] . GetString ( ) ) elif dest_value . IsArray ( ) and orig_value . IsArray ( ) : if dest_value . size ( ) != orig_value . size ( ) : raise Exception ( 'len("' + name + '") != ' + str ( dest_value . size ( ) ) ) for i in range ( dest_value . size ( ) ) : if dest_value [ i ] . IsDouble ( ) and orig_value [ i ] . IsDouble ( ) : dest_value [ i ] . SetDouble ( orig_value [ i ] . GetDouble ( ) ) elif dest_value [ i ] . IsInt ( ) and orig_value [ i ] . IsInt ( ) : dest_value [ i ] . SetInt ( orig_value [ i ] . GetInt ( ) ) elif dest_value [ i ] . IsBool ( ) and orig_value [ i ] . IsBool ( ) : dest_value [ i ] . SetBool ( orig_value [ i ] . GetBool ( ) ) elif dest_value [ i ] . IsString ( ) and orig_value [ i ] . IsString ( ) : dest_value [ i ] . SetString ( orig_value [ i ] . GetString ( ) ) elif dest_value [ i ] . IsSubParameter ( ) and orig_value [ i ] . IsSubParameter ( ) : self . _validate_and_transfer_matching_settings ( orig_value [ i ] , dest_value [ i ] ) if len ( orig_value [ i ] . items ( ) ) != 0 : raise Exception ( 'Json settings not found in default settings: ' + orig_value [ i ] . PrettyPrintJsonString ( ) ) else : raise Exception ( 'Unsupported parameter type.' ) elif dest_value . IsSubParameter ( ) and orig_value . IsSubParameter ( ) : self . _validate_and_transfer_matching_settings ( orig_value , dest_value ) if len ( orig_value . items ( ) ) != 0 : raise Exception ( 'Json settings not found in default settings: ' + orig_value . PrettyPrintJsonString ( ) ) else : raise Exception ( 'Unsupported parameter type.' ) origin_settings . RemoveValue ( name )