[cig-commits] r19793 - in short/3D/PyLith/trunk/applications: . utilities

brad at geodynamics.org brad at geodynamics.org
Thu Mar 15 15:57:56 PDT 2012


Author: brad
Date: 2012-03-15 15:57:55 -0700 (Thu, 15 Mar 2012)
New Revision: 19793

Added:
   short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf.in
   short/3D/PyLith/trunk/applications/utilities/pylithinfo.in
Removed:
   short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf
   short/3D/PyLith/trunk/applications/utilities/pylithinfo
Modified:
   short/3D/PyLith/trunk/applications/pylith.in
   short/3D/PyLith/trunk/applications/pylith_prepmesh.in
   short/3D/PyLith/trunk/applications/utilities/Makefile.am
Log:
Merge from stable.

Modified: short/3D/PyLith/trunk/applications/pylith.in
===================================================================
--- short/3D/PyLith/trunk/applications/pylith.in	2012-03-15 22:55:32 UTC (rev 19792)
+++ short/3D/PyLith/trunk/applications/pylith.in	2012-03-15 22:57:55 UTC (rev 19793)
@@ -10,7 +10,7 @@
 # This code was developed as part of the Computational Infrastructure
 # for Geodynamics (http://geodynamics.org).
 #
-# Copyright (c) 2010-2011 University of California, Davis
+# Copyright (c) 2010-2012 University of California, Davis
 #
 # See COPYING for license information.
 #

Modified: short/3D/PyLith/trunk/applications/pylith_prepmesh.in
===================================================================
--- short/3D/PyLith/trunk/applications/pylith_prepmesh.in	2012-03-15 22:55:32 UTC (rev 19792)
+++ short/3D/PyLith/trunk/applications/pylith_prepmesh.in	2012-03-15 22:57:55 UTC (rev 19793)
@@ -10,7 +10,7 @@
 # This code was developed as part of the Computational Infrastructure
 # for Geodynamics (http://geodynamics.org).
 #
-# Copyright (c) 2010-2011 University of California, Davis
+# Copyright (c) 2010-2012 University of California, Davis
 #
 # See COPYING for license information.
 #

Modified: short/3D/PyLith/trunk/applications/utilities/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/applications/utilities/Makefile.am	2012-03-15 22:55:32 UTC (rev 19792)
+++ short/3D/PyLith/trunk/applications/utilities/Makefile.am	2012-03-15 22:57:55 UTC (rev 19793)
@@ -16,10 +16,50 @@
 # ----------------------------------------------------------------------
 #
 
-dist_bin_SCRIPTS = \
+bin_SCRIPTS = \
 	pylithinfo \
 	pylith_genxdmf \
 	powerlaw_gendb.py
 
 
