[cig-commits] r22042 - short/3D/PyLith/trunk/libsrc/pylith/meshio
knepley at geodynamics.org
knepley at geodynamics.org
Fri May 10 20:43:34 PDT 2013
Author: knepley
Date: 2013-05-10 20:43:34 -0700 (Fri, 10 May 2013)
New Revision: 22042
Modified:
short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc
Log:
Removed sieve from MeshIO
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc 2013-05-11 03:35:34 UTC (rev 22041)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc 2013-05-11 03:43:34 UTC (rev 22042)
@@ -28,18 +28,11 @@
#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
-#include "Selection.hh" // USES boundary()
-
#include <cassert> // USES assert()
#include <sstream> // USES std::ostringstream
#include <stdexcept> // USES std::runtime_error
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::IntSection IntSection;
-
-// ----------------------------------------------------------------------
// Constructor
pylith::meshio::MeshIO::MeshIO(void) :
_mesh(0),
@@ -120,40 +113,6 @@
assert(spaceDim);
assert(_mesh);
-#if 0 // Sieve
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
-
- const ALE::Obj<SieveMesh::label_sequence>& vertices = sieveMesh->depthStratum(0);
- assert(!vertices.isNull());
- const SieveMesh::label_sequence::iterator verticesBegin = vertices->begin();
- const SieveMesh::label_sequence::iterator verticesEnd = vertices->end();
- const ALE::Obj<RealSection>& coordsField =
- sieveMesh->hasRealSection("coordinates_dimensioned") ?
- sieveMesh->getRealSection("coordinates_dimensioned") :
- sieveMesh->getRealSection("coordinates");
- assert(!coordsField.isNull());
-
- *numVertices = vertices->size();
- assert(*numVertices > 0);
- assert(vertices->size() > 0);
- *spaceDim = coordsField->getFiberDimension(*vertices->begin());
- assert(*spaceDim > 0);
-
- const int size = (*numVertices) * (*spaceDim);
- coordinates->resize(size);
-
- int i = 0;
- for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
- v_iter != verticesEnd;
- ++v_iter) {
- const RealSection::value_type *vertexCoords =
- coordsField->restrictPoint(*v_iter);
- for (int iDim=0; iDim < *spaceDim; ++iDim)
- (*coordinates)[i++] = vertexCoords[iDim];
- } // for
-#endif
-
const spatialdata::geocoords::CoordSys* cs = _mesh->coordsys();assert(cs);
*spaceDim = cs->spaceDim();
@@ -198,44 +157,6 @@
assert(meshDim);
assert(_mesh);
-#if 0 // Sieve
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
-
- const ALE::Obj<SieveMesh::sieve_type>& sieve = sieveMesh->getSieve();
- assert(!sieve.isNull());
- const ALE::Obj<SieveMesh::label_sequence>& meshCells = sieveMesh->heightStratum(0);
- assert(!meshCells.isNull());
- const SieveMesh::label_sequence::iterator meshCellsBegin = meshCells->begin();
- const SieveMesh::label_sequence::iterator meshCellsEnd = meshCells->end();
-
- *meshDim = _mesh->dimension();
- *numCells = meshCells->size();
- *numCorners = sieveMesh->getNumCellCorners();
-
- const ALE::Obj<SieveMesh::numbering_type>& vNumbering =
- sieveMesh->getFactory()->getLocalNumbering(sieveMesh, 0);
-
- const int size = (*numCells) * (*numCorners);
- cells->resize(size);
-
- ALE::ISieveVisitor::PointRetriever<SieveMesh::sieve_type>
- pV(sieve->getMaxConeSize());
- int i = 0;
- for(SieveMesh::label_sequence::iterator e_iter = meshCellsBegin;
- e_iter != meshCellsEnd;
- ++e_iter) {
- sieve->cone(*e_iter, pV);
- const SieveMesh::point_type *cone = pV.getPoints();
- const int coneSize = pV.getSize();
- assert(coneSize == *numCorners);
- for(int p = 0; p < coneSize; ++p, ++i) {
- (*cells)[i] = vNumbering->getIndex(cone[p]);
- }
- pV.clear();
- } // for
-#endif // Sieve
-
PetscDM dmMesh = _mesh->dmMesh();assert(dmMesh);
topology::Stratum cellsStratum(dmMesh, topology::Stratum::HEIGHT, 0);
const PetscInt cStart = cellsStratum.begin();
@@ -285,29 +206,6 @@
PetscErrorCode err;
if (!_mesh->commRank()) {
-#if 1 // Sieve
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- if (!sieveMesh.isNull()) {
- const ALE::Obj<SieveMesh::label_type>& labelMaterials = sieveMesh->createLabel("material-id");
- const ALE::Obj<SieveMesh::label_sequence>& cells = sieveMesh->heightStratum(0);
- assert(!cells.isNull());
- const SieveMesh::label_sequence::iterator cellsBegin = cells->begin();
- const SieveMesh::label_sequence::iterator cellsEnd = cells->end();
-
- const int numCells = materialIds.size();
- if (cells->size() != numCells) {
- std::ostringstream msg;
- msg << "Mismatch in size of materials identifier array ("
- << numCells << ") and number of cells in mesh ("<< cells->size() << ").";
- throw std::runtime_error(msg.str());
- } // if
- int i = 0;
- for(SieveMesh::label_sequence::iterator e_iter = cellsBegin; e_iter != cellsEnd; ++e_iter) {
- sieveMesh->setValue(labelMaterials, *e_iter, materialIds[i++]);
- }
- }
-#endif // Sieve
-
PetscDM dmMesh = _mesh->dmMesh();assert(dmMesh);
topology::Stratum cellsStratum(dmMesh, topology::Stratum::HEIGHT, 0);
const PetscInt cStart = cellsStratum.begin();
@@ -338,32 +236,6 @@
assert(materialIds);
assert(_mesh);
-#if 0 // Sieve
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
-
- const ALE::Obj<SieveMesh::label_sequence>& cells =
- sieveMesh->heightStratum(0);
- assert(!cells.isNull());
- const SieveMesh::label_sequence::iterator cellsBegin = cells->begin();
- const SieveMesh::label_sequence::iterator cellsEnd = cells->end();
- const int numCells = cells->size();
-
- const int size = numCells;
- materialIds->resize(size);
-
- const ALE::Obj<SieveMesh::label_type>& labelMaterials =
- sieveMesh->getLabel("material-id");
- const int idDefault = 0;
-
- int i = 0;
- for(SieveMesh::label_sequence::iterator e_iter = cellsBegin;
- e_iter != cellsEnd;
- ++e_iter)
- (*materialIds)[i++] =
- sieveMesh->getValue(labelMaterials, *e_iter, idDefault);
-#endif // Sieve
-
PetscDM dmMesh = _mesh->dmMesh();assert(dmMesh);
topology::Stratum cellsStratum(dmMesh, topology::Stratum::HEIGHT, 0);
const PetscInt cStart = cellsStratum.begin();
@@ -391,35 +263,6 @@
assert(_mesh);
-#if 1 // Sieve
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- if (!sieveMesh.isNull()) {
- if (sieveMesh->hasIntSection(name)) {
- std::ostringstream msg;
- msg << "Could not setup group '" << name
- << "'. Group already exists in mesh.";
- throw std::runtime_error(msg.str());
- } // if
-
- const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
- assert(!groupField.isNull());
-
- const int numPoints = points.size();
- const int numVertices = sieveMesh->depthStratum(0)->size();
- const int numCells = sieveMesh->heightStratum(0)->size();
- if (CELL == type) {
- groupField->setChart(IntSection::chart_type(0,numCells));
- for(int i=0; i < numPoints; ++i)
- groupField->setFiberDimension(points[i], 1);
- } else if (VERTEX == type) {
- groupField->setChart(IntSection::chart_type(numCells, numCells+numVertices));
- for(int i=0; i < numPoints; ++i)
- groupField->setFiberDimension(numCells+points[i], 1);
- } // if/else
- sieveMesh->allocate(groupField);
- }
-#endif // Sieve
-
PetscDM dmMesh = _mesh->dmMesh();assert(dmMesh);
const PetscInt numPoints = points.size();
PetscErrorCode err;
@@ -449,49 +292,8 @@
PYLITH_METHOD_BEGIN;
assert(_mesh);
-
// dmMesh does not need to broadcast the label names. They come from proc 0.
-#if 1 // Sieve
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- if (!sieveMesh.isNull()) {
- if (!sieveMesh->commRank()) {
- const ALE::Obj<std::set<std::string> >& sectionNames =
- sieveMesh->getIntSections();
- int numGroups = sectionNames->size();
-
- MPI_Bcast(&numGroups, 1, MPI_INT, 0, sieveMesh->comm());
-
- const std::set<std::string>::const_iterator namesEnd = sectionNames->end();
- for (std::set<std::string>::const_iterator name=sectionNames->begin();
- name != namesEnd;
- ++name) {
- int len = name->size();
-
- MPI_Bcast(&len, 1, MPI_INT, 0, sieveMesh->comm());
- MPI_Bcast((void *) name->c_str(), len, MPI_CHAR, 0, sieveMesh->comm());
- }
- } else {
- int numGroups;
-
- MPI_Bcast(&numGroups, 1, MPI_INT, 0, sieveMesh->comm());
- for(int g = 0; g < numGroups; ++g) {
- char *name;
- int len;
-
- MPI_Bcast(&len, 1, MPI_INT, 0, sieveMesh->comm());
- name = new char[len+1];
- MPI_Bcast(name, len, MPI_CHAR, 0, sieveMesh->comm());
- name[len] = 0;
- const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
- assert(!groupField.isNull());
- sieveMesh->allocate(groupField);
- delete [] name;
- } // for
- } // if/else
- }
-#endif // Sieve
-
PYLITH_METHOD_END;
} // _distributeGroups
@@ -505,23 +307,6 @@
assert(names);
assert(_mesh);
-#if 0 // Sieve
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
-
- const ALE::Obj<std::set<std::string> >& sectionNames =
- sieveMesh->getIntSections();
-
- const int numGroups = sectionNames->size();
- names->resize(numGroups);
- const std::set<std::string>::const_iterator namesEnd = sectionNames->end();
- int i=0;
- for (std::set<std::string>::const_iterator name=sectionNames->begin();
- name != namesEnd;
- ++name)
- (*names)[i++] = *name;
-#endif // Sieve
-
PetscDM dmMesh = _mesh->dmMesh();assert(dmMesh);
PetscInt numGroups = 0;
PetscErrorCode err = 0;
@@ -551,53 +336,6 @@
assert(groupType);
assert(_mesh);
-#if 0
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
-
- if (!sieveMesh->hasIntSection(name)) {
- std::ostringstream msg;
- msg << "Could not get group '" << name
- << "'. Group missing from mesh.";
- throw std::runtime_error(msg.str());
- } // if
-
- const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
- assert(!groupField.isNull());
- const IntSection::chart_type& chart = groupField->getChart();
- SieveMesh::point_type firstPoint;
- IntSection::chart_type::const_iterator chartEnd = chart.end();
- for(IntSection::chart_type::const_iterator c_iter=chart.begin();
- c_iter != chartEnd;
- ++c_iter) {
- if (groupField->getFiberDimension(*c_iter)) {
- firstPoint = *c_iter;
- break;
- } // if
- }
- ALE::Obj<SieveMesh::numbering_type> numbering;
-
- if (sieveMesh->height(firstPoint) == 0) {
- *groupType = CELL;
- numbering = sieveMesh->getFactory()->getNumbering(sieveMesh,
- sieveMesh->depth());
- } else {
- *groupType = VERTEX;
- numbering = sieveMesh->getFactory()->getNumbering(sieveMesh, 0);
- } // if/else
- const int numPoints = groupField->size();
- points->resize(numPoints);
- int i = 0;
-
- for(IntSection::chart_type::const_iterator c_iter=chart.begin();
- c_iter != chartEnd;
- ++c_iter) {
- assert(!numbering.isNull());
- if (groupField->getFiberDimension(*c_iter)) (*points)[i++] =
- numbering->getIndex(*c_iter);
- } // for
-#endif
-
PetscDM dmMesh = _mesh->dmMesh();assert(dmMesh);
topology::Stratum cellsStratum(dmMesh, topology::Stratum::HEIGHT, 0);
const PetscInt cStart = cellsStratum.begin();
More information about the CIG-COMMITS
mailing list