Mercurial > repos > greg > icqsol_add_surface_field_from_expression
comparison icqsol_utils.py @ 12:12c5c13d2553 draft
Uploaded
| author | greg |
|---|---|
| date | Mon, 11 Jan 2016 09:24:02 -0500 |
| parents | 10c694ca63e6 |
| children | 9d3ba1049f14 |
comparison
equal
deleted
inserted
replaced
| 11:3040077c45e3 | 12:12c5c13d2553 |
|---|---|
| 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) |
