[cig-commits] r14441 - in short/3D/PyLith/branches/pylith-swig: . applications pylith pylith/apps
brad at geodynamics.org
brad at geodynamics.org
Tue Mar 24 18:06:49 PDT 2009
Author: brad
Date: 2009-03-24 18:06:48 -0700 (Tue, 24 Mar 2009)
New Revision: 14441
Added:
short/3D/PyLith/branches/pylith-swig/pylith/apps/
short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py
Removed:
short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py
Modified:
short/3D/PyLith/branches/pylith-swig/TODO
short/3D/PyLith/branches/pylith-swig/applications/pylith.in
short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
short/3D/PyLith/branches/pylith-swig/pylith/__init__.py
Log:
Moved PyLithApp to apps.
Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO 2009-03-25 01:06:30 UTC (rev 14440)
+++ short/3D/PyLith/branches/pylith-swig/TODO 2009-03-25 01:06:48 UTC (rev 14441)
@@ -36,6 +36,8 @@
DirichletPoints (Python) - rate == None -> dbRate == 0
DirichletBoundary (Python) - rate == None -> dbRate == 0
+ Add check before calling newSection() when want to enforce at least 1 value.
+
1. Reduce memory use (new labels) [Matt]
2. Nondimensionalize [Brad]
Modified: short/3D/PyLith/branches/pylith-swig/applications/pylith.in
===================================================================
--- short/3D/PyLith/branches/pylith-swig/applications/pylith.in 2009-03-25 01:06:30 UTC (rev 14440)
+++ short/3D/PyLith/branches/pylith-swig/applications/pylith.in 2009-03-25 01:06:48 UTC (rev 14441)
@@ -28,7 +28,7 @@
sys.path.insert(1, directory)
site.addsitedir(directory)
- from pylith.PyLithApp import PyLithApp
+ from pylith.apps.PyLithApp import PyLithApp
from pyre.applications import start
start(applicationClass=PyLithApp)
Modified: short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am 2009-03-25 01:06:30 UTC (rev 14440)
+++ short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am 2009-03-25 01:06:48 UTC (rev 14441)
@@ -11,8 +11,8 @@
#
nobase_pkgpyexec_PYTHON = \
- PyLithApp.py \
__init__.py \
+ apps/PyLithApp.py \
bc/__init__.py \
bc/AbsorbingDampers.py \
bc/BoundaryCondition.py \
Deleted: short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py 2009-03-25 01:06:30 UTC (rev 14440)
+++ short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py 2009-03-25 01:06:48 UTC (rev 14441)
@@ -1,160 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/PyLithApp.py
-##
-## @brief Python PyLith application
-
-from mpi import Application
-
-# PyLithApp class
-class PyLithApp(Application):
- """
- Python PyLithApp application.
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(Application.Inventory):
- """
- Python object for managing PyLithApp facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing PyLithApp facilities and properties.
- ##
- ## \b Properties
-
- ## @li None
- ##
- ## \b Facilities
- ## @li \b mesher Generates or imports the computational mesh.
- ## @li \b problem Computational problem to solve
- ## @li \b petsc Manager for PETSc options
-
- import pyre.inventory
-
- from pylith.topology.MeshImporter import MeshImporter
- mesher = pyre.inventory.facility("mesh_generator", family="mesh_generator",
- factory=MeshImporter)
- mesher.meta['tip'] = "Generates or imports the computational mesh."
-
- from pylith.problems.TimeDependent import TimeDependent
- problem = pyre.inventory.facility("problem", family="problem",
- factory=TimeDependent)
- problem.meta['tip'] = "Computational problem to solve."
-
- # Dummy facility for passing options to PETSc
- from pylith.utils.PetscManager import PetscManager
- petsc = pyre.inventory.facility("petsc", family="petsc_manager",
- factory=PetscManager)
- petsc.meta['tip'] = "Manager for PETSc options."
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, name="pylithapp"):
- """
- Constructor.
- """
- Application.__init__(self, name)
- self._loggingPrefix = "PyLith "
- return
-
-
- def main(self, *args, **kwds):
- """
- Run the application.
- """
- from pylith.utils.profiling import resourceUsageString
-
- self.petsc.initialize()
- self._debug.log(resourceUsageString())
-
- self._setupLogging()
- self._logger.eventBegin("PyLith main")
-
- # Create mesh (adjust to account for interfaces (faults) if necessary)
- self._logger.stagePush("Meshing")
- interfaces = None
- if "interfaces" in dir(self.problem):
- interfaces = self.problem.interfaces.components()
- mesh = self.mesher.create(self.problem.dimension,
- self.problem.normalizer, interfaces)
- self._debug.log(resourceUsageString())
- self._logger.stagePop()
-
- # Setup problem, verify configuration, and then initialize
- self._logger.stagePush("Setup")
- self.problem.preinitialize(mesh)
- self._debug.log(resourceUsageString())
-
- self.problem.verifyConfiguration()
-
- self.problem.initialize()
- self._debug.log(resourceUsageString())
-
- self._logger.stagePop()
-
- # Run problem
- self._logger.stagePush("Run")
- self.problem.run(self)
- self._debug.log(resourceUsageString())
- self._logger.stagePop()
-
- # Cleanup
- self._logger.stagePush("Finalize")
- self.problem.finalize()
- self._logger.stagePop()
-
- self._logger.eventEnd("PyLith main")
- self.petsc.finalize()
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """
- Setup members using inventory.
- """
- Application._configure(self)
- self.mesher = self.inventory.mesher
- self.problem = self.inventory.problem
- self.petsc = self.inventory.petsc
-
- import journal
- self._debug = journal.debug(self.name)
- return
-
- def _setupLogging(self):
- """
- Setup event logging.
- """
- from pylith.utils.EventLogger import EventLogger
- logger = EventLogger()
- logger.setClassName("PyLith")
- logger.initialize()
- logger.registerEvent("PyLith main")
-
- stages = ["Meshing",
- "Setup",
- "Run",
- "Finalize"]
- for stage in stages:
- logger.registerStage(stage)
-
- self._logger = logger
- return
-
-
-# End of file
Modified: short/3D/PyLith/branches/pylith-swig/pylith/__init__.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/__init__.py 2009-03-25 01:06:30 UTC (rev 14440)
+++ short/3D/PyLith/branches/pylith-swig/pylith/__init__.py 2009-03-25 01:06:48 UTC (rev 14441)
@@ -14,15 +14,17 @@
## @brief Python top-level PyLith module initialization
-__all__ = ['PyLithApp',
+__all__ = ['apps',
+ 'bc',
+ 'faults',
'feassemble',
'materials',
'meshio',
'mpi',
'problems',
- 'solver',
'topology',
- 'utils']
+ 'utils',
+ ]
# End of file
Copied: short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py (from rev 14438, short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py 2009-03-25 01:06:48 UTC (rev 14441)
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/PyLithApp.py
+##
+## @brief Python PyLith application
+
+from mpi import Application
+
+# PyLithApp class
+class PyLithApp(Application):
+ """
+ Python PyLithApp application.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Application.Inventory):
+ """
+ Python object for managing PyLithApp facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing PyLithApp facilities and properties.
+ ##
+ ## \b Properties
+
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b mesher Generates or imports the computational mesh.
+ ## @li \b problem Computational problem to solve
+ ## @li \b petsc Manager for PETSc options
+
+ import pyre.inventory
+
+ from pylith.topology.MeshImporter import MeshImporter
+ mesher = pyre.inventory.facility("mesh_generator", family="mesh_generator",
+ factory=MeshImporter)
+ mesher.meta['tip'] = "Generates or imports the computational mesh."
+
+ from pylith.problems.TimeDependent import TimeDependent
+ problem = pyre.inventory.facility("problem", family="problem",
+ factory=TimeDependent)
+ problem.meta['tip'] = "Computational problem to solve."
+
+ # Dummy facility for passing options to PETSc
+ from pylith.utils.PetscManager import PetscManager
+ petsc = pyre.inventory.facility("petsc", family="petsc_manager",
+ factory=PetscManager)
+ petsc.meta['tip'] = "Manager for PETSc options."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="pylithapp"):
+ """
+ Constructor.
+ """
+ Application.__init__(self, name)
+ self._loggingPrefix = "PyLith "
+ return
+
+
+ def main(self, *args, **kwds):
+ """
+ Run the application.
+ """
+ from pylith.utils.profiling import resourceUsageString
+
+ self.petsc.initialize()
+ self._debug.log(resourceUsageString())
+
+ self._setupLogging()
+ self._logger.eventBegin("PyLith main")
+
+ # Create mesh (adjust to account for interfaces (faults) if necessary)
+ self._logger.stagePush("Meshing")
+ interfaces = None
+ if "interfaces" in dir(self.problem):
+ interfaces = self.problem.interfaces.components()
+ mesh = self.mesher.create(self.problem.dimension,
+ self.problem.normalizer, interfaces)
+ self._debug.log(resourceUsageString())
+ self._logger.stagePop()
+
+ # Setup problem, verify configuration, and then initialize
+ self._logger.stagePush("Setup")
+ self.problem.preinitialize(mesh)
+ self._debug.log(resourceUsageString())
+
+ self.problem.verifyConfiguration()
+
+ self.problem.initialize()
+ self._debug.log(resourceUsageString())
+
+ self._logger.stagePop()
+
+ # Run problem
+ self._logger.stagePush("Run")
+ self.problem.run(self)
+ self._debug.log(resourceUsageString())
+ self._logger.stagePop()
+
+ # Cleanup
+ self._logger.stagePush("Finalize")
+ self.problem.finalize()
+ self._logger.stagePop()
+
+ self._logger.eventEnd("PyLith main")
+ self.petsc.finalize()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Application._configure(self)
+ self.mesher = self.inventory.mesher
+ self.problem = self.inventory.problem
+ self.petsc = self.inventory.petsc
+
+ import journal
+ self._debug = journal.debug(self.name)
+ return
+
+ def _setupLogging(self):
+ """
+ Setup event logging.
+ """
+ from pylith.utils.EventLogger import EventLogger
+ logger = EventLogger()
+ logger.setClassName("PyLith")
+ logger.initialize()
+ logger.registerEvent("PyLith main")
+
+ stages = ["Meshing",
+ "Setup",
+ "Run",
+ "Finalize"]
+ for stage in stages:
+ logger.registerStage(stage)
+
+ self._logger = logger
+ return
+
+
+# End of file
More information about the CIG-COMMITS
mailing list