comparison icqsol_utils.py @ 5:25a8989c8d74 draft

Uploaded
author greg
date Mon, 11 Jan 2016 09:16:18 -0500
parents 7598b7336e58
children 0f4599a72a0e
comparison
equal deleted inserted replaced
4:7598b7336e58 5:25a8989c8d74
1 import os 1 import os
2 import sys 2 import sys
3 import tempfile 3 import tempfile
4
5 from icqsol.shapes.icqShapeManager import ShapeManager
6 from icqsol.bem.icqLaplaceMatrices import LaplaceMatrices
4 7
5 PLY = 'ply' 8 PLY = 'ply'
6 POLYDATA = 'POLYDATA' 9 POLYDATA = 'POLYDATA'
7 VTK = 'vtk' 10 VTK = 'vtk'
8 11
37 os.remove(file_path) 40 os.remove(file_path)
38 os.symlink(input_file, file_path) 41 os.symlink(input_file, file_path)
39 return file_path 42 return file_path
40 43
41 44
45 def get_laplace_solver(shape_data, max_edge_length=float('inf')):
46 return LaplaceMatrices(shape_data, max_edge_length=max_edge_length)
47
48
49 def get_shape_manager(format, dataset_type):
50 # Instantiate a ShapeManager.
51 if format == VTK:
52 return ShapeManager(file_format=format, vtk_dataset_type=dataset_type)
53 else:
54 return ShapeManager(file_format=format)
55
56
42 def get_temp_dir(prefix='tmp-vtk-', dir=None): 57 def get_temp_dir(prefix='tmp-vtk-', dir=None):
43 """ 58 """
44 Return a temporary directory. 59 Return a temporary directory.
45 """ 60 """
46 return tempfile.mkdtemp(prefix=prefix, dir=dir) 61 return tempfile.mkdtemp(prefix=prefix, dir=dir)