[cig-commits] r14323 - in short/3D/PyLith/branches/pylith-swig: libsrc/bc libsrc/feassemble unittests/libtests/bc unittests/libtests/feassemble
brad at geodynamics.org
brad at geodynamics.org
Sun Mar 15 15:52:00 PDT 2009
Author: brad
Date: 2009-03-15 15:52:00 -0700 (Sun, 15 Mar 2009)
New Revision: 14323
Modified:
short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityExplicit.cc
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityImplicit.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestAbsorbingDampers.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestNeumann.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/Makefile.am
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.hh
Log:
Changed names of solution fields (easier to understand). Updated ElasticityExplicit C++ unit tests.
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -283,13 +283,13 @@
&_cellVector[0]);
const topology::Field<topology::Mesh>& dispTpdt =
- fields->get("disp t+dt");
+ fields->get("disp(t+dt)");
const ALE::Obj<RealSection>& dispTpdtSection = dispTpdt.section();
assert(!dispTpdtSection.isNull());
topology::Mesh::RestrictVisitor dispTpdtVisitor(*dispTpdtSection,
numBasis*spaceDim);
const topology::Field<topology::Mesh>& dispTmdt =
- fields->get("disp t-dt");
+ fields->get("disp(t-dt)");
const ALE::Obj<RealSection>& dispTmdtSection = dispTmdt.section();
assert(!dispTmdtSection.isNull());
topology::Mesh::RestrictVisitor dispTmdtVisitor(*dispTmdtSection,
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityExplicit.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityExplicit.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -163,13 +163,13 @@
const SieveMesh::label_sequence::iterator cellsEnd = cells->end();
// Get sections
- const ALE::Obj<RealSection>& dispTSection = fields->get("disp t").section();
+ const ALE::Obj<RealSection>& dispTSection = fields->get("disp(t)").section();
assert(!dispTSection.isNull());
topology::Mesh::RestrictVisitor dispTVisitor(*dispTSection,
numBasis*spaceDim,
&dispTCell[0]);
const ALE::Obj<RealSection>& dispTmdtSection =
- fields->get("disp t-dt").section();
+ fields->get("disp(t-dt)").section();
assert(!dispTmdtSection.isNull());
topology::Mesh::RestrictVisitor dispTmdtVisitor(*dispTmdtSection,
numBasis*spaceDim,
@@ -309,7 +309,7 @@
// Get sections
const ALE::Obj<RealSection>& dispTSection =
- fields->get("disp t").section();
+ fields->get("disp(t)").section();
assert(!dispTSection.isNull());
// Get sparse matrix
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityImplicit.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/ElasticityImplicit.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -165,7 +165,7 @@
// Get sections
const ALE::Obj<RealSection>& dispTBctpdtSection =
- fields->get("dispTBctpdt").section();
+ fields->get("disp(T), bc(t+dt)").section();
assert(!dispTBctpdtSection.isNull());
topology::Mesh::RestrictVisitor dispTBctpdtVisitor(*dispTBctpdtSection,
numBasis*spaceDim,
@@ -347,7 +347,7 @@
// Get sections
const ALE::Obj<RealSection>& dispTBctpdtSection =
- fields->get("dispTBctpdt").section();
+ fields->get("disp(t), bc(t+dt)").section();
assert(!dispTBctpdtSection.isNull());
topology::Mesh::RestrictVisitor dispTBctpdtVisitor(*dispTBctpdtSection,
numBasis*spaceDim,
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestAbsorbingDampers.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestAbsorbingDampers.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -312,11 +312,11 @@
// Setup fields
CPPUNIT_ASSERT(0 != fields);
fields->add("residual");
- fields->add("disp t+dt");
- fields->add("disp t");
- fields->add("disp t-dt");
- fields->solutionName("disp t+dt");
- const char* history[] = { "disp t+dt", "disp t", "disp t-dt" };
+ fields->add("disp(t+dt)");
+ fields->add("disp(t)");
+ fields->add("disp(t-dt)");
+ fields->solutionName("disp(t+dt)");
+ const char* history[] = { "disp(t+dt)", "disp(t)", "disp(t-dt)" };
const int historySize = 3;
fields->createHistory(history, historySize);
@@ -335,11 +335,11 @@
const int numMeshCells = sieveMesh->heightStratum(0)->size();
const int fieldSize = _data->spaceDim * totalNumVertices;
const ALE::Obj<RealSection>& dispTpdtSection =
- fields->get("disp t+dt").section();
+ fields->get("disp(t+dt)").section();
const ALE::Obj<RealSection>& dispTSection =
- fields->get("disp t").section();
+ fields->get("disp(t)").section();
const ALE::Obj<RealSection>& dispTmdtSection =
- fields->get("disp t-dt").section();
+ fields->get("disp(t-dt)").section();
CPPUNIT_ASSERT(!dispTpdtSection.isNull());
CPPUNIT_ASSERT(!dispTSection.isNull());
CPPUNIT_ASSERT(!dispTmdtSection.isNull());
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestNeumann.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestNeumann.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestNeumann.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -253,8 +253,8 @@
// Set up fields
CPPUNIT_ASSERT(0 != fields);
fields->add("residual");
- fields->add("dispTBctpdt");
- fields->solutionName("dispTBctpdt");
+ fields->add("disp(t), bc(t+dt)");
+ fields->solutionName("disp(t), bc(t+dt)");
topology::Field<topology::Mesh>& residual = fields->get("residual");
const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/Makefile.am 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/Makefile.am 2009-03-15 22:52:00 UTC (rev 14323)
@@ -46,15 +46,15 @@
TestQuadrature.cc \
TestIntegrator.cc \
TestIntegratorElasticity.cc \
+ TestElasticityExplicit.cc \
+ TestElasticityExplicit1DLinear.cc \
+ TestElasticityExplicit1DQuadratic.cc \
+ TestElasticityExplicit2DLinear.cc \
+ TestElasticityExplicit2DQuadratic.cc \
+ TestElasticityExplicit3DLinear.cc \
+ TestElasticityExplicit3DQuadratic.cc \
test_feassemble.cc
-# TestElasticityExplicit.cc \
-# TestElasticityExplicit1DLinear.cc \
-# TestElasticityExplicit1DQuadratic.cc \
-# TestElasticityExplicit2DLinear.cc \
-# TestElasticityExplicit2DQuadratic.cc \
-# TestElasticityExplicit3DLinear.cc \
-# TestElasticityExplicit3DQuadratic.cc \
# TestElasticityImplicit.cc \
# TestElasticityImplicit1DLinear.cc \
# TestElasticityImplicit1DQuadratic.cc \
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -21,6 +21,7 @@
#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/SolutionFields.hh" // USES SolutionFields
+#include "pylith/topology/Jacobian.hh" // USES Jacobian
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
@@ -36,12 +37,16 @@
CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestElasticityExplicit );
// ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+typedef pylith::topology::Mesh::RealSection RealSection;
+
+// ----------------------------------------------------------------------
// Setup testing data.
void
pylith::feassemble::TestElasticityExplicit::setUp(void)
{ // setUp
+ _quadrature = new Quadrature<topology::Mesh>();
_data = 0;
- _quadrature = 0;
_material = 0;
_gravityField = 0;
} // setUp
@@ -149,22 +154,18 @@
} // testUseSolnIncr
// ----------------------------------------------------------------------
-// Test updateState().
+// Test initialize().
void
-pylith::feassemble::TestElasticityExplicit::testUpdateState(void)
-{ // testUpdateState
+pylith::feassemble::TestElasticityExplicit::testInitialize(void)
+{ // testInitialize
CPPUNIT_ASSERT(0 != _data);
- ALE::Obj<Mesh> mesh;
+ topology::Mesh mesh;
ElasticityExplicit integrator;
topology::SolutionFields fields(mesh);
_initialize(&mesh, &integrator, &fields);
- const ALE::Obj<real_section_type>& dispT = fields.getReal("dispT");
- CPPUNIT_ASSERT(!dispT.isNull());
- const double t = 1.0;
- integrator.updateState(t, &fields, mesh);
-} // testUpdateState
+} // testInitialize
// ----------------------------------------------------------------------
// Test integrateResidual().
@@ -173,25 +174,22 @@
{ // testIntegrateResidual
CPPUNIT_ASSERT(0 != _data);
- ALE::Obj<Mesh> mesh;
+ topology::Mesh mesh;
ElasticityExplicit integrator;
topology::SolutionFields fields(mesh);
_initialize(&mesh, &integrator, &fields);
- spatialdata::geocoords::CSCart cs;
- cs.setSpaceDim((mesh)->getDimension());
- cs.initialize();
-
- const ALE::Obj<real_section_type>& residual = fields.getReal("residual");
- CPPUNIT_ASSERT(!residual.isNull());
+ topology::Field<topology::Mesh>& residual = fields.get("residual");
const double t = 1.0;
- integrator.integrateResidual(residual, t, &fields, mesh, &cs);
+ integrator.integrateResidual(residual, t, &fields);
const double* valsE = _data->valsResidual;
const int sizeE = _data->spaceDim * _data->numVertices;
- const double* vals = residual->restrictSpace();
- const int size = residual->sizeWithBC();
+ const ALE::Obj<RealSection>& residualSection = residual.section();
+ CPPUNIT_ASSERT(!residualSection.isNull());
+ const double* vals = residualSection->restrictSpace();
+ const int size = residualSection->sizeWithBC();
CPPUNIT_ASSERT_EQUAL(sizeE, size);
const double tolerance = 1.0e-06;
@@ -209,42 +207,35 @@
{ // testIntegrateJacobian
CPPUNIT_ASSERT(0 != _data);
- ALE::Obj<Mesh> mesh;
+ topology::Mesh mesh;
ElasticityExplicit integrator;
topology::SolutionFields fields(mesh);
_initialize(&mesh, &integrator, &fields);
integrator._needNewJacobian = true;
- const ALE::Obj<pylith::real_section_type>& dispTpdt =
- fields.getReal("dispTpdt");
- CPPUNIT_ASSERT(!dispTpdt.isNull());
+ topology::Jacobian jacobian(fields);
- PetscMat jacobian;
- PetscErrorCode err = MeshCreateMatrix(mesh, dispTpdt, MATMPIBAIJ, &jacobian);
- CPPUNIT_ASSERT(0 == err);
-
const double t = 1.0;
- integrator.integrateJacobian(&jacobian, t, &fields, mesh);
+ integrator.integrateJacobian(&jacobian, t, &fields);
CPPUNIT_ASSERT_EQUAL(false, integrator.needNewJacobian());
- err = MatAssemblyBegin(jacobian, MAT_FINAL_ASSEMBLY);
- CPPUNIT_ASSERT(0 == err);
- err = MatAssemblyEnd(jacobian, MAT_FINAL_ASSEMBLY);
- CPPUNIT_ASSERT(0 == err);
+ jacobian.assemble("final_assembly");
const double* valsE = _data->valsJacobian;
const int nrowsE = _data->numVertices * _data->spaceDim;
const int ncolsE = _data->numVertices * _data->spaceDim;
+ const PetscMat* jacobianMat = jacobian.matrix();
+
int nrows = 0;
int ncols = 0;
- MatGetSize(jacobian, &nrows, &ncols);
+ MatGetSize(*jacobianMat, &nrows, &ncols);
CPPUNIT_ASSERT_EQUAL(nrowsE, nrows);
CPPUNIT_ASSERT_EQUAL(ncolsE, ncols);
PetscMat jDense;
PetscMat jSparseAIJ;
- MatConvert(jacobian, MATSEQAIJ, MAT_INITIAL_MATRIX, &jSparseAIJ);
+ MatConvert(*jacobianMat, MATSEQAIJ, MAT_INITIAL_MATRIX, &jSparseAIJ);
MatConvert(jSparseAIJ, MATSEQDENSE, MAT_INITIAL_MATRIX, &jDense);
double_array vals(nrows*ncols);
@@ -269,10 +260,26 @@
} // testIntegrateJacobian
// ----------------------------------------------------------------------
+// Test updateStateVars().
+void
+pylith::feassemble::TestElasticityExplicit::testUpdateStateVars(void)
+{ // testUpdateStateVars
+ CPPUNIT_ASSERT(0 != _data);
+
+ topology::Mesh mesh;
+ ElasticityExplicit integrator;
+ topology::SolutionFields fields(mesh);
+ _initialize(&mesh, &integrator, &fields);
+
+ const double t = 1.0;
+ integrator.updateStateVars(t, &fields);
+} // testUpdateStateVars
+
+// ----------------------------------------------------------------------
// Initialize elasticity integrator.
void
pylith::feassemble::TestElasticityExplicit::_initialize(
- ALE::Obj<Mesh>* mesh,
+ topology::Mesh* mesh,
ElasticityExplicit* const integrator,
topology::SolutionFields* fields)
{ // _initialize
@@ -282,41 +289,55 @@
CPPUNIT_ASSERT(0 != _quadrature);
CPPUNIT_ASSERT(0 != _material);
- // Setup mesh
spatialdata::geocoords::CSCart cs;
cs.setSpaceDim(_data->spaceDim);
cs.initialize();
- *mesh = new Mesh(PETSC_COMM_WORLD, _data->cellDim);
- CPPUNIT_ASSERT(!mesh->isNull());
- ALE::Obj<sieve_type> sieve = new sieve_type((*mesh)->comm());
+ mesh->coordsys(&cs);
+ mesh->createSieveMesh(_data->cellDim);
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ ALE::Obj<SieveMesh::sieve_type> sieve =
+ new SieveMesh::sieve_type(mesh->comm());
CPPUNIT_ASSERT(!sieve.isNull());
+
+ // Cells and vertices
const bool interpolate = false;
- ALE::Obj<ALE::Mesh::sieve_type> s = new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
+ ALE::Obj<ALE::Mesh::sieve_type> s =
+ new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
+
+ ALE::SieveBuilder<ALE::Mesh>::buildTopology(s,
+ _data->cellDim, _data->numCells,
+ const_cast<int*>(_data->cells),
+ _data->numVertices,
+ interpolate, _data->numBasis);
+ std::map<ALE::Mesh::point_type,ALE::Mesh::point_type> renumbering;
+ ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
+ sieveMesh->setSieve(sieve);
+ sieveMesh->stratify();
+ ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, _data->spaceDim,
+ _data->vertices);
- ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, _data->cellDim,
- _data->numCells, const_cast<int*>(_data->cells),
- _data->numVertices, interpolate, _data->numBasis);
- std::map<Mesh::point_type,Mesh::point_type> renumbering;
- ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
- (*mesh)->setSieve(sieve);
- (*mesh)->stratify();
- ALE::SieveBuilder<Mesh>::buildCoordinates((*mesh), _data->spaceDim,
- _data->vertices);
- const ALE::Obj<Mesh::label_type>& labelMaterials =
- (*mesh)->createLabel("material-id");
+ // Material ids
+ const ALE::Obj<SieveMesh::label_sequence>& cells =
+ sieveMesh->heightStratum(0);
+ CPPUNIT_ASSERT(!cells.isNull());
+ const ALE::Obj<SieveMesh::label_type>& labelMaterials =
+ sieveMesh->createLabel("material-id");
+ CPPUNIT_ASSERT(!labelMaterials.isNull());
int i = 0;
- const ALE::Obj<Mesh::label_sequence>& cells = (*mesh)->heightStratum(0);
- CPPUNIT_ASSERT(!cells.isNull());
- for(Mesh::label_sequence::iterator c_iter = cells->begin();
- c_iter != cells->end();
- ++c_iter)
- (*mesh)->setValue(labelMaterials, *c_iter, _data->matId);
- (*mesh)->getFactory()->clear(); // clear numberings
+ for(SieveMesh::label_sequence::iterator e_iter=cells->begin();
+ e_iter != cells->end();
+ ++e_iter)
+ sieveMesh->setValue(labelMaterials, *e_iter, _data->matId);
+ sieveMesh->getFactory()->clear(); // clear numberings
// Setup quadrature
- _quadrature->initialize(_data->basis, _data->basisDerivRef, _data->quadPts,
- _data->quadWts, _data->cellDim, _data->numBasis,
- _data->numQuadPts, _data->spaceDim);
+ _quadrature->initialize(_data->basis, _data->numQuadPts, _data->numBasis,
+ _data->basisDerivRef, _data->numQuadPts,
+ _data->numBasis, _data->cellDim,
+ _data->quadPts, _data->numQuadPts, _data->cellDim,
+ _data->quadWts, _data->numQuadPts,
+ _data->spaceDim);
// Setup gravityField
_gravityField = 0;
@@ -324,55 +345,57 @@
// Setup material
spatialdata::spatialdb::SimpleIOAscii iohandler;
iohandler.filename(_data->matDBFilename);
- spatialdata::spatialdb::SimpleDB db;
- db.ioHandler(&iohandler);
+ spatialdata::spatialdb::SimpleDB dbProperties;
+ dbProperties.ioHandler(&iohandler);
spatialdata::units::Nondimensional normalizer;
_material->id(_data->matId);
_material->label(_data->matLabel);
- _material->db(&db);
+ _material->dbProperties(&dbProperties);
_material->normalizer(normalizer);
- _material->initialize(*mesh, &cs, _quadrature);
integrator->quadrature(_quadrature);
integrator->gravityField(_gravityField);
integrator->timeStep(_data->dt);
integrator->material(_material);
+ integrator->initialize(*mesh);
// Setup fields
CPPUNIT_ASSERT(0 != fields);
- fields->addReal("residual");
- fields->addReal("dispTpdt");
- fields->addReal("dispT");
- fields->addReal("dispTmdt");
- const char* history[] = { "dispTpdt", "dispT", "dispTmdt" };
+ fields->add("residual");
+ fields->add("disp(t+dt)");
+ fields->add("disp(t)");
+ fields->add("disp(t-dt)");
+ fields->solutionName("disp(t+dt)");
+ const char* history[] = { "disp(t+dt)", "disp(t)", "disp(t-dt)" };
const int historySize = 3;
fields->createHistory(history, historySize);
- const ALE::Obj<real_section_type>& residual = fields->getReal("residual");
- CPPUNIT_ASSERT(!residual.isNull());
- residual->setChart((*mesh)->getSieve()->getChart());
- residual->setFiberDimension((*mesh)->depthStratum(0), _data->spaceDim);
- (*mesh)->allocate(residual);
- residual->zero();
+ topology::Field<topology::Mesh>& residual = fields->get("residual");
+ residual.newSection(topology::FieldBase::VERTICES_FIELD, _data->spaceDim);
+ residual.allocate();
+ residual.zero();
fields->copyLayout("residual");
const int fieldSize = _data->spaceDim * _data->numVertices;
- const ALE::Obj<real_section_type>& dispTpdt = fields->getReal("dispTpdt");
- const ALE::Obj<real_section_type>& dispT = fields->getReal("dispT");
- const ALE::Obj<real_section_type>& dispTmdt = fields->getReal("dispTmdt");
- CPPUNIT_ASSERT(!dispTpdt.isNull());
- CPPUNIT_ASSERT(!dispT.isNull());
- CPPUNIT_ASSERT(!dispTmdt.isNull());
+ topology::Field<topology::Mesh>& dispTpdt = fields->get("disp(t+dt)");
+ topology::Field<topology::Mesh>& dispT = fields->get("disp(t)");
+ topology::Field<topology::Mesh>& dispTmdt = fields->get("disp(t-dt)");
+ const ALE::Obj<RealSection>& dispTpdtSection = dispTpdt.section();
+ const ALE::Obj<RealSection>& dispTSection = dispT.section();
+ const ALE::Obj<RealSection>& dispTmdtSection = dispTmdt.section();
+ CPPUNIT_ASSERT(!dispTpdtSection.isNull());
+ CPPUNIT_ASSERT(!dispTSection.isNull());
+ CPPUNIT_ASSERT(!dispTmdtSection.isNull());
const int offset = _data->numCells;
for (int iVertex=0; iVertex < _data->numVertices; ++iVertex) {
- dispTpdt->updatePoint(iVertex+offset,
- &_data->fieldTpdt[iVertex*_data->spaceDim]);
- dispT->updatePoint(iVertex+offset,
- &_data->fieldT[iVertex*_data->spaceDim]);
- dispTmdt->updatePoint(iVertex+offset,
- &_data->fieldTmdt[iVertex*_data->spaceDim]);
+ dispTpdtSection->updatePoint(iVertex+offset,
+ &_data->fieldTpdt[iVertex*_data->spaceDim]);
+ dispTSection->updatePoint(iVertex+offset,
+ &_data->fieldT[iVertex*_data->spaceDim]);
+ dispTmdtSection->updatePoint(iVertex+offset,
+ &_data->fieldTmdt[iVertex*_data->spaceDim]);
} // for
} // _initialize
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -33,6 +33,7 @@
namespace pylith {
namespace feassemble {
class TestElasticityExplicit;
+ class IntegratorData;
} // feassemble
} // pylith
@@ -50,6 +51,10 @@
CPPUNIT_TEST( testNeedNewJacobian );
CPPUNIT_TEST( testUseSolnIncr );
+ // Testing of initialize(), integrateResidual(),
+ // integrateJacobian(), and updateStateVars() handled by derived
+ // classes.
+
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -79,8 +84,8 @@
/// Test useSolnIncr().
void testUseSolnIncr(void);
- /// Test updateState().
- void testUpdateState(void);
+ /// Test initialize().
+ void testInitialize(void);
/// Test integrateResidual().
void testIntegrateResidual(void);
@@ -88,12 +93,15 @@
/// Test integrateJacobian().
void testIntegrateJacobian(void);
+ /// Test updateStateVars().
+ void testUpdateStateVars(void);
+
// PROTECTED MEMBERS //////////////////////////////////////////////////
protected :
IntegratorData* _data; ///< Data for testing.
materials::ElasticMaterial* _material; ///< Elastic material.
- Quadrature* _quadrature; ///< Quadrature information.
+ Quadrature<topology::Mesh>* _quadrature; ///< Quadrature information.
spatialdata::spatialdb::GravityField* _gravityField; ///< Gravity field.
// PRIVATE METHODS ////////////////////////////////////////////////////
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -16,7 +16,8 @@
#include "data/ElasticityExplicitData1DLinear.hh"
-#include "pylith/feassemble/Quadrature1D.hh" // USES Quadrature1D
+#include "pylith/topology/Mesh.hh" // USES Quadrature<Mesh>
+#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
#include "pylith/feassemble/GeometryLine1D.hh" // USES GeometryLine1D
#include "pylith/materials/ElasticStrain1D.hh" // USES ElasticStrain1D
@@ -28,8 +29,9 @@
void
pylith::feassemble::TestElasticityExplicit1DLinear::setUp(void)
{ // setUp
+ TestElasticityExplicit::setUp();
+
_data = new ElasticityExplicitData1DLinear();
- _quadrature = new Quadrature1D();
GeometryLine1D geometry;
CPPUNIT_ASSERT(0 != _quadrature);
_quadrature->refGeometry(&geometry);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DLinear.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -38,9 +38,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestElasticityExplicit1DLinear );
- CPPUNIT_TEST( testUpdateState );
+ CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -16,7 +16,8 @@
#include "data/ElasticityExplicitData1DQuadratic.hh"
-#include "pylith/feassemble/Quadrature1D.hh" // USES Quadrature1D
+#include "pylith/topology/Mesh.hh" // USES Quadrature<Mesh>
+#include "pylith/feassemble/Quadrature.hh" // USES Quadrature1D
#include "pylith/feassemble/GeometryLine1D.hh" // USES GeometryLine1D
#include "pylith/materials/ElasticStrain1D.hh" // USES ElasticStrain1D
@@ -28,8 +29,9 @@
void
pylith::feassemble::TestElasticityExplicit1DQuadratic::setUp(void)
{ // setUp
+ TestElasticityExplicit::setUp();
+
_data = new ElasticityExplicitData1DQuadratic();
- _quadrature = new Quadrature1D();
GeometryLine1D geometry;
CPPUNIT_ASSERT(0 != _quadrature);
_quadrature->refGeometry(&geometry);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit1DQuadratic.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -38,9 +38,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestElasticityExplicit1DQuadratic );
- CPPUNIT_TEST( testUpdateState );
+ CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -16,7 +16,8 @@
#include "data/ElasticityExplicitData2DLinear.hh"
-#include "pylith/feassemble/Quadrature2D.hh" // USES Quadrature2D
+#include "pylith/topology/Mesh.hh" // USES Quadrature<Mesh>
+#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
#include "pylith/feassemble/GeometryTri2D.hh" // USES GeometryTri2D
#include "pylith/materials/ElasticPlaneStrain.hh" // USES ElasticPlaneStrain
@@ -28,8 +29,9 @@
void
pylith::feassemble::TestElasticityExplicit2DLinear::setUp(void)
{ // setUp
+ TestElasticityExplicit::setUp();
+
_data = new ElasticityExplicitData2DLinear();
- _quadrature = new Quadrature2D();
CPPUNIT_ASSERT(0 != _quadrature);
GeometryTri2D geometry;
_quadrature->refGeometry(&geometry);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DLinear.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -38,9 +38,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestElasticityExplicit2DLinear );
- CPPUNIT_TEST( testUpdateState );
+ CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -16,7 +16,8 @@
#include "data/ElasticityExplicitData2DQuadratic.hh"
-#include "pylith/feassemble/Quadrature2D.hh" // USES Quadrature2D
+#include "pylith/topology/Mesh.hh" // USES Quadrature<Mesh>
+#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
#include "pylith/feassemble/GeometryTri2D.hh" // USES GeometryTri2D
#include "pylith/materials/ElasticPlaneStrain.hh" // USES ElasticPlaneStrain
@@ -28,8 +29,9 @@
void
pylith::feassemble::TestElasticityExplicit2DQuadratic::setUp(void)
{ // setUp
+ TestElasticityExplicit::setUp();
+
_data = new ElasticityExplicitData2DQuadratic();
- _quadrature = new Quadrature2D();
CPPUNIT_ASSERT(0 != _quadrature);
GeometryTri2D geometry;
_quadrature->refGeometry(&geometry);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit2DQuadratic.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -38,9 +38,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestElasticityExplicit2DQuadratic );
- CPPUNIT_TEST( testUpdateState );
+ CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -16,7 +16,8 @@
#include "data/ElasticityExplicitData3DLinear.hh"
-#include "pylith/feassemble/Quadrature3D.hh" // USES Quadrature3D
+#include "pylith/topology/Mesh.hh" // USES Quadrature<Mesh>
+#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
#include "pylith/feassemble/GeometryTet3D.hh" // USES GeometryTet3D
#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
@@ -28,8 +29,9 @@
void
pylith::feassemble::TestElasticityExplicit3DLinear::setUp(void)
{ // setUp
+ TestElasticityExplicit::setUp();
+
_data = new ElasticityExplicitData3DLinear();
- _quadrature = new Quadrature3D();
CPPUNIT_ASSERT(0 != _quadrature);
GeometryTet3D geometry;
_quadrature->refGeometry(&geometry);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DLinear.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -38,9 +38,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestElasticityExplicit3DLinear );
- CPPUNIT_TEST( testUpdateState );
+ CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.cc 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.cc 2009-03-15 22:52:00 UTC (rev 14323)
@@ -16,7 +16,8 @@
#include "data/ElasticityExplicitData3DQuadratic.hh"
-#include "pylith/feassemble/Quadrature3D.hh" // USES Quadrature3D
+#include "pylith/topology/Mesh.hh" // USES Quadrature<Mesh>
+#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
#include "pylith/feassemble/GeometryTet3D.hh" // USES GeometryTet3D
#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
@@ -28,8 +29,9 @@
void
pylith::feassemble::TestElasticityExplicit3DQuadratic::setUp(void)
{ // setUp
+ TestElasticityExplicit::setUp();
+
_data = new ElasticityExplicitData3DQuadratic();
- _quadrature = new Quadrature3D();
CPPUNIT_ASSERT(0 != _quadrature);
GeometryTet3D geometry;
_quadrature->refGeometry(&geometry);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit3DQuadratic.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -38,9 +38,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestElasticityExplicit3DQuadratic );
- CPPUNIT_TEST( testUpdateState );
+ CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.hh 2009-03-15 22:08:53 UTC (rev 14322)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.hh 2009-03-15 22:52:00 UTC (rev 14323)
@@ -65,6 +65,8 @@
CPPUNIT_TEST( testMaterial );
CPPUNIT_TEST( testNeedNewJacobian );
CPPUNIT_TEST( testUseSolnIncr );
+ CPPUNIT_TEST( testIntegrateResidual );
+ CPPUNIT_TEST( testIntegrateJacobian );
CPPUNIT_TEST_SUITE_END();
More information about the CIG-COMMITS
mailing list