[cig-commits] r12774 - in short/3D/PyLith/trunk: libsrc/topology modulesrc/topology pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Tue Sep 2 12:24:31 PDT 2008
Author: brad
Date: 2008-09-02 12:24:30 -0700 (Tue, 02 Sep 2008)
New Revision: 12774
Modified:
short/3D/PyLith/trunk/libsrc/topology/Distributor.cc
short/3D/PyLith/trunk/libsrc/topology/Distributor.hh
short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
short/3D/PyLith/trunk/pylith/topology/Distributor.py
Log:
Fixed output of partition information. Replaced output manager in Distributor with data writer. Fixed bug in creating partition section in Distributor (missing setChar() related to using IMesh).
Modified: short/3D/PyLith/trunk/libsrc/topology/Distributor.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Distributor.cc 2008-09-02 17:24:34 UTC (rev 12773)
+++ short/3D/PyLith/trunk/libsrc/topology/Distributor.cc 2008-09-02 19:24:30 UTC (rev 12774)
@@ -16,7 +16,7 @@
#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
#include "pylith/utils/vectorfields.hh" // USES SCALAR_FIELD
-#include "pylith/meshio/OutputManager.hh" // USES OutputManager
+#include "pylith/meshio/DataWriter.hh" // USES DataWriter
#include <string.h> // USES strlen()
#include <stdexcept> // USES std::runtime_error
@@ -155,10 +155,11 @@
(*newMesh)->setCalculatedOverlap(true);
} // distribute
+#include <iostream>
// ----------------------------------------------------------------------
// Write partitioning info for distributed mesh.
void
-pylith::topology::Distributor::write(meshio::OutputManager* const output,
+pylith::topology::Distributor::write(meshio::DataWriter* const writer,
const ALE::Obj<Mesh>& mesh,
const spatialdata::geocoords::CoordSys* cs)
{ // write
@@ -169,27 +170,28 @@
new real_section_type(mesh->comm(), mesh->debug());
const ALE::Obj<Mesh::label_sequence>& cells = mesh->heightStratum(0);
assert(!cells.isNull());
+ partition->setChart(real_section_type::chart_type(*std::min_element(cells->begin(), cells->end()),
+ *std::max_element(cells->begin(), cells->end())+1));
partition->setFiberDimension(cells, fiberDim);
mesh->allocate(partition);
const int rank = mesh->commRank();
double rankReal = double(rank);
- const Mesh::label_sequence::iterator cellsEnd = cells->end();
+ const Mesh::label_sequence::iterator cellsEnd = cells->end();
for (Mesh::label_sequence::iterator c_iter=cells->begin();
c_iter != cellsEnd;
++c_iter) {
partition->updatePoint(*c_iter, &rankReal);
} // for
-
- partition->view("PARTITION");
+ //partition->view("PARTITION");
const double t = 0.0;
const int numTimeSteps = 0;
- output->open(mesh, cs, numTimeSteps);
- output->openTimeStep(t, mesh, cs);
- output->appendCellField(t, "partition", partition, SCALAR_FIELD, mesh);
- output->closeTimeStep();
- output->close();
+ writer->open(mesh, cs, numTimeSteps);
+ writer->openTimeStep(t, mesh, cs);
+ writer->writeCellField(t, "partition", partition, SCALAR_FIELD, mesh);
+ writer->closeTimeStep();
+ writer->close();
} // write
Modified: short/3D/PyLith/trunk/libsrc/topology/Distributor.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Distributor.hh 2008-09-02 17:24:34 UTC (rev 12773)
+++ short/3D/PyLith/trunk/libsrc/topology/Distributor.hh 2008-09-02 19:24:30 UTC (rev 12774)
@@ -28,7 +28,7 @@
} // topology
namespace meshio {
- class OutputManager;
+ class DataWriter;
} // meshio
} // pylith
@@ -64,12 +64,12 @@
/** Write partitioning info for distributed mesh.
*
- * @param output Output manager for partition information.
+ * @param writer Data writer for partition information.
* @param mesh Distributed mesh.
* @param cs Coordinate system for mesh.
*/
static
- void write(meshio::OutputManager* const output,
+ void write(meshio::DataWriter* const writer,
const ALE::Obj<Mesh>& mesh,
const spatialdata::geocoords::CoordSys* cs);
Modified: short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2008-09-02 17:24:34 UTC (rev 12773)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2008-09-02 19:24:30 UTC (rev 12774)
@@ -544,22 +544,22 @@
return newMesh
- def write(self, output, mesh, cs):
+ def write(self, writer, mesh, cs):
"""
Write partitioning information to file..
"""
# create shim for method 'write'
- #embed{ void Distributor_write(void* outputVptr, void* meshVptr, void* csVptr)
+ #embed{ void Distributor_write(void* writerVptr, void* meshVptr, void* csVptr)
try {
- assert(0 != outputVptr);
+ assert(0 != writerVptr);
assert(0 != meshVptr);
assert(0 != csVptr);
ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- pylith::meshio::OutputManager* output =
- (pylith::meshio::OutputManager*) outputVptr;
+ pylith::meshio::DataWriter* writer =
+ (pylith::meshio::DataWriter*) writerVptr;
spatialdata::geocoords::CoordSys* cs =
(spatialdata::geocoords::CoordSys*) csVptr;
- pylith::topology::Distributor::write(output, *mesh, cs);
+ pylith::topology::Distributor::write(writer, *mesh, cs);
} catch (const std::exception& err) {
PyErr_SetString(PyExc_RuntimeError,
const_cast<char*>(err.what()));
@@ -571,16 +571,16 @@
"Caught unknown C++ exception.");
} // try/catch
#}embed
- if output.name != "pylith_meshio_OutputManager":
+ if writer.name != "pylith_meshio_DataWriter":
raise TypeError, \
- "Argument 'output' must be extension module type 'OutputManager'."
+ "Argument 'writer' must be extension module type 'DataWriter'."
if mesh.name != "pylith_topology_Mesh":
raise TypeError, \
"Argument 'mesh' must be extension module type 'Mesh'."
if cs.name != "spatialdata_geocoords_CoordSys":
raise TypeError, \
"Argument 'cs' must be extension module type 'CoordSys'."
- Distributor_write(ptrFromHandle(output), ptrFromHandle(mesh),
+ Distributor_write(ptrFromHandle(writer), ptrFromHandle(mesh),
ptrFromHandle(cs))
return
Modified: short/3D/PyLith/trunk/pylith/topology/Distributor.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Distributor.py 2008-09-02 17:24:34 UTC (rev 12773)
+++ short/3D/PyLith/trunk/pylith/topology/Distributor.py 2008-09-02 19:24:30 UTC (rev 12774)
@@ -53,10 +53,10 @@
debug = pyre.inventory.bool("debug", default=False)
debug.meta['tip'] = "Write partition information to file."
- from pylith.meshio.OutputManager import OutputManager
- output = pyre.inventory.facility("output", factory=OutputManager,
- family="output_manager")
- output.meta['tip'] = "Output manager for partition information."
+ from pylith.meshio.DataWriterVTK import DataWriterVTK
+ dataWriter = pyre.inventory.facility("data_writer", factory=DataWriterVTK,
+ family="output_data_writer")
+ dataWriter.meta['tip'] = "Data writer for partition information."
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -87,8 +87,8 @@
newMesh.coordsys = mesh.coordsys
if self.debug:
- self.output.initialize()
- self.cppHandle.write(self.output.cppHandle,
+ self.dataWriter.initialize()
+ self.cppHandle.write(self.dataWriter.cppHandle,
newMesh.cppHandle, newMesh.coordsys.cppHandle)
self._logger.eventEnd(logEvent)
@@ -104,7 +104,7 @@
Component._configure(self)
self.partitioner = self.inventory.partitioner
self.debug = self.inventory.debug
- self.output = self.inventory.output
+ self.dataWriter = self.inventory.dataWriter
return
More information about the cig-commits
mailing list