comparison icqsol_utils.py @ 10:1cc95decb3b7 draft

Uploaded
author greg
date Mon, 11 Jan 2016 09:34:43 -0500
parents b509c887aea8
children 0c02880e972f
comparison
equal deleted inserted replaced
9:b509c887aea8 10:1cc95decb3b7
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=None, dataset_type=None):
50 # Instantiate a ShapeManager.
51 if format is None and dataset_type is None:
52 return ShapeManager()
53 if format == VTK:
54 return ShapeManager(file_format=format, vtk_dataset_type=dataset_type)
55 else:
56 return ShapeManager(file_format=format)
57
58
42 def get_temp_dir(prefix='tmp-vtk-', dir=None): 59 def get_temp_dir(prefix='tmp-vtk-', dir=None):
43 """ 60 """
44 Return a temporary directory. 61 Return a temporary directory.
45 """ 62 """
46 return tempfile.mkdtemp(prefix=prefix, dir=dir) 63 return tempfile.mkdtemp(prefix=prefix, dir=dir)