parameters: (self)
docstring: This method is executed in order to finalize the current step
  
          Here the dictionary containing the solution is filled
  
          Keyword arguments:
          self -- It signifies an instance of a class.
docstring_summary: This method is executed in order to finalize the current step
docstring_tokens: This method is executed in order to finalize the current step
function: def ExecuteFinalizeSolutionStep(self):
          """ This method is executed in order to finalize the current step
  
          Here the dictionary containing the solution is filled
  
          Keyword arguments:
          self -- It signifies an instance of a class.
          """
  
          data = read_external_json(self.output_file_name)
  
          time = self.sub_model_part.ProcessInfo.GetValue(KratosMultiphysics.TIME)
          dt = self.sub_model_part.ProcessInfo.GetValue(KratosMultiphysics.DELTA_TIME)
          self.time_counter += dt
          if self.time_counter > self.frequency:
              self.time_counter = 0.0
              data["TIME"].append(time)
              count = 0
  
              # Nodal values
              for node in self.sub_model_part.Nodes:
                  compute = self.__check_flag(node)
  
                  if compute:
                      node_identifier = "NODE_" + self.__get_node_identifier(node)
  
                      for i in range(self.params["output_variables"].size()):
                          out = self.params["output_variables"][i]
                          variable_name = out.GetString()
                          variable = KratosMultiphysics.KratosGlobals.GetVariable(variable_name)
                          variable_type = KratosMultiphysics.KratosGlobals.GetVariableType(variable_name)
                          if self.historical_value:
                              value = node.GetSolutionStepValue(variable, 0)
                          else:
                              value = node.GetValue(variable)
  
                          if variable_type == "Double":
                              if not self.resultant_solution:
                                  data[node_identifier][variable_name].append(value)
                              else:
                                  if count == 0:
                                      data["RESULTANT"][variable_name].append(value)
                                  else:
                                      data["RESULTANT"][variable_name][-1] += value
                          elif variable_type == "Array":
                              if KratosMultiphysics.KratosGlobals.GetVariableType(variable_name + "_X") == "Double":
                                  if not self.resultant_solution:
                                      data[node_identifier][variable_name + "_X"].append(value[0])
                                      data[node_identifier][variable_name + "_Y"].append(value[1])
                                      data[node_identifier][variable_name + "_Z"].append(value[2])
                                  else:
                                      if count == 0:
                                          data["RESULTANT"][variable_name + "_X"].append(value[0])
                                          data["RESULTANT"][variable_name + "_Y"].append(value[1])
                                          data["RESULTANT"][variable_name + "_Z"].append(value[2])
                                      else:
                                          data["RESULTANT"][variable_name + "_X"][-1] += value[0]
                                          data["RESULTANT"][variable_name + "_Y"][-1] += value[1]
                                          data["RESULTANT"][variable_name + "_Z"][-1] += value[2]
                              else:
                                  if not self.resultant_solution:
                                      list = self.__kratos_vector_to__python_list(value)
                                      data[node_identifier][variable_name ].append(list)
                                  else:
                                      aux = 0.0
                                      for index in range(len(value)):
                                          aux += value[index]
                                      if count == 0:
                                          data["RESULTANT"][variable_name ].append(aux)
                                      else:
                                          data["RESULTANT"][variable_name ][-1] += aux
                          elif variable_type == "Vector":
                              if not self.resultant_solution:
                                  data[node_identifier][variable_name].append(value)
                              else:
                                  if count == 0:
                                      data["RESULTANT"][variable_name].append(value)
                                  else:
                                      data["RESULTANT"][variable_name][-1] += value
  
                          # TODO: Add pending classes
                      count += 1
  
              count = 0
              # Gauss points values
              for elem in self.sub_model_part.Elements:
                  compute = self.__check_flag(elem)
  
                  if compute:
                      for i in range(self.params["gauss_points_output_variables"].size()):
                          out = self.params["gauss_points_output_variables"][i]
                          variable_name = out.GetString()
                          variable = KratosMultiphysics.KratosGlobals.GetVariable(variable_name)
                          variable_type = KratosMultiphysics.KratosGlobals.GetVariableType(variable_name)
                          value = elem.CalculateOnIntegrationPoints(variable, self.sub_model_part.ProcessInfo)
  
                          gauss_point_number = len(value)
  
                          if variable_type == "Double":
                              if not self.resultant_solution:
                                  for gp in range(gauss_point_number):
                                      data["ELEMENT_" + str(elem.Id)][variable_name][str(gp)].append(value[gp])
                              else:
                                  if count == 0:
                                      for gp in range(gauss_point_number):
                                          data["RESULTANT"][variable_name][str(gp)].append(value[gp])
                                  else:
                                      for gp in range(gauss_point_number):
                                          data["RESULTANT"][variable_name][str(gp)][-1] += value[gp]
                          elif variable_type == "Array":
                              if KratosMultiphysics.KratosGlobals.GetVariableType(variable_name + "_X") == "Double":
                                  if not self.resultant_solution:
                                      for gp in range(gauss_point_number):
                                          data["ELEMENT_" + str(elem.Id)][variable_name + "_X"][str(gp)].append(value[gp][0])
                                          data["ELEMENT_" + str(elem.Id)][variable_name + "_Y"][str(gp)].append(value[gp][1])
                                          data["ELEMENT_" + str(elem.Id)][variable_name + "_Z"][str(gp)].append(value[gp][2])
                                  else:
                                      if count == 0:
                                          for gp in range(gauss_point_number):
                                              data["RESULTANT"][variable_name + "_X"][str(gp)].append(value[gp][0])
                                              data["RESULTANT"][variable_name + "_Y"][str(gp)].append(value[gp][1])
                                              data["RESULTANT"][variable_name + "_Z"][str(gp)].append(value[gp][2])
                                      else:
                                          for gp in range(gauss_point_number):
                                              data["RESULTANT"][variable_name + "_X"][str(gp)][-1] += value[gp][0]
                                              data["RESULTANT"][variable_name + "_Y"][str(gp)][-1] += value[gp][1]
                                              data["RESULTANT"][variable_name + "_Z"][str(gp)][-1] += value[gp][2]
                              else:
                                  if not self.resultant_solution:
                                      list = self.__kratos_vector_to__python_list(value)
                                      for gp in range(gauss_point_number):
                                          data["ELEMENT_" + str(elem.Id)][variable_name][str(gp)].append(list)
                                  else:
                                      if count == 0:
                                          for gp in range(gauss_point_number):
                                              aux = 0.0
                                              for index in range(len(value[gp])):
                                                  aux += value[index]
                                              data["RESULTANT"][variable_name][str(gp)].append(aux)
                                      else:
                                          for gp in range(gauss_point_number):
                                              aux = 0.0
                                              for index in range(len(value[gp])):
                                                  aux += value[index]
                                              data["RESULTANT"][variable_name][str(gp)][-1] += aux
                          elif variable_type == "Vector":
                              if not self.resultant_solution:
                                  for gp in range(gauss_point_number):
                                      list = self.__kratos_vector_to__python_list(value[gp])
                                      data["ELEMENT_" + str(elem.Id)][variable_name][str(gp)].append(list)
                              else:
                                  if count == 0:
                                      for gp in range(gauss_point_number):
                                          list = self.__kratos_vector_to__python_list(value[gp])
                                          data["RESULTANT"][variable_name][str(gp)][-1] += list
  
                              # TODO: Add pending classes
                  count += 1
  
          write_external_json(self.output_file_name, data)
