sensotwin.lifetime_extrapolation.simulation.lib.convertFRDtoVTK

 1import logging
 2from ccx2paraview import ccx2paraview
 3import os
 4
 5def f_convertFRD2VTU(working_dir = '/.'):
 6    '''
 7    Converts all native CCX results in the .frd format
 8    in the current working directory to the .vtu format
 9    using ccx2paraview.
10
11    Parameters:
12    - None
13
14    Returns:
15    - None
16    '''
17    logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
18
19    # get all frd files in the current directory
20    current_dir = working_dir
21    
22    all_files = os.listdir(current_dir)
23    all_frd_files = []
24
25    for file in all_files:
26        if file.endswith('.frd'):
27            all_frd_files.append(file)
28
29    # convert file with ccx2paraview
30    for file in all_frd_files:
31        c = ccx2paraview.Converter(os.path.join(current_dir, file), ['vtu'])
32        c.run()
33
34def main():
35    f_convertFRD2VTU()
36
37if __name__ == '__main__':
38    main()
def f_convertFRD2VTU(working_dir='/.'):
 6def f_convertFRD2VTU(working_dir = '/.'):
 7    '''
 8    Converts all native CCX results in the .frd format
 9    in the current working directory to the .vtu format
10    using ccx2paraview.
11
12    Parameters:
13    - None
14
15    Returns:
16    - None
17    '''
18    logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
19
20    # get all frd files in the current directory
21    current_dir = working_dir
22    
23    all_files = os.listdir(current_dir)
24    all_frd_files = []
25
26    for file in all_files:
27        if file.endswith('.frd'):
28            all_frd_files.append(file)
29
30    # convert file with ccx2paraview
31    for file in all_frd_files:
32        c = ccx2paraview.Converter(os.path.join(current_dir, file), ['vtu'])
33        c.run()

Converts all native CCX results in the .frd format in the current working directory to the .vtu format using ccx2paraview.

Parameters:

  • None

Returns:

  • None
def main():
35def main():
36    f_convertFRD2VTU()