[Trilinos-Users] ParameterList XML files

Bill Spotz wfspotz at sandia.gov
Mon Apr 23 13:25:07 MDT 2007


Trilinos users,

I wanted to drop a note to let people know that I have added support  
for classes XMLObject, XMLParameterListWriter and  
XMLParameterListReader to the PyTrilinos module Teuchos.  Thus, if  
you build PyTrilinos, you can write scripts for building and  
maintaining ParameterList XML files such as the following:

   from PyTrilinos import Teuchos
   params = { "precond"  : "IC",
              "maxiters" : 100,
              "tol"      : 1.0e-6 }
   xmlObj = Teuchos.XMLParameterListWriter().toXML(params)
   open("params.xml","w").write(xmlObj.toString())

This script produces params.xml:

   <ParameterList>
   <Parameter name="maxiters" type="int" value="100"/>
   <Parameter name="precond" type="string" value="IC"/>
   <Parameter name="tol" type="double" value="1e-06"/>
   </ParameterList>

The advantages are:

   (1) You don't have to compile a program.
   (2) You can use python's elegant dictionary syntax.
   (3) You can avoid editing XML directly.

for more information, see

   http://software.sandia.gov/Trilinos/packages/pytrilinos/ 
development/Teuchos.html

This capability has been added to the development branch (for those  
who have access to it) and will be a part of release 8.0.

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-5451      **
** Albuquerque, NM 87185-0370    Email: wfspotz at sandia.gov **




More information about the Trilinos-Users mailing list