[cig-commits] r13322 - in short/3D/PyLith/trunk: libsrc/faults libsrc/meshio libsrc/topology playpen/memcheck
knepley at geodynamics.org
knepley at geodynamics.org
Mon Nov 17 08:54:46 PST 2008
Author: knepley
Date: 2008-11-17 08:54:46 -0800 (Mon, 17 Nov 2008)
New Revision: 13322
Modified:
short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
short/3D/PyLith/trunk/libsrc/topology/Distributor.cc
short/3D/PyLith/trunk/playpen/memcheck/memory_usage.py
Log:
Changes for new stratification
Modified: short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc 2008-11-16 23:21:33 UTC (rev 13321)
+++ short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc 2008-11-17 16:54:46 UTC (rev 13322)
@@ -202,7 +202,7 @@
typedef ALE::Selection<ALE::Mesh> selection;
const Obj<ALE::Mesh::sieve_type>& faultSieve = fault->getSieve();
const Mesh::point_type firstFaultCell = *fault->heightStratum(1)->begin();
- const Obj<Mesh::label_sequence>& fFaces = fault->heightStratum(2);
+ const Obj<ALE::Mesh::label_sequence>& fFaces = fault->heightStratum(2);
const int numFaultFaces = fFaces->size();
const int faultDepth = fault->depth()-1; // Depth of fault cells
int numFaultCorners = 0; // The number of vertices in a fault cell
@@ -660,7 +660,7 @@
// This completes the set of cells scheduled to be replaced
PointSet replaceCellsBase(replaceCells);
- const ALE::Obj<Mesh::label_sequence>& faultBdVerts = faultBd->depthStratum(0);
+ const ALE::Obj<ALE::Mesh::label_sequence>& faultBdVerts = faultBd->depthStratum(0);
PointSet faultBdVertices;
faultBdVertices.insert(faultBdVerts->begin(), faultBdVerts->end());
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2008-11-16 23:21:33 UTC (rev 13321)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2008-11-17 16:54:46 UTC (rev 13322)
@@ -166,6 +166,19 @@
// Optimized stratification
const ALE::Obj<Mesh::label_type>& height = (*_mesh)->createLabel("height");
const ALE::Obj<Mesh::label_type>& depth = (*_mesh)->createLabel("depth");
+
+#ifdef IMESH_NEW_LABELS
+ height->setChart((*_mesh)->getSieve()->getChart());
+ depth->setChart((*_mesh)->getSieve()->getChart());
+ for(int c = 0; c < numCells+numVertices; ++c) {
+ height->setConeSize(c, 1);
+ depth->setConeSize(c, 1);
+ }
+ if (numCells+numVertices) {height->setSupportSize(0, numCells+numVertices);}
+ if (numCells+numVertices) {depth->setSupportSize(0, numCells+numVertices);}
+ height->allocate();
+ depth->allocate();
+#endif
for(int c = 0; c < numCells; ++c) {
height->setCone(0, c);
depth->setCone(1, c);
@@ -174,6 +187,10 @@
height->setCone(1, v);
depth->setCone(0, v);
}
+#ifdef IMESH_NEW_LABELS
+ height->recalculateLabel();
+ depth->recalculateLabel();
+#endif
(*_mesh)->setHeight(1);
(*_mesh)->setDepth(1);
} else {
@@ -413,10 +430,21 @@
} // if
int i = 0;
const Mesh::label_sequence::iterator end = cells->end();
- for(Mesh::label_sequence::iterator e_iter = cells->begin();
- e_iter != end;
- ++e_iter)
+
+#ifdef IMESH_NEW_LABELS
+ labelMaterials->setChart((*_mesh)->getSieve()->getChart());
+ for(Mesh::label_sequence::iterator e_iter = cells->begin(); e_iter != end; ++e_iter) {
+ labelMaterials->setConeSize(*e_iter, 1);
+ }
+ if (cells->size()) {labelMaterials->setSupportSize(0, cells->size());}
+ labelMaterials->allocate();
+#endif
+ for(Mesh::label_sequence::iterator e_iter = cells->begin(); e_iter != end; ++e_iter) {
(*_mesh)->setValue(labelMaterials, *e_iter, materialIds[i++]);
+ }
+#ifdef IMESH_NEW_LABELS
+ labelMaterials->recalculateLabel();
+#endif
} // if
logger.stagePop();
Modified: short/3D/PyLith/trunk/libsrc/topology/Distributor.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Distributor.cc 2008-11-16 23:21:33 UTC (rev 13321)
+++ short/3D/PyLith/trunk/libsrc/topology/Distributor.cc 2008-11-17 16:54:46 UTC (rev 13322)
@@ -64,8 +64,9 @@
pylith::topology::Distributor::distribute_private(ALE::Obj<Mesh>* const newMesh,
const ALE::Obj<Mesh>& origMesh)
{ // distribute
- typedef typename Mesh::point_type point_type;
- typedef typename DistributionType::partition_type partition_type;
+ typedef typename Mesh::point_type point_type;
+ typedef typename DistributionType::partitioner_type partitioner_type;
+ typedef typename DistributionType::partition_type partition_type;
const Obj<Mesh::sieve_type> newSieve = new Mesh::sieve_type(origMesh->comm(), origMesh->debug());
const Obj<Mesh::send_overlap_type> sendMeshOverlap = new Mesh::send_overlap_type(origMesh->comm(), origMesh->debug());
@@ -148,8 +149,21 @@
for(Mesh::labels_type::const_iterator l_iter = labels.begin(); l_iter != labels.end(); ++l_iter) {
if ((*newMesh)->hasLabel(l_iter->first)) continue;
+#ifdef IMESH_NEW_LABELS
const Obj<Mesh::label_type>& origLabel = l_iter->second;
const Obj<Mesh::label_type>& newLabel = (*newMesh)->createLabel(l_iter->first);
+
+ newLabel->setChart(newSieve->getChart());
+ // Size the local mesh
+ partitioner_type::sizeLocalSieveV(origLabel, partition, renumbering, newLabel);
+ // Create the remote meshes
+ DistributionType::completeConesV(origLabel, newLabel, renumbering, sendMeshOverlap, recvMeshOverlap);
+ // Create the local mesh
+ partitioner_type::createLocalSieveV(origLabel, partition, renumbering, newLabel);
+ newLabel->symmetrize();
+#else
+ const Obj<Mesh::label_type>& origLabel = l_iter->second;
+ const Obj<Mesh::label_type>& newLabel = (*newMesh)->createLabel(l_iter->first);
// Get remote labels
ALE::New::Completion<Mesh,Mesh::point_type>::scatterCones(origLabel, newLabel, sendMeshOverlap, recvMeshOverlap, renumbering);
// Create local label
@@ -162,6 +176,7 @@
origLabel->view(serialName.c_str());
newLabel->view(parallelName.c_str());
#endif
+#endif
}
// Create the parallel overlap
Obj<Mesh::send_overlap_type> sendParallelMeshOverlap = (*newMesh)->getSendOverlap();
Modified: short/3D/PyLith/trunk/playpen/memcheck/memory_usage.py
===================================================================
--- short/3D/PyLith/trunk/playpen/memcheck/memory_usage.py 2008-11-16 23:21:33 UTC (rev 13321)
+++ short/3D/PyLith/trunk/playpen/memcheck/memory_usage.py 2008-11-17 16:54:46 UTC (rev 13322)
@@ -15,8 +15,16 @@
sizeInt = 4
sizeDouble = 8
-sizeArrow = 40
+import distutils.sysconfig
+pointerSize = distutils.sysconfig.get_config_var('SIZEOF_VOID_P')
+if pointerSize == 4:
+ sizeArrow = 40 # 32 bit
+elif pointerSize == 8:
+ sizeArrow = 56 # 64 bit
+else:
+ raise RuntimeError('Could not determine the size of a pointer')
+
# ITEM FACTORIES ///////////////////////////////////////////////////////
def materialFactory(name):
@@ -131,7 +139,6 @@
# mesh
nbytes = sizeInt * ( 2 * (coneSize*ncells + nvertices + ncells) + \
coneSize*ncells )
- nbytes += sizeDouble * nvertices * dimension
memory['mesh'] = nbytes
# stratification
@@ -139,7 +146,7 @@
memory['stratification'] = nbytes
# coordinates
- nbytes = dimension * nvertices
+ nbytes = sizeDouble * dimension * nvertices
memory['coordinates'] = nbytes
# materials
@@ -374,7 +381,7 @@
print " Stratification: %d bytes (%.3f MB)" % \
(memory['stratification'],
memory['stratification'] / megabyte)
- print " Coordinates: %d bytes (%.3f MB)" % \
+ print " Coordinates: %d bytes (%.3f MB)" % \
(memory['coordinates'],
memory['coordinates'] / megabyte)
print " Materials: %d bytes (%.3f MB)" % \
More information about the CIG-COMMITS
mailing list