Added collection and removal of temporary files in python script.

This commit is contained in:
Xavier Raynaud
2012-04-18 15:42:44 +02:00
parent 6d04f0042c
commit 944f788b88
2 changed files with 29 additions and 16 deletions

View File

@@ -51,7 +51,7 @@ PROJECT_LOGO =
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY =
OUTPUT_DIRECTORY = ../Documentation
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -610,7 +610,8 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = opm/core tutorials examples
#INPUT = opm/core tutorials examples
INPUT = tutorials
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -688,7 +689,7 @@ EXAMPLE_RECURSIVE = NO
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH = Figure/
IMAGE_PATH = ../Documentation/Figure/
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program

View File

@@ -4,18 +4,22 @@ from paraview import servermanager
from os import remove, mkdir, curdir
from os.path import join, isdir
figure_path = curdir
figure_path = "../Documentation/Figure"
tutorial_data_path = curdir
tutorial_path = "tutorials"
collected_garbage_file = []
if not isdir(figure_path):
mkdir(figure_path)
connection = servermanager.Connect()
# tutorial 1
call(join(tutorial_path,"tutorial1"))
grid = servermanager.sources.XMLUnstructuredGridReader(FileName=join(tutorial_data_path,"tutorial1.vtu"))
call(join(tutorial_path, "tutorial1"))
data_file_name = join(tutorial_data_path, "tutorial1.vtu")
grid = servermanager.sources.XMLUnstructuredGridReader(FileName = data_file_name)
collected_garbage_file.append(data_file_name)
grid.UpdatePipeline()
Show(grid)
dp = GetDisplayProperties(grid)
@@ -30,13 +34,14 @@ camera.SetViewUp(-0.19, 0.4, 0.9)
camera.SetViewAngle(30)
camera.SetFocalPoint(1.5, 1.5, 1)
Render()
WriteImage(join(figure_path,"tutorial1.png"))
WriteImage(join(figure_path, "tutorial1.png"))
Hide(grid)
remove(join(tutorial_data_path,"tutorial1.vtu"))
# tutorial 2
call(join(tutorial_path,"tutorial2"))
grid = servermanager.sources.XMLUnstructuredGridReader(FileName=join(tutorial_data_path,"tutorial2.vtu"))
call(join(tutorial_path, "tutorial2"))
data_file_name = join(tutorial_data_path, "tutorial2.vtu")
grid = servermanager.sources.XMLUnstructuredGridReader(FileName = data_file_name)
collected_garbage_file.append(data_file_name)
grid.UpdatePipeline()
Show(grid)
dp = GetDisplayProperties(grid)
@@ -53,15 +58,19 @@ camera.SetViewUp(0, 1, 0)
camera.SetViewAngle(30)
camera.SetFocalPoint(20, 20, 0.5)
Render()
WriteImage(join(figure_path,"tutorial2.png"))
WriteImage(join(figure_path, "tutorial2.png"))
Hide(grid)
remove(join(tutorial_data_path,"tutorial2.vtu"))
# tutorial 3
call(join(tutorial_path,"tutorial3"))
call(join(tutorial_path, "tutorial3"))
for case in range(0,20):
data_file_name = join(tutorial_data_path, "tutorial3-"+"%(case)03d"%{"case": case}+".vtu")
collected_garbage_file.append(data_file_name)
cases = ["000", "005", "010", "015", "019"]
for case in cases:
grid = servermanager.sources.XMLUnstructuredGridReader(FileName=join(tutorial_data_path,"tutorial3-"+case+".vtu"))
data_file_name = join(tutorial_data_path, "tutorial3-"+case+".vtu")
grid = servermanager.sources.XMLUnstructuredGridReader(FileName = data_file_name)
grid.UpdatePipeline()
Show(grid)
dp = GetDisplayProperties(grid)
@@ -77,7 +86,10 @@ for case in cases:
camera.SetViewAngle(30)
camera.SetFocalPoint(100, 100, 5)
Render()
WriteImage(join(figure_path,"tutorial3-"+case+".png"))
WriteImage(join(figure_path, "tutorial3-"+case+".png"))
Hide(grid)
# remove(join(tutorial_data_path,"tutorial3.vtu"))
# remove temporary files
for f in collected_garbage_file:
remove(f)