+INTERPRETER = $(PYTHON)
+noinstINTERPRETER = $(PYTHON)
+
+do_build = sed -e s%[@]INTERPRETER[@]%$(noinstINTERPRETER)%g -e s%[@]PYTHONPATH[@]%$(noinstPYTHONPATH)%g
+do_install = sed -e s%[@]INTERPRETER[@]%$(INTERPRETER)%g -e s%[@]PYTHONPATH[@]%$(PYTHONPATH)%g
+
+pylithinfo:  $(srcdir)/pylithinfo.in Makefile
+	$(do_build) <  $(srcdir)/pylithinfo.in > $@ || (rm -f $@ && exit 1)
+	chmod +x $@
+
+pylith_genxdmf:  $(srcdir)/pylith_genxdmf.in Makefile
+	$(do_build) <  $(srcdir)/pylith_genxdmf.in > $@ || (rm -f $@ && exit 1)
+	chmod +x $@
+
+install-binSCRIPTS: $(bin_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  if test -f "$$p.in"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f $$d$$p.in; then \
+	    f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+	    echo " $(do_install) '$$d$$p.in' > '$(DESTDIR)$(bindir)/$$f'"; \
+	    $(do_install) "$$d$$p.in" > "$(DESTDIR)$(bindir)/$$f"; \
+	    echo " chmod +x '$(DESTDIR)$(bindir)/$$f'"; \
+	    chmod +x "$(DESTDIR)$(bindir)/$$f"; \
+	  else :; fi; \
+	done
+
+EXTRA_DIST = \
+	pylithinfo.in \
+	pylith_genxdmf.in
+
+CLEANFILES = $(bin_SCRIPTS)
+
+
 # End of file 
+
+
+
+
+# End of file 

Deleted: short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf
===================================================================
--- short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf	2012-03-15 22:55:32 UTC (rev 19792)
+++ short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf	2012-03-15 22:57:55 UTC (rev 19793)
@@ -1,74 +0,0 @@
-#!/usr/bin/env nemesis
-#
-# ======================================================================
-#
-# Brad T. Aagaard, U.S. Geological Survey
-# Charles A. Williams, GNS Science
-# Matthew G. Knepley, University of Chicago
-#
-# This code was developed as part of the Computational Infrastructure
-# for Geodynamics (http://geodynamics.org).
-#
-# Copyright (c) 2010-2011 University of California, Davis
-#
-# See COPYING for license information.
-#
-# ======================================================================
-#
-
-# This script creates a metadata file (.xmf) from an HDF5 file written
-# by PyLith permitting the data to be viewed in VTK visualization
-# software, such as ParaView and Visit.
-#
-# Usage: pylith_genxdmf --file=FILE
-
-__requires__ = "PyLith"
-
-
-# ======================================================================
-class GenXdmfApp(object):
-  """
-  Application for generating an Xdmf file for an HDF5 file.
-  """
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, name="pylith_genxdmf"):
-    """
-    Constructor.
-    """
-    self.filename = "output.h5"
-    return
-
-
-  def main(self, *args, **kwds):
-    """
-    Main entry point for application.
-    """
-    from pylith.meshio.Xdmf import Xdmf
-    writer = Xdmf()
-    filenameHDF5 = self.filename
-    filenameXdmf = filenameHDF5.replace(".h5", ".xmf")
-    writer.write(filenameXdmf, filenameHDF5)
-    return
-
-
-# ----------------------------------------------------------------------
-if __name__ == "__main__":
-
-  usage = "%prog --file=FILE"
-  from optparse import OptionParser
-  parser = OptionParser(usage=usage)
-  parser.add_option("-f", "--file", 
-                    dest="filename",
-                    type="string", metavar="FILE",
-                    help="Create Xdmf file for HDF5 file FILE. [output.h5]",
-                    default="output.h5")
-  (options, args) = parser.parse_args()
-
-  app = GenXdmfApp()
-  app.filename = options.filename
-  app.main()
-
-
-# End of file 

