Mercurial > repos > greg > icqsol_solve_laplace
changeset 1:696bfb47d45e draft
Uploaded
author | greg |
---|---|
date | Mon, 25 Jan 2016 07:53:44 -0500 |
parents | e04795a38512 |
children | 4fc22a63a17e |
files | icqsol_solve_laplace.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/icqsol_solve_laplace.py Mon Jan 11 08:55:00 2016 -0500 +++ b/icqsol_solve_laplace.py Mon Jan 25 07:53:44 2016 -0500 @@ -21,19 +21,30 @@ # Instantiate the shape manager. shape_mgr = icqsol_utils.get_shape_manager(input_format, args.input_dataset_type) + # Get the vtk polydata from the input dataset. vtk_poly_data = shape_mgr.loadAsVtkPolyData(args.input) + # Instantiate the Laplace solver. solver = icqsol_utils.get_laplace_solver(vtk_poly_data) + # Set the output field names. solver.setNormalElectricFieldJumpName(args.output_jump_electric_field_name) + # In place operation, vtk_poly_data will be modified. normalEJump = solver.computeNormalElectricFieldJump(potName=args.input_potential_name) +surfIntegral = shape_mgr.integrateSurfaceField(solver.getVtkPolyData(), args.output_jump_electric_field_name) +print 'Surface integral of normal electric field jump: {0}'.format(surfIntegral) +minVal, maxVal = shape_mgr.getFieldRange(solver.getVtkPolyData(), args.output_jump_electric_field_name) +print 'min/max values of normal electrc field jump: {0}/{1}'.format(minVal, maxVal) + # Define the output file format and type (the output_format can only be 'vtk'). output_format, output_file_type = icqsol_utils.get_format_and_type(args.output_vtk_type) tmp_output_path = icqsol_utils.get_temporary_file_path(tmp_dir, output_format) + # Make sure the ShapeManager's writer is vtk. shape_mgr.setWriter(file_format=icqsol_utils.VTK, vtk_dataset_type=icqsol_utils.POLYDATA) + # Save the output. shape_mgr.saveVtkPolyData(vtk_poly_data=solver.getVtkPolyData(), file_name=tmp_output_path, file_type=output_file_type) shutil.move(tmp_output_path, args.output)