[cig-commits] r21385 - in short/3D/PyLith/trunk: libsrc/pylith libsrc/pylith/bc libsrc/pylith/faults libsrc/pylith/meshio libsrc/pylith/topology modulesrc/faults modulesrc/topology pylith/faults unittests/libtests/bc unittests/libtests/feassemble unittests/libtests/meshio unittests/libtests/topology unittests/pytests/faults unittests/pytests/topology
knepley at geodynamics.org
knepley at geodynamics.org
Sun Feb 24 20:20:58 PST 2013
Author: knepley
Date: 2013-02-24 20:20:58 -0800 (Sun, 24 Feb 2013)
New Revision: 21385
Removed:
short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.cc
short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.hh
Modified:
short/3D/PyLith/trunk/libsrc/pylith/Makefile.am
short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc
short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.cc
short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.hh
short/3D/PyLith/trunk/libsrc/pylith/meshio/Makefile.am
short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc
short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.hh
short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc
short/3D/PyLith/trunk/libsrc/pylith/meshio/meshiofwd.hh
short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc
short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc
short/3D/PyLith/trunk/modulesrc/faults/FaultCohesive.i
short/3D/PyLith/trunk/modulesrc/topology/Mesh.i
short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py
short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc
short/3D/PyLith/trunk/unittests/libtests/feassemble/TestQuadrature.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc
short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.hh
short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveImpulses.py
short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
short/3D/PyLith/trunk/unittests/pytests/topology/TestMesh.py
short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshField.py
short/3D/PyLith/trunk/unittests/pytests/topology/TestSolutionFields.py
Log:
Took out UCD stuff, enabled interpolated meshes, put in switch to turn off Sieve mesh, all tests passing
Modified: short/3D/PyLith/trunk/libsrc/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/Makefile.am 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/Makefile.am 2013-02-25 04:20:58 UTC (rev 21385)
@@ -139,7 +139,6 @@
meshio/PsetFileBinary.cc \
meshio/OutputSolnSubset.cc \
meshio/OutputSolnPoints.cc \
- meshio/UCDFaultFile.cc \
problems/Formulation.cc \
problems/Explicit.cc \
problems/Implicit.cc \
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -235,12 +235,16 @@
const PylithScalar lengthScale = _getNormalizer().lengthScale();
scalar_array coordsVertex(spaceDim);
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- assert(!sieveMesh.isNull());
- const ALE::Obj<RealSection>& coordinates =
- sieveMesh->getRealSection("coordinates");
- assert(!coordinates.isNull());
+ DM dmMesh = mesh.dmMesh();
+ PetscSection coordSection;
+ Vec coordVec;
+ PetscScalar *coordArray;
+ PetscErrorCode err;
+ assert(dmMesh);
+ err = DMPlexGetCoordinateSection(dmMesh, &coordSection);CHECK_PETSC_ERROR(err);
+ err = DMGetCoordinatesLocal(dmMesh, &coordVec);CHECK_PETSC_ERROR(err);
+
PetscSection parametersSection = _parameters->get(name).petscSection();
Vec parametersVec = _parameters->get(name).localVector();
assert(parametersSection);assert(parametersVec);
@@ -256,21 +260,23 @@
const int numPoints = _points.size();
PetscScalar *array;
- PetscErrorCode err;
err = VecGetArray(parametersVec, &array);CHECK_PETSC_ERROR(err);
+ err = VecGetArray(coordVec, &coordArray);CHECK_PETSC_ERROR(err);
for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ PetscInt cdof, coff;
+
// Get dimensionalized coordinates of vertex
- coordinates->restrictPoint(_points[iPoint],
- &coordsVertex[0], coordsVertex.size());
- _getNormalizer().dimensionalize(&coordsVertex[0], coordsVertex.size(),
- lengthScale);
- int err = db->query(&valueVertex[0], valueVertex.size(),
- &coordsVertex[0], coordsVertex.size(), cs);
+ err = PetscSectionGetDof(coordSection, _points[iPoint], &cdof);CHECK_PETSC_ERROR(err);
+ err = PetscSectionGetOffset(coordSection, _points[iPoint], &coff);CHECK_PETSC_ERROR(err);
+ assert(cdof == spaceDim);
+ for (PetscInt d = 0; d < spaceDim; ++d) {coordsVertex[d] = coordArray[coff+d];}
+ _getNormalizer().dimensionalize(&coordsVertex[0], coordsVertex.size(), lengthScale);
+ int err = db->query(&valueVertex[0], valueVertex.size(), &coordsVertex[0], coordsVertex.size(), cs);
if (err) {
std::ostringstream msg;
msg << "Error querying for '" << name << "' at (";
for (int i=0; i < spaceDim; ++i)
- msg << " " << coordsVertex[i];
+ msg << " " << coordsVertex[i];
msg << ") using spatial database " << db->label() << ".";
throw std::runtime_error(msg.str());
} // if
@@ -287,6 +293,7 @@
array[off+i] = valueVertex[i];
} // for
err = VecRestoreArray(parametersVec, &array);CHECK_PETSC_ERROR(err);
+ err = VecRestoreArray(coordVec, &coordArray);CHECK_PETSC_ERROR(err);
} // _queryDB
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -21,7 +21,6 @@
#include "FaultCohesive.hh" // implementation of object methods
#include "CohesiveTopology.hh" // USES CohesiveTopology
-#include "pylith/meshio/UCDFaultFile.hh" // USES UCDFaultFile
#include "pylith/topology/Field.hh" // USES Field
#include "pylith/topology/Fields.hh" // USES Fields
@@ -38,8 +37,7 @@
// Default constructor.
pylith::faults::FaultCohesive::FaultCohesive(void) :
_fields(0),
- _useFaultMesh(false),
- _faultMeshFilename("fault.inp")
+ _useFaultMesh(false)
{ // constructor
} // constructor
@@ -71,14 +69,6 @@
} // useFaultMesh
// ----------------------------------------------------------------------
-// Set filename of UCD file for fault mesh.
-void
-pylith::faults::FaultCohesive::faultMeshFilename(const char* filename)
-{ // faultMeshFilename
- _faultMeshFilename = filename;
-} // faultMeshFilename
-
-// ----------------------------------------------------------------------
// Get the number of vertices associated with the fault (before
// fault mesh exists).
int
@@ -103,7 +93,7 @@
nvertices = groupField->size();
} else {
assert(3 == mesh.dimension());
- nvertices = meshio::UCDFaultFile::numVertices(_faultMeshFilename.c_str());
+ nvertices = -1;
} // else
return nvertices;
@@ -149,8 +139,7 @@
const int faultDim = 2;
assert(3 == mesh->dimension());
- meshio::UCDFaultFile::read(_faultMeshFilename.c_str(),
- &faultMesh, faultBoundary, *mesh);
+ //meshio::UCDFaultFile::read(_faultMeshFilename.c_str(), &faultMesh, faultBoundary, *mesh);
// Set coordinates in fault mesh
const ALE::Obj<topology::SubMesh::SieveMesh>& faultSieveMesh =
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.hh 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesive.hh 2013-02-25 04:20:58 UTC (rev 21385)
@@ -64,16 +64,6 @@
*/
void useFaultMesh(const bool flag);
- /** Set filename of UCD file for fault mesh.
- *
- * This method is part of a KLUDGE to allow creation of cohesive
- * cells in cases where domain cells have more than one face (edge
- * for 2-D problems) on the fault.
- *
- * @param filename Filename for UCD file.
- */
- void faultMeshFilename(const char* filename);
-
/** Get the number of vertices associated with the fault (before
* fault mesh exists).
*
@@ -134,8 +124,6 @@
/// vertices to define fault.
bool _useFaultMesh;
- std::string _faultMeshFilename; /// Filename for fault mesh UCD file.
-
// NOT IMPLEMENTED ////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/Makefile.am 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/Makefile.am 2013-02-25 04:20:58 UTC (rev 21385)
@@ -42,7 +42,6 @@
OutputManager.cc \
OutputSolnSubset.hh \
OutputSolnPoints.hh \
- UCDFaultFile.hh \
VertexFilter.hh \
VertexFilter.cc \
VertexFilterVecNorm.hh \
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -50,11 +50,11 @@
const bool isParallel)
{ // buildMesh
assert(mesh);
-
assert(coordinates);
- MPI_Comm comm = mesh->comm();
- int dim = meshDim;
- const int commRank = mesh->commRank();
+ MPI_Comm comm = mesh->comm();
+ PetscInt dim = meshDim;
+ PetscMPIInt commRank = mesh->commRank();
+ const bool useSieve = true;
PetscErrorCode err;
{ // Check to make sure every vertex is in at least one cell.
@@ -66,23 +66,21 @@
int count = 0;
for (int i=0; i < numVertices; ++i)
if (!vertexInCell[i])
- ++count;
+ ++count;
if (count > 0) {
std::ostringstream msg;
msg << "Mesh contains " << count
- << " vertices that are not in any cells.";
+ << " vertices that are not in any cells.";
throw std::runtime_error(msg.str());
} // if
} // check
+ /* Sieve */
+ if (useSieve) {
MPI_Bcast(&dim, 1, MPI_INT, 0, comm);
mesh->createSieveMesh(dim);
const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
assert(!sieveMesh.isNull());
- /* DMPlex */
- mesh->createDMMesh(dim);
- DM complexMesh = mesh->dmMesh();
- assert(complexMesh);
ALE::Obj<SieveMesh::sieve_type> sieve =
new SieveMesh::sieve_type(mesh->comm());
@@ -122,23 +120,6 @@
delete[] coneO; coneO = 0;
// Symmetrize to fill up supports
sieve->symmetrize();
- /* DMPlex */
- err = DMPlexSetChart(complexMesh, 0, numCells+numVertices);CHECK_PETSC_ERROR(err);
- for(PetscInt c = 0; c < numCells; ++c) {
- err = DMPlexSetConeSize(complexMesh, c, numCorners);CHECK_PETSC_ERROR(err);
- }
- err = DMSetUp(complexMesh);CHECK_PETSC_ERROR(err);
- PetscInt *cone2 = new PetscInt[numCorners];
- for(PetscInt c = 0; c < numCells; ++c) {
- for(PetscInt v = 0; v < numCorners; ++v) {
- cone2[v] = cells[c*numCorners+v]+numCells;
- }
- err = DMPlexSetCone(complexMesh, c, cone2);CHECK_PETSC_ERROR(err);
- } // for
- delete [] cone2; cone2 = 0;
- err = DMPlexSymmetrize(complexMesh);CHECK_PETSC_ERROR(err);
- err = DMPlexStratify(complexMesh);CHECK_PETSC_ERROR(err);
- /* TODO Interpolate mesh if necessary */
} else {
// Same old thing
ALE::Obj<SieveFlexMesh::sieve_type> s =
@@ -190,141 +171,17 @@
} // if/else
logger.stagePush("MeshCoordinates");
- ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim,
- &(*coordinates)[0]);
- /* DMPlex */
- PetscSection coordSection;
- Vec coordVec;
- PetscScalar *coords;
- PetscInt coordSize;
-
- err = DMPlexGetCoordinateSection(complexMesh, &coordSection);CHECK_PETSC_ERROR(err);
- err = PetscSectionSetChart(coordSection, numCells, numCells+numVertices);CHECK_PETSC_ERROR(err);
- for(PetscInt v = numCells; v < numCells+numVertices; ++v) {
- err = PetscSectionSetDof(coordSection, v, spaceDim);CHECK_PETSC_ERROR(err);
+ ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, &(*coordinates)[0]);
+ logger.stagePop(); // Coordinates
+ sieveMesh->getFactory()->clear();
}
- err = PetscSectionSetUp(coordSection);CHECK_PETSC_ERROR(err);
- err = PetscSectionGetStorageSize(coordSection, &coordSize);CHECK_PETSC_ERROR(err);
- err = VecCreate(comm, &coordVec);CHECK_PETSC_ERROR(err);
- err = VecSetSizes(coordVec, coordSize, PETSC_DETERMINE);CHECK_PETSC_ERROR(err);
- err = VecSetFromOptions(coordVec);CHECK_PETSC_ERROR(err);
- err = VecGetArray(coordVec, &coords);CHECK_PETSC_ERROR(err);
- for(PetscInt v = 0; v < numVertices; ++v) {
- PetscInt off;
- err = PetscSectionGetOffset(coordSection, v+numCells, &off);CHECK_PETSC_ERROR(err);
- for(PetscInt d = 0; d < spaceDim; ++d) {
- coords[off+d] = (*coordinates)[v*spaceDim+d];
- }
- }
- err = VecRestoreArray(coordVec, &coords);CHECK_PETSC_ERROR(err);
- err = DMSetCoordinatesLocal(complexMesh, coordVec);CHECK_PETSC_ERROR(err);
- err = VecDestroy(&coordVec);CHECK_PETSC_ERROR(err);
- logger.stagePop(); // Coordinates
+ /* DMPlex */
+ DM dmMesh;
+ PetscBool pInterpolate = interpolate ? PETSC_TRUE : PETSC_FALSE;
- sieveMesh->getFactory()->clear();
+ err = DMPlexCreateFromCellList(comm, dim, numCells, numVertices, numCorners, pInterpolate, &cells[0], spaceDim, &(*coordinates)[0], &dmMesh);CHECK_PETSC_ERROR(err);
+ mesh->setDMMesh(dmMesh);
} // buildMesh
-// ----------------------------------------------------------------------
-// Set vertices and cells for fault mesh.
-void
-pylith::meshio::MeshBuilder::buildFaultMesh(const ALE::Obj<SieveMesh>& fault,
- ALE::Obj<SieveFlexMesh>& faultBd,
- const scalar_array& coordinates,
- const int numVertices,
- const int spaceDim,
- const int_array& cells,
- const int numCells,
- const int numCorners,
- const int firstCell,
- const int_array& faceCells,
- const int meshDim)
-{ // buildFaultMesh
- int dim = meshDim;
-
- assert(!fault.isNull());
-
- ALE::Obj<SieveMesh::sieve_type> sieve =
- new SieveMesh::sieve_type(fault->comm());
- fault->setDebug(fault->debug());
- fault->setSieve(sieve);
-
- const int commRank = fault->commRank();
-
- // Memory logging
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- //logger.setDebug(fault->debug()/2);
- logger.stagePush("Creation");
-
- if (0 == commRank) {
- assert(coordinates.size() == numVertices*spaceDim);
- assert(cells.size() == numCells*numCorners);
- ALE::Obj<SieveFlexMesh::sieve_type> s =
- new SieveFlexMesh::sieve_type(sieve->comm(), sieve->debug());
-
- ALE::SieveBuilder<SieveFlexMesh>::buildTopology(s, meshDim,
- numCells,
- const_cast<int*>(&cells[0]),
- numVertices,
- true,
- numCorners,
- 0,
- fault->getArrowSection("orientation"),
- firstCell);
-
- // Add in cells
- for(int c = 0; c < numCells; ++c) {
- s->addArrow(c+firstCell, faceCells[c*2+0]);
- s->addArrow(c+firstCell, faceCells[c*2+1]);
- } // for
-
- SieveFlexMesh::renumbering_type& renumbering = fault->getRenumbering();
- ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering, false);
- ALE::ISieveConverter::convertOrientation(*s, *sieve, renumbering,
- fault->getArrowSection("orientation").ptr());
-
- Obj<SieveFlexMesh> tmpMesh =
- new SieveFlexMesh(fault->comm(), dim, fault->debug());
- faultBd = ALE::Selection<SieveFlexMesh>::boundary(tmpMesh);
-
- logger.stagePop();
- logger.stagePush("Stratification");
- fault->stratify();
- logger.stagePop();
- } else {
- Obj<SieveFlexMesh> tmpMesh =
- new SieveFlexMesh(fault->comm(), dim, fault->debug());
- faultBd = ALE::Selection<SieveFlexMesh>::boundary(tmpMesh);
-
- logger.stagePop();
- logger.stagePush("Stratification");
- fault->getSieve()->setChart(SieveMesh::sieve_type::chart_type());
- fault->getSieve()->allocate();
- fault->stratify();
- logger.stagePop();
- } // if/else
-
-#if defined(ALE_MEM_LOGGING)
- std::cout
- << std::endl
- << "FaultCreation " << logger.getNumAllocations("Creation")
- << " allocations " << logger.getAllocationTotal("Creation")
- << " bytes" << std::endl
-
- << "FaultCreation " << logger.getNumDeallocations("Creation")
- << " deallocations " << logger.getDeallocationTotal("Creation")
- << " bytes" << std::endl
-
- << "FaultStratification " << logger.getNumAllocations("Stratification")
- << " allocations " << logger.getAllocationTotal("Stratification")
- << " bytes" << std::endl
-
- << "FaultStratification " << logger.getNumDeallocations("Stratification")
- << " deallocations " << logger.getDeallocationTotal("Stratification")
- << " bytes" << std::endl << std::endl;
-#endif
-
-} // buildFaultMesh
-
-
// End of file
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.hh 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.hh 2013-02-25 04:20:58 UTC (rev 21385)
@@ -75,39 +75,6 @@
const int meshDim,
const bool interpolate,
const bool isParallel =false);
-
- /** Build fault mesh topology.
- *
- * All mesh information must use zero based indices. In other words,
- * the lowest index MUST be 0 not 1.
- *
- * @param fault PETSc mesh for fault.
- * @param faultBd PETSc mesh for fault boundary.
- * @param coordinates Array of coordinates of vertices.
- * @param numVertices Number of vertices.
- * @param spaceDim Dimension of vector space for vertex coordinates.
- * @param cells Array of indices of vertices in cells (first index is 0).
- * @param numCells Number of cells.
- * @param numCorners Number of vertices per cell.
- * @param firstCell Label of first cell.
- * @param cells Array of indices of vertices for fault surface cells
- * (first index is 0).
- * @param meshDim Dimension of cells in mesh.
- */
- static
- void buildFaultMesh(const ALE::Obj<topology::Mesh::SieveMesh>& fault,
- ALE::Obj<SieveFlexMesh>& faultBd,
- const scalar_array& coordinates,
- const int numVertices,
- const int spaceDim,
- const int_array& cells,
- const int numCells,
- const int numCorners,
- const int firstCell,
- const int_array& faceCells,
- const int meshDim);
-
-
}; // MeshBuilder
#endif // pylith_meshio_meshbuilder_hh
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -207,48 +207,46 @@
pylith::meshio::MeshIO::_setMaterials(const int_array& materialIds)
{ // _setMaterials
assert(0 != _mesh);
-
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
- DM complexMesh = _mesh->dmMesh();
- assert(complexMesh);
PetscErrorCode err;
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
///logger.setDebug(2);
logger.stagePush("MeshLabels");
- const ALE::Obj<SieveMesh::label_type>& labelMaterials =
- sieveMesh->createLabel("material-id");
- if (!sieveMesh->commRank()) {
- const ALE::Obj<SieveMesh::label_sequence>& cells =
- sieveMesh->heightStratum(0);
- assert(!cells.isNull());
- const SieveMesh::label_sequence::iterator cellsBegin =
- cells->begin();
- const SieveMesh::label_sequence::iterator cellsEnd =
- cells->end();
+ if (!_mesh->commRank()) {
+ const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
+ if (!sieveMesh.isNull()) {
+ const ALE::Obj<SieveMesh::label_type>& labelMaterials = sieveMesh->createLabel("material-id");
+ const ALE::Obj<SieveMesh::label_sequence>& cells = sieveMesh->heightStratum(0);
+ assert(!cells.isNull());
+ const SieveMesh::label_sequence::iterator cellsBegin = cells->begin();
+ const SieveMesh::label_sequence::iterator cellsEnd = cells->end();
- const int numCells = materialIds.size();
- if (cells->size() != numCells) {
+ const int numCells = materialIds.size();
+ if (cells->size() != numCells) {
+ std::ostringstream msg;
+ msg << "Mismatch in size of materials identifier array ("
+ << numCells << ") and number of cells in mesh ("<< cells->size() << ").";
+ throw std::runtime_error(msg.str());
+ } // if
+ int i = 0;
+ for(SieveMesh::label_sequence::iterator e_iter = cellsBegin; e_iter != cellsEnd; ++e_iter) {
+ sieveMesh->setValue(labelMaterials, *e_iter, materialIds[i++]);
+ }
+ }
+
+ DM dmMesh = _mesh->dmMesh();
+ PetscInt cStart, cEnd;
+
+ assert(dmMesh);
+ err = DMPlexGetHeightStratum(dmMesh, 0, &cStart, &cEnd);CHECK_PETSC_ERROR(err);
+ if ((cEnd - cStart) != materialIds.size()) {
std::ostringstream msg;
msg << "Mismatch in size of materials identifier array ("
- << numCells << ") and number of cells in mesh ("
- << cells->size() << ").";
+ << materialIds.size() << ") and number of cells in mesh ("<< (cEnd - cStart) << ").";
throw std::runtime_error(msg.str());
} // if
- int i = 0;
-
- for(SieveMesh::label_sequence::iterator e_iter = cellsBegin;
- e_iter != cellsEnd;
- ++e_iter) {
- sieveMesh->setValue(labelMaterials, *e_iter, materialIds[i++]);
- }
-
- PetscInt cStart, cEnd;
- err = DMPlexGetHeightStratum(complexMesh, 0, &cStart, &cEnd);CHECK_PETSC_ERROR(err);
- assert(numCells == cEnd - cStart);
for(PetscInt c = cStart; c < cEnd; ++c) {
- err = DMPlexSetLabelValue(complexMesh, "material-id", c, materialIds[c-cStart]);CHECK_PETSC_ERROR(err);
+ err = DMPlexSetLabelValue(dmMesh, "material-id", c, materialIds[c-cStart]);CHECK_PETSC_ERROR(err);
}
} // if
logger.stagePop();
@@ -296,47 +294,52 @@
const int_array& points)
{ // _setGroup
assert(0 != _mesh);
+ PetscErrorCode err;
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("MeshIntSections");
const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
- DM complexMesh = _mesh->dmMesh();
- assert(complexMesh);
- PetscErrorCode err;
+ if (!sieveMesh.isNull()) {
+ if (sieveMesh->hasIntSection(name)) {
+ std::ostringstream msg;
+ msg << "Could not setup group '" << name
+ << "'. Group already exists in mesh.";
+ throw std::runtime_error(msg.str());
+ } // if
- if (sieveMesh->hasIntSection(name)) {
- std::ostringstream msg;
- msg << "Could not setup group '" << name
- << "'. Group already exists in mesh.";
- throw std::runtime_error(msg.str());
- } // if
+ const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
+ assert(!groupField.isNull());
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("MeshIntSections");
- const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
- assert(!groupField.isNull());
+ const int numPoints = points.size();
+ const int numVertices = sieveMesh->depthStratum(0)->size();
+ const int numCells = sieveMesh->heightStratum(0)->size();
+ if (CELL == type) {
+ groupField->setChart(IntSection::chart_type(0,numCells));
+ for(int i=0; i < numPoints; ++i)
+ groupField->setFiberDimension(points[i], 1);
+ } else if (VERTEX == type) {
+ groupField->setChart(IntSection::chart_type(numCells, numCells+numVertices));
+ for(int i=0; i < numPoints; ++i)
+ groupField->setFiberDimension(numCells+points[i], 1);
+ } // if/else
+ sieveMesh->allocate(groupField);
+ }
- const int numPoints = points.size();
- const int numVertices = sieveMesh->depthStratum(0)->size();
- const int numCells = sieveMesh->heightStratum(0)->size();
- if (CELL == type) {
- groupField->setChart(IntSection::chart_type(0,numCells));
- for(int i=0; i < numPoints; ++i)
- groupField->setFiberDimension(points[i], 1);
- } else if (VERTEX == type) {
- groupField->setChart(IntSection::chart_type(numCells,
- numCells+numVertices));
- for(int i=0; i < numPoints; ++i)
- groupField->setFiberDimension(numCells+points[i], 1);
- } // if/else
- sieveMesh->allocate(groupField);
+ DM dmMesh = _mesh->dmMesh();
+ const PetscInt numPoints = points.size();
+ assert(dmMesh);
if (CELL == type) {
for(PetscInt p = 0; p < numPoints; ++p) {
- err = DMPlexSetLabelValue(complexMesh, name.c_str(), points[p], 1);CHECK_PETSC_ERROR(err);
+ err = DMPlexSetLabelValue(dmMesh, name.c_str(), points[p], 1);CHECK_PETSC_ERROR(err);
}
} else if (VERTEX == type) {
+ PetscInt cStart, cEnd, numCells;
+
+ err = DMPlexGetHeightStratum(dmMesh, 0, &cStart, &cEnd);CHECK_PETSC_ERROR(err);
+ numCells = cEnd - cStart;
for(PetscInt p = 0; p < numPoints; ++p) {
- err = DMPlexSetLabelValue(complexMesh, name.c_str(), numCells+points[p], 1);CHECK_PETSC_ERROR(err);
+ err = DMPlexSetLabelValue(dmMesh, name.c_str(), numCells+points[p], 1);CHECK_PETSC_ERROR(err);
}
}
logger.stagePop();
@@ -348,48 +351,45 @@
pylith::meshio::MeshIO::_distributeGroups()
{ // _distributeGroups
assert(0 != _mesh);
+ /* dmMesh does not need to broadcast the label names. They come from proc 0 */
const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
- DM complexMesh = _mesh->dmMesh();
- assert(complexMesh);
- PetscErrorCode err;
+ if (!sieveMesh.isNull()) {
+ if (!sieveMesh->commRank()) {
+ const ALE::Obj<std::set<std::string> >& sectionNames =
+ sieveMesh->getIntSections();
+ int numGroups = sectionNames->size();
- if (!sieveMesh->commRank()) {
- const ALE::Obj<std::set<std::string> >& sectionNames =
- sieveMesh->getIntSections();
- int numGroups = sectionNames->size();
+ MPI_Bcast(&numGroups, 1, MPI_INT, 0, sieveMesh->comm());
- MPI_Bcast(&numGroups, 1, MPI_INT, 0, sieveMesh->comm());
+ const std::set<std::string>::const_iterator namesEnd = sectionNames->end();
+ for (std::set<std::string>::const_iterator name=sectionNames->begin();
+ name != namesEnd;
+ ++name) {
+ int len = name->size();
+
+ MPI_Bcast(&len, 1, MPI_INT, 0, sieveMesh->comm());
+ MPI_Bcast((void *) name->c_str(), len, MPI_CHAR, 0, sieveMesh->comm());
+ }
+ } else {
+ int numGroups;
- const std::set<std::string>::const_iterator namesEnd = sectionNames->end();
- for (std::set<std::string>::const_iterator name=sectionNames->begin();
- name != namesEnd;
- ++name) {
- int len = name->size();
-
- MPI_Bcast(&len, 1, MPI_INT, 0, sieveMesh->comm());
- MPI_Bcast((void *) name->c_str(), len, MPI_CHAR, 0, sieveMesh->comm());
- }
- } else {
- int numGroups;
+ MPI_Bcast(&numGroups, 1, MPI_INT, 0, sieveMesh->comm());
+ for(int g = 0; g < numGroups; ++g) {
+ char *name;
+ int len;
- MPI_Bcast(&numGroups, 1, MPI_INT, 0, sieveMesh->comm());
- for(int g = 0; g < numGroups; ++g) {
- char *name;
- int len;
-
- MPI_Bcast(&len, 1, MPI_INT, 0, sieveMesh->comm());
- name = new char[len+1];
- MPI_Bcast(name, len, MPI_CHAR, 0, sieveMesh->comm());
- name[len] = 0;
- const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
- assert(!groupField.isNull());
- sieveMesh->allocate(groupField);
- /* complexMesh does not need to broadcast the label names. They come from proc 0 */
- delete [] name;
- } // for
- } // if/else
+ MPI_Bcast(&len, 1, MPI_INT, 0, sieveMesh->comm());
+ name = new char[len+1];
+ MPI_Bcast(name, len, MPI_CHAR, 0, sieveMesh->comm());
+ name[len] = 0;
+ const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
+ assert(!groupField.isNull());
+ sieveMesh->allocate(groupField);
+ delete [] name;
+ } // for
+ } // if/else
+ }
} // _distributeGroups
// ----------------------------------------------------------------------
Deleted: short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -1,237 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard, U.S. Geological Survey
-// Charles A. Williams, GNS Science
-// Matthew G. Knepley, University of Chicago
-//
-// This code was developed as part of the Computational Infrastructure
-// for Geodynamics (http://geodynamics.org).
-//
-// Copyright (c) 2010-2012 University of California, Davis
-//
-// See COPYING for license information.
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "UCDFaultFile.hh" // implementation of class methods
-
-#include "MeshBuilder.hh" // USES MeshBuilder
-
-#include "pylith/topology/SubMesh.hh" // USES SubMesh
-#include "pylith/utils/array.hh" // USES scalar_array, int_array
-
-#include <petsc.h> // USES MPI_Comm
-
-#include <cassert> // USES assert()
-#include <sstream> // USES std::ostringstream
-#include <stdexcept> // USES std::runtime_error
-
-// ----------------------------------------------------------------------
-int
-pylith::meshio::UCDFaultFile::numVertices(const char* filename)
-{ // read
- int nvertices = 0;
-
- std::ifstream fin(filename, std::ios::in);
- if (!(fin.is_open() && fin.good())) {
- std::ostringstream msg;
- msg << "Could not open ASCII INP file '" << filename << "' for reading.";
- throw std::runtime_error(msg.str());
- } // if
-
- // Section 1: <num_nodes> <num_cells> <num_ndata> <num_cdata> <num_mdata>
- fin >> nvertices;
- fin.close();
-
- if (nvertices <= 0) {
- std::ostringstream msg;
- msg << "Number of vertices (" << nvertices << ") in ASCII INP file '"
- << filename << "' must be positive.";
- throw std::runtime_error(msg.str());
- } // if
-
- return nvertices;
-} // numVertices
-
-
-// ----------------------------------------------------------------------
-void
-pylith::meshio::UCDFaultFile::read(const char* filename,
- topology::SubMesh* faultMesh,
- ALE::Obj<SieveFlexMesh>& faultBoundary,
- const topology::Mesh& mesh)
-{ // read
- assert(0 != faultMesh);
-
- int faultDim = 2;
- int fSpaceDim = 0;
- int numFVertices = 0;
- int numFCells = 0;
- int numFCorners = 0;
- scalar_array fCoordinates;
- int_array fCells;
- int_array fMaterialIds;
- int_array faceCells;
- int_array vertexIDs;
-
- const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
- assert(!sieveMesh.isNull());
-
- int rank = 0;
- MPI_Comm_rank(mesh.comm(), &rank);
- if (0 == rank) {
- std::ifstream fin(filename, std::ios::in);
- if (!(fin.is_open() && fin.good())) {
- std::ostringstream msg;
- msg << "Could not open ASCII INP file '" << filename << "' for reading.";
- throw std::runtime_error(msg.str());
- } // if
- int numNodeData = 0;
- int numCellData = 0;
- int numModelData = 0;
-
- fSpaceDim = 3;
-
- // Section 1: <num_nodes> <num_cells> <num_ndata> <num_cdata> <num_mdata>
- fin >> numFVertices;
- fin >> numFCells;
- fin >> numNodeData;
- fin >> numCellData;
- fin >> numModelData;
- // Section 2: <node_id 1> <x> <y> <z>
- fCoordinates.resize(numFVertices * fSpaceDim);
- for(int v = 0; v < numFVertices; ++v) {
- int id;
- fin >> id;
- for(int d = 0; d < fSpaceDim; ++d)
- fin >> fCoordinates[v*fSpaceDim + d];
- } // for
-
- // Section 3: <cell_id 1> <mat_id> <cell_type> <cell_vert 1> ... <cell_vert n>
- fMaterialIds.resize(numFCells);
- for(int c = 0; c < numFCells; ++c) {
- std::string cellType = "";
- int cellID = 0;
-
- fin >> cellID;
- fin >> fMaterialIds[c];
- fin >> cellType;
- if (cellType == "tri") {
- numFCorners = 3;
- } else if (cellType == "quad") {
- numFCorners = 4;
- } else {
- std::ostringstream msg;
- msg << "Unknown cell type " << cellType << "while reading INP file.";
- throw std::runtime_error(msg.str());
- } // if/else
- if (c == 0) fCells.resize(numFCells*numFCorners);
- for(int i = 0; i < numFCorners; ++i)
- fin >> fCells[c*numFCorners+i];
- } // for
-
- // Section 4: <num_comp for node data> <size comp 1> <size comp 2>...<size comp n>
- int numComponents = 0;
- int totalSize = 0;
-
- fin >> numComponents;
- totalSize = 0;
- for(int i = 0; i < numComponents; ++i) {
- int compSize;
- fin >> compSize;
- totalSize += compSize;
- } // for
- // Section 5: <node_comp_label 1> , <units_label 1>
- for(int c = 0; c < numComponents; ++c) {
- std::string label, typeName;
-
- fin >> label;
- fin >> typeName;
- } // for
-
- // Section 6: <node_id 1> <node_data 1> ... <node_data num_ndata>
- vertexIDs.resize(numFVertices);
- for(int v = 0; v < numFVertices; ++v) {
- int id;
- PylithScalar dummy;
-
- fin >> id;
- fin >> vertexIDs[v]; // global node number
- fin >> dummy; // components of normal at vertices
- fin >> dummy;
- fin >> dummy;
- } // for
-
- // Section 7: <num_comp for cell's data> <size comp 1> <size comp 2>...<size comp n>
- fin >> numComponents;
- totalSize = 0;
- for(int i = 0; i < numComponents; ++i) {
- int compSize;
- fin >> compSize;
- totalSize += compSize;
- }
-
- // Section 8: <cell_component_label 1> , <units_label 1>
- for(int c = 0; c < numComponents; ++c) {
- std::string label, typeName;
-
- fin >> label;
- fin >> typeName;
- } // for
-
- // Section 9: <cell_id 1> <cell_data 1> ... <cell_data num_cdata>
- faceCells.resize(numFCells*2);
- for(int c = 0; c < numFCells; ++c) {
- int id, faultId;
-
- fin >> id;
- fin >> faceCells[c*2+0]; // Cell numbers in global mesh on either side of fault
- fin >> faceCells[c*2+1];
- fin >> faultId;
- } // for
-
- // Determine the number of cells
- // Only do this once since we add cohesive cells after that
- static int numCells = -1;
-
- assert(!sieveMesh->heightStratum(0).isNull());
- if (numCells == -1) {numCells = sieveMesh->heightStratum(0)->size();}
-
- // Renumber vertices and use zero based indices
- // UCD file has one-based indices for both vertexIDs and fCells
- // Also, vertex numbers are offset by the number of cells
- for(int c = 0; c < numFCells; ++c)
- for(int corner = 0; corner < numFCorners; ++corner)
- fCells[c*numFCorners+corner] =
- vertexIDs[fCells[c*numFCorners+corner]-1] - 1 + numCells;
-
- // Switch to zero based index for global cell numbering
- for (int c=0; c < numFCells; ++c)
- for (int i=0; i < 2; ++i)
- faceCells[c*2+i] -= 1;
- } // if
-
- // Create Sieve mesh for fault
- ALE::Obj<pylith::topology::Mesh::SieveSubMesh>& faultSieveMesh =
- faultMesh->sieveMesh();
- faultSieveMesh =
- new pylith::topology::Mesh::SieveSubMesh(mesh.comm(), mesh.dimension()-1,
- mesh.debug());
-
- assert(!sieveMesh->getSieve().isNull());
- const int firstFaultCell =
- sieveMesh->getSieve()->getBaseSize() + sieveMesh->getSieve()->getCapSize();
- MeshBuilder::buildFaultMesh(faultSieveMesh, faultBoundary,
- fCoordinates, numFVertices, fSpaceDim, fCells,
- numFCells, numFCorners, firstFaultCell,
- faceCells, faultDim);
-} // read
-
-
-// End of file
-
Deleted: short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.hh 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/UCDFaultFile.hh 2013-02-25 04:20:58 UTC (rev 21385)
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard, U.S. Geological Survey
-// Charles A. Williams, GNS Science
-// Matthew G. Knepley, University of Chicago
-//
-// This code was developed as part of the Computational Infrastructure
-// for Geodynamics (http://geodynamics.org).
-//
-// Copyright (c) 2010-2012 University of California, Davis
-//
-// See COPYING for license information.
-//
-// ======================================================================
-//
-
-/**
- * @file libsrc/meshio/UCDFaultFile.hh
- *
- * @brief C++ object for reading a fault mesh from a UCD file.
- */
-
-#if !defined(pylith_meshio_ucdfaultfile_hh)
-#define pylith_meshio_ucdfaultfile_hh
-
-// Include directives ---------------------------------------------------
-#include "meshiofwd.hh" // forward declarations
-
-#include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh
-
-#include "pylith/utils/sievetypes.hh" // USES ALE::Obj, SieveFlexMesh
-
-// UCDFaultFile ---------------------------------------------------------
-/** @brief C++ object for reading a fault mesh from a UCD file.
- *
- * TEMPORARY fix for getting a fault mesh information into
- * PyLith. Using a fault mesh permits cells to have more than one face
- * on the fault surface. Supporting information also provides the
- * orientation of the fault surface, eliminating the need to determine
- * it from the faces/vertices alone.
- */
-class pylith::meshio::UCDFaultFile
-{ // UCDFaultFile
- friend class TestUCDFaultFile; // unit testing
-
-// PUBLIC METHODS ///////////////////////////////////////////////////////
-public :
-
- /** Get number of vertices in fault mesh.
- *
- * @param filename Name of UCD file.
- * @returns Number of vertices.
- */
- static
- int numVertices(const char* filename);
-
- /** Read fault mesh from UCD file. The fault mesh must be associated
- * with the mesh of the domain.
- *
- * :WARNING: Only works for 3-D domains with tetrahedral cells and
- * UCD files with specific information.
- *
- * @param filename Name of UCD file.
- * @param faultMesh Fault mesh.
- * @param faultBoundary Boundary of fault mesh.
- * @param mesh Domain mesh.
- */
- static
- void read(const char* filename,
- topology::SubMesh* faultMesh,
- ALE::Obj<SieveFlexMesh>& faultBoundary,
- const topology::Mesh& mesh);
-
-}; // UCDFaultFile
-
-#endif // pylith_meshio_ucdfaultfile_hh
-
-
-// End of file
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/meshiofwd.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/meshiofwd.hh 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/meshiofwd.hh 2013-02-25 04:20:58 UTC (rev 21385)
@@ -59,8 +59,6 @@
class OutputSolnSubset;
class OutputSolnPoints;
- class UCDFaultFile;
-
class HDF5;
class Xdmf;
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -116,65 +116,59 @@
void
pylith::topology::Mesh::nondimensionalize(const spatialdata::units::Nondimensional& normalizer)
{ // initialize
-
- // Get coordinates (currently dimensioned).
- assert(!_mesh.isNull());
- const ALE::Obj<RealSection>& coordsSection =
- _mesh->getRealSection("coordinates");
- assert(!coordsSection.isNull());
Vec coordVec, coordDimVec;
+ const PylithScalar lengthScale = normalizer.lengthScale();
PetscErrorCode err;
- assert(_newMesh);
- err = DMGetCoordinatesLocal(_newMesh, &coordVec);CHECK_PETSC_ERROR(err);
- assert(coordVec);
+ // Get coordinates (currently dimensioned).
+ if (!_mesh.isNull()) {
+ const ALE::Obj<RealSection>& coordsSection = _mesh->getRealSection("coordinates");
+ assert(!coordsSection.isNull());
- // Get field for dimensioned coordinates.
- const ALE::Obj<RealSection>& coordsDimSection =
- _mesh->getRealSection("coordinates_dimensioned");
- assert(!coordsDimSection.isNull());
- coordsDimSection->setAtlas(coordsSection->getAtlas());
- coordsDimSection->allocateStorage();
- coordsDimSection->setBC(coordsSection->getBC());
+ // Get field for dimensioned coordinates.
+ const ALE::Obj<RealSection>& coordsDimSection =
+ _mesh->getRealSection("coordinates_dimensioned");
+ assert(!coordsDimSection.isNull());
+ coordsDimSection->setAtlas(coordsSection->getAtlas());
+ coordsDimSection->allocateStorage();
+ coordsDimSection->setBC(coordsSection->getBC());
- const PylithScalar lengthScale = normalizer.lengthScale();
- const ALE::Obj<SieveMesh::label_sequence>& vertices =
- _mesh->depthStratum(0);
- assert(!vertices.isNull());
- const SieveMesh::label_sequence::iterator verticesBegin =
- vertices->begin();
- const SieveMesh::label_sequence::iterator verticesEnd =
- vertices->end();
+ const ALE::Obj<SieveMesh::label_sequence>& vertices = _mesh->depthStratum(0);
+ assert(!vertices.isNull());
+ const SieveMesh::label_sequence::iterator verticesBegin = vertices->begin();
+ const SieveMesh::label_sequence::iterator verticesEnd = vertices->end();
- // There does not seem to be an advantage to calling nondimensionalize()
- err = VecScale(coordVec, 1.0/lengthScale);CHECK_PETSC_ERROR(err);
- err = DMPlexSetScale(_newMesh, PETSC_UNIT_LENGTH, lengthScale);CHECK_PETSC_ERROR(err);
-
- PylithScalar coordsVertex[3];
- for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
- v_iter != verticesEnd;
- ++v_iter) {
- const int spaceDim = coordsSection->getFiberDimension(*v_iter);
- assert(spaceDim <= 3);
- const PylithScalar* coordsDimVertex = coordsSection->restrictPoint(*v_iter);
+ PylithScalar coordsVertex[3];
+ for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
+ v_iter != verticesEnd;
+ ++v_iter) {
+ const int spaceDim = coordsSection->getFiberDimension(*v_iter);
+ assert(spaceDim <= 3);
+ const PylithScalar* coordsDimVertex = coordsSection->restrictPoint(*v_iter);
- // Update section with dimensioned coordinates
- assert(spaceDim ==
- coordsDimSection->getFiberDimension(*v_iter));
- coordsDimSection->updatePoint(*v_iter, coordsDimVertex);
+ // Update section with dimensioned coordinates
+ assert(spaceDim == coordsDimSection->getFiberDimension(*v_iter));
+ coordsDimSection->updatePoint(*v_iter, coordsDimVertex);
- // Copy coordinates to array for nondimensionalization.
- for (int i=0; i < spaceDim; ++i)
- coordsVertex[i] = coordsDimVertex[i];
+ // Copy coordinates to array for nondimensionalization.
+ for (int i=0; i < spaceDim; ++i)
+ coordsVertex[i] = coordsDimVertex[i];
- // Nondimensionalize original coordinates.
- normalizer.nondimensionalize(&coordsVertex[0], spaceDim, lengthScale);
+ // Nondimensionalize original coordinates.
+ normalizer.nondimensionalize(&coordsVertex[0], spaceDim, lengthScale);
- // Update section with nondimensional coordinates
- assert(spaceDim ==
- coordsSection->getFiberDimension(*v_iter));
- coordsSection->updatePoint(*v_iter, coordsVertex);
- } // for
+ // Update section with nondimensional coordinates
+ assert(spaceDim == coordsSection->getFiberDimension(*v_iter));
+ coordsSection->updatePoint(*v_iter, coordsVertex);
+ } // for
+ }
+
+ assert(_newMesh);
+ err = DMGetCoordinatesLocal(_newMesh, &coordVec);CHECK_PETSC_ERROR(err);
+ assert(coordVec);
+ // There does not seem to be an advantage to calling nondimensionalize()
+ err = VecScale(coordVec, 1.0/lengthScale);CHECK_PETSC_ERROR(err);
+ err = DMPlexSetScale(_newMesh, PETSC_UNIT_LENGTH, lengthScale);CHECK_PETSC_ERROR(err);
} // nondimensionalize
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -102,30 +102,50 @@
inline
int
pylith::topology::Mesh::dimension(void) const {
- return (!_mesh.isNull()) ? _mesh->getDimension() : 0;
+ if (_newMesh) {
+ PetscInt dim;
+ PetscErrorCode err = DMPlexGetDimension(_newMesh, &dim);CHECK_PETSC_ERROR(err);
+ return dim;
+ }
+ return 0;
}
// Get representative cone size for mesh.
inline
int
pylith::topology::Mesh::coneSize(void) const {
-
- return (!_mesh.isNull() && numCells() > 0) ?
- _mesh->getSieve()->getConeSize(*_mesh->heightStratum(0)->begin()) : 0;
+ if (_newMesh) {
+ PetscInt cStart, coneSize;
+ PetscErrorCode err;
+ err = DMPlexGetHeightStratum(_newMesh, 0, &cStart, NULL);CHECK_PETSC_ERROR(err);
+ err = DMPlexGetConeSize(_newMesh, cStart, &coneSize);CHECK_PETSC_ERROR(err);
+ return coneSize;
+ }
+ return 0;
}
// Get number of vertices in mesh.
inline
int
pylith::topology::Mesh::numVertices(void) const {
- return (!_mesh.isNull() && _mesh->depth() > 0) ? _mesh->depthStratum(0)->size() : 0;
+ if (_newMesh) {
+ PetscInt vStart, vEnd;
+ PetscErrorCode err = DMPlexGetDepthStratum(_newMesh, 0, &vStart, &vEnd);CHECK_PETSC_ERROR(err);
+ return vEnd-vStart;
+ }
+ return 0;
}
// Get number of cells in mesh.
inline
int
pylith::topology::Mesh::numCells(void) const {
- return (!_mesh.isNull() && _mesh->height() > 0) ? _mesh->heightStratum(0)->size() : 0;
+ if (_newMesh) {
+ PetscInt cStart, cEnd;
+ PetscErrorCode err = DMPlexGetHeightStratum(_newMesh, 0, &cStart, &cEnd);CHECK_PETSC_ERROR(err);
+ return cEnd-cStart;
+ }
+ return 0;
}
// Set MPI communicator associated with mesh.
@@ -155,7 +175,8 @@
inline
void
pylith::topology::Mesh::view(const char* label) const {
- _mesh->view(label);
+ assert(_newMesh);
+ PetscErrorCode err = DMView(_newMesh, PETSC_VIEWER_STDOUT_WORLD);CHECK_PETSC_ERROR(err);
}
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -75,18 +75,73 @@
_mesh.destroy();
const ALE::Obj<DomainSieveMesh>& meshSieveMesh = mesh.sieveMesh();
- assert(!meshSieveMesh.isNull());
- DM dmMesh = mesh.dmMesh();
- assert(dmMesh);
+ if (!meshSieveMesh.isNull()) {
+ if (!meshSieveMesh->hasIntSection(label)) {
+ std::ostringstream msg;
+ msg << "Could not find group of points '" << label << "' in mesh.";
+ throw std::runtime_error(msg.str());
+ } // if
- if (!meshSieveMesh->hasIntSection(label)) {
- std::ostringstream msg;
- msg << "Could not find group of points '" << label << "' in mesh.";
- throw std::runtime_error(msg.str());
- } // if
+ const ALE::Obj<IntSection>& groupField = meshSieveMesh->getIntSection(label);
+ assert(!groupField.isNull());
+ _mesh = ALE::Selection<DomainSieveMesh>::submeshV<SieveMesh>(meshSieveMesh,
+ groupField);
+ _mesh->setDebug(mesh.debug());
+ std::string meshLabel = "subdomain_" + std::string(label);
+ _mesh->setName(meshLabel);
+ if (_mesh.isNull()) {
+ std::ostringstream msg;
+ msg << "Could not construct boundary mesh for boundary '"
+ << label << "'.";
+ throw std::runtime_error(msg.str());
+ } // if
+ _mesh->setRealSection("coordinates",
+ meshSieveMesh->getRealSection("coordinates"));
+ if (meshSieveMesh->hasRealSection("coordinates_dimensioned"))
+ _mesh->setRealSection("coordinates_dimensioned",
+ meshSieveMesh->getRealSection("coordinates_dimensioned"));
+
+ // Create the parallel overlap
+ const ALE::Obj<SieveMesh::sieve_type>& sieve = _mesh->getSieve();
+ assert(!sieve.isNull());
+ ALE::Obj<SieveMesh::send_overlap_type> sendParallelMeshOverlap =
+ _mesh->getSendOverlap();
+ assert(!sendParallelMeshOverlap.isNull());
+ ALE::Obj<SieveMesh::recv_overlap_type> recvParallelMeshOverlap =
+ _mesh->getRecvOverlap();
+ assert(!recvParallelMeshOverlap.isNull());
+
+ SieveMesh::renumbering_type& renumbering = _mesh->getRenumbering();
+
+ DomainSieveMesh::renumbering_type& oldRenumbering =
+ meshSieveMesh->getRenumbering();
+ const SieveMesh::renumbering_type::const_iterator oldBegin =
+ oldRenumbering.begin();
+ const SieveMesh::renumbering_type::const_iterator oldEnd =
+ oldRenumbering.end();
+ for (SieveMesh::renumbering_type::const_iterator r_iter = oldBegin;
+ r_iter != oldEnd;
+ ++r_iter)
+ if (sieve->getChart().hasPoint(r_iter->second) &&
+ (sieve->getConeSize(r_iter->second) ||
+ sieve->getSupportSize(r_iter->second)))
+ renumbering[r_iter->first] = r_iter->second;
+
+ // Can I figure this out in a nicer way?
+ ALE::SetFromMap<std::map<DomainSieveMesh::point_type,
+ DomainSieveMesh::point_type> > globalPoints(renumbering);
+
+ ALE::OverlapBuilder<>::constructOverlap(globalPoints, renumbering,
+ sendParallelMeshOverlap,
+ recvParallelMeshOverlap);
+ _mesh->setCalculatedOverlap(true);
+ }
+
+ DM dmMesh = mesh.dmMesh();
PetscBool hasLabel;
PetscErrorCode err;
+ assert(dmMesh);
err = DMPlexHasLabel(dmMesh, label, &hasLabel);CHECK_PETSC_ERROR(err);
if (!hasLabel) {
std::ostringstream msg;
@@ -94,74 +149,20 @@
throw std::runtime_error(msg.str());
} // if
- const ALE::Obj<IntSection>& groupField = meshSieveMesh->getIntSection(label);
- assert(!groupField.isNull());
- _mesh =
- ALE::Selection<DomainSieveMesh>::submeshV<SieveMesh>(meshSieveMesh,
- groupField);
- if (_mesh.isNull()) {
- std::ostringstream msg;
- msg << "Could not construct boundary mesh for boundary '"
- << label << "'.";
- throw std::runtime_error(msg.str());
- } // if
- _mesh->setRealSection("coordinates",
- meshSieveMesh->getRealSection("coordinates"));
- if (meshSieveMesh->hasRealSection("coordinates_dimensioned"))
- _mesh->setRealSection("coordinates_dimensioned",
- meshSieveMesh->getRealSection("coordinates_dimensioned"));
-
/* TODO: Add creation of pointSF for submesh */
err = DMPlexCreateSubmesh(dmMesh, label, &_newMesh);CHECK_PETSC_ERROR(err);
- // Create the parallel overlap
- const ALE::Obj<SieveMesh::sieve_type>& sieve = _mesh->getSieve();
- assert(!sieve.isNull());
- ALE::Obj<SieveMesh::send_overlap_type> sendParallelMeshOverlap =
- _mesh->getSendOverlap();
- assert(!sendParallelMeshOverlap.isNull());
- ALE::Obj<SieveMesh::recv_overlap_type> recvParallelMeshOverlap =
- _mesh->getRecvOverlap();
- assert(!recvParallelMeshOverlap.isNull());
-
- SieveMesh::renumbering_type& renumbering = _mesh->getRenumbering();
-
- DomainSieveMesh::renumbering_type& oldRenumbering =
- meshSieveMesh->getRenumbering();
- const SieveMesh::renumbering_type::const_iterator oldBegin =
- oldRenumbering.begin();
- const SieveMesh::renumbering_type::const_iterator oldEnd =
- oldRenumbering.end();
- for (SieveMesh::renumbering_type::const_iterator r_iter = oldBegin;
- r_iter != oldEnd;
- ++r_iter)
- if (sieve->getChart().hasPoint(r_iter->second) &&
- (sieve->getConeSize(r_iter->second) ||
- sieve->getSupportSize(r_iter->second)))
- renumbering[r_iter->first] = r_iter->second;
-
- // Can I figure this out in a nicer way?
- ALE::SetFromMap<std::map<DomainSieveMesh::point_type,
- DomainSieveMesh::point_type> > globalPoints(renumbering);
-
- ALE::OverlapBuilder<>::constructOverlap(globalPoints, renumbering,
- sendParallelMeshOverlap,
- recvParallelMeshOverlap);
- _mesh->setCalculatedOverlap(true);
-
// Set data from mesh.
- _mesh->setDebug(mesh.debug());
coordsys(mesh);
// Set name
std::string meshLabel = "subdomain_" + std::string(label);
- _mesh->setName(meshLabel);
err = PetscObjectSetName((PetscObject) _newMesh, meshLabel.c_str());CHECK_PETSC_ERROR(err);
+ PetscInt maxConeSizeLocal, maxConeSize = 0;
- int maxConeSizeLocal = sieve->getMaxConeSize();
- int maxConeSize = 0;
+ err = DMPlexGetMaxSizes(dmMesh, &maxConeSizeLocal, NULL);CHECK_PETSC_ERROR(err);
err = MPI_Allreduce(&maxConeSizeLocal, &maxConeSize, 1, MPI_INT, MPI_MAX,
- sieve->comm()); CHECK_PETSC_ERROR(err);
+ PetscObjectComm((PetscObject) dmMesh)); CHECK_PETSC_ERROR(err);
if (maxConeSize <= 0) {
std::ostringstream msg;
Modified: short/3D/PyLith/trunk/modulesrc/faults/FaultCohesive.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/FaultCohesive.i 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/modulesrc/faults/FaultCohesive.i 2013-02-25 04:20:58 UTC (rev 21385)
@@ -53,16 +53,6 @@
*/
void useFaultMesh(const bool flag);
- /** Set filename of UCD file for fault mesh.
- *
- * This method is part of a KLUDGE to allow creation of cohesive
- * cells in cases where domain cells have more than one face
- * (edge for 2-D problems) on the fault.
- *
- * @param filename Filename for UCD file.
- */
- void faultMeshFilename(const char* filename);
-
/** Get the number of vertices associated with the fault (before
* fault mesh exists).
*
Modified: short/3D/PyLith/trunk/modulesrc/topology/Mesh.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/Mesh.i 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/modulesrc/topology/Mesh.i 2013-02-25 04:20:58 UTC (rev 21385)
@@ -50,11 +50,11 @@
virtual
void deallocate(void);
- /** Create Sieve mesh.
+ /** Create DM mesh.
*
* @param dim Dimension associated with mesh cells.
*/
- void createSieveMesh(const int dim=3);
+ void createDMMesh(const int dim=3);
/** Set coordinate system.
*
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py 2013-02-25 04:20:58 UTC (rev 21385)
@@ -89,9 +89,6 @@
ModuleFaultCohesive.useFaultMesh(self, self.inventory.useMesh)
#ModuleFaultCohesive.faultMeshImporter(self,
# self.inventory.faultMeshImporter)
- # TEMPORARY
- ModuleFaultCohesive.faultMeshFilename(self,
- self.inventory.meshFilename)
# Hardwire collocated quadrature
self.faultQuadrature.inventory.cell._configure()
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -72,7 +72,7 @@
// Create submesh
topology::SubMesh submesh(mesh, _data->bcLabel);
- CPPUNIT_ASSERT(!submesh.sieveMesh().isNull());
+ CPPUNIT_ASSERT(submesh.dmMesh());
// Check vertices
const ALE::Obj<SieveSubMesh::label_sequence>& vertices =
Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestQuadrature.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestQuadrature.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestQuadrature.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -201,7 +201,7 @@
// Cells and vertices
PetscBool interpolate = PETSC_FALSE;
- err = DMPlexCreateFromCellList(mesh.comm(), cellDim, numCells, data.numVertices, numBasis, interpolate, const_cast<int*>(data.cells), data.vertices, &dmMesh);CHECK_PETSC_ERROR(err);
+ err = DMPlexCreateFromCellList(mesh.comm(), cellDim, numCells, data.numVertices, numBasis, interpolate, const_cast<int*>(data.cells), spaceDim, data.vertices, &dmMesh);CHECK_PETSC_ERROR(err);
CPPUNIT_ASSERT(dmMesh);
mesh.setDMMesh(dmMesh);
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -82,7 +82,7 @@
PetscBool interpolateMesh = interpolate ? PETSC_TRUE : PETSC_FALSE;
PetscErrorCode err;
- err = DMPlexCreateFromCellList(mesh->comm(), data.cellDim, data.numCells, data.numVertices, data.numCorners, interpolateMesh, data.cells, data.vertices, &dmMesh);CHECK_PETSC_ERROR(err);
+ err = DMPlexCreateFromCellList(mesh->comm(), data.cellDim, data.numCells, data.numVertices, data.numCorners, interpolateMesh, data.cells, data.spaceDim, data.vertices, &dmMesh);CHECK_PETSC_ERROR(err);
mesh->setDMMesh(dmMesh);
// Material ids
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc 2013-02-25 04:20:58 UTC (rev 21385)
@@ -54,34 +54,36 @@
// ----------------------------------------------------------------------
// Test createSieveMesh().
void
-pylith::topology::TestMesh::testCreateSieveMesh(void)
-{ // testCreateSieveMesh
+pylith::topology::TestMesh::testCreateDMMesh(void)
+{ // testCreateDMMesh
Mesh mesh;
CPPUNIT_ASSERT(mesh._mesh.isNull());
int dim = 2;
- mesh.createSieveMesh(dim);
- CPPUNIT_ASSERT(!mesh._mesh.isNull());
+ mesh.createDMMesh(dim);
+ CPPUNIT_ASSERT(mesh._newMesh);
CPPUNIT_ASSERT_EQUAL(dim, mesh.dimension());
dim = 1;
- mesh.createSieveMesh(dim);
- CPPUNIT_ASSERT(!mesh._mesh.isNull());
+ mesh.createDMMesh(dim);
+ CPPUNIT_ASSERT(mesh._newMesh);
CPPUNIT_ASSERT_EQUAL(dim, mesh.dimension());
-} // testCreateMeshSieve
+} // testCreateDMMesh
// ----------------------------------------------------------------------
-// Test sieveMesh().
+// Test dmMesh().
void
-pylith::topology::TestMesh::testSieveMesh(void)
-{ // testSieveMesh
+pylith::topology::TestMesh::testDMMesh(void)
+{ // testDMMesh
const int dim = 2;
+ PetscInt dmDim;
Mesh mesh(dim);
- const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
- CPPUNIT_ASSERT_EQUAL(dim, sieveMesh->getDimension());
-} // testSieveMesh
+ DM dmMesh = mesh.dmMesh();
+ CPPUNIT_ASSERT(dmMesh);
+ PetscErrorCode err = DMPlexGetDimension(dmMesh, &dmDim);CHECK_PETSC_ERROR(err);
+ CPPUNIT_ASSERT_EQUAL(dim, dmDim);
+} // testDMMesh
// ----------------------------------------------------------------------
// Test coordsys().
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.hh 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.hh 2013-02-25 04:20:58 UTC (rev 21385)
@@ -47,8 +47,8 @@
CPPUNIT_TEST_SUITE( TestMesh );
CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testCreateSieveMesh );
- CPPUNIT_TEST( testSieveMesh );
+ CPPUNIT_TEST( testCreateDMMesh );
+ CPPUNIT_TEST( testDMMesh );
CPPUNIT_TEST( testCoordsys );
CPPUNIT_TEST( testDebug );
CPPUNIT_TEST( testDimension );
@@ -63,11 +63,11 @@
/// Test constructor.
void testConstructor(void);
- /// Test createSieveMesh().
- void testCreateSieveMesh(void);
+ /// Test createDMMesh().
+ void testCreateDMMesh(void);
- /// Test sieveMesh().
- void testSieveMesh(void);
+ /// Test dmMesh().
+ void testDMMesh(void);
/// Test coordsys().
void testCoordsys(void);
Modified: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveImpulses.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveImpulses.py 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveImpulses.py 2013-02-25 04:20:58 UTC (rev 21385)
@@ -75,21 +75,6 @@
return
- def test_faultMeshFilename(self):
- """
- Test faultMeshFilename().
- """
- fault = FaultCohesiveImpulses()
- fault.inventory.faultLabel = "fault group"
- fault._configure()
-
- filename = "SanAndreas.inp"
- fault.faultMeshFilename(filename)
-
- # No test of result
- return
-
-
def test_adjustTopology(self):
"""
Test adjustTopology().
Modified: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2013-02-25 04:20:58 UTC (rev 21385)
@@ -75,21 +75,6 @@
return
- def test_faultMeshFilename(self):
- """
- Test faultMeshFilename().
- """
- fault = FaultCohesiveKin()
- fault.inventory.faultLabel = "fault group"
- fault._configure()
-
- filename = "SanAndreas.inp"
- fault.faultMeshFilename(filename)
-
- # No test of result
- return
-
-
def test_adjustTopology(self):
"""
Test adjustTopology().
Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestMesh.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestMesh.py 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestMesh.py 2013-02-25 04:20:58 UTC (rev 21385)
@@ -63,17 +63,17 @@
return
- def test_createSieveMesh(self):
+ def test_createDMMesh(self):
"""
- Test createSeiveMesh().
+ Test createDMMesh().
"""
mesh = Mesh()
- mesh.createSieveMesh()
+ mesh.createDMMesh()
self.assertEqual(3, mesh.dimension())
dim = 2
- mesh.createSieveMesh(dim)
+ mesh.createDMMesh(dim)
self.assertEqual(dim, mesh.dimension())
return
Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshField.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshField.py 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshField.py 2013-02-25 04:20:58 UTC (rev 21385)
@@ -159,6 +159,7 @@
Test newSection(field).
"""
fieldB = MeshField(self.mesh)
+ fieldB.allocate()
self.field += fieldB
# No test of result
Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestSolutionFields.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestSolutionFields.py 2013-02-22 19:56:50 UTC (rev 21384)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestSolutionFields.py 2013-02-25 04:20:58 UTC (rev 21385)
@@ -108,6 +108,8 @@
def helper_fieldAdd(fields):
fieldA = fields.get("field A")
fieldB = fields.get("field B")
+ fieldA.allocate()
+ fieldB.allocate()
fieldA += fieldB
return
More information about the CIG-COMMITS
mailing list