Copied: short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf.in (from rev 19792, short/3D/PyLith/branches/v1.6-stable/applications/utilities/pylith_genxdmf.in)
===================================================================
--- short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf.in	                        (rev 0)
+++ short/3D/PyLith/trunk/applications/utilities/pylith_genxdmf.in	2012-03-15 22:57:55 UTC (rev 19793)
@@ -0,0 +1,74 @@
+#!/usr/bin/env nemesis
+#
+# ======================================================================
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2012 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ======================================================================
+#
+
+# This script creates a metadata file (.xmf) from an HDF5 file written
+# by PyLith permitting the data to be viewed in VTK visualization
+# software, such as ParaView and Visit.
+#
+# Usage: pylith_genxdmf --file=FILE
+
+__requires__ = "PyLith"
+
+
+# ======================================================================
+class GenXdmfApp(object):
+  """
+  Application for generating an Xdmf file for an HDF5 file.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="pylith_genxdmf"):
+    """
+    Constructor.
+    """
+    self.filename = "output.h5"
+    return
+
+
+  def main(self, *args, **kwds):
+    """
+    Main entry point for application.
+    """
+    from pylith.meshio.Xdmf import Xdmf
+    writer = Xdmf()
+    filenameHDF5 = self.filename
+    filenameXdmf = filenameHDF5.replace(".h5", ".xmf")
+    writer.write(filenameXdmf, filenameHDF5)
+    return
+
+
+# ----------------------------------------------------------------------
+if __name__ == "__main__":
+
+  usage = "%prog --file=FILE"
+  from optparse import OptionParser
+  parser = OptionParser(usage=usage)
+  parser.add_option("-f", "--file", 
+                    dest="filename",
+                    type="string", metavar="FILE",
+                    help="Create Xdmf file for HDF5 file FILE. [output.h5]",
+                    default="output.h5")
+  (options, args) = parser.parse_args()
+
+  app = GenXdmfApp()
+  app.filename = options.filename
+  app.main()
+
+
+# End of file 

Deleted: short/3D/PyLith/trunk/applications/utilities/pylithinfo
===================================================================
--- short/3D/PyLith/trunk/applications/utilities/pylithinfo	2012-03-15 22:55:32 UTC (rev 19792)
+++ short/3D/PyLith/trunk/applications/utilities/pylithinfo	2012-03-15 22:57:55 UTC (rev 19793)
@@ -1,193 +0,0 @@
-#!/usr/bin/env nemesis
-#
-# ======================================================================
-#
-# Brad T. Aagaard, U.S. Geological Survey
-# Charles A. Williams, GNS Science
-# Matthew G. Knepley, University of Chicago
-#
-# This code was developed as part of the Computational Infrastructure
-# for Geodynamics (http://geodynamics.org).
-#
-# Copyright (c) 2010-2011 University of California, Davis
-#
-# See COPYING for license information.
-#
-# ======================================================================
-#
-
-# This script dumps all PyLith parameters (defaults plus those
-# specified by the user to a text file. The default name of the output
-# file is 'pylith_parameters.txt'. Verbose output includes a
-# description of the parameter along with where it's current value was
-# set.
-#
-# Usage: pylithinfo.py [--verbose] [--fileout=FILE] [PyLith args]
-
-__requires__ = "PyLith"
-
-
-# ======================================================================
-class ParametersApp(object):
-  """
-  Application for printing current PyLith parameters to a text file.
-  """
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, name="pylithinfo"):
-    """
-    Constructor.
-    """
-    self.verbose = False
-    self.filename = "pylith_parameters.txt"
-    self.pylith_args = ""
-    self._tab = "   "
-    self._printPropertyFn = self._printPropertyBasic
-    self._printFacilityFn = self._printFacilityBasic
-    return
-
-
-  def main(self, *args, **kwds):
-    """
-    Main entry point for application.
-    """
-    from pylith.apps.PyLithApp import InfoApp
-    targetapp = InfoApp(self.pylith_args)
-    targetapp.run(*args, **kwds)
-
-    if self.verbose:
-      self._printPropertyFn = self._printPropertyVerbose
-      self._printFacilityFn = self._printFacilityVerbose
-    else:
-      self._printPropertyFn = self._printPropertyBasic
-      self._printFacilityFn = self._printFacilityBasic
-
-    depth = 0
-    fout = open(self.filename, "w")
-    fout.write("Application: %s %s\n" % (targetapp.name, targetapp))
-    self._printParams(fout, targetapp, depth+1)
-    fout.close()
-    return
-
-
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _printParams(self, fout, obj, depth):
-    """
-    Print objects parameters to fout.
-    """
-    propertyNames = obj.inventory.propertyNames()
-    facilityNames = obj.inventory.facilityNames()
-
-    propertiesOmit = ["help", 
-                      "help-components",
-                      "help-persistence",
-                      "help-properties",
-                      "typos",
-                      ]
-    facilitiesOmit = ["weaver",
-                      ]
-
-    propertyNames.sort()
-    facilityNames.sort()
-
-    for name in propertyNames:
-      if name in facilityNames or name in propertiesOmit:
-        continue
-      trait = obj.inventory.getTrait(name)
-      descriptor = obj.inventory.getTraitDescriptor(name)
-      self._printPropertyFn(fout, name, trait, descriptor, depth)
-    for name in facilityNames:
-      if name in facilitiesOmit:
-        continue
-      trait = obj.inventory.getTrait(name)
-      descriptor = obj.inventory.getTraitDescriptor(name)
-      self._printFacilityFn(fout, name, trait, descriptor, depth)
-    return
-
-
-  def _printPropertyBasic(self, fout, name, trait, descriptor, depth):
-    """
-    Print property name, type, and value.
-    """
-    indent = self._tab*depth
-    fout.write("%s%s (%s) = %s\n" % \
-                 (indent, name, trait.type, descriptor.value))
-    return
-
-
-  def _printFacilityBasic(self, fout, name, trait, descriptor, depth):
-    """
-    Print facility name, type, and value.
-    """
-    indent = self._tab*depth
-    fout.write("%s%s = %s (%s)\n" % \
-                 (indent, name, descriptor.value.name, descriptor.value))
-    self._printParams(fout, descriptor.value, depth+1)
-    return
-
-
-  def _printPropertyVerbose(self, fout, name, trait, descriptor, depth):
-    """
-    Print property, name, type, value, description, and location set.
-    """
-    indent = self._tab*depth
-    fout.write("\n%s%s (%s) = %s\n" % \
-                 (indent, name, trait.type, descriptor.value))    
-
-    indent += self._tab
-    try:
-      description = trait.meta['tip']
-    except KeyError:
-      description = "No description available."
-    fout.write("%sDescription: %s\n" % (indent, description))
-    fout.write("%sSet from: %s\n" % (indent, descriptor.locator))
-    return
-
-
-  def _printFacilityVerbose(self, fout, name, trait, descriptor, depth):
-    """
-    Print facility name, type, value, description, and location set.
-    """
-    indent = self._tab*depth
-    fout.write("\n%s%s = %s (%s)\n" % \
-                 (indent, name, descriptor.value.name, descriptor.value))
-
-    indent += self._tab
-    try:
-      description = trait.meta['tip']
-    except KeyError:
-      description = "No description available."
-    fout.write("%sDescription: %s\n" % (indent, description))
-    fout.write("%sSet from: %s\n" % (indent, descriptor.locator))
-    fout.write("%sConfigurable as: %s\n" % \
-                 (indent, ", ".join(descriptor.value.aliases)))
-    
-    self._printParams(fout, descriptor.value, depth+1)
-    return
-
-
-# ----------------------------------------------------------------------
-if __name__ == "__main__":
-
-  usage = "%prog [options] [PyLith args]"
-  from optparse import OptionParser
-  parser = OptionParser(usage=usage)
-  parser.add_option("-v", "--verbose", dest="verbose",
-                    action="store_true", default=False,
-                    help="Print verbose output.")
-  parser.add_option("-o", "--fileout", dest="filename",
-                    type="string", metavar="FILE",
-                    help="Write to FILE. [pylith_parameters.txt]",
-                    default="pylith_parameters.txt")
-  (options, args) = parser.parse_args()
-
-  app = ParametersApp()
-  app.verbose = options.verbose
-  app.filename = options.filename
-  app.pylith_args = args
-  app.main()
-
-
-# End of file 

Copied: short/3D/PyLith/trunk/applications/utilities/pylithinfo.in (from rev 19792, short/3D/PyLith/branches/v1.6-stable/applications/utilities/pylithinfo.in)
===================================================================
--- short/3D/PyLith/trunk/applications/utilities/pylithinfo.in	                        (rev 0)
+++ short/3D/PyLith/trunk/applications/utilities/pylithinfo.in	2012-03-15 22:57:55 UTC (rev 19793)
@@ -0,0 +1,193 @@
+#!/usr/bin/env nemesis
+#
+# ======================================================================
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2012 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ======================================================================
+#
+
+# This script dumps all PyLith parameters (defaults plus those
+# specified by the user to a text file. The default name of the output
+# file is 'pylith_parameters.txt'. Verbose output includes a
+# description of the parameter along with where it's current value was
+# set.
+#
+# Usage: pylithinfo.py [--verbose] [--fileout=FILE] [PyLith args]
+
+__requires__ = "PyLith"
+
+
+# ======================================================================
+class ParametersApp(object):
+  """
+  Application for printing current PyLith parameters to a text file.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="pylithinfo"):
+    """
+    Constructor.
+    """
+    self.verbose = False
+    self.filename = "pylith_parameters.txt"
+    self.pylith_args = ""
+    self._tab = "   "
+    self._printPropertyFn = self._printPropertyBasic
+    self._printFacilityFn = self._printFacilityBasic
+    return
+
+
+  def main(self, *args, **kwds):
+    """
+    Main entry point for application.
+    """
+    from pylith.apps.PyLithApp import InfoApp
+    targetapp = InfoApp(self.pylith_args)
+    targetapp.run(*args, **kwds)
+
+    if self.verbose:
+      self._printPropertyFn = self._printPropertyVerbose
+      self._printFacilityFn = self._printFacilityVerbose
+    else:
+      self._printPropertyFn = self._printPropertyBasic
+      self._printFacilityFn = self._printFacilityBasic
+
+    depth = 0
+    fout = open(self.filename, "w")
+    fout.write("Application: %s %s\n" % (targetapp.name, targetapp))
+    self._printParams(fout, targetapp, depth+1)
+    fout.close()
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _printParams(self, fout, obj, depth):
+    """
+    Print objects parameters to fout.
+    """
+    propertyNames = obj.inventory.propertyNames()
+    facilityNames = obj.inventory.facilityNames()
+
+    propertiesOmit = ["help", 
+                      "help-components",
+                      "help-persistence",
+                      "help-properties",
+                      "typos",
+                      ]
+    facilitiesOmit = ["weaver",
+                      ]
+
+    propertyNames.sort()
+    facilityNames.sort()
+
+    for name in propertyNames:
+      if name in facilityNames or name in propertiesOmit:
+        continue
+      trait = obj.inventory.getTrait(name)
+      descriptor = obj.inventory.getTraitDescriptor(name)
+      self._printPropertyFn(fout, name, trait, descriptor, depth)
+    for name in facilityNames:
+      if name in facilitiesOmit:
+        continue
+      trait = obj.inventory.getTrait(name)
+      descriptor = obj.inventory.getTraitDescriptor(name)
+      self._printFacilityFn(fout, name, trait, descriptor, depth)
+    return
+
+
+  def _printPropertyBasic(self, fout, name, trait, descriptor, depth):
+    """
+    Print property name, type, and value.
+    """
+    indent = self._tab*depth
+    fout.write("%s%s (%s) = %s\n" % \
+                 (indent, name, trait.type, descriptor.value))
+    return
+
+
+  def _printFacilityBasic(self, fout, name, trait, descriptor, depth):
+    """
+    Print facility name, type, and value.
+    """
+    indent = self._tab*depth
+    fout.write("%s%s = %s (%s)\n" % \
+                 (indent, name, descriptor.value.name, descriptor.value))
+    self._printParams(fout, descriptor.value, depth+1)
+    return
+
+
+  def _printPropertyVerbose(self, fout, name, trait, descriptor, depth):
+    """
+    Print property, name, type, value, description, and location set.
+    """
+    indent = self._tab*depth
+    fout.write("\n%s%s (%s) = %s\n" % \
+                 (indent, name, trait.type, descriptor.value))    
+
+    indent += self._tab
+    try:
+      description = trait.meta['tip']
+    except KeyError:
+      description = "No description available."
+    fout.write("%sDescription: %s\n" % (indent, description))
+    fout.write("%sSet from: %s\n" % (indent, descriptor.locator))
+    return
+
+
+  def _printFacilityVerbose(self, fout, name, trait, descriptor, depth):
+    """
+    Print facility name, type, value, description, and location set.
+    """
+    indent = self._tab*depth
+    fout.write("\n%s%s = %s (%s)\n" % \
+                 (indent, name, descriptor.value.name, descriptor.value))
+
+    indent += self._tab
+    try:
+      description = trait.meta['tip']
+    except KeyError:
+      description = "No description available."
+    fout.write("%sDescription: %s\n" % (indent, description))
+    fout.write("%sSet from: %s\n" % (indent, descriptor.locator))
+    fout.write("%sConfigurable as: %s\n" % \
+                 (indent, ", ".join(descriptor.value.aliases)))
+    
+    self._printParams(fout, descriptor.value, depth+1)
+    return
+
+
+# ----------------------------------------------------------------------
+if __name__ == "__main__":
+
+  usage = "%prog [options] [PyLith args]"
+  from optparse import OptionParser
+  parser = OptionParser(usage=usage)
+  parser.add_option("-v", "--verbose", dest="verbose",
+                    action="store_true", default=False,
+                    help="Print verbose output.")
+  parser.add_option("-o", "--fileout", dest="filename",
+                    type="string", metavar="FILE",
+                    help="Write to FILE. [pylith_parameters.txt]",
+                    default="pylith_parameters.txt")
+  (options, args) = parser.parse_args()
+
+  app = ParametersApp()
+  app.verbose = options.verbose
+  app.filename = options.filename
+  app.pylith_args = args
+  app.main()
+
+
+# End of file 



More information about the CIG-COMMITS mailing list