[cig-commits] r14568 - in short/3D/PyLith/branches/pylith-swig: . doc/uml libsrc/meshio
brad at geodynamics.org
brad at geodynamics.org
Thu Apr 2 08:48:58 PDT 2009
Author: brad
Date: 2009-04-02 08:48:57 -0700 (Thu, 02 Apr 2009)
New Revision: 14568
Removed:
short/3D/PyLith/branches/pylith-swig/doc/uml/PyLith.vpp
Modified:
short/3D/PyLith/branches/pylith-swig/TODO
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.cc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.hh
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.cc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.hh
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.cc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.hh
Log:
Worked on output.
Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/TODO 2009-04-02 15:48:57 UTC (rev 14568)
@@ -39,6 +39,8 @@
Add _cleanup() to components to deallocate local data structures.
Add cleanup() to non-components to deallocate local data structures.
+ Remove Inventory class from Pyre
+
1. Reduce memory use (new labels) [Matt]
2. Nondimensionalize [Brad]
@@ -58,6 +60,8 @@
3. Power-law nonlinear rheology [Charles]
+
+
4. Savage-Presscott benchmark [Charles]
5. Interface with PETSc nonlinear solvers [Brad and Matt]
Deleted: short/3D/PyLith/branches/pylith-swig/doc/uml/PyLith.vpp
===================================================================
(Binary files differ)
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.cc 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.cc 2009-04-02 15:48:57 UTC (rev 14568)
@@ -12,27 +12,28 @@
#include <portinfo>
-#include "CellFilter.hh" // implementation of class methods
-
#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
// ----------------------------------------------------------------------
// Constructor
-pylith::meshio::CellFilter::CellFilter(void) :
+template<typename mesh_type>
+pylith::meshio::CellFilter<mesh_type>::CellFilter(void) :
_quadrature(0)
{ // constructor
} // constructor
// ----------------------------------------------------------------------
// Destructor
-pylith::meshio::CellFilter::~CellFilter(void)
+template<typename mesh_type>
+pylith::meshio::CellFilter<mesh_type>::~CellFilter(void)
{ // destructor
delete _quadrature; _quadrature = 0;
} // destructor
// ----------------------------------------------------------------------
// Copy constructor.
-pylith::meshio::CellFilter::CellFilter(const CellFilter& f) :
+template<typename mesh_type>
+pylith::meshio::CellFilter<mesh_type>::CellFilter(const CellFilter& f) :
_quadrature(0)
{ // copy constructor
if (0 != f._quadrature)
@@ -41,8 +42,9 @@
// ----------------------------------------------------------------------
// Set quadrature associated with cells.
+template<typename mesh_type>
void
-pylith::meshio::CellFilter::quadrature(const feassemble::Quadrature* q)
+pylith::meshio::CellFilter<mesh_type>::quadrature(const feassemble::Quadrature* q)
{ // quadrature
delete _quadrature; _quadrature = (0 != q) ? q->clone() : 0;
} // quadrature
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.hh 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilter.hh 2009-04-02 15:48:57 UTC (rev 14568)
@@ -20,22 +20,26 @@
#if !defined(pylith_meshio_cellfilter_hh)
#define pylith_meshio_cellfilter_hh
-#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh, real_section_type
-#include "pylith/utils/vectorfields.hh" // USES VectorFieldEnum
+// Include directives ---------------------------------------------------
+#include "meshiofwd.hh" // forward declarations
-namespace pylith {
- namespace meshio {
- class CellFilter;
- } // meshio
+#include "pylith/feassemble/topologyfwd.hh" // HOLDSA Quadrature<Mesh>
+#include "pylith/feassemble/feassemblefwd.hh" // HOLDSA Quadrature<Mesh>
- namespace feassemble {
- class Quadrature;
- } // meshio
-} // pylith
-
+// CellFilter -----------------------------------------------------------
+template<typename mesh_type>
class pylith::meshio::CellFilter
{ // CellFilter
+// PROTECTED TYPEDEFS ///////////////////////////////////////////////////
+protected:
+
+ // Convenience typedefs
+ typedef typename mesh_type::RealSection RealSection;
+ typedef typename mesh_type::SieveMesh SieveMesh;
+ typedef typename SieveMesh::label_sequence label_sequence;
+ typedef typename RealSection::chart_type chart_type;
+
// PUBLIC METHODS ///////////////////////////////////////////////////////
public :
@@ -56,23 +60,19 @@
*
* @param q Quadrature for cells.
*/
- void quadrature(const feassemble::Quadrature* q);
+ void quadrature(const feassemble::Quadrature<mesh_type>* q);
/** Filter field. Field type of filtered field is returned via an argument.
*
- * @param fieldType Field type of filtered field.
* @param fieldIn Field to filter.
- * @param mesh PETSc mesh.
- * @param label Label identifying cells.
- * @param Value of label of cells to filter.
+ * @param label Value of label of cells to filter.
+ * @param labelId Id associated with label of cells to filter.
*
* @returns Averaged field.
*/
virtual
- const ALE::Obj<real_section_type>&
- filter(VectorFieldEnum* fieldType,
- const ALE::Obj<real_section_type>& fieldIn,
- const ALE::Obj<Mesh>& mesh,
+ const topology::Field<mesh_type>&
+ filter(const topology::Field<mesh_type>& fieldIn,
const char* label =0,
const int labelId =0) = 0;
@@ -95,10 +95,13 @@
// PROTECTED MEMBERS ////////////////////////////////////////////////////
protected :
- feassemble::Quadrature* _quadrature; ///< Quadrature associated with cells.
+ /// Quadrature associated with cells.
+ feassemble::Quadrature<mesh_type>* _quadrature;
}; // CellFilter
+#include "CellFilter.cc" // template definitions
+
#endif // pylith_meshio_cellfilter_hh
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.cc 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.cc 2009-04-02 15:48:57 UTC (rev 14568)
@@ -12,75 +12,102 @@
#include <portinfo>
-#include "CellFilterAvg.hh" // implementation of class methods
-
#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
// ----------------------------------------------------------------------
// Constructor
-pylith::meshio::CellFilterAvg::CellFilterAvg(void)
+template<typename mesh_type>
+pylith::meshio::CellFilterAvg<mesh_type>::CellFilterAvg(void)
{ // constructor
} // constructor
// ----------------------------------------------------------------------
// Destructor
-pylith::meshio::CellFilterAvg::~CellFilterAvg(void)
+template<typename mesh_type>
+pylith::meshio::CellFilterAvg<mesh_type>::~CellFilterAvg(void)
{ // destructor
} // destructor
// ----------------------------------------------------------------------
// Copy constructor.
-pylith::meshio::CellFilterAvg::CellFilterAvg(const CellFilterAvg& f) :
+template<typename mesh_type>
+pylith::meshio::CellFilterAvg<mesh_type>::CellFilterAvg(const CellFilterAvg& f) :
CellFilter(f)
{ // copy constructor
} // copy constructor
// ----------------------------------------------------------------------
// Create copy of filter.
-pylith::meshio::CellFilter*
-pylith::meshio::CellFilterAvg::clone(void) const
+template<typename mesh_type>
+pylith::meshio::CellFilter<mesh_type>*
+pylith::meshio::CellFilterAvg<mesh_type>::clone(void) const
{ // clone
- return new CellFilterAvg(*this);
+ return new CellFilterAvg<mesh_type>(*this);
} // clone
// ----------------------------------------------------------------------
// Filter field.
-const ALE::Obj<pylith::real_section_type>&
-pylith::meshio::CellFilterAvg::filter(
- VectorFieldEnum* fieldType,
- const ALE::Obj<real_section_type>& fieldIn,
- const ALE::Obj<Mesh>& mesh,
+template<typename mesh_type>
+const pylith::topology::Field<mesh_type>&
+pylith::meshio::CellFilterAvg<mesh_type>::filter(
+ const topology::Field<mesh_type>& fieldIn,
const char* label,
const int labelId)
{ // filter
- assert(0 != fieldType);
assert(0 != _quadrature);
const int numQuadPts = _quadrature->numQuadPts();
const double_array& wts = _quadrature->quadWts();
- const ALE::Obj<Mesh::label_sequence>& cells = (0 == label) ?
+ const ALE::Obj<SieveMesh>& sieveMesh = fieldIn.mesh().sieveMesh();
+ assert(!sieveMesh.isNull());
+
+ const ALE::Obj<SieveMesh::label_sequence>& cells = (0 == label) ?
mesh->heightStratum(0) :
mesh->getLabelStratum(label, labelId);
assert(!cells.isNull());
- const Mesh::label_sequence::iterator cellsEnd = cells->end();
+ const SieveMesh::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 ALE::Obj<RealSection>& sectionIn = fieldIn.section();
+ assert(!sectionIn.isNull());
+ const int totalFiberDim = sectionIn->getFiberDimension(*cells->begin());
const int fiberDim = totalFiberDim / numQuadPts;
assert(fiberDim * numQuadPts == totalFiberDim);
- *fieldType = OTHER_FIELD; // Don't know field type
-
- // Allocation field if necessary
- if (_fieldAvg.isNull() ||
- fiberDim != _fieldAvg->getFiberDimension(*cells->begin())) {
- _fieldAvg = new real_section_type(mesh->comm(), mesh->debug());
- _fieldAvg->setChart(real_section_type::chart_type(*std::min_element(cells->begin(), cells->end()),
- *std::max_element(cells->begin(), cells->end())+1));
- _fieldAvg->setFiberDimension(cells, fiberDim);
- mesh->allocate(_fieldAvg);
+ // Allocate field if necessary
+ if (0 == _fieldAvg) {
+ _fieldAvg = new topology::Field<mesh_type>(fieldIn.mesh());
+ assert(0 != _fieldAvg);
+ _fieldAvg->newSection(fieldIn->getChart(), fiberDim);
+ _fieldAvg->allocate();
+
+ _fieldAvg->label(fieldIn.label());
+ switch (fieldIn.vectorFieldType())
+ { // switch
+ case FieldBase::MULTI_SCALAR:
+ _fieldAvg->vectorFieldType(FieldBase::SCALAR);
+ break;
+ case FieldBase::MULTI_VECTOR:
+ _fieldAvg->vectorFieldType(FieldBase::VECTOR);
+ break;
+ case FieldBase::MULTI_TENSOR:
+ _fieldAvg->vectorFieldType(FieldBase::TENSOR);
+ break;
+ case FieldBase::MULTI_OTHER:
+ _fieldAvg->vectorFieldType(FieldBase::OTHER);
+ break;
+ case FieldBase::SCALAR:
+ case FieldBase::VECTOR:
+ case FieldBase::TENSOR:
+ case FieldBase::OTHER:
+ default :
+ std::cerr << "Bad vector field type for CellFilterAvg." << std::endl;
+ assert(0);
+ } // switch
} // if
+ assert(0 != _fieldAvg);
+ const ALE::Obj<RealSection>& sectionAvg = _fieldAvg->section();
double_array fieldAvgCell(fiberDim);
double scalar = 0.0;
@@ -88,22 +115,21 @@
scalar += wts[iQuad];
// Loop over cells
- for (Mesh::label_sequence::iterator c_iter=cells->begin();
+ for (SieveMesh::label_sequence::iterator c_iter=cells->begin();
c_iter != cellsEnd;
++c_iter) {
- const real_section_type::value_type* values =
- fieldIn->restrictPoint(*c_iter);
+ const double* values = sectionIn->restrictPoint(*c_iter);
fieldAvgCell = 0.0;
for (int iQuad=0; iQuad < numQuadPts; ++iQuad)
for (int i=0; i < fiberDim; ++i)
fieldAvgCell[i] += wts[iQuad] / scalar * values[iQuad*fiberDim+i];
- _fieldAvg->updatePoint(*c_iter, &fieldAvgCell[0]);
+ _sectionAvg->updatePoint(*c_iter, &fieldAvgCell[0]);
PetscLogFlops( numQuadPts*fiberDim*3 );
} // for
- return _fieldAvg;
+ return *_fieldAvg;
} // filter
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.hh 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/CellFilterAvg.hh 2009-04-02 15:48:57 UTC (rev 14568)
@@ -19,15 +19,11 @@
#if !defined(pylith_meshio_cellfilteravg_hh)
#define pylith_meshio_cellfilteravg_hh
-
+// Include directives ---------------------------------------------------
#include "CellFilter.hh" // ISA CellFilter
-namespace pylith {
- namespace meshio {
- class CellFilterAvg;
- } // meshio
-} // pylith
-
+// CellFilter -----------------------------------------------------------
+template<typename mesh_type>
class pylith::meshio::CellFilterAvg : public CellFilter
{ // CellFilterAvg
@@ -46,20 +42,16 @@
*/
CellFilter* clone(void) const;
- /** Filter field. Field type of filtered field is returned via an argument.
+ /** Filter field over cells.
*
- * @param fieldType Field type of filtered field.
* @param fieldIn Field to filter.
- * @param mesh PETSc mesh.
* @param label Label identifying cells.
- * @param Value of label of cells to filter.
+ * @param labelId Value of label of cells to filter.
*
* @returns Averaged field.
*/
- const ALE::Obj<real_section_type>&
- filter(VectorFieldEnum* fieldType,
- const ALE::Obj<real_section_type>& fieldIn,
- const ALE::Obj<Mesh>& mesh,
+ const topology::Field<mesh_type>&
+ filter(const topology::Field<mesh_type>& fieldIn,
const char* label =0,
const int labelId =0);
@@ -82,10 +74,12 @@
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
- ALE::Obj<real_section_type> _fieldAvg; ///< Averaged cell field
+ topology::Field<mesh_type>* _fieldAvg; ///< Averaged cell field
}; // CellFilterAvg
+#include "CellFilterAvg.cc" // template definitions
+
#endif // pylith_meshio_cellfilteravg_hh
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am 2009-04-02 15:48:57 UTC (rev 14568)
@@ -15,7 +15,9 @@
subpkginclude_HEADERS = \
CellFilter.hh \
+ CellFilter.cc \
CellFilterAvg.hh \
+ CellFilterAvg.cc \
DataWriter.hh \
DataWriter.cc \
DataWriterVTK.hh \
@@ -33,7 +35,9 @@
OutputSolnSubset.hh \
UCDFaultFile.hh \
VertexFilter.hh \
+ VertexFilter.cc \
VertexFilterVecNorm.hh \
+ VertexFilterVecNorm.cc \
meshiofwd.hh
if ENABLE_CUBIT
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.cc 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.cc 2009-04-02 15:48:57 UTC (rev 14568)
@@ -12,30 +12,32 @@
#include <portinfo>
-#include "VertexFilter.hh" // implementation of class methods
-
// ----------------------------------------------------------------------
// Constructor
-pylith::meshio::VertexFilter::VertexFilter(void)
+template<typename mesh_type>
+pylith::meshio::VertexFilter<mesh_type>::VertexFilter(void)
{ // constructor
} // constructor
// ----------------------------------------------------------------------
// Destructor
-pylith::meshio::VertexFilter::~VertexFilter(void)
+template<typename mesh_type>
+pylith::meshio::VertexFilter<mesh_type>::~VertexFilter(void)
{ // destructor
} // destructor
// ----------------------------------------------------------------------
// Copy constructor.
-pylith::meshio::VertexFilter::VertexFilter(const VertexFilter& f)
+template<typename mesh_type>
+pylith::meshio::VertexFilter<mesh_type>::VertexFilter(const VertexFilter& f)
{ // copy constructor
} // copy constructor
// ----------------------------------------------------------------------
// operator=.
+template<typename mesh_type>
const pylith::meshio::VertexFilter&
-pylith::meshio::VertexFilter::operator=(const VertexFilter& f)
+pylith::meshio::VertexFilter<mesh_type>::operator=(const VertexFilter& f)
{ // operator=
} // operator=
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.hh 2009-04-02 14:39:01 UTC (rev 14567)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/VertexFilter.hh 2009-04-02 15:48:57 UTC (rev 14568)
@@ -20,16 +20,14 @@
#if !defined(pylith_meshio_vertexfilter_hh)
#define pylith_meshio_vertexfilter_hh
-#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh, real_section_type
-#include "pylith/utils/vectorfields.hh" // USES VectorFieldEnum
+// Include directives ---------------------------------------------------
+#include "meshiofwd.hh" // forward declarations
-namespace pylith {
- namespace meshio {
- class VertexFilter;
- } // meshio
+#include "pylith/feassemble/topologyfwd.hh" // HOLDSA Quadrature<Mesh>
+#include "pylith/feassemble/feassemblefwd.hh" // HOLDSA Quadrature<Mesh>
-} // pylith
-
+// VertexFilter ---------------------------------------------------------
+template<typename mesh_type>
class pylith::meshio::VertexFilter
{ // VertexFilter
@@ -49,17 +47,13 @@
virtual
VertexFilter* clone(void) const = 0;
- /** Filter field. Field type of filtered field is returned via an argument.
+ /** Filter field over vertices of a mesh.
*
- * @param fieldType Field type of filtered field.
* @param fieldIn Field to filter.
- * @param mesh PETSc mesh.
*/
virtual
- const ALE::Obj<real_section_type>&
- filter(VectorFieldEnum* fieldType,
- const ALE::Obj<real_section_type>& fieldIn,
- const ALE::Obj<Mesh>& mesh) = 0;
+ const topology::Field<mesh_type>&
+ filter(const topology::Field<mesh_type>& fieldIn) = 0;
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
@@ -80,6 +74,8 @@
}; // VertexFilter
+#include "VertexFilter.cc" // template definitions
+
#endif // pylith_meshio_vertexfilter_hh
More information about the CIG-COMMITS
mailing list