Overview | All Modules | Tutorial | User's Guide | Programming Guide |
Previous | COVISE Online Documentation |
The Batch Processing function has been provided together with COVISE version 5.3.1., and this Appendix provides a short introduction to (actual a presentation of) this topic.
User:
Developer:
New user interface: the command-line
Language used: PYTHON
Advantages of Python:
Figure 7.1: Mapping of COVISE to PYTHON
Run Python-interface by typing: covise - script [filename]
[gromit|SNAP] ~ > covise -- script *************************************************************** * COVISE 5.4_a1 starting up, please be patient.... * * Flexlm license of type STD_UI checked out... * * * * Starting local request broker... * * Starting user interface.... * * ******* COVISE PYTHON INTERFACE ******** * * ...done initialization * *************************************************************** COVISE PYTHON INTERFACE ready covise>
Note: Using the Python Interpreter provided by your Vendor
On some Linux distributions incompatibilities between existing libraries and
the python interpreter included in covise may occur. In those cases
using the python interpreter provided by your linux distributor can resolve
the problem. Known are incompatibilities at SuSE 9 and Mandrake 9.0 systems.
In order to circumvent those problems do:
rpm -qa | grep pythonshould show you that the package is installed. If not, install python according to the rules of your distribution. The packages are currently included in all known linux distributions.
After entering covise -script you should receive the following output:
*************************************************************** * COVISE 5.3.2 starting up, please be patient.... * * Flexlm license of type STD_UI checked out... * * * * Starting local request broker... * * Starting user interface.... * * using local python interpreter /usr/bin/python * ******* COVISE PYTHON INTERFACE ******** * * ...done initialization * *************************************************************** COVISE PYTHON INTERFACE ready covise>
On some systems you might obtain a warning like:
RuntimeWarning: Python C API version mismatch for module _covise: This Python has API version 1012, module _covise has version 1011
In most cases you can ignore this warning but nevertheless it is recommended to check the proper functionality by converting an example COVISE map with the tool map_converter:
map\_converter -P -o converted.py $COVISEDIR/net/tutorial/channel.net
and run the resulting python-script in COVISE-python by typing the command
covise --script convertedNet.py
In case problems occur due to version incompatibilities of covise and the version of python provided by your linux-distributor please contact support@visenso.de.
covise> a=3 covise> b=14----- Assignment
covise> print a+b 17----- Output
covise> i=0 covise> for i in range(0,3): ... print i ... 0 1 2----- Loop
covise> s="hello World" covise> print s Hello World----- String
Comprehensive tutorial:
http://www.python.org/doc/2.2p1/tut/tut.html
covise> myNet=net()----- Create a net object - implicit after opening the map-editor
covise> rin=RWCovise()----- Create a RWCovise object
covise> myNet.add( rin )----- Add module to the net - drag RWCovise module to the visual programming area (VPA)
covise> rin.showParams() set_grid_path( x )----- Utility function
covise> rin.showPorts() mesh_in mesh
covise> rin.set_grid_path("share/covise/example-data/COVISE/airbag.covise")----- Set parameter
covise> render=Renderer()----- Create Renderer module
covise> myNet.add( render )----- Add Renderer to net - drag Renderer to the VPA
covise> myNet.connect(rin, "mesh", render, "RenderData")----- Create connection between modules
covise> runMap()----- Guess what- (-;
Example:
covise> re=ReadEnsightNT() covise> re.showParams() set_case_file( x ) set_data for sdata1( x ) set_data for sdata2( x ) set_data for vdata1( x ) set_data for vdata2( x ) set_choose_parts( x ) set_repair connectivity( x )
Note:
Due to technical reasons you MUST set a parameter after you have added the module to the
network!
myNet.add( module )----- Add module to net
[ mynet.remove( module ) ]----- Remove module from net
myNet.save( filename )----- Save module into a COVISE net file
myNet.connect( module1, portName1, module2, prtName2 )----- Connect two modules
myNet.finishedBarrier()----- Wait until all modules have finished their work !!
module.showParams() module.showPorts()
Note:
Due to technical reasons you MUST set a parameter after you have added the module to the
network!
COVISE-net file to Python:
map_converter -P -o myFile.py myFile.net
Example airbag.net:
# # converted with COVISE (C) map_converter # from /home/ralfm_te/covise_snap/net/examples/Airbag.net # # create global net # theNet = net() # # MODULE: RWCovise # RWCovise_1 = RWCovise() theNet.add( RWCovise_1 ) # # set parameter values # RWCovise_1.set_grid_path( "share/covise/example-data/COVISE/airbag.covise" ) # # MODULE: Renderer # Renderer_1 = Renderer() theNet.add( Renderer_1 ) # # CONNECTIONS # theNet.connect( RWCovise_1, "mesh", Renderer_1, "RenderData" ) # # uncomment the following line if you want your script to be executed after loading # #runMap() # # uncomment the following line if you want exit the COVISE-Python interface # #sys.exit()
Previous |
Authors: Martin Aumüller, Ruth Lang, Daniela Rainer, Jürgen Schulze-Döbold, Andreas Werner, Peter Wolf, Uwe Wössner |
Copyright © 1993-2022 HLRS, 2004-2014 RRZK, 2005-2014 Visenso |
COVISE Version 2021.12
|