[cig-commits] r19821 - in short/3D/PyLith/trunk: examples/3d/hex8 libsrc/pylith/meshio modulesrc/meshio pylith/meshio

brad at geodynamics.org brad at geodynamics.org
Mon Mar 19 15:56:09 PDT 2012


Author: brad
Date: 2012-03-19 15:56:09 -0700 (Mon, 19 Mar 2012)
New Revision: 19821

Modified:
   short/3D/PyLith/trunk/examples/3d/hex8/output_points.txt
   short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
   short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.hh
   short/3D/PyLith/trunk/modulesrc/meshio/OutputSolnPoints.i
   short/3D/PyLith/trunk/pylith/meshio/OutputSolnPoints.py
Log:
Fixed bug in interpolation of output to aribitrary points. Need to store dimensioned and nondimensioned coordinates.

Modified: short/3D/PyLith/trunk/examples/3d/hex8/output_points.txt
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/output_points.txt	2012-03-19 22:34:54 UTC (rev 19820)
+++ short/3D/PyLith/trunk/examples/3d/hex8/output_points.txt	2012-03-19 22:56:09 UTC (rev 19821)
@@ -7,7 +7,7 @@
 # coordsys component of the OutputSolnPoints object. The points will
 # be transformed into the coordinate system of the mesh before
 # interpolation.
-10.0 10.0  -500.0
-10.0 10.0 -1500.0
-10.0 10.0 -2500.0
-10.0 10.0 -3500.0
+0.0001  0.0001   -500.0
+0.0001  0.0001  -1500.0
+0.0001  0.0001  -2500.0
+0.0001  0.0001  -3500.0

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc	2012-03-19 22:34:54 UTC (rev 19820)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc	2012-03-19 22:56:09 UTC (rev 19821)
@@ -84,7 +84,8 @@
 pylith::meshio::OutputSolnPoints::setupInterpolator(topology::Mesh* mesh,
 						    const PylithScalar* points,
 						    const int numPoints,
-						    const int spaceDim)
+						    const int spaceDim,
+						    const spatialdata::units::Nondimensional& normalizer)
 { // setupInterpolator
   assert(mesh);
   assert(points);
@@ -123,6 +124,10 @@
 			 cells, numCells, numCorners, meshDim,
 			 interpolate);
   _pointsMesh->coordsys(_mesh->coordsys());
+  _pointsMesh->nondimensionalize(normalizer);
+#if 1 // DEBUGGING
+  _pointsMesh->view("POINTS MESH");
+#endif
 
   // Setup interpolator object
   DM dm;
@@ -139,7 +144,13 @@
 
   err = DMMeshInterpolationSetDim(dm, spaceDim, 
 				  _interpolator);CHECK_PETSC_ERROR(err);
-  err = DMMeshInterpolationAddPoints(dm, numPoints, (PetscReal*)points, 
+
+  assert(!_pointsMesh->sieveMesh().isNull());
+  assert(_pointsMesh->sieveMesh()->hasRealSection("coordinates"));
+  const ALE::Obj<topology::Mesh::RealSection>& coordinatesSection = _pointsMesh->sieveMesh()->getRealSection("coordinates");
+  assert(!coordinatesSection.isNull());
+  const PylithScalar* coordinates = coordinatesSection->restrictSpace();
+  err = DMMeshInterpolationAddPoints(dm, numPoints, (PetscReal*)coordinates, 
 				     _interpolator);CHECK_PETSC_ERROR(err);
   err = DMMeshInterpolationSetUp(dm, _interpolator);CHECK_PETSC_ERROR(err);
   err = DMDestroy(&dm);CHECK_PETSC_ERROR(err);

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.hh	2012-03-19 22:34:54 UTC (rev 19820)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.hh	2012-03-19 22:56:09 UTC (rev 19821)
@@ -64,14 +64,16 @@
   /** Setup interpolator.
    *
    * @param mesh Domain mesh.
-   * @param points Array of coordinates for points [numPoints*spaceDim].
+   * @param points Array of dimensioned coordinates for points [numPoints*spaceDim].
    * @param numPoints Number of points.
    * @param spaceDim Spatial dimension for coordinates.
+   * @param normalizer Nondimensionalizer.
    */
   void setupInterpolator(topology::Mesh* mesh,
 			 const PylithScalar* points,
 			 const int numPoints,
-			 const int spaceDim);
+			 const int spaceDim,
+			 const spatialdata::units::Nondimensional& normalizer);
   
   /** Prepare for output.
    *

Modified: short/3D/PyLith/trunk/modulesrc/meshio/OutputSolnPoints.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/OutputSolnPoints.i	2012-03-19 22:34:54 UTC (rev 19820)
+++ short/3D/PyLith/trunk/modulesrc/meshio/OutputSolnPoints.i	2012-03-19 22:56:09 UTC (rev 19821)
@@ -52,7 +52,7 @@
       /** Setup interpolator.
        *
        * @param mesh Domain mesh.
-       * @param points Array of coordinates for points [numPoints*spaceDim].
+       * @param points Array of dimensioned coordinates for points [numPoints*spaceDim].
        * @param numPoints Number of points.
        * @param spaceDim Spatial dimension for coordinates.
        */
@@ -64,7 +64,8 @@
       void setupInterpolator(pylith::topology::Mesh* mesh,
 			     const PylithScalar* points,
 			     const int numPoints,
-			     const int spaceDim);
+			     const int spaceDim,
+			     const spatialdata::units::Nondimensional& normalizer);
       %clear(const PylithScalar* points, const int numPoints, const int spaceDim);
   
       /** Prepare for output.

Modified: short/3D/PyLith/trunk/pylith/meshio/OutputSolnPoints.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputSolnPoints.py	2012-03-19 22:34:54 UTC (rev 19820)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputSolnPoints.py	2012-03-19 22:56:09 UTC (rev 19821)
@@ -113,10 +113,8 @@
     # Convert to mesh coordinate system
     from spatialdata.geocoords.Converter import convert
     convert(points, mesh.coordsys(), self.coordsys)
-    print "LENGTH SCALE",normalizer.lengthScale()
-    points /= normalizer.lengthScale().value
 
-    ModuleOutputSolnPoints.setupInterpolator(self, mesh, points)
+    ModuleOutputSolnPoints.setupInterpolator(self, mesh, points, normalizer)
     self.mesh = ModuleOutputSolnPoints.pointsMesh(self)
 
     self._eventLogger.eventEnd(logEvent)



More information about the CIG-COMMITS mailing list