Coverage for mpcforces_extractor\main.py: 0%

24 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-03 22:18 +0100

1import os 

2import time 

3from mpcforces_extractor.force_extractor import MPCForceExtractor 

4from mpcforces_extractor.visualization.tcl_visualize import VisualizerConnectedParts 

5from mpcforces_extractor.writer.summary_writer import SummaryWriter 

6 

7 

8def main(): 

9 """ 

10 This is the main function that is used to test the MPCForceExtractor class 

11 Its there because of a entry point in the toml file 

12 """ 

13 

14 input_folder = "data/input" 

15 output_folder = "data/output" 

16 model_name = "m" 

17 # model_name = "Flange" 

18 blocksize = 8 

19 

20 mpc_force_extractor = MPCForceExtractor( 

21 input_folder + f"/{model_name}.fem", 

22 input_folder + f"/{model_name}.mpcf", 

23 output_folder + f"/{model_name}", 

24 ) 

25 

26 # Write Summary 

27 mpc_force_extractor.build_fem_and_subcase_data(blocksize) 

28 summary_writer = SummaryWriter( 

29 mpc_force_extractor, mpc_force_extractor.output_folder 

30 ) 

31 summary_writer.add_header() 

32 summary_writer.add_mpc_lines() 

33 summary_writer.write_lines() 

34 

35 # Visualize the connected parts 

36 start_time = time.time() 

37 output_vis = os.path.join(output_folder, model_name, "tcl_visualization") 

38 visualizer = VisualizerConnectedParts(output_vis) 

39 visualizer.output_tcl_lines_for_part_vis() 

40 

41 print("TCL visualization lines written to", output_vis) 

42 print("..took ", round(time.time() - start_time, 2), "seconds") 

43 

44 

45if __name__ == "__main__": 

46 main()