[cig-commits] r14954 - in short/3D/PyLith/trunk: libsrc/materials libsrc/meshio pylith/meshio unittests/pytests/meshio
brad at geodynamics.org
brad at geodynamics.org
Sat May 9 18:56:49 PDT 2009
Author: brad
Date: 2009-05-09 18:56:48 -0700 (Sat, 09 May 2009)
New Revision: 14954
Modified:
short/3D/PyLith/trunk/libsrc/materials/Material.cc
short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py
short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py
short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormMesh.py
short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormSubMesh.py
short/3D/PyLith/trunk/unittests/pytests/meshio/TestCellFilterAvg.py
short/3D/PyLith/trunk/unittests/pytests/meshio/TestVertexFilterVecNorm.py
Log:
Fixed bug in output of material data. Needed to turn on filter in Python. Need to translate property/state variable vector field type into multi-location vector field type.
Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc 2009-05-10 01:56:48 UTC (rev 14954)
@@ -262,7 +262,9 @@
assert(!cells.isNull());
const SieveMesh::label_sequence::iterator cellsBegin = cells->begin();
const SieveMesh::label_sequence::iterator cellsEnd = cells->end();
-
+
+ topology::FieldBase::VectorFieldEnum fieldType = topology::FieldBase::OTHER;
+
if (propertyIndex >= 0) { // If field is a property
int propOffset = 0;
const string_vector& properties = _metadata.properties();
@@ -292,8 +294,8 @@
field->allocate();
} // if
assert(!fieldSection.isNull());
- field->vectorFieldType(_metadata.fieldType(name, Metadata::PROPERTY));
field->label(name);
+ fieldType = _metadata.fieldType(name, Metadata::PROPERTY);
// Buffer for property at cell's quadrature points
double_array fieldCell(numQuadPts*fiberDim);
@@ -347,7 +349,7 @@
field->allocate();
} // if
assert(!fieldSection.isNull());
- field->vectorFieldType(_metadata.fieldType(name, Metadata::STATEVAR));
+ fieldType = _metadata.fieldType(name, Metadata::STATEVAR);
field->label(name);
// Buffer for state variable at cell's quadrature points
@@ -372,6 +374,33 @@
fieldSection->updatePoint(*c_iter, &fieldCell[0]);
} // for
} // if/else
+
+ topology::FieldBase::VectorFieldEnum multiType =
+ topology::FieldBase::MULTI_OTHER;
+ switch (fieldType)
+ { // switch
+ case topology::FieldBase::SCALAR:
+ multiType = topology::FieldBase::MULTI_SCALAR;
+ break;
+ case topology::FieldBase::VECTOR:
+ multiType = topology::FieldBase::MULTI_VECTOR;
+ break;
+ case topology::FieldBase::TENSOR:
+ multiType = topology::FieldBase::MULTI_TENSOR;
+ break;
+ case topology::FieldBase::OTHER:
+ multiType = topology::FieldBase::MULTI_OTHER;
+ break;
+ case topology::FieldBase::MULTI_SCALAR:
+ case topology::FieldBase::MULTI_VECTOR:
+ case topology::FieldBase::MULTI_TENSOR:
+ case topology::FieldBase::MULTI_OTHER:
+ default :
+ std::cerr << "Bad vector field type for Material." << std::endl;
+ assert(0);
+ throw std::logic_error("Bad vector field type for Material.");
+ } // switch
+ field->vectorFieldType(multiType);
} // getField
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc 2009-05-10 01:56:48 UTC (rev 14954)
@@ -93,7 +93,6 @@
_fieldAvg->newSection(sectionIn->getChart(), fiberDim);
_fieldAvg->allocate();
- _fieldAvg->label(fieldIn.label());
switch (fieldIn.vectorFieldType())
{ // switch
case topology::FieldBase::MULTI_SCALAR:
@@ -115,6 +114,7 @@
default :
std::cerr << "Bad vector field type for CellFilterAvg." << std::endl;
assert(0);
+ throw std::logic_error("Bad vector field type for CellFilterAvg.");
} // switch
} // if
assert(0 != _fieldAvg);
@@ -137,9 +137,11 @@
fieldAvgCell[i] += wts[iQuad] / scalar * values[iQuad*fiberDim+i];
sectionAvg->updatePoint(*c_iter, &fieldAvgCell[0]);
- PetscLogFlops( numQuadPts*fiberDim*3 );
} // for
+ PetscLogFlops( cells->size() * numQuadPts*fiberDim*3 );
+ _fieldAvg->label(fieldIn.label());
+
return *_fieldAvg;
} // filter
Modified: short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py 2009-05-10 01:56:48 UTC (rev 14954)
@@ -37,6 +37,7 @@
"""
CellFilter.__init__(self, name)
ModuleCellFilterAvg.__init__(self)
+ self.filter = True
return
Modified: short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py 2009-05-10 01:56:48 UTC (rev 14954)
@@ -37,6 +37,7 @@
"""
CellFilter.__init__(self, name)
ModuleCellFilterAvg.__init__(self)
+ self.filter = True
return
Modified: short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormMesh.py 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormMesh.py 2009-05-10 01:56:48 UTC (rev 14954)
@@ -37,6 +37,7 @@
"""
VertexFilter.__init__(self, name)
ModuleVertexFilterVecNorm.__init__(self)
+ self.filter = True
return
Modified: short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormSubMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormSubMesh.py 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/pylith/meshio/VertexFilterVecNormSubMesh.py 2009-05-10 01:56:48 UTC (rev 14954)
@@ -37,6 +37,7 @@
"""
VertexFilter.__init__(self, name)
ModuleVertexFilterVecNorm.__init__(self)
+ self.filter = True
return
Modified: short/3D/PyLith/trunk/unittests/pytests/meshio/TestCellFilterAvg.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/meshio/TestCellFilterAvg.py 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/unittests/pytests/meshio/TestCellFilterAvg.py 2009-05-10 01:56:48 UTC (rev 14954)
@@ -31,6 +31,7 @@
"""
filter = CellFilterAvgMesh()
filter._configure()
+ self.failIf(filter.filter is None)
return
Modified: short/3D/PyLith/trunk/unittests/pytests/meshio/TestVertexFilterVecNorm.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/meshio/TestVertexFilterVecNorm.py 2009-05-10 01:33:18 UTC (rev 14953)
+++ short/3D/PyLith/trunk/unittests/pytests/meshio/TestVertexFilterVecNorm.py 2009-05-10 01:56:48 UTC (rev 14954)
@@ -31,6 +31,7 @@
"""
filter = VertexFilterVecNormMesh()
filter._configure()
+ self.failIf(filter.filter is None)
return
More information about the CIG-COMMITS
mailing list