Skip to content

Commit

Permalink
Merge pull request #192 from keiyamamo/save_meshing_command
Browse files Browse the repository at this point in the history
modify meshing script to save given meshing command
  • Loading branch information
keiyamamo authored Oct 1, 2024
2 parents 6ea971a + 19030d3 commit 7915b55
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/vasp/automatedPreprocessing/automated_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later

import sys
import datetime
from pathlib import Path
import vtk

Expand All @@ -30,6 +31,21 @@
from vasp.simulations.simulation_common import load_mesh_and_data


def save_command_to_file(file_path):
"""
Save the command-line arguments to a file.
Args:
file_path (str): Path to the file where the command-line arguments should be saved.
"""
# Join the command-line arguments into a single string
command = ' '.join(sys.argv)

# Open the file in append mode and write the command
with open(file_path, 'a') as f:
f.write(command + '\n')


def run_pre_processing(input_model, verbose_print, smoothing_method, smoothing_factor, smoothing_iterations,
meshing_method, refine_region, has_multiple_inlets, add_flow_extensions, visualize, config_path,
coarsening_factor, inlet_flow_extension_length, outlet_flow_extension_length,
Expand Down Expand Up @@ -91,6 +107,10 @@ def run_pre_processing(input_model, verbose_print, smoothing_method, smoothing_f
dir_path = input_model_path.parent
print(f"\n--- Working on case: {case_name} \n")

# Get unique time stamp and save given command to file
time_stamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
save_command_to_file(dir_path / f"commands_{time_stamp}.txt")

# Naming conventions
base_path = dir_path / case_name
file_name_centerlines = base_path.with_name(base_path.name + "_centerlines.vtp")
Expand Down

0 comments on commit 7915b55

Please sign in to comment.