[cig-commits] r5691 - in short/3D/PyLith/trunk: . libsrc/feassemble
modulesrc/feassemble pylith/feassemble pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Sun Jan 7 16:09:37 PST 2007
Author: brad
Date: 2007-01-07 16:09:36 -0800 (Sun, 07 Jan 2007)
New Revision: 5691
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh
short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe
short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
short/3D/PyLith/trunk/pylith/topology/Mesh.py
Log:
Worked on Integrator object. Need Matt's help flushing out Python/C++ interface and higher-level objects.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/TODO 2007-01-08 00:09:36 UTC (rev 5691)
@@ -14,7 +14,7 @@
Status: Implemented a & b.
-3. Implement Inertia object (manager for integrating inertia over ALL patches)
+3. Implement WFInertia object (manager for integrating inertia over ALL patches)
a. C++ object
b. unit tests at C++ level
c. Python object
@@ -36,3 +36,10 @@
b. Python object (MeshIOHDF5)
c. bindings
d. unit tests at Python level
+
+1. Implement MeshIOCubit
+ a. C++ objects
+ b. unit tests at C++ level
+ b. Python object (MeshIOCubit)
+ c. bindings
+ d. unit tests at Python level
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2007-01-08 00:09:36 UTC (rev 5691)
@@ -93,21 +93,15 @@
*/
void quadrature(const Quadrature* q);
- /** Set spatial database for material properties.
- *
- * @param db Pointer to spatial database
- */
- void database(const spatialdata::spatialdb::SpatialDB* db);
-
/** Initialize, get material property parameters from database.
*
* @param mesh PETSc mesh
- * @param db Pointer to spatial database with material property parameters
* @param cs Pointer to coordinate system of vertices
+ * @param db Pointer to spatial database with material property parameters
*/
virtual void initialize(ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::spatialdb::SpatialDB* db,
- spatialdata::geocoords::CoordSys* cs) = 0;
+ spatialdata::geocoords::CoordSys* cs,
+ spatialdata::spatialdb::SpatialDB* db) = 0;
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh 2007-01-08 00:09:36 UTC (rev 5691)
@@ -65,13 +65,13 @@
/** Initialize, get material property parameters from database.
*
- * @param mesh PETSc mesh
+ * @param mesh PETSc mesh
+ * @param cs Pointer to coordinate system of vertices
* @param db Pointer to spatial database with material property parameters
- * @param cs Pointer to coordinate system of vertices
*/
void initialize(ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::spatialdb::SpatialDB* db,
- spatialdata::geocoords::CoordSys* cs);
+ spatialdata::geocoords::CoordSys* cs,
+ spatialdata::spatialdb::SpatialDB* db);
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc 2007-01-08 00:09:36 UTC (rev 5691)
@@ -266,20 +266,21 @@
void
pylith::feassemble::IntegratorInertia::initialize(
ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::spatialdb::SpatialDB* db,
- spatialdata::geocoords::CoordSys* cs)
+ spatialdata::geocoords::CoordSys* cs,
+ spatialdata::spatialdb::SpatialDB* db)
{ // initialize
+ assert(0 != cs);
+ assert(0 != db);
+
typedef ALE::Mesh::real_section_type real_section_type;
typedef ALE::Mesh::topology_type topology_type;
- assert(0 != db);
- assert(0 != cs);
-
// Create density section
+ const int numQuadPts = _quadrature->numQuadPts();
const ALE::Mesh::int_section_type::patch_type patch = 0;
_density = mesh->getRealSection("density");
- const int fiberDim = 1; // number of values in field per cell
- _density->setName("fieldOut");
+ const int fiberDim = numQuadPts; // number of values in field per cell
+ _density->setName("density");
_density->setFiberDimensionByDepth(patch, 0, fiberDim);
_density->allocate();
@@ -298,7 +299,6 @@
const topology_type::label_sequence::iterator cellsEnd = cells->end();
// Loop over cells
- const int numQuadPts = _quadrature->numQuadPts();
double* cellDensity = (numQuadPts > 0) ? new double[numQuadPts] : 0;
for (topology_type::label_sequence::iterator cellIter=cells->begin();
cellIter != cellsEnd;
@@ -314,9 +314,7 @@
iQuadPt < numQuadPts;
++iQuadPt, index+=spaceDim)
const int err = db->query(&cellDensity[iQuadPt], numVals,
- quadPts[index],
- quadPts[index+1],
- quadPts[index+2], cs);
+ &quadPts[index], spaceDim, cs);
// Assemble cell contribution into field
_density->updateAdd(patch, *cellIter, cellDensity);
} // for
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh 2007-01-08 00:09:36 UTC (rev 5691)
@@ -89,12 +89,12 @@
/** Initialize, get material property parameters from database.
*
* @param mesh PETSc mesh
+ * @param cs Pointer to coordinate system of vertices
* @param db Pointer to spatial database with material property parameters
- * @param cs Pointer to coordinate system of vertices
*/
void initialize(ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::spatialdb::SpatialDB* db,
- spatialdata::geocoords::CoordSys* cs);
+ spatialdata::geocoords::CoordSys* cs,
+ spatialdata::spatialdb::SpatialDB* db);
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
@@ -122,6 +122,6 @@
#include "IntegratorInertia.icc" // inline methods
-#endif // pylith_feassemble_integratorineria_hh
+#endif // pylith_feassemble_integratorinertia_hh
// End of file
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe 2007-01-08 00:09:36 UTC (rev 5691)
@@ -284,6 +284,42 @@
return
+ def initialize(self, mesh, cs, db):
+ """
+ Initialize integrator.
+
+ @param mesh PETSc mesh
+ @param cs Coordinate system associated with mesh vertices
+ @param db Database of material properties
+ """
+ # create shim for method 'initialize'
+ #embed{ void Integrator_initialize(void* pObj, void* meshObj, void* csObj, void* dbObj)
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh*>) meshObj;
+ spatialdata::geocoords::CoordSys* cs =
+ (spatialdata::geocoords::CoordSys*) csObj;
+ spatialdata::spatialdb::SpatialDB* db =
+ (spatialdata::spatialdb::SpatialDB*) dbObj;
+ ((pylith::feassemble::Integrator*) pObj)->initialize(mesh, cs, db);
+ #}embed
+
+ if not mesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'pylith::topology::Mesh'."
+ if not cs.name == "spatialdata_geocoords_CoordSys":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::geocoords::CoordSys'."
+ if not db.name == "spatialdata_spatialdb_SpatialDB":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::spatialdb::SpatialDB'."
+ meshObj = <void*> PyCObject_AsVoidPtr(mesh)
+ Integrator_initialize(self.thisptr, meshObj,
+ ptrFromHandle(cs), ptrFromHandle(db))
+ return
+
+
def _createHandle(self):
"""Wrap pointer to C++ object in PyCObject."""
# create shim for destructor
Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2007-01-08 00:09:36 UTC (rev 5691)
@@ -27,7 +27,9 @@
# INVENTORY //////////////////////////////////////////////////////////
class Inventory(Component.Inventory):
- """Python object for managing Integrator facilities and properties."""
+ """
+ Python object for managing Integrator facilities and properties.
+ """
## @class Inventory
## Python object for managing Integrator facilities and properties.
@@ -37,6 +39,7 @@
##
## \b Facilities
## @li \b quadrature Quadrature object for integration
+ ## @li \b db Database for material properties.
import pyre.inventory
@@ -44,7 +47,11 @@
quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
quadrature.meta['tip'] = "Quadrature object for integration."
+ from spatialdata.spatialdb.SimpleDB import SimpleDB
+ db = pyre.inventory.facility("db", factory=SimpleDB)
+ db.meta['tip'] = "Database for material properties."
+
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="integrator"):
@@ -57,13 +64,15 @@
return
- def initialize(self):
+ def initialize(self, mesh):
"""
Initialize C++ integrator object.
"""
q = self.quadrature
q.initialize()
self.cppHandle.quadrature = q.cppHandle
+ self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle,
+ self.db)
return
@@ -75,6 +84,7 @@
"""
Component._configure(self)
self.quadrature = self.inventory.quadrature
+ self.db = self.inventory.db
return
Modified: short/3D/PyLith/trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-01-07 21:19:42 UTC (rev 5690)
+++ short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-01-08 00:09:36 UTC (rev 5691)
@@ -17,12 +17,16 @@
# Mesh class
class Mesh(Component):
- """Python Mesh for finite-element topology information."""
+ """
+ Python Mesh for finite-element topology information.
+ """
# INVENTORY //////////////////////////////////////////////////////////
class Inventory(Component.Inventory):
- """Python object for managing Mesh facilities and properties."""
+ """
+ Python object for managing Mesh facilities and properties.
+ """
## @class Inventory
## Python object for managing Mesh facilities and properties.
@@ -31,11 +35,13 @@
## @li None
##
## \b Facilities
- ## @li None
+ ## @li \b coordsys Coordinate system associated with mesh
import pyre.inventory
-
+ from spatialdata.geocoords.CSCart import CSCart
+ coordsys = pyre.inventory.facility("coordsys", factory=CSCart)
+ coordsys.meta['tip'] = "Coordinate system associated with mesh."
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -45,7 +51,9 @@
def __init__(self, name="mesh"):
- """Constructor."""
+ """
+ Constructor.
+ """
Component.__init__(self, name, facility="mesh")
self.cppHandle = None
return
@@ -54,7 +62,10 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
def _configure(self):
- """Set members based using inventory."""
+ """
+ Set members based using inventory.
+ """
+ self.coordsys = self.inventory.coordsys
return
More information about the cig-commits
mailing list