Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
codie3611 committed Jun 2, 2024
1 parent 071df4b commit 3e6cc58
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 45 deletions.
4 changes: 3 additions & 1 deletion lasso/dimred/dimred_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ def __init__(
self.logfile_filepath = (
logfile_filepath
if logfile_filepath
else os.path.join(project_dir, "logfile") if project_dir else ""
else os.path.join(project_dir, "logfile")
if project_dir
else ""
)

self._msg_option = "{:16s}: {}"
Expand Down
42 changes: 22 additions & 20 deletions lasso/dyna/d3plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2412,10 +2412,12 @@ def _read_geometry_data(self):
if self.header.has_solid_2_extra_nodes:
section_word_length = 2 * n_solids
try:
self.arrays[ArrayType.element_solid_extra_nodes] = elem_solid_data = (
self._buffer.read_ndarray(
position, section_word_length * self.header.wordsize, 1, self._header.itype
).reshape((n_solids, 2))
self.arrays[
ArrayType.element_solid_extra_nodes
] = elem_solid_data = self._buffer.read_ndarray(
position, section_word_length * self.header.wordsize, 1, self._header.itype
).reshape(
(n_solids, 2)
)
except Exception:
trb_msg = traceback.format_exc()
Expand Down Expand Up @@ -2771,9 +2773,9 @@ def _read_rigid_body_description(self):
rigid_body_n_active_nodes, dtype=self._header.itype
)
self.arrays[ArrayType.rigid_body_node_indexes_list] = rigid_body_node_indexes_list
self.arrays[ArrayType.rigid_body_active_node_indexes_list] = (
rigid_body_active_node_indexes_list
)
self.arrays[
ArrayType.rigid_body_active_node_indexes_list
] = rigid_body_active_node_indexes_list

# update position
self.geometry_section_size = position
Expand Down Expand Up @@ -4532,10 +4534,10 @@ def _read_states_tshell(self, state_data: np.ndarray, var_index: int, array_dict
# PSTRAIN
if has_pstrain:
try:
array_dict[ArrayType.element_tshell_effective_plastic_strain] = (
tshell_layer_data[:, :, :, i_tshell_layer_var].reshape(
(n_states, n_tshells, n_layers)
)
array_dict[
ArrayType.element_tshell_effective_plastic_strain
] = tshell_layer_data[:, :, :, i_tshell_layer_var].reshape(
(n_states, n_tshells, n_layers)
)
except Exception:
trb_msg = traceback.format_exc()
Expand Down Expand Up @@ -4922,9 +4924,9 @@ def _read_states_shell(self, state_data: np.ndarray, var_index: int, array_dict:
pstrain_tensor = shell_nonlayer_data[
:, :, nonlayer_var_index : nonlayer_var_index + n_plastic_strain_tensor
]
array_dict[ArrayType.element_shell_plastic_strain_tensor] = (
pstrain_tensor.reshape((n_states, n_shells, n_layers, 6))
)
array_dict[
ArrayType.element_shell_plastic_strain_tensor
] = pstrain_tensor.reshape((n_states, n_shells, n_layers, 6))
except Exception:
trb_msg = traceback.format_exc()
msg = "A failure in %s was caught:\n%s"
Expand All @@ -4940,9 +4942,9 @@ def _read_states_shell(self, state_data: np.ndarray, var_index: int, array_dict:
thermal_tensor = shell_nonlayer_data[
:, :, nonlayer_var_index : nonlayer_var_index + n_thermal_strain_tensor
]
array_dict[ArrayType.element_shell_thermal_strain_tensor] = (
thermal_tensor.reshape((n_states, n_shells, 6))
)
array_dict[
ArrayType.element_shell_thermal_strain_tensor
] = thermal_tensor.reshape((n_states, n_shells, 6))
except Exception:
trb_msg = traceback.format_exc()
msg = "A failure in %s was caught:\n%s"
Expand Down Expand Up @@ -5432,9 +5434,9 @@ def get_dtype(type_flag):
# particle segment distance
elif var_name.startswith("NS dist"):
try:
array_dict[ArrayType.airbag_particle_nearest_segment_distance] = (
particle_data[:, :, i_particle_var].view(get_dtype(var_type))
)
array_dict[
ArrayType.airbag_particle_nearest_segment_distance
] = particle_data[:, :, i_particle_var].view(get_dtype(var_type))
except Exception:
trb_msg = traceback.format_exc()
msg = "A failure in %s %s was caught:\n%s"
Expand Down
48 changes: 24 additions & 24 deletions lasso/femzip/femzip_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,16 +1068,16 @@ def _decompose_read_variables_array(
(n_timesteps_read, file_metadata.number_of_nodes, 3)
)
var_pos += array_size
result_arrays[(variable_index, variable_name, FemzipVariableCategory.NODE)] = (
var_array
)
result_arrays[
(variable_index, variable_name, FemzipVariableCategory.NODE)
] = var_array
else:
array_size = file_metadata.number_of_nodes
var_array = all_vars_array[:, var_pos : var_pos + array_size]
var_pos += array_size
result_arrays[(variable_index, variable_name, FemzipVariableCategory.NODE)] = (
var_array
)
result_arrays[
(variable_index, variable_name, FemzipVariableCategory.NODE)
] = var_array

elif variable_category == FemzipVariableCategory.SHELL:
array_size = (
Expand All @@ -1086,44 +1086,44 @@ def _decompose_read_variables_array(
)
var_array = all_vars_array[:, var_pos : var_pos + array_size]
var_pos += array_size
result_arrays[(variable_index, variable_name, FemzipVariableCategory.SHELL)] = (
var_array
)
result_arrays[
(variable_index, variable_name, FemzipVariableCategory.SHELL)
] = var_array
elif variable_category == FemzipVariableCategory.SOLID:
array_size = file_metadata.number_of_solid_elements
var_array = all_vars_array[:, var_pos : var_pos + array_size]
var_pos += array_size
result_arrays[(variable_index, variable_name, FemzipVariableCategory.SOLID)] = (
var_array
)
result_arrays[
(variable_index, variable_name, FemzipVariableCategory.SOLID)
] = var_array
elif variable_category == FemzipVariableCategory.BEAM:
array_size = file_metadata.number_of_1D_elements
var_array = all_vars_array[:, var_pos : var_pos + array_size]
var_pos += array_size
result_arrays[variable_index, variable_name, FemzipVariableCategory.BEAM] = (
var_array
)
result_arrays[
variable_index, variable_name, FemzipVariableCategory.BEAM
] = var_array
elif variable_category == FemzipVariableCategory.THICK_SHELL:
array_size = file_metadata.number_of_thick_shell_elements
var_array = all_vars_array[:, var_pos : var_pos + array_size]
var_pos += array_size
result_arrays[variable_index, variable_name, FemzipVariableCategory.THICK_SHELL] = (
var_array
)
result_arrays[
variable_index, variable_name, FemzipVariableCategory.THICK_SHELL
] = var_array
elif variable_category == FemzipVariableCategory.GLOBAL:
array_size = 6
var_array = all_vars_array[:, var_pos : var_pos + array_size]
var_pos += array_size
result_arrays[variable_index, variable_name, FemzipVariableCategory.GLOBAL] = (
var_array
)
result_arrays[
variable_index, variable_name, FemzipVariableCategory.GLOBAL
] = var_array
elif variable_category == FemzipVariableCategory.PART:
array_size = n_parts * 7 + n_rigid_walls * n_rigid_wall_vars
var_array = all_vars_array[:, var_pos : var_pos + array_size]
var_pos += array_size
result_arrays[variable_index, variable_name, FemzipVariableCategory.PART] = (
var_array
)
result_arrays[
variable_index, variable_name, FemzipVariableCategory.PART
] = var_array
elif variable_category == FemzipVariableCategory.CPM_FLOAT_VAR:
array_size = n_airbag_particles
var_array = all_vars_array[:, var_pos : var_pos + array_size]
Expand Down

0 comments on commit 3e6cc58

Please sign in to comment.