[cig-commits] r4702 - short/3D/PyLith/trunk/libsrc/meshio
brad at geodynamics.org
brad at geodynamics.org
Wed Oct 4 16:59:59 PDT 2006
Author: brad
Date: 2006-10-04 16:59:59 -0700 (Wed, 04 Oct 2006)
New Revision: 4702
Modified:
short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.cc
short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.hh
Log:
Updated to reflect changes in Sieve layout.
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.cc 2006-10-04 22:57:23 UTC (rev 4701)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.cc 2006-10-04 23:59:59 UTC (rev 4702)
@@ -36,7 +36,7 @@
// ----------------------------------------------------------------------
// Unpickle mesh
void
-pylith::meshio::MeshIOAscii::read(Obj<Mesh>& mesh,
+pylith::meshio::MeshIOAscii::read(ALE::Obj<Mesh>& mesh,
const bool interpolate)
{ // read
int meshDim = 0;
@@ -107,18 +107,18 @@
if (readDim && readCells && readVertices && !builtTopology) {
// Can now build topology
mesh = Mesh(PETSC_COMM_WORLD, meshDim);
- mesh->debug = true;
// allow mesh to have different dimension than coordinates
- Obj<sieve_type> sieve = new sieve_type(mesh->comm(), mesh->debug);
- Obj<topology_type> topology = new topology_type(mesh->comm(), mesh->debug);
+ ALE::Obj<sieve_type> sieve = new sieve_type(mesh->comm());
+ ALE::Obj<topology_type> topology = new topology_type(mesh->comm());
ALE::New::SieveBuilder<sieve_type>::buildTopology(sieve, meshDim, numCells, cells, numVertices, interpolate, numCorners);
sieve->stratify();
topology->setPatch(0, sieve);
topology->stratify();
- mesh->setTopologyNew(topology);
- ALE::New::SieveBuilder<sieve_type>::buildCoordinates(mesh->getSection("coordinates"), meshDim, coordinates);
+ mesh->setTopology(topology);
+ ALE::New::SieveBuilder<sieve_type>::buildCoordinates(mesh->getRealSection("coordinates"),
+ meshDim, coordinates);
delete[] coordinates; coordinates = NULL;
delete[] cells; cells = NULL;
builtTopology = true;
@@ -132,7 +132,7 @@
// ----------------------------------------------------------------------
// Write mesh to file.
void
-pylith::meshio::MeshIOAscii::write(const Obj<Mesh>& mesh) const
+pylith::meshio::MeshIOAscii::write(const ALE::Obj<Mesh>& mesh) const
{ // write
std::ofstream fileout(_filename.c_str());
if (!fileout.is_open() || !fileout.good()) {
@@ -217,13 +217,16 @@
// Write mesh vertices.
void
pylith::meshio::MeshIOAscii::_writeVertices(std::ostream& fileout,
- const Obj<Mesh>& mesh) const
+ const ALE::Obj<Mesh>& mesh) const
{ // _writeVertices
- const Obj<Mesh::section_type>& coords_field = mesh->getSection("coordinates");
- const Obj<Mesh::topology_type>& topology = mesh->getTopologyNew();
- const Mesh::section_type::patch_type patch = 0;
- const Obj<Mesh::topology_type::label_sequence>& vertices = topology->depthStratum(patch, 0);
- const int embedDim = coords_field->getFiberDimension(patch, *vertices->begin());
+ const ALE::Obj<Mesh::real_section_type>&
+ coords_field = mesh->getRealSection("coordinates");
+ const ALE::Obj<Mesh::topology_type>& topology = mesh->getTopology();
+ const Mesh::real_section_type::patch_type patch = 0;
+ const ALE::Obj<Mesh::topology_type::label_sequence>& vertices =
+ topology->depthStratum(patch, 0);
+ const int embedDim =
+ coords_field->getFiberDimension(patch, *vertices->begin());
fileout
<< " vertices = {\n"
@@ -233,8 +236,11 @@
<< std::resetiosflags(std::ios::fixed)
<< std::setiosflags(std::ios::scientific)
<< std::setprecision(6);
- for(Mesh::topology_type::label_sequence::iterator v_iter = vertices->begin(); v_iter != vertices->end(); ++v_iter) {
- const Mesh::section_type::value_type *coordinates = coords_field->restrict(patch, *v_iter);
+ for(Mesh::topology_type::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const Mesh::real_section_type::value_type *coordinates =
+ coords_field->restrict(patch, *v_iter);
fileout << " ";
for(int d = 0; d < embedDim; ++d) {
@@ -313,14 +319,17 @@
// Write mesh cells.
void
pylith::meshio::MeshIOAscii::_writeCells(std::ostream& fileout,
- const Obj<Mesh>& mesh) const
+ const ALE::Obj<Mesh>& mesh) const
{ // _writeCells
- const Obj<topology_type>& topology = mesh->getTopologyNew();
- const topology_type::patch_type patch = 0;
- const Obj<sieve_type>& sieve = topology->getPatch(patch);
- const Obj<Mesh::topology_type::label_sequence>& cells = topology->heightStratum(patch, 0);
- const Obj<Mesh::numbering_type>& vNumbering = mesh->getLocalNumbering(0);
- const int numCorners = sieve->nCone(*cells->begin(), topology->depth())->size();
+ const ALE::Obj<topology_type>& topology = mesh->getTopology();
+ const topology_type::patch_type patch = 0;
+ const ALE::Obj<sieve_type>& sieve = topology->getPatch(patch);
+ const ALE::Obj<Mesh::topology_type::label_sequence>& cells =
+ topology->heightStratum(patch, 0);
+ const ALE::Obj<Mesh::numbering_type>& vNumbering =
+ mesh->getFactory()->getLocalNumbering(topology, patch, 0);
+ const int numCorners = sieve->nCone(*cells->begin(),
+ topology->depth())->size();
fileout
<< " cells = {\n"
@@ -329,13 +338,17 @@
<< " simplices = {\n";
const int offset = (useIndexZero()) ? 0 : 1;
- for(Mesh::topology_type::label_sequence::iterator e_iter = cells->begin(); e_iter != cells->end(); ++e_iter) {
+ for(Mesh::topology_type::label_sequence::iterator e_iter = cells->begin();
+ e_iter != cells->end();
+ ++e_iter) {
fileout << " ";
- const Obj<sieve_type::traits::coneSequence>& cone = sieve->cone(*e_iter);
-
- for(sieve_type::traits::coneSequence::iterator c_iter = cone->begin(); c_iter != cone->end(); ++c_iter) {
- fileout << std::setw(8) << vNumbering->getIndex(*c_iter) + offset;
- }
+ const ALE::Obj<sieve_type::traits::coneSequence>& cone =
+ sieve->cone(*e_iter);
+ for(sieve_type::traits::coneSequence::iterator c_iter = cone->begin();
+ c_iter != cone->end();
+ ++c_iter)
+ fileout << std::setw(8)
+ << vNumbering->getIndex(*c_iter) + offset;
fileout << "\n";
} // for
fileout
@@ -347,7 +360,7 @@
// Read mesh group.
void
pylith::meshio::MeshIOAscii::_readGroup(std::istream& filein,
- const Obj<Mesh>& mesh) const
+ const ALE::Obj<Mesh>& mesh) const
{ // _readGroup
std::string name = ""; // Name of group
int dimension = 0; // Topology dimension associated with group
@@ -392,9 +405,9 @@
#if 0
assert(!mesh.isNull());
- Obj<Mesh::field_type> groupField = mesh->getField(name);
+ ALE::Obj<Mesh::field_type> groupField = mesh->getField(name);
const int meshDim = mesh->getDimension();
- Obj<std::list<Mesh::point_type> > patchPoints =
+ ALE::Obj<std::list<Mesh::point_type> > patchPoints =
std::list<Mesh::point_type>();
Mesh::field_type::patch_type patch;
@@ -417,7 +430,7 @@
// Write mesh group.
void
pylith::meshio::MeshIOAscii::_writeGroup(std::ostream& fileout,
- const Obj<Mesh>& mesh,
+ const ALE::Obj<Mesh>& mesh,
const char* name) const
{ // _writeGroup
//_writeGroup(fileout, mesh);
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.hh 2006-10-04 22:57:23 UTC (rev 4701)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIOAscii.hh 2006-10-04 23:59:59 UTC (rev 4702)
@@ -17,8 +17,6 @@
#include <string> // HASA std::string
#include "MeshIO.hh"
-using ALE::Obj;
-
namespace pylith {
namespace meshio {
class MeshIOAscii;
@@ -58,14 +56,14 @@
* @param pMesh Pointer to PETSc mesh object
* @param interpolate Flag indicating whether to build intermediate topology
*/
- void read(Obj<Mesh>& mesh,
+ void read(ALE::Obj<Mesh>& mesh,
const bool interpolate =false);
/** Write mesh to file.
*
* @param mesh PETSc mesh object
*/
- void write(const Obj<Mesh>& mesh) const;
+ void write(const ALE::Obj<Mesh>& mesh) const;
// PRIVATE METHODS ------------------------------------------------------
private :
@@ -88,7 +86,7 @@
* @param mesh PETSc mesh
*/
void _writeVertices(std::ostream& fileout,
- const Obj<Mesh>& mesh) const;
+ const ALE::Obj<Mesh>& mesh) const;
/** Read mesh cells.
*
@@ -108,7 +106,7 @@
* @param mesh PETSc mesh
*/
void _writeCells(std::ostream& fileout,
- const Obj<Mesh>& mesh) const;
+ const ALE::Obj<Mesh>& mesh) const;
/** Read mesh group.
*
@@ -116,7 +114,7 @@
* @param pMesh Pointer to PETSc mesh
*/
void _readGroup(std::istream& filein,
- const Obj<Mesh>& pMesh) const;
+ const ALE::Obj<Mesh>& pMesh) const;
/** Write mesh group.
*
@@ -125,7 +123,7 @@
* @param name Name of group
*/
void _writeGroup(std::ostream& fileout,
- const Obj<Mesh>& mesh,
+ const ALE::Obj<Mesh>& mesh,
const char* name) const;
// PRIVATE MEMBERS ------------------------------------------------------
More information about the cig-commits
mailing list