function_tokens: def ExecuteFinalizeSolutionStep ( self ) : data = read_external_json ( self . output_file_name ) time = self . sub_model_part . ProcessInfo . GetValue ( KratosMultiphysics . TIME ) dt = self . sub_model_part . ProcessInfo . GetValue ( KratosMultiphysics . DELTA_TIME ) self . time_counter += dt if self . time_counter > self . frequency : self . time_counter = 0.0 data [ "TIME" ] . append ( time ) count = 0 # Nodal values for node in self . sub_model_part . Nodes : compute = self . __check_flag ( node ) if compute : node_identifier = "NODE_" + self . __get_node_identifier ( node ) for i in range ( self . params [ "output_variables" ] . size ( ) ) : out = self . params [ "output_variables" ] [ i ] variable_name = out . GetString ( ) variable = KratosMultiphysics . KratosGlobals . GetVariable ( variable_name ) variable_type = KratosMultiphysics . KratosGlobals . GetVariableType ( variable_name ) if self . historical_value : value = node . GetSolutionStepValue ( variable , 0 ) else : value = node . GetValue ( variable ) if variable_type == "Double" : if not self . resultant_solution : data [ node_identifier ] [ variable_name ] . append ( value ) else : if count == 0 : data [ "RESULTANT" ] [ variable_name ] . append ( value ) else : data [ "RESULTANT" ] [ variable_name ] [ - 1 ] += value elif variable_type == "Array" : if KratosMultiphysics . KratosGlobals . GetVariableType ( variable_name + "_X" ) == "Double" : if not self . resultant_solution : data [ node_identifier ] [ variable_name + "_X" ] . append ( value [ 0 ] ) data [ node_identifier ] [ variable_name + "_Y" ] . append ( value [ 1 ] ) data [ node_identifier ] [ variable_name + "_Z" ] . append ( value [ 2 ] ) else : if count == 0 : data [ "RESULTANT" ] [ variable_name + "_X" ] . append ( value [ 0 ] ) data [ "RESULTANT" ] [ variable_name + "_Y" ] . append ( value [ 1 ] ) data [ "RESULTANT" ] [ variable_name + "_Z" ] . append ( value [ 2 ] ) else : data [ "RESULTANT" ] [ variable_name + "_X" ] [ - 1 ] += value [ 0 ] data [ "RESULTANT" ] [ variable_name + "_Y" ] [ - 1 ] += value [ 1 ] data [ "RESULTANT" ] [ variable_name + "_Z" ] [ - 1 ] += value [ 2 ] else : if not self . resultant_solution : list = self . __kratos_vector_to__python_list ( value ) data [ node_identifier ] [ variable_name ] . append ( list ) else : aux = 0.0 for index in range ( len ( value ) ) : aux += value [ index ] if count == 0 : data [ "RESULTANT" ] [ variable_name ] . append ( aux ) else : data [ "RESULTANT" ] [ variable_name ] [ - 1 ] += aux elif variable_type == "Vector" : if not self . resultant_solution : data [ node_identifier ] [ variable_name ] . append ( value ) else : if count == 0 : data [ "RESULTANT" ] [ variable_name ] . append ( value ) else : data [ "RESULTANT" ] [ variable_name ] [ - 1 ] += value # TODO: Add pending classes count += 1 count = 0 # Gauss points values for elem in self . sub_model_part . Elements : compute = self . __check_flag ( elem ) if compute : for i in range ( self . params [ "gauss_points_output_variables" ] . size ( ) ) : out = self . params [ "gauss_points_output_variables" ] [ i ] variable_name = out . GetString ( ) variable = KratosMultiphysics . KratosGlobals . GetVariable ( variable_name ) variable_type = KratosMultiphysics . KratosGlobals . GetVariableType ( variable_name ) value = elem . CalculateOnIntegrationPoints ( variable , self . sub_model_part . ProcessInfo ) gauss_point_number = len ( value ) if variable_type == "Double" : if not self . resultant_solution : for gp in range ( gauss_point_number ) : data [ "ELEMENT_" + str ( elem . Id ) ] [ variable_name ] [ str ( gp ) ] . append ( value [ gp ] ) else : if count == 0 : for gp in range ( gauss_point_number ) : data [ "RESULTANT" ] [ variable_name ] [ str ( gp ) ] . append ( value [ gp ] ) else : for gp in range ( gauss_point_number ) : data [ "RESULTANT" ] [ variable_name ] [ str ( gp ) ] [ - 1 ] += value [ gp ] elif variable_type == "Array" : if KratosMultiphysics . KratosGlobals . GetVariableType ( variable_name + "_X" ) == "Double" : if not self . resultant_solution : for gp in range ( gauss_point_number ) : data [ "ELEMENT_" + str ( elem . Id ) ] [ variable_name + "_X" ] [ str ( gp ) ] . append ( value [ gp ] [ 0 ] ) data [ "ELEMENT_" + str ( elem . Id ) ] [ variable_name + "_Y" ] [ str ( gp ) ] . append ( value [ gp ] [ 1 ] ) data [ "ELEMENT_" + str ( elem . Id ) ] [ variable_name + "_Z" ] [ str ( gp ) ] . append ( value [ gp ] [ 2 ] ) else : if count == 0 : for gp in range ( gauss_point_number ) : data [ "RESULTANT" ] [ variable_name + "_X" ] [ str ( gp ) ] . append ( value [ gp ] [ 0 ] ) data [ "RESULTANT" ] [ variable_name + "_Y" ] [ str ( gp ) ] . append ( value [ gp ] [ 1 ] ) data [ "RESULTANT" ] [ variable_name + "_Z" ] [ str ( gp ) ] . append ( value [ gp ] [ 2 ] ) else : for gp in range ( gauss_point_number ) : data [ "RESULTANT" ] [ variable_name + "_X" ] [ str ( gp ) ] [ - 1 ] += value [ gp ] [ 0 ] data [ "RESULTANT" ] [ variable_name + "_Y" ] [ str ( gp ) ] [ - 1 ] += value [ gp ] [ 1 ] data [ "RESULTANT" ] [ variable_name + "_Z" ] [ str ( gp ) ] [ - 1 ] += value [ gp ] [ 2 ] else : if not self . resultant_solution : list = self . __kratos_vector_to__python_list ( value ) for gp in range ( gauss_point_number ) : data [ "ELEMENT_" + str ( elem . Id ) ] [ variable_name ] [ str ( gp ) ] . append ( list ) else : if count == 0 : for gp in range ( gauss_point_number ) : aux = 0.0 for index in range ( len ( value [ gp ] ) ) : aux += value [ index ] data [ "RESULTANT" ] [ variable_name ] [ str ( gp ) ] . append ( aux ) else : for gp in range ( gauss_point_number ) : aux = 0.0 for index in range ( len ( value [ gp ] ) ) : aux += value [ index ] data [ "RESULTANT" ] [ variable_name ] [ str ( gp ) ] [ - 1 ] += aux elif variable_type == "Vector" : if not self . resultant_solution : for gp in range ( gauss_point_number ) : list = self . __kratos_vector_to__python_list ( value [ gp ] ) data [ "ELEMENT_" + str ( elem . Id ) ] [ variable_name ] [ str ( gp ) ] . append ( list ) else : if count == 0 : for gp in range ( gauss_point_number ) : list = self . __kratos_vector_to__python_list ( value [ gp ] ) data [ "RESULTANT" ] [ variable_name ] [ str ( gp ) ] [ - 1 ] += list # TODO: Add pending classes count += 1 write_external_json ( self . output_file_name , data )