[cig-commits] r11542 - in short/3D/PyLith/trunk: libsrc/meshio unittests/libtests/meshio

brad at geodynamics.org brad at geodynamics.org
Mon Mar 24 22:43:42 PDT 2008


Author: brad
Date: 2008-03-24 22:43:42 -0700 (Mon, 24 Mar 2008)
New Revision: 11542

Modified:
   short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
   short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestCellFilterAvg.cc
Log:
Minor cleanup to account for fiber dimension == 0 for processors without cells/vertices for given material, fault, etc.

Modified: short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc	2008-03-25 00:17:51 UTC (rev 11541)
+++ short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc	2008-03-25 05:43:42 UTC (rev 11542)
@@ -65,16 +65,12 @@
   assert(!cells.isNull());
   const Mesh::label_sequence::iterator cellsEnd = cells->end();
 
+  // Only processors with cells for output get the correct fiber dimension.
   const int totalFiberDim = fieldIn->getFiberDimension(*cells->begin());
   const int fiberDim = totalFiberDim / numQuadPts;
   assert(fiberDim * numQuadPts == totalFiberDim);
 
-  if (1 == fiberDim)
-    *fieldType = SCALAR_FIELD;
-  else if (mesh->getDimension() == fiberDim)
-    *fieldType = VECTOR_FIELD;
-  else
-    *fieldType = OTHER_FIELD;
+  *fieldType = OTHER_FIELD; // Don't know field type
   
   // Allocation field if necessary
   if (_fieldAvg.isNull() ||

Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc	2008-03-25 00:17:51 UTC (rev 11541)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc	2008-03-25 05:43:42 UTC (rev 11542)
@@ -148,6 +148,14 @@
   assert(!field.isNull());
 
   try {
+    const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
+    assert(!vertices.isNull());
+    int rank = 0;
+    MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
+    std::cout << "Proc: " << rank
+	      << ", # vertices: " << vertices->size() 
+	      << std::endl;
+
     const std::string labelName = 
       (mesh->hasLabel("censored depth")) ? "censored depth" : "depth";
     const ALE::Obj<Mesh::numbering_type>& numbering =
@@ -156,7 +164,6 @@
 
     const int fiberDim = 
       field->getFiberDimension(*mesh->getLabelStratum(labelName, 0)->begin());
-    assert(fiberDim > 0);
     const int enforceDim = (fieldType != VECTOR_FIELD) ? fiberDim : 3;
 
     PetscErrorCode err = 0;
@@ -204,6 +211,16 @@
   assert(!field.isNull());
 
   try {
+    const ALE::Obj<Mesh::label_sequence>& cells = (0 == label) ?
+      mesh->heightStratum(0) :
+      mesh->getLabelStratum(label, labelId);
+    assert(!cells.isNull());
+    int rank = 0;
+    MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
+    std::cout << "Proc: " << rank
+	      << ", # cells: " << cells->size() 
+	      << std::endl;
+
     // Correctly handle boundary and fault meshes
     //const int depth = mesh->depth();
     const int depth = (0 == label) ? 1 : labelId;

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2008-03-25 00:17:51 UTC (rev 11541)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2008-03-25 05:43:42 UTC (rev 11542)
@@ -135,7 +135,9 @@
   assert(!coordsField.isNull());
 
   *numVertices = vertices->size();
+  assert(*numVertices > 0);
   *spaceDim = coordsField->getFiberDimension(*vertices->begin());
+  assert(*spaceDim > 0);
 
   const int size = (*numVertices) * (*spaceDim);
   coordinates->resize(size);

Modified: short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc	2008-03-25 00:17:51 UTC (rev 11541)
+++ short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc	2008-03-25 05:43:42 UTC (rev 11542)
@@ -56,7 +56,6 @@
   assert(!vertices.isNull());
   const Mesh::label_sequence::iterator verticesEnd = vertices->end();
 
-  const int totalFiberDim = fieldIn->getFiberDimension(*vertices->begin());
   const int fiberDim = fieldIn->getFiberDimension(*vertices->begin());
 
   // Allocation field if necessary

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestCellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestCellFilterAvg.cc	2008-03-25 00:17:51 UTC (rev 11541)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestCellFilterAvg.cc	2008-03-25 05:43:42 UTC (rev 11542)
@@ -68,7 +68,7 @@
 
 
 
-  const VectorFieldEnum fieldTypeE = SCALAR_FIELD;
+  const VectorFieldEnum fieldTypeE = OTHER_FIELD;
   const int fiberDimE = 1;
   const double fieldValuesE[] = {
     (1.5*1.1 + 0.5*1.2)/2.0,



More information about the cig-commits mailing list