[cig-commits] r17288 - in short/3D/PyLith/branches/pylith-scecdynrup: . doc/developer examples/greensfns/hex8 examples/twocells libsrc libsrc/bc libsrc/faults libsrc/feassemble libsrc/friction libsrc/materials libsrc/meshio libsrc/problems libsrc/topology modulesrc/meshio playpen playpen/closure pylith/feassemble pylith/meshio pylith/perf pylith/utils tests/3d tests_auto/2d tests_auto/2d/tri3 tests_auto/3dnew tests_auto/3dnew/hex8 unittests/libtests/bc unittests/libtests/bc/data unittests/libtests/faults unittests/libtests/faults/data unittests/libtests/feassemble unittests/libtests/meshio unittests/libtests/meshio/data unittests/libtests/topology unittests/libtests/topology/data unittests/pytests/feassemble unittests/pytests/meshio unittests/pytests/topology unittests/pytests/topology/data
brad at geodynamics.org
brad at geodynamics.org
Fri Oct 15 16:45:22 PDT 2010
Author: brad
Date: 2010-10-15 16:45:21 -0700 (Fri, 15 Oct 2010)
New Revision: 17288
Added:
short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/toplevel_flow.txt
short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py
short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designprior.py
short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py
short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py
short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/merge_greens.py
short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/points2spatialdb.py
short/3D/PyLith/branches/pylith-scecdynrup/examples/twocells/twohex27-cubit/
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.icc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.icc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.hh
short/3D/PyLith/branches/pylith-scecdynrup/playpen/quadratic/
short/3D/PyLith/branches/pylith-scecdynrup/tests/3d/plasticity/
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/quad9/
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/tri3/sheardisp_refine.cfg
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/tri6/
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex27/
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axial_disp.spatialdb
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp.cfg
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_gendb.py
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_soln.py
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/tet10/
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/tet4/
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourquad4.mesh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourtri3.mesh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/twotet4.mesh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterHDF5.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/TestRefineUniform.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/twotet4.mesh
Modified:
short/3D/PyLith/branches/pylith-scecdynrup/TODO
short/3D/PyLith/branches/pylith-scecdynrup/configure.ac
short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/general
short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/howto_mergefromstable.txt
short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/gfgen.py
short/3D/PyLith/branches/pylith-scecdynrup/examples/twocells/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/AbsorbingDampers.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/Neumann.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/CohesiveTopology.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveLagrange.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveTract.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/TopologyOps.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicit.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitLgDeform.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicit.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicitLgDeform.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryHex3D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine1D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine2D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine3D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad2D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad3D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticityLgDeform.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din2D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din3D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2Din3D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature3D.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/friction/FrictionModel.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/ElasticMaterial.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/Material.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/MaxwellPlaneStrain.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilter.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriter.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIOCubit.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilter.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.icc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldBase.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/topologyfwd.hh
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilter.i
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilterAvg.i
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriter.i
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterHDF5.i
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterVTK.i
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputManager.i
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputSolnSubset.i
short/3D/PyLith/branches/pylith-scecdynrup/playpen/closure/TestClosure.cc
short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATLagrange.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATSimplex.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5Mesh.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubMesh.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubSubMesh.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKMesh.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubMesh.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubSubMesh.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py
short/3D/PyLith/branches/pylith-scecdynrup/pylith/utils/VTKDataReader.py
short/3D/PyLith/branches/pylith-scecdynrup/tests/3d/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/mesh.exo
short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/mesh.jou
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestAbsorbingDampers.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestNeumann.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestTimeDependent.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/TestFaultCohesive.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8b.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8d.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8e.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8f.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8g.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8h.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8i.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDynDataTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4e.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4f.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinSrcsDataTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/TestQuadrature.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_cell_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_vertex_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_cell_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_vertex_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_cell_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_vertex_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_cell_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_vertex_t10.vtk
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldSubMesh.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATLagrange.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATSimplex.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestMeshQuadrature.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestSubMeshQuadrature.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterVTK.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/testmeshio.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/testtopology.py
Log:
Merge from trunk.
Modified: short/3D/PyLith/branches/pylith-scecdynrup/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/TODO 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/TODO 2010-10-15 23:45:21 UTC (rev 17288)
@@ -2,8 +2,19 @@
CURRENT ISSUES/PRIORITIES
======================================================================
-* Uniform global refinement for tets with faults
+* Unform global refinement
+ tri3 and tet4, level 2 work in serial, sometimes crash in parallel
+ quad4, level 2 (add face vertices for overlap)
+ hex8, level 2
+ tet4, level 4
+ tri3, level 4
+ hex8, level 4
+ quad4, level 4
+
+ Python unit tests
+ Can't test result (no cohesive cells in MeshIOAscii).
+
* Output to HDF5 files.
* Reformulate solves in terms of Schur complement
@@ -23,17 +34,31 @@
Add elasticPrestep() to Formulation
Remove solnIncr, keep setField()
+* Reimplement Fields to use a single section.
+
+ Fields -> SolutionFields
+ FieldsNew -> Fields
+
+ UniformSectionDS
+ getFibration needs to return an ISection
+ chart from original section
+ array from original section
+ atlas - set offsets based on fibration
+
* Optimization
- + Reimplement Fields to use a single section.
- - SolutionFields (RealSection)
- - UniformFields (UniformSection)?
- + May be gotchas associated with Petsc Vec and scatters
+ inline methods (what isn't getting inlined) -Winline
+ Specialized elasticity integrator objects for Quad4, Hex8
- Add for lgdeform, implicit time integration?
+
+* Testing
+ + Need full-scale test with variation in physical properties
+ within a material.
+
* Lumped elasticity formulation for large deformations
+* Add output of initial fields (initial stress and initial strain).
+
----------------------------------------------------------------------
SECONDARY PRIORITIES
----------------------------------------------------------------------
@@ -69,6 +94,36 @@
Make fault nucleation (initial tractions) modular (allow space/time
variation).
+* Time step based on state variables
+
+ TimeStepStrainRate object
+ strainRateTarget
+ strainRateTolerance
+ maxDt
+ updateInterval
+
+ if (fabs(1.0 - strainRate / strainRateTarget) < tolerance) {
+ assert(strainRate != 0.0);
+ dtNew = dtOld * strainRateTolerance / strainRate;
+ if (dtNew > maxDt)
+ dtNew = maxDt;
+ } // if
+
+ ElasticMaterial
+ strain rate not stored for purely elastic materials
+
+ storeStrainRate()
+ set flag to store strain rate
+ maxStrainRate()
+ compute total strain (if nec)
+ compute strain rate, get maximum
+
+* Explicit time step
+
+ utility code
+ Compute stable explicit time step
+ Write stable time step explicit (CFL, adhoc)
+
* Manual
Are material models consistent with governing equations discussion?
Modified: short/3D/PyLith/branches/pylith-scecdynrup/configure.ac
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/configure.ac 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/configure.ac 2010-10-15 23:45:21 UTC (rev 17288)
@@ -70,6 +70,15 @@
[enable_tetgen=no])
AM_CONDITIONAL([ENABLE_TETGEN], [test "$enable_tetgen" = yes])
+# PETSc w/HDF5
+AC_ARG_ENABLE([hdf5],
+ [AC_HELP_STRING([--enable-hdf5],
+ [enable output to HDF5 files via PETSc @<:@default=no@:>@])],
+ [enable_hdf5=yes
+ CPPFLAGS="-DENABLE_HDF5 $CPPFLAGS"; export CPPFLAGS],
+ [enable_hdf5=no])
+AM_CONDITIONAL([ENABLE_HDF5], [test "$enable_hdf5" = yes])
+
# MEMORY LOGGING
AC_ARG_ENABLE([memory_logging],
[AC_HELP_STRING([--enable-memory-logging],
@@ -170,7 +179,7 @@
if test "$enable_tetgen" = "yes" ; then
AC_REQUIRE_CPP
AC_LANG(C++)
- CPPFLAGS="$PETSC_INCLUDE $PETSC_CXX_INCLUDE $CPPFLAGS"
+ CPPFLAGS="$PETSC_CC_INCLUDES $PETSC_CXX_INCLUDE $CPPFLAGS"
AC_CHECK_HEADER([tetgen.h], [], [
AC_MSG_ERROR([tetgen header not found; check PETSc installation.])
])
@@ -184,6 +193,24 @@
])
fi
+# HDF5
+if test "$enable_hdf5" = "yes" ; then
+ AC_REQUIRE_CPP
+ AC_LANG(C++)
+ CPPFLAGS="$PETSC_CC_INCLUDES $PETSC_CXX_INCLUDE $CPPFLAGS"
+ AC_CHECK_HEADER([hdf5.h], [], [
+ AC_MSG_ERROR([HDF5 header not found.])
+ ])
+ AC_MSG_CHECKING([for H5Fopen in -lhdf5])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <hdf5.h>]],
+ [[H5Fopen("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT);]])],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ AC_MSG_ERROR([hdf5 library not found.])
+ ])
+fi
+
# PROJ4
AC_CHECK_LIB(proj, pj_init_plus, [
AC_CHECK_HEADER([proj_api.h], [], [
@@ -304,6 +331,17 @@
tests/3d/Makefile
tests/3d/matprops/Makefile
tests/3d/slipdir/Makefile
+ tests/3d/plasticity/Makefile
+ tests/3d/plasticity/threehex27/Makefile
+ tests/3d/plasticity/threehex27/config/Makefile
+ tests/3d/plasticity/threehex27/mesh/Makefile
+ tests/3d/plasticity/threehex27/results/Makefile
+ tests/3d/plasticity/threehex27/spatialdb/Makefile
+ tests/3d/plasticity/threehex8/Makefile
+ tests/3d/plasticity/threehex8/config/Makefile
+ tests/3d/plasticity/threehex8/mesh/Makefile
+ tests/3d/plasticity/threehex8/results/Makefile
+ tests/3d/plasticity/threehex8/spatialdb/Makefile
doc/Makefile
doc/developer/Makefile
doc/install/Makefile
@@ -332,6 +370,7 @@
examples/greensfns/hex8/gfresponses/Makefile
examples/greensfns/hex8/gfspatialdb/Makefile
examples/twocells/twohex8/Makefile
+ examples/twocells/twohex27-cubit/Makefile
examples/twocells/twoquad4/Makefile
examples/twocells/twotet4/Makefile
examples/twocells/twotet4-geoproj/Makefile
Modified: short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,6 +19,7 @@
EXTRA_DIST = \
general \
Sieve.tex \
+ toplevel_flow.txt \
SWIG
Modified: short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/general
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/general 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/general 2010-10-15 23:45:21 UTC (rev 17288)
@@ -9,7 +9,11 @@
3. Files checked in to the repository trunk should at least compile.
-4. C++ and Python classes should have corresponding unit tests in
+4. Changes to the code that fix bugs in released code should be done
+in the stable branch. Those changes are then merged into the trunk
+(this is tricky, so please notify Brad and he will do it for you).
+
+5. C++ and Python classes should have corresponding unit tests in
libtests and pytests. High-level functionality should be verified
using a full-scale test.
Modified: short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/howto_mergefromstable.txt
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/howto_mergefromstable.txt 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/howto_mergefromstable.txt 2010-10-15 23:45:21 UTC (rev 17288)
@@ -1,3 +1,8 @@
+# THIS IS TRICKY and can cause hundreds of conflicts in your local
+# version of the repository.
+#
+# Don't attempt a merge unless you really know what you are doing!!!!
+
# Run svn log to find last marge.
svn log | less
Copied: short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/toplevel_flow.txt (from rev 17287, short/3D/PyLith/trunk/doc/developer/toplevel_flow.txt)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/toplevel_flow.txt (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/doc/developer/toplevel_flow.txt 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,14 @@
+Top-Level Flow of PyLith
+
+pylith "main"
+
+ The pylith Python script creates a PyLithApp object, which controls
+ the flow of the code.
+
+problem
+
+ The type of PyLith simulation is known as a "problem". Currently,
+ only time-dependent problems are solved. The TimeDependent.run()
+ method controls the time-stepping with quasi-static time-stepping
+ handled by the Implicit object and the dynamic time-stepping handled
+ by the Explicit object.
Copied: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py (from rev 17287, short/3D/PyLith/trunk/examples/greensfns/hex8/designdata.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,528 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file greensfns/designdata
+
+## @brief Python application to create the data arrays necessary for an
+## inversion, given data information and Green's function information.
+## The matrices produced are the data matrix (vector), the data covariance
+## matrix (diagonal at present), and the data design matrix (numObservations
+## by numParameters).
+
+import math
+import numpy
+import sys
+from pyre.units.length import km
+from pyre.units.length import m
+
+from pyre.applications.Script import Script as Application
+
+class DesignData(Application):
+ """
+ Python application to create the data arrays necessary for an
+ inversion, given data information and Green's function information.
+ The matrices produced are the data matrix (vector), the data covariance
+ matrix (diagonal at present), and the data design matrix (numObservations
+ by numParameters).
+ """
+
+ class Inventory(Application.Inventory):
+ """
+ Python object for managing DesignData facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing DesignData facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b data_input_file File containing data, locations, and stdDev.
+ ## @li \b gf_metadata_file File containing metadata for GF.
+ ## @li \b gfresponses_ll_root Root name for left-lateral GF responses.
+ ## @li \b gfresponses_ud_root Root name for updip GF responses.
+ ## @li \b data_output_file Output file for scaled data.
+ ## @li \b cov_output_file Output file for scaled covariance matrix.
+ ## @li \b design_output_file Output file for data design matrix.
+ ## @li \b metadata_output_file Output file describing impulses and responses.
+ ## @li \b data_scale Scaling factor to apply to data and stdDev.
+ ## @li \b search_radius Radius from data center to search for GF.
+ ## @li \b impulse_number_width Width of impulse number field.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ dataInputFile = pyre.inventory.str("data_input_file",
+ default="data.txt")
+ dataInputFile.meta['tip'] = "File containing data, locations, and stdDev."
+
+ gfMetadataFile = pyre.inventory.str("gf_metadata_file",
+ default="gf_metadata.txt")
+ gfMetadataFile.meta['tip'] = "Name of file describing GF impulses."
+
+ gfResponsesLlRoot = pyre.inventory.str("gfresponses_ll_root",
+ default="gfresponse_ll.vtk")
+ gfResponsesLlRoot.meta['tip'] = "Root name for left-lateral GF responses."
+
+ gfResponsesUdRoot = pyre.inventory.str("gfresponses_ud_root",
+ default="gfresponse_ud.vtk")
+ gfResponsesUdRoot.meta['tip'] = "Root name for updip GF responses."
+
+ dataOutputFile = pyre.inventory.str("data_output_file",
+ default="data_vals.txt")
+ dataOutputFile.meta['tip'] = "Output file for scaled data."
+
+ covOutputFile = pyre.inventory.str("cov_output_file",
+ default="data_cov.txt")
+ covOutputFile.meta['tip'] = "Output file for scaled covriance matrix."
+
+ designOutputFile = pyre.inventory.str("design_output_file",
+ default="data_design.txt")
+ designOutputFile.meta['tip'] = "Output file for data design matrix."
+
+ metadataOutputFile = pyre.inventory.str("metadata_output_file",
+ default="data_metadata.txt")
+ metadataOutputFile.meta['tip'] = "Output file containing data metadata."
+
+ dataScale = pyre.inventory.float("data_scale", default=1.0)
+ dataScale.meta['tip'] = "Scaling factor to apply to data and stdDev."
+
+ searchRadius = pyre.inventory.dimensional("search_radius", default=100.0*km)
+ searchRadius.meta['tip'] = "Radius from data center to search for GF."
+
+ impulseNumberWidth = pyre.inventory.int("impulse_number_width", default=5)
+ impulseNumberWidth.meta['tip'] = "Width of impulse number field."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="designdata"):
+ Application.__init__(self, name)
+
+ self.numTotalImpulses = 0
+ self.numUsedImpulses = 0
+ self.numDataPoints = 0
+ self.designRows = 0
+ self.designColumns = 0
+ self.numCells = 0
+ self.numVertices = 0
+ self.distanceScale = 0.0
+
+ self.usedImpulses = []
+ self.usedImpulsesLl = []
+ self.usedImpulsesUd = []
+ self.interpIndices = []
+ self.dataNames = []
+ self.dataCoords = None
+ self.dataVals = None
+ self.dataCov = None
+ self.dataCenter = None
+ self.design = None
+ self.interpFuncs = None
+ self.vertexCoords = None
+ self.cellConnect = None
+
+ return
+
+
+ def main(self):
+ # import pdb
+ # pdb.set_trace()
+ self._readData()
+ self._readMetadata()
+ self._findImpulses()
+ self._createInterp()
+ self._writeMetadata()
+ self._makeDesign()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Application._configure(self)
+ # import pdb
+ # pdb.set_trace()
+
+ # File info.
+ self.dataInputFile = self.inventory.dataInputFile
+ self.gfMetadataFile = self.inventory.gfMetadataFile
+ self.gfResponsesLlRoot = self.inventory.gfResponsesLlRoot
+ self.gfResponsesUdRoot = self.inventory.gfResponsesUdRoot
+ self.dataOutputFile = self.inventory.dataOutputFile
+ self.covOutputFile = self.inventory.covOutputFile
+ self.designOutputFile = self.inventory.designOutputFile
+ self.metadataOutputFile = self.inventory.metadataOutputFile
+
+ # Data information
+ self.dataScale = self.inventory.dataScale
+
+ # Impulse information
+ self.searchRadius = self.inventory.searchRadius.value
+ self.impulseNumberWidth = self.inventory.impulseNumberWidth
+
+ return
+
+
+ def _readData(self):
+ """
+ Function to read data, coordinates, and standard deviations.
+ """
+ f = open(self.dataInputFile, 'r')
+ lines = f.readlines()
+ self.numDataPoints = len(lines) - 1
+ self.designRows = 3 * self.numDataPoints
+ coords = []
+ data = []
+ cov = []
+ for line in range(1,self.numDataPoints + 1):
+ lineSplit = lines[line].split()
+ east = float(lineSplit[2])
+ north = float(lineSplit[1])
+ self.dataNames.append(lineSplit[0])
+ coords.append([east, north])
+ vE = self.dataScale * float(lineSplit[5])
+ vN = self.dataScale * float(lineSplit[6])
+ vU = self.dataScale * float(lineSplit[7])
+ data.append(vE)
+ data.append(vN)
+ data.append(vU)
+ sigE = self.dataScale * float(lineSplit[8])
+ sigN = self.dataScale * float(lineSplit[9])
+ sigU = self.dataScale * float(lineSplit[10])
+ cov.append(sigE*sigE)
+ cov.append(sigN*sigN)
+ cov.append(sigU*sigU)
+
+ f.close()
+
+ print "Number of data points: %i" % self.numDataPoints
+ print "Number of rows in design matrix: %i" % self.designRows
+ sys.stdout.flush()
+ self.dataVals = numpy.array(data, dtype=numpy.float64)
+ self.dataCov = numpy.array(cov, dtype=numpy.float64)
+ numpy.savetxt(self.dataOutputFile, self.dataVals)
+ numpy.savetxt(self.covOutputFile, self.dataCov)
+ self.dataCoords = numpy.array(coords, dtype=numpy.float64)
+ self.dataCenter = numpy.mean(self.dataCoords, axis=0).reshape((1, 2))
+
+ return
+
+
+ def _readMetadata(self):
+ """
+ Function to read metadata.
+ """
+ self.metadata = numpy.loadtxt(self.gfMetadataFile, dtype=numpy.float64,
+ skiprows=1)
+ self.numTotalImpulses = self.metadata.shape[0]
+
+ print "Total number of impulses: %i" % self.numTotalImpulses
+ sys.stdout.flush()
+
+ return
+
+
+ def _findImpulses(self):
+ """
+ Function to find impulses that lie within a given radius of the data center.
+ """
+ import scipy.spatial.distance
+
+ impulseCoords = self.metadata[:,1:3]
+ distance = scipy.spatial.distance.cdist(impulseCoords, self.dataCenter,
+ 'euclidean')
+
+ for impulse in range(self.numTotalImpulses):
+ if (distance[impulse] < self.searchRadius):
+ self.usedImpulses.append(impulse)
+ llFilename = self._getFilename(self.gfResponsesLlRoot, impulse)
+ udFilename = self._getFilename(self.gfResponsesUdRoot, impulse)
+ self.usedImpulsesLl.append(llFilename)
+ self.usedImpulsesUd.append(udFilename)
+
+ self.numUsedImpulses = len(self.usedImpulses)
+ self.designColumns = 2 * self.numUsedImpulses
+ print "Number of impulse locations used: %i" % self.numUsedImpulses
+ print "Number of columns in design matrix: %i" % self.designColumns
+ sys.stdout.flush()
+ return
+
+
+ def _getFilename(self, fileRoot, impulse):
+ """
+ Function to create a filename given the root filename and the impulse
+ number.
+ """
+ impulseNum = int(impulse)
+ impulseString = repr(impulseNum).rjust(self.impulseNumberWidth, '0')
+ filename = fileRoot + "_t" + impulseString + ".vtk"
+
+ return filename
+
+
+ def _createInterp(self):
+ """
+ Function to find cell containing an observation point and create the
+ corresponding interpolation functions.
+ """
+ from enthought.mayavi.sources.vtk_file_reader import VTKFileReader
+ from enthought.tvtk.api import tvtk
+
+ # First read a VTK file to get geometry info
+ reader = VTKFileReader()
+ filename = self.usedImpulsesLl[0]
+ reader.initialize(filename)
+ data = reader.outputs[0]
+
+ # Get cell and vertex info.
+ cellVtk = data.get_cells()
+ self.numCells = cellVtk.number_of_cells
+ cellArray = cellVtk.to_array()
+ self.vertexCoords = data._get_points().to_array()
+ (self.numVertices, spaceDim) = self.vertexCoords.shape
+ cellMatrix = cellArray.reshape(self.numCells,4)
+ self.cellConnect = cellMatrix[:,1:4]
+
+ meshRange = numpy.ptp(self.vertexCoords, axis=0)
+ self.distanceScale = 0.1 * numpy.amax(meshRange)
+
+ # Find cells enclosing each observation point.
+ self.interpIndices = self._findCells()
+
+ # Compute interpolation functions for each cell/observation point.
+ self._computeInterp()
+
+ return
+
+
+ def _computeInterp(self):
+ """
+ Function to compute interpolation functions for a point lying in a
+ triangular cell.
+ """
+ interpList = []
+ for point in range(self.numDataPoints):
+ cellNum = self.interpIndices[point]
+ cellCoords = self.vertexCoords[self.cellConnect[cellNum,:],0:2]
+ pointCoords = self.dataCoords[point,:]
+ x1 = cellCoords[0,0]
+ x2 = cellCoords[1,0]
+ x3 = cellCoords[2,0]
+ y1 = cellCoords[0,1]
+ y2 = cellCoords[1,1]
+ y3 = cellCoords[2,1]
+ x = pointCoords[0]
+ y = pointCoords[1]
+ denom = x1 * (y3 - y2) + x2 * (y1 - y3) + x3 * (y2 - y1)
+ l1 = x * (y3 - y2) + x2 * (y - y3) + x3 * (y2 - y)
+ l2 = -(x * (y3 - y1) + x1 * (y - y3) + x3 * (y1 - y))
+ l3 = x * (y2 - y1) + x1 * (y - y2) + x2 * (y1 - y)
+ interpList.append([l1/denom, l2/denom, l3/denom])
+
+ self.interpFuncs = numpy.array(interpList, dtype=numpy.float64)
+
+ return
+
+
+ def _findCells(self):
+ """
+ Function to find triangles enclosing a set of points.
+ Brute force method for now.
+ """
+
+ indices = []
+ for point in range(self.numDataPoints):
+ pointCoords = self.dataCoords[point,:]
+ cellFound = False
+ for cell in range(self.numCells):
+ cellCoords = self.vertexCoords[self.cellConnect[cell,:],0:2]
+ inTriangle = self._inTriangle(pointCoords, cellCoords)
+ if (inTriangle):
+ indices.append(cell)
+ cellFound = True
+ break
+
+ if (not cellFound):
+ msg = 'Unable to find surrounding cell for data point # %i' % point
+ raise ValueError(msg)
+
+ return indices
+
+
+ def _inTriangle(self, pointCoords, cellCoords):
+ """
+ Function to determine whether a point lies within a triangular cell.
+ """
+
+ v2 = pointCoords - cellCoords[0,:]
+
+ if (math.sqrt(numpy.dot(v2, v2)) > self.distanceScale):
+ return False
+
+ v0 = cellCoords[2,:] - cellCoords[0,:]
+ v1 = cellCoords[1,:] - cellCoords[0,:]
+
+ dot00 = numpy.dot(v0, v0)
+ dot01 = numpy.dot(v0, v1)
+ dot02 = numpy.dot(v0, v2)
+ dot11 = numpy.dot(v1, v1)
+ dot12 = numpy.dot(v1, v2)
+
+ invDenom = 1.0/(dot00 * dot11 - dot01 * dot01)
+ u = (dot11 * dot02 - dot01 * dot12) * invDenom
+ v = (dot00 * dot12 - dot01 * dot02) * invDenom
+
+ return ((u > 0.0) and (v > 0.0) and (u + v < 1.0))
+
+
+ def _makeDesign(self):
+ """
+ Function to create design matrix and write it to a file.
+ """
+ # Compute coefficients for each impulse/response pair.
+ impulseList = []
+ impulseTypes = [self.usedImpulsesLl, self.usedImpulsesUd]
+ for impulseType in range(2):
+ filelist = impulseTypes[impulseType]
+ for impulse in range(self.numUsedImpulses):
+ print 'Working on impulse # %i (%i)' % \
+ (impulse, self.usedImpulses[impulse])
+ sys.stdout.flush()
+ impulseCoeffs = self._getCoeffs(filelist[impulse])
+ impulseList.append(impulseCoeffs)
+ self.design = numpy.transpose(numpy.array(impulseList, dtype=numpy.float64))
+ numpy.savetxt(self.designOutputFile, self.design)
+
+ return
+
+
+ def _getCoeffs(self, vtkFile):
+ """
+ Function to compute all the coefficients from a particular impulse.
+ """
+ from enthought.mayavi.sources.vtk_file_reader import VTKFileReader
+ from enthought.tvtk.api import tvtk
+
+ # Read VTK file
+ reader = VTKFileReader()
+ reader.initialize(vtkFile)
+ data = reader.outputs[0]
+
+ # Get computed displacements
+ vertData = data._get_point_data()
+ numVertDataArrays = vertData._get_number_of_arrays()
+ displArray = None
+ for arrayNum in range(numVertDataArrays):
+ arrayName = vertData.get_array_name(arrayNum)
+ if (arrayName == 'displacement'):
+ displArray = vertData.get_array(arrayNum).to_array()
+ break
+
+ responseVals = []
+ for dataPoint in range(self.numDataPoints):
+ u, v, w = self._computeDispl(dataPoint, displArray)
+ responseVals.append(u)
+ responseVals.append(v)
+ responseVals.append(w)
+
+ return responseVals
+
+
+ def _computeDispl(self, dataPoint, displArray):
+ """
+ Function to interpolate displacements to a given data point.
+ """
+
+ u = 0.0
+ v = 0.0
+ w = 0.0
+ cellNum = self.interpIndices[dataPoint]
+ for vertex in range(3):
+ vertNum = self.cellConnect[cellNum, vertex]
+ u += self.interpFuncs[dataPoint, vertex] * displArray[vertNum, 0]
+ v += self.interpFuncs[dataPoint, vertex] * displArray[vertNum, 1]
+ w += self.interpFuncs[dataPoint, vertex] * displArray[vertNum, 2]
+
+ return (u, v, w)
+
+
+ def _writeMetadata(self):
+ """
+ Function to write metadata describing impulses (columns) and data (rows).
+ """
+ f = open(self.metadataOutputFile, 'w')
+ newLine = '\n'
+ tab = '\t'
+
+ # Write data information.
+ dataDescr = 'Information for rows (data points), %i rows total\n' % self.designRows
+ f.write(dataDescr)
+ dataHead = 'Row #' + tab + 'Site-name' + tab + 'Component' + tab + \
+ 'X-coord' + tab + 'Y-coord' + newLine
+ f.write(dataHead)
+ components = ['X', 'Y', 'Z']
+ dataFormat = '%i' + tab + '%s' + tab + '%s' + tab + '%e' + tab + '%e' + \
+ newLine
+
+
+ rowNum = 0
+ for dataPoint in range(self.numDataPoints):
+ coords = self.dataCoords[dataPoint, :]
+ name = self.dataNames[dataPoint]
+ for component in range(3):
+ outLine = dataFormat % (rowNum, name, components[component],
+ coords[0], coords[1])
+ f.write(outLine)
+ rowNum += 1
+
+ # Write impulse information.
+ impulseDescr = newLine + newLine + \
+ 'Information for columns (impulses), %i columns total\n' % self.designColumns
+ f.write(impulseDescr)
+ impulseHead = 'Column #' + tab + 'Impulse type' + tab + 'X-coord' + tab + \
+ 'Y-coord' + tab + 'Z-coord' + tab + \
+ 'Normal-X' + tab + 'Normal-Y' + tab + 'Normal-Z' + tab + \
+ 'Strike-X' + tab + 'Strike-Y' + tab + 'Strike-Z' + tab + \
+ 'Dip-X' + tab + 'Dip-Y' + tab + 'Dip-Z' + newLine
+ f.write(impulseHead)
+ impulseTypes = ['ll', 'ud']
+
+ colNum = 0
+ metadataOut = 12 * (tab + '%e')
+ outFormat = '%i' + tab + '%s' + metadataOut + newLine
+ for impulseType in range(2):
+ impulseText = impulseTypes[impulseType]
+ for impulse in self.usedImpulses:
+ metadata = self.metadata[impulse, 1:13]
+ outLine = outFormat % (colNum, impulseText,
+ metadata[0], metadata[1], metadata[2],
+ metadata[3], metadata[4], metadata[5],
+ metadata[6], metadata[7], metadata[8],
+ metadata[9], metadata[10], metadata[11])
+ f.write(outLine)
+ colNum += 1
+
+ f.close()
+
+ return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = DesignData()
+ app.run()
+
+# End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designprior.py (from rev 17287, short/3D/PyLith/trunk/examples/greensfns/hex8/designprior.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designprior.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designprior.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,228 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file greensfns/designprior
+
+## @brief Python application to create the a priori arrays necessary for an
+## inversion, given the impulse locations, the a priori values, and the
+## desired correlation length.
+## The matrices produced are the a priori data matrix (vector) and the a priori
+## covariance matrix. The a priori design matrix is assumed to be an identity
+## matrix with dimensions corresponding to the number of parameters.
+
+import math
+import numpy
+import sys
+from pyre.units.length import km
+from pyre.units.length import m
+
+from pyre.applications.Script import Script as Application
+
+class DesignPrior(Application):
+ """
+ Python application to create the a priori arrays necessary for an
+ inversion, given the impulse locations, the a priori values, and the
+ desired correlation length.
+ The matrices produced are the a priori data matrix (vector) and the a priori
+ covariance matrix. The a priori design matrix is assumed to be an identity
+ matrix with dimensions corresponding to the number of parameters.
+ """
+
+ class Inventory(Application.Inventory):
+ """
+ Python object for managing DesignPrior facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing DesignPrior facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b metadata_input_file File containing metadata for the inversion.
+ ## @li \b data_output_file File containing a priori parameter values.
+ ## @li \b cov_output_file Output file for a priori covariance matrix.
+ ## @li \b correlation_length Correlation length for covariance.
+ ## @li \b std_dev Standard deviation to use for covariance.
+ ## @li \b apriori_value A priori parameter values (all set to this value).
+ ## @li \b diagonal_frac Additional fraction to add to covariance diagonal.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ metadataInputFile = pyre.inventory.str("metadata_input_file",
+ default="metadata.txt")
+ metadataInputFile.meta['tip'] = "File containing inversion metadata."
+
+ dataOutputFile = pyre.inventory.str("data_output_file",
+ default="data_vals.txt")
+ dataOutputFile.meta['tip'] = "Output file with a priori parameter values."
+
+ covOutputFile = pyre.inventory.str("cov_output_file",
+ default="data_cov.txt")
+ covOutputFile.meta['tip'] = "Output file for a priori covriance matrix."
+
+ correlationLength = pyre.inventory.dimensional("correlation_length",
+ default=10.0*km)
+ correlationLength.meta['tip'] = "Correlation length for covariance."
+
+ stdDev = pyre.inventory.dimensional("std_dev", default=1.0*m)
+ stdDev.meta['tip'] = "Standard deviation for covariance."
+
+ aprioriValue = pyre.inventory.dimensional("apriori_value", default=0.0*m)
+ aprioriValue.meta['tip'] = "A priori parameter values."
+
+ diagonalFrac = pyre.inventory.float("diagonal_frac", default=0.1)
+ diagonalFrac.meta['tip'] = "Additional fraction to add to covariance diagonal."
+
+ minCovar = pyre.inventory.float("min_covar", default=1.0e-5)
+ minCovar.meta['tip'] = "Covariance values less than this are set to zero."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="designprior"):
+ Application.__init__(self, name)
+
+ self.numParameters = 0
+
+ self.impulseCoords = None
+
+ return
+
+
+ def main(self):
+ # import pdb
+ # pdb.set_trace()
+ self._readMetadata()
+ self._makeCovar()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Application._configure(self)
+ # import pdb
+ # pdb.set_trace()
+
+ # File info.
+ self.metadataInputFile = self.inventory.metadataInputFile
+ self.dataOutputFile = self.inventory.dataOutputFile
+ self.covOutputFile = self.inventory.covOutputFile
+
+ # Parameters
+ self.correlationLength = self.inventory.correlationLength.value
+ self.stdDev = self.inventory.stdDev.value
+ self.aprioriValue = self.inventory.aprioriValue.value
+ self.diagonalFrac = self.inventory.diagonalFrac
+ self.minCovar = self.inventory.minCovar
+
+ return
+
+
+ def _readMetadata(self):
+ """
+ Function to read information describing parameters and write parameter
+ values.
+ """
+ # Get impulse information.
+ f = open(self.metadataInputFile, 'r')
+ lines = f.readlines()
+ coords = []
+ impulseData = False
+ for line in lines:
+ if impulseData:
+ lineSplit = line.split()
+ impulseCoord = [float(lineSplit[2]), float(lineSplit[3]),
+ float(lineSplit[4])]
+ coords.append(impulseCoord)
+ self.numParameters += 1
+ testFind = line.find('Column')
+ if testFind > -1:
+ impulseData = True
+
+ f.close()
+ self.impulseCoords = numpy.array(coords, dtype=numpy.float64)
+
+ print "Number of parameters: %i" % self.numParameters
+
+ # Write a priori parameter values.
+ parameterVals = self.aprioriValue * numpy.ones(self.numParameters)
+ numpy.savetxt(self.dataOutputFile, parameterVals)
+
+ return
+
+
+ def _distanceFunc(self, distance):
+ """
+ Function to compute autocorrelation based on distance.
+ """
+ distanceArg = -0.5 * (distance * distance)/\
+ (self.correlationLength * self.correlationLength)
+ covariance = self.stdDev * self.stdDev * math.exp(distanceArg)
+ return covariance
+
+
+ def _makeCovar(self):
+ """
+ Function to create a priori covariance matrix for a given correlation
+ length.
+ """
+ import scipy.spatial.distance
+ import scipy.stats.mstats
+
+ # Compute distances between all points.
+ # Temporary kludge because the prior approach correlated different types
+ # of impulses with each other.
+ impulseHalf = self.impulseCoords[0:self.numParameters/2,:]
+ distance = scipy.spatial.distance.cdist(impulseHalf,
+ impulseHalf, 'euclidean')
+
+ # Compute covariance.
+ multiplier = -0.5/(self.correlationLength * self.correlationLength)
+ distanceArg = multiplier * distance * distance
+ # distanceFunc = numpy.vectorize(self._distanceFunc)
+ # aprioriCovar = distanceFunc(distance)
+ covarMult = self.stdDev * self.stdDev
+ aprioriCovarHalf = covarMult * numpy.exp(distanceArg)
+ aprioriCovarEmpty = numpy.zeros_like(aprioriCovarHalf)
+
+ # Delete all entries below threshold.
+ aprioriCovarHalfThresh = scipy.stats.mstats.threshold(
+ aprioriCovarHalf, threshmin=self.minCovar)
+
+ # Join together different pieces.
+ aprioriCovarTop = numpy.hstack((aprioriCovarHalfThresh, aprioriCovarEmpty))
+ aprioriCovarBot = numpy.hstack((aprioriCovarEmpty, aprioriCovarHalfThresh))
+ aprioriCovar = numpy.vstack((aprioriCovarTop, aprioriCovarBot))
+
+ # Add additional amount to diagonal.
+ covarDiagAdd = self.diagonalFrac * numpy.diag(aprioriCovar)
+ diagIndices = numpy.arange(self.numParameters)
+ aprioriCovar[diagIndices, diagIndices] += covarDiagAdd
+
+ # Write covariance to file.
+ numpy.savetxt(self.covOutputFile, aprioriCovar)
+
+ return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = DesignPrior()
+ app.run()
+
+# End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py (from rev 17287, short/3D/PyLith/trunk/examples/greensfns/hex8/getcoords.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,146 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file greensfns/getcoords
+
+## @brief Python application to get the coordinates for a set of vertex
+## ID's and output them to a file. This is a very simple code that expects
+## coordinates in Abaqus format as well as ID's in Abaqus nodeset format.
+
+import math
+import numpy
+import os
+import re
+import glob
+from pyre.units.time import s
+from pyre.units.length import m
+
+from pyre.applications.Script import Script as Application
+
+class GetCoords(Application):
+ """
+ Python application to get the coordinates for a set of vertex
+ ID's and output them to a file. This is a very simple code that expects
+ coordinates in Abaqus format as well as ID's in Abaqus nodeset format.
+ """
+
+ class Inventory(Application.Inventory):
+ """
+ Python object for managing GetCoords facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing GetCoords facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b coord_file Name of file containing vertex coordinates.
+ ## @li \b id_file Name of file containing vertex ID's.
+ ## @li \b output_file Name of output file with requested coordinates.
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ coordFile = pyre.inventory.str("coord_file", default="mesh.coords")
+ coordFile.meta['tip'] = "Name of file containing vertex coordinates."
+
+ idFile = pyre.inventory.str("id_file", default="mesh.ids")
+ idFile.meta['tip'] = "Name of file containing vertex ID's."
+
+ outputFile = pyre.inventory.str("output_file", default="mesh.ids")
+ outputFile.meta['tip'] = "Name of output file with requested coordinates."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="getcoords"):
+ Application.__init__(self, name)
+
+ self.numIds = 0
+ self.idList = []
+
+ return
+
+
+ def main(self):
+ # import pdb
+ # pdb.set_trace()
+ self._readIds()
+ self._getCoords()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Application._configure(self)
+ # import pdb
+ # pdb.set_trace()
+
+ # File info.
+ self.coordFile = self.inventory.coordFile
+ self.idFile = self.inventory.idFile
+ self.outputFile = self.inventory.outputFile
+
+ return
+
+
+ def _readIds(self):
+ """
+ Function to read ID numbers.
+ """
+ f = open(self.idFile, 'r')
+ lines = f.readlines()
+ for line in lines:
+ for entry in line.split(', '):
+ self.idList.append(int(entry.rstrip(',\n')))
+
+ self.numIds = len(self.idList)
+ f.close()
+
+ return
+
+
+ def _getCoords(self):
+ """
+ Function to read a list of coordinates and output the coordinates if
+ they correspond to one of the requested ID's.
+ """
+ f = open(self.coordFile, 'r')
+ o = open(self.outputFile, 'w')
+ lines = f.readlines()
+ for line in lines:
+ vertexId = int(line.split(', ')[0].rstrip(',\n'))
+ for requestedId in self.idList:
+ if vertexId == requestedId:
+ x = line.split(', ')[1].rstrip(',')
+ y = line.split(', ')[2].rstrip(',')
+ z = line.split(', ')[3].rstrip(',\n')
+ outLine = x + ' ' + y + ' ' + z + '\n'
+ o.write(outLine)
+ break
+
+ f.close()
+ o.close()
+
+ return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = GetCoords()
+ app.run()
+
+# End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/gfgen.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/gfgen.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/gfgen.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -54,6 +54,9 @@
## @li \b impulse_type Type of impulse to be applied.
## @li \b impulse_value Amount of impulse to apply.
## @li \b impulse_number_width Width of impulse number field.
+ ## @li \b start_impulse_num Number assigned to first impulse.
+ ## @li \b exclude_file File containing vertex coordinates to exclude.
+ ## @li \b distance_tol Distance tolerance to determine coincident vertices.
##
## \b Facilities
## @li \b geometry Geometry for output database.
@@ -92,6 +95,15 @@
impulseNumberWidth = pyre.inventory.int("impulse_number_width", default=4)
impulseNumberWidth.meta['tip'] = "Width of impulse number field."
+ startImpulseNum = pyre.inventory.int("start_impulse_num", default=0)
+ startImpulseNum.meta['tip'] = "Number assigned to first impulse."
+
+ excludeFile = pyre.inventory.str("exclude_file", default="")
+ excludeFile.meta['tip'] = "File containing vertex coordinates to exclude."
+
+ distanceTol = pyre.inventory.dimensional("distance_tol", default=0.1*m)
+ distanceTol.meta['tip'] = "Distance tolerance to determine coincident vertices."
+
from spatialdata.spatialdb.generator.Geometry import Geometry
geometry = pyre.inventory.facility("geometry", family="geometry",
factory=Geometry)
@@ -104,11 +116,15 @@
Application.__init__(self, name)
self.numFaultVertices = 0
+ self.numExcludedVertices = 0
+ self.numIncludedVertices = 0
self.numFaultCells = 0
self.spaceDim = 0
self.cellType = ""
- self.faultCoords = None
+ self.excludeCoords = None
+ self.numExcludeCoords = 0
+ self.faultVertices = None
self.normalDir = None
self.strikeDir = None
self.dipDir = None
@@ -119,6 +135,7 @@
def main(self):
# import pdb
# pdb.set_trace()
+ self._readExcludeInfo()
self._readFaultInfo()
self._makeSpatialdb()
self._makeConfig()
@@ -147,13 +164,31 @@
self.impulseType = self.inventory.impulseType
self.impulseValue = self.inventory.impulseValue.value
self.impulseNumberWidth = self.inventory.impulseNumberWidth
+ self.startImpulseNum = self.inventory.startImpulseNum
+ # Excluded vertex information
+ self.excludeFile = self.inventory.excludeFile
+ self.distanceTol = self.inventory.distanceTol.value
+
# Spatialdb output facilities
self.geometry = self.inventory.geometry
return
+ def _readExcludeInfo(self):
+ """
+ Function to read coordinates of vertices to exclude from impulse list.
+ """
+ fileExists = os.path.isfile(self.excludeFile)
+ if fileExists:
+ self.excludeCoords = numpy.loadtxt(self.excludeFile, dtype=numpy.float64)
+ self.numExcludeCoords = self.excludeCoords.shape[0]
+ else:
+ print "No exclude file found!"
+
+ return
+
def _readFaultInfo(self):
"""
Function to read fault information from VTK file.
@@ -169,9 +204,9 @@
cellVtk = data.get_cells()
self.numFaultCells = cellVtk.number_of_cells
self.faultCellArray = cellVtk.to_array()
- self.faultVertices = data._get_points().to_array()
+ faultCoords = data._get_points().to_array()
self.cellType = data.get_cell_type(0)
- (self.numFaultVertices, self.spaceDim) = self.faultVertices.shape
+ (self.numFaultVertices, self.spaceDim) = faultCoords.shape
# Get vertex fields and extract normal vectors.
vertData = data._get_point_data()
@@ -179,12 +214,52 @@
for vertDataArray in range(numVertDataArrays):
arrayName = vertData.get_array_name(vertDataArray)
if (arrayName == "normal_dir"):
- self.normalDir = vertData.get_array(vertDataArray).to_array()
+ normalDir = vertData.get_array(vertDataArray).to_array()
elif (arrayName == "strike_dir"):
- self.strikeDir = vertData.get_array(vertDataArray).to_array()
+ strikeDir = vertData.get_array(vertDataArray).to_array()
elif (arrayName == "dip_dir"):
- self.dipDir = vertData.get_array(vertDataArray).to_array()
+ dipDir = vertData.get_array(vertDataArray).to_array()
+ # Determine which vertices to exclude, if any.
+ includedVertices = []
+ excludedVertices = []
+ if self.numExcludeCoords == 0:
+ self.numIncludedVertices = self.numFaultVertices
+ else:
+ for vertex in range(self.numFaultVertices):
+ vertexCoords = faultCoords[vertex,:]
+ vertexMatch = False
+ for excludeVertex in range(self.numExcludeCoords):
+ excludeCoords = self.excludeCoords[excludeVertex,:]
+ diff = vertexCoords - excludeCoords
+ dist =numpy.linalg.norm(diff)
+ if (dist <= self.distanceTol):
+ vertexMatch = True
+ excludedVertices.append(vertex)
+ break
+
+ if not vertexMatch:
+ includedVertices.append(vertex)
+
+ self.numIncludedVertices = len(includedVertices)
+ self.numExcludedVertices = len(excludedVertices)
+ # Reorder arrays so excluded vertices are at the end.
+ includedCoords = faultCoords[includedVertices,:]
+ excludedCoords = faultCoords[excludedVertices,:]
+ self.faultVertices = numpy.vstack((includedCoords, excludedCoords))
+ includedNormal = normalDir[includedVertices,:]
+ excludedNormal = normalDir[excludedVertices,:]
+ self.normalDir = numpy.vstack((includedNormal, excludedNormal))
+ includedStrike = strikeDir[includedVertices,:]
+ excludedStrike = strikeDir[excludedVertices,:]
+ self.strikeDir = numpy.vstack((includedStrike, excludedStrike))
+ includedDip = dipDir[includedVertices,:]
+ excludedDip = dipDir[excludedVertices,:]
+ self.dipDir = numpy.vstack((includedDip, excludedDip))
+
+ print "Number of excluded vertices: %i" % self.numExcludedVertices
+ print "Number of included vertices: %i" % self.numIncludedVertices
+
return
@@ -235,7 +310,8 @@
dataDim = self.spaceDim - 1
# Loop over impulses to generate and modify the appropriate entries.
- for impulse in range(self.numFaultVertices):
+ impulse = self.startImpulseNum
+ for vertex in range(self.numIncludedVertices):
# Set filename
impulseNum = int(impulse)
@@ -246,12 +322,12 @@
writer._configure()
# Modify database values.
- array1[impulse] = self.impulseValue
- if (impulse > 0):
- array1[impulse - 1] = -self.impulseValue
+ array1[vertex] = self.impulseValue
+ if (vertex > 0):
+ array1[vertex - 1] = -self.impulseValue
- if (impulse > 1):
- array1[impulse - 2] = 0.0
+ if (vertex > 1):
+ array1[vertex - 2] = 0.0
info1 = {'name': self.impulseType,
'units': "m",
'data': array1.flatten()}
@@ -269,6 +345,7 @@
'values': [info1, info2, info3]}
writer.write(data)
+ impulse += 1
return
@@ -285,8 +362,8 @@
f.write(topHeader)
# Write time step information
- totalTime = "total_time = " + repr(float(self.numFaultVertices - 1)) + \
- "*year" + newLine
+ time = float(self.startImpulseNum) + float(self.numIncludedVertices) - 1.0
+ totalTime = "total_time = " + repr(time) + "*year" + newLine
dt = "dt = 1.0*year" + newLine
divider = "# ----------------------------------------------------------" + \
newLine
@@ -303,11 +380,13 @@
comma = ","
# Write eq_srcs list.
- for impulse in range(self.numFaultVertices):
+ impulse = self.startImpulseNum
+ for vertex in range(self.numIncludedVertices):
srcName = repr(impulse).rjust(self.impulseNumberWidth, '0')
f.write(srcName)
- if (impulse != self.numFaultVertices - 1):
+ if (vertex != self.numIncludedVertices - 1):
f.write(comma)
+ impulse += 1
srcEnd = "]" + newLine
f.write(srcEnd)
@@ -324,7 +403,8 @@
self.slipTimeSpatialdb + newLine
# Write info for each eq_src.
- for impulse in range(self.numFaultVertices):
+ impulse = self.startImpulseNum
+ for vertex in range(self.numIncludedVertices):
f.write(newLine)
srcName = repr(impulse).rjust(self.impulseNumberWidth, '0')
originTime = float(impulse)
@@ -333,6 +413,7 @@
f.write(baseOrigin + originString)
f.write(baseSlip + srcName + ".spatialdb\n")
f.write(slipTime)
+ impulse += 1
f.close()
@@ -353,22 +434,24 @@
"Strike-Z" + tab + "Dip-X" + tab + "Dip-Y" + tab + "Dip-Z" \
+ newLine
f.write(header)
- for impulse in range(self.numFaultVertices):
- x = str(self.faultVertices[impulse, 0]) + tab
- y = str(self.faultVertices[impulse, 1]) + tab
- z = str(self.faultVertices[impulse, 2]) + tab
- xNorm = str(self.normalDir[impulse, 0]) + tab
- yNorm = str(self.normalDir[impulse, 1]) + tab
- zNorm = str(self.normalDir[impulse, 2]) + tab
- xStrike = str(self.strikeDir[impulse, 0]) + tab
- yStrike = str(self.strikeDir[impulse, 1]) + tab
- zStrike = str(self.strikeDir[impulse, 2]) + tab
- xDip = str(self.dipDir[impulse, 0]) + tab
- yDip = str(self.dipDir[impulse, 1]) + tab
- zDip = str(self.dipDir[impulse, 2]) + newLine
+ impulse = self.startImpulseNum
+ for vertex in range(self.numIncludedVertices):
+ x = str(self.faultVertices[vertex, 0]) + tab
+ y = str(self.faultVertices[vertex, 1]) + tab
+ z = str(self.faultVertices[vertex, 2]) + tab
+ xNorm = str(self.normalDir[vertex, 0]) + tab
+ yNorm = str(self.normalDir[vertex, 1]) + tab
+ zNorm = str(self.normalDir[vertex, 2]) + tab
+ xStrike = str(self.strikeDir[vertex, 0]) + tab
+ yStrike = str(self.strikeDir[vertex, 1]) + tab
+ zStrike = str(self.strikeDir[vertex, 2]) + tab
+ xDip = str(self.dipDir[vertex, 0]) + tab
+ yDip = str(self.dipDir[vertex, 1]) + tab
+ zDip = str(self.dipDir[vertex, 2]) + newLine
outLine = str(impulse) + tab + x + y + z + xNorm + yNorm + zNorm + \
xStrike + yStrike + zStrike + xDip + yDip + zDip
f.write(outLine)
+ impulse += 1
f.close()
Copied: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py (from rev 17287, short/3D/PyLith/trunk/examples/greensfns/hex8/lininvert.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,310 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file greensfns/lininvert
+
+## @brief Python application to perform a linear inversion, given the necessary
+## matrices. In addition to performing the inversion, a number of (optional)
+## files are produced containing inversion information.
+
+import math
+import numpy
+import sys
+from pyre.units.length import km
+from pyre.units.length import m
+
+from pyre.applications.Script import Script as Application
+
+class LinInvert(Application):
+ """
+ Python application to perform a linear inversion, given the necessary
+ matrices. In addition to performing the inversion, a number of (optional)
+ files are produced containing inversion information.
+ """
+
+ class Inventory(Application.Inventory):
+ """
+ Python object for managing LinInvert facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing LinInvert facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b data_input_file File containing data values.
+ ## @li \b apriori_input_file File containing a priori parameter values.
+ ## @li \b data_cov_input_file File containing data covariance.
+ ## @li \b apriori_cov_input_file File containing a priori covariance.
+ ## @li \b data_design_input_file File containing data design matrix.
+ ## @li \b info_output_file Output file with inversion summary.
+ ## @li \b data_output_file Output file containing data information.
+ ## @li \b param_output_file Output file containing parameter information.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ dataInputFile = pyre.inventory.str("data_input_file", default="data.txt")
+ dataInputFile.meta['tip'] = "File containing data values."
+
+ aprioriInputFile = pyre.inventory.str("apriori_input_file",
+ default="apriori_values.txt")
+ aprioriInputFile.meta['tip'] = "File containing a priori parameter values."
+
+ dataCovInputFile = pyre.inventory.str("data_cov_input_file",
+ default="data_cov.txt")
+ dataCovInputFile.meta['tip'] = "File containing data covariance."
+
+ aprioriCovInputFile = pyre.inventory.str("apriori_cov_input_file",
+ default="apriori_cov.txt")
+ aprioriCovInputFile.meta['tip'] = "File containing a priori covariance."
+
+ dataDesignInputFile = pyre.inventory.str("data_design_input_file",
+ default="data_design.txt")
+ dataDesignInputFile.meta['tip'] = "File containing data design matrix."
+
+ infoOutputFile = pyre.inventory.str("info_output_file",
+ default="inversion_info.txt")
+ infoOutputFile.meta['tip'] = "Output file with inversion summary."
+
+ dataOutputFile = pyre.inventory.str("data_output_file",
+ default="data_output.txt")
+ dataOutputFile.meta['tip'] = "Output file containing data information."
+
+ paramOutputFile = pyre.inventory.str("param_output_file",
+ default="param_output.txt")
+ paramOutputFile.meta['tip'] = "Output file with parameter information."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="lininvert"):
+ Application.__init__(self, name)
+
+ self.numObs = 0
+ self.numParams = 0
+ self.chiSquare = 0.0
+
+ self.dataVals = None
+ self.dataCovVec = None
+ self.dataCov = None
+ self.dataDesign = None
+ self.aprioriVals = None
+ self.aprioriCov = None
+
+ self.hData = None
+ self.hApriori = None
+ self.resolData = None
+ self.solution = None
+ self.fData = None
+ self.predicted = None
+
+ return
+
+
+ def main(self):
+ # import pdb
+ # pdb.set_trace()
+ self._readMats()
+ self._invertData()
+ self._outputDataInfo()
+ self._outputParamInfo()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Application._configure(self)
+ # import pdb
+ # pdb.set_trace()
+
+ # File info.
+ self.dataInputFile = self.inventory.dataInputFile
+ self.aprioriInputFile = self.inventory.aprioriInputFile
+ self.dataCovInputFile = self.inventory.dataCovInputFile
+ self.aprioriCovInputFile = self.inventory.aprioriCovInputFile
+ self.dataDesignInputFile = self.inventory.dataDesignInputFile
+ self.infoOutputFile = self.inventory.infoOutputFile
+ self.dataOutputFile = self.inventory.dataOutputFile
+ self.paramOutputFile = self.inventory.paramOutputFile
+
+ return
+
+
+ def _readMats(self):
+ """
+ Function to read input matrices.
+ """
+ self.dataVals = numpy.loadtxt(self.dataInputFile, dtype=numpy.float64)
+ self.dataCovVec = numpy.loadtxt(self.dataCovInputFile, dtype=numpy.float64)
+ self.dataCov = numpy.diag(self.dataCovVec)
+ self.dataDesign = numpy.loadtxt(self.dataDesignInputFile,
+ dtype=numpy.float64)
+ self.aprioriVals = numpy.loadtxt(self.aprioriInputFile, dtype=numpy.float64)
+ self.aprioriCov = numpy.loadtxt(self.aprioriCovInputFile,
+ dtype=numpy.float64)
+
+ self.numObs = self.dataVals.shape[0]
+ self.numParams = self.aprioriVals.shape[0]
+ # print "Number of observations: %i" % self.numObs
+ # print "Number of parameters: %i" % self.numParams
+ # sys.stdout.flush()
+
+ return
+
+
+ def _invertData(self):
+ """
+ Function to perform inversion.
+ """
+ # Perform inversion.
+ covAAdT = numpy.dot(self.aprioriCov, numpy.transpose(self.dataDesign))
+ sum1 = self.dataCov + numpy.dot(self.dataDesign, covAAdT)
+ self.hData = numpy.dot(covAAdT, numpy.linalg.inv(sum1))
+ self.resolData = numpy.dot(self.hData, self.dataDesign)
+ self.hApriori = numpy.identity(self.numParams, dtype=numpy.float64) - \
+ self.resolData
+ self.solution = numpy.dot(self.hData, self.dataVals) + \
+ numpy.dot(self.hApriori, self.aprioriVals)
+
+ return
+
+
+ def _outputDataInfo(self):
+ """
+ Function to write out general info and info related to data.
+ """
+
+ # Compute data-related quantities.
+ fDataVec = numpy.sqrt(1.0/self.dataCovVec)
+ fDataVecInv = 1.0/fDataVec
+ self.fData = numpy.diag(fDataVec)
+ self.predicted = numpy.dot(self.dataDesign, self.solution)
+ dataMisfit = self.dataVals - self.predicted
+ weightMisfit = dataMisfit * fDataVec
+ self.chiSquare = numpy.sum(weightMisfit * weightMisfit)
+
+ # Write out inversion info.
+ string1 = "\nNumber of observations: %i\n" % self.numObs
+ string2 = "Number of parameters: %i\n" % self.numParams
+ string3 = "Chi-square value: %e\n" % self.chiSquare
+ print string1
+ print string2
+ print string3
+ sys.stdout.flush()
+ i = open(self.infoOutputFile, 'w')
+ i.write(string1)
+ i.write(string2)
+ i.write(string3)
+ i.close()
+
+ # Write out data info.
+ # Write out the following columns:
+ # 1. Observed data value.
+ # 2. Predicted data value.
+ # 3. Standard deviation of observation.
+ # 4. Observed minus predicted value.
+ # 5. Observed minus predicted weighted by standard deviation.
+
+ dataOut = numpy.transpose(numpy.vstack((self.dataVals, self.predicted,
+ fDataVecInv, dataMisfit,
+ weightMisfit)))
+ numpy.savetxt(self.dataOutputFile, dataOut)
+
+ return
+
+
+ def _outputParamInfo(self):
+ """
+ Function to write out parameter-related information.
+ """
+
+ # Compute a posteriori covariance contributions.
+ aposterioriCov = numpy.dot(self.hApriori, self.aprioriCov)
+ prod1 = numpy.dot(self.hData, self.dataCov)
+ aposterioriCovD = numpy.dot(prod1, numpy.transpose(self.hData))
+ aposterioriCovA = numpy.dot(aposterioriCov, numpy.transpose(self.hApriori))
+
+ # Compute eigenvalues and eigenvectors of a priori covariance.
+ aprioriEigVals, aprioriEigVecs = numpy.linalg.eigh(self.aprioriCov)
+ aprioriValsVec = numpy.sqrt(1.0/aprioriEigVals)
+ aprioriValsVecInv = 1.0/aprioriValsVec
+ aprioriValsDiag = numpy.diag(aprioriValsVec)
+ aprioriValsDiagInv = numpy.diag(aprioriValsVecInv)
+ fApriori = numpy.dot(aprioriValsDiag, numpy.transpose(aprioriEigVecs))
+ fAprioriInv = numpy.dot(aprioriEigVecs, aprioriValsDiagInv)
+
+ # Compute a posteriori covariances in primed coordinate system.
+ prod2 = numpy.dot(fApriori, aposterioriCov)
+ aposterioriCovPrime = numpy.dot(prod2, numpy.transpose(fApriori))
+ hDataPrime = numpy.dot(aposterioriCovPrime,
+ numpy.transpose(self.dataDesign))
+ prod3 = numpy.dot(self.dataDesign, fAprioriInv)
+ dataDesignPrime = numpy.dot(self.fData, prod3)
+
+ aposterioriCovDPrime = numpy.dot(hDataPrime, numpy.transpose(hDataPrime))
+ aposterioriCovAPrime = numpy.dot(aposterioriCovPrime,
+ numpy.transpose(aposterioriCovPrime))
+
+ resolDataPrime = numpy.dot(hDataPrime, dataDesignPrime)
+
+ # Columns to output:
+ # 1. Predicted parameter value.
+ # 2. A priori parameter value.
+ # 3. A priori covariance.
+ # 4. A posteriori covariance.
+ # 5. A posteriori covariance (normalized).
+ # 6. Contribution of data to a posteriori covariance.
+ # 7. Contribution of data to a posteriori covariance (normalized).
+ # 8. Contribution of a priori data to a posteriori covariance.
+ # 9. Contribution of a priori data to a posteriori covariance (normalized).
+ # 10. Contribution of data to resolution matrix.
+ # 11. Contribution of data to resolution matrix (normalized).
+
+ # Extract necessary diagonals.
+ aprioriCovDiag = numpy.diag(self.aprioriCov)
+ aposterioriCovDiag = numpy.diag(aposterioriCov)
+ aposterioriCovPrimeDiag = numpy.diag(aposterioriCovPrime)
+ aposterioriCovDDiag = numpy.diag(aposterioriCovD)
+ aposterioriCovDPrimeDiag = numpy.diag(aposterioriCovDPrime)
+ aposterioriCovADiag = numpy.diag(aposterioriCovA)
+ aposterioriCovAPrimeDiag = numpy.diag(aposterioriCovAPrime)
+ resolDataDiag = numpy.diag(self.resolData)
+ resolDataPrimeDiag = numpy.diag(resolDataPrime)
+
+ # Output columns.
+ paramOut = numpy.transpose(numpy.vstack((self.solution, self.aprioriVals,
+ aprioriCovDiag, aposterioriCovDiag,
+ aposterioriCovPrimeDiag,
+ aposterioriCovDDiag,
+ aposterioriCovDPrimeDiag,
+ aposterioriCovADiag,
+ aposterioriCovAPrimeDiag,
+ resolDataDiag,
+ resolDataPrimeDiag)))
+
+ numpy.savetxt(self.paramOutputFile, paramOut)
+
+ return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = LinInvert()
+ app.run()
+
+# End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/merge_greens.py (from rev 17287, short/3D/PyLith/trunk/examples/greensfns/hex8/merge_greens.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/merge_greens.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/merge_greens.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,420 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file greensfns/merge_greens
+
+## @brief Python application to merge Green's functions that were created using
+## separate fault patches with gfgen.py (and then PyLith). Functions with
+## duplicate coordinates are removed and all the necessary files are renumbered
+## and moved to a specified location. A metadata file is produced, along with
+## a file showing the correspondence between the original and moved files.
+
+import math
+import numpy
+import os
+import re
+import glob
+from pyre.units.time import s
+from pyre.units.length import m
+
+from pyre.applications.Script import Script as Application
+
+class MergeGreens(Application):
+ """
+ Python application to merge Green's functions that were created using
+ separate fault patches with gfgen.py (and then PyLith). Functions with
+ duplicate coordinates are removed and all the necessary files are renumbered
+ and moved to a specified location. A metadata file is produced, along with
+ a file showing the correspondence between the original and moved files.
+ """
+
+ class Inventory(Application.Inventory):
+ """
+ Python object for managing MergeGreens facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing MergeGreens facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b metadata_input File with a list of all the metadata input files.
+ ## @li \b impulse_input File with root names of all input impulse files.
+ ## @li \b response_input File with root names of all input response files.
+ ## @li \b metadata_output Name of output metadata file.
+ ## @li \b correspondence_output Name of output correspondence file.
+ ## @li \b impulse_output Root name of impulse output files.
+ ## @li \b response_output Root name of response output files.
+ ## @li \b impulse_input_width Width of input impulse number field.
+ ## @li \b impulse_output_width Width of output impulse number field.
+ ## @li \b distance_tol Distance tolerance to determine coincident vertices.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ metadataInput = pyre.inventory.str("metadata_input",
+ default="metadata.list")
+ metadataInput.meta['tip'] = "File with a list of input metadata files."
+
+ impulseInput = pyre.inventory.str("impulse_input",
+ default="impulse.list")
+ impulseInput.meta['tip'] = "File with a list of input impulse root names."
+
+ responseInput = pyre.inventory.str("response_input",
+ default="response.list")
+ responseInput.meta['tip'] = "File with a list of input response root names."
+
+ metadataOutput = pyre.inventory.str("metadata_output",
+ default="impulse_description.txt")
+ metadataOutput.meta['tip'] = "Name of output file with merged metadata."
+
+ correspondenceOutput = pyre.inventory.str("correspondence_output",
+ default="correspondence.txt")
+ correspondenceOutput.meta['tip'] = "Name of output correspondence file."
+
+ impulseOutput = pyre.inventory.str("impulse_output",
+ default="gfimpulse.vtk")
+ impulseOutput.meta['tip'] = "Root name of impulse output files."
+
+ responseOutput = pyre.inventory.str("response_output",
+ default="gfresponse.vtk")
+ responseOutput.meta['tip'] = "Root name of response output files."
+
+ impulseInputWidth = pyre.inventory.int("impulse_input_width", default=4)
+ impulseInputWidth.meta['tip'] = "Width of input impulse number field."
+
+ impulseOutputWidth = pyre.inventory.int("impulse_output_width", default=5)
+ impulseOutputWidth.meta['tip'] = "Width of output impulse number field."
+
+ distanceTol = pyre.inventory.dimensional("distance_tol", default=0.1*m)
+ distanceTol.meta['tip'] = "Distance tolerance for coincident vertices."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="merge_greens"):
+ Application.__init__(self, name)
+
+ self.numPatches = 0
+ self.numOriginalImpulses = 0
+ self.numMergedImpulses = 0
+ self.numOutputImpulses = 0
+
+ self.impulseOutputDir = ''
+ self.responseOutputDir = ''
+ self.impulseOutputRoot = ''
+ self.responseOutputRoot = ''
+
+ self.numImpulsesPerPatch = []
+ self.metadataInputFiles = []
+ self.impulseInputRoots = []
+ self.responseInputRoots = []
+ self.metadata = []
+
+ return
+
+
+ def main(self):
+ # import pdb
+ # pdb.set_trace()
+ self._readLists()
+ self._setupOutput()
+ self._readMetadata()
+ self._excludeImpulses()
+
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Application._configure(self)
+
+ # File info.
+ self.metadataInput = self.inventory.metadataInput
+ self.impulseInput = self.inventory.impulseInput
+ self.responseInput = self.inventory.responseInput
+ self.metadataOutput = self.inventory.metadataOutput
+ self.correspondenceOutput = self.inventory.correspondenceOutput
+ self.impulseOutput = self.inventory.impulseOutput
+ self.responseOutput = self.inventory.responseOutput
+
+ # Impulse information
+ self.impulseInputWidth = self.inventory.impulseInputWidth
+ self.impulseOutputWidth = self.inventory.impulseOutputWidth
+
+ # Excluded vertex information
+ self.distanceTol = self.inventory.distanceTol.value
+
+ return
+
+
+ def _readLists(self):
+ """
+ Function to read lists for input files.
+ """
+ import os
+ import re
+
+ # Read names of metadata files.
+ f = open(self.metadataInput, 'r')
+ lines = f.readlines()
+ for line in lines:
+ self.metadataInputFiles.append(line.rstrip('\n'))
+ self.numPatches += 1
+ f.close()
+
+ # Read root filenames of impulse files.
+ f = open(self.impulseInput, 'r')
+ lines = f.readlines()
+ for line in lines:
+ impulseRoot = line.rstrip('\n')
+ totalInputPath = os.path.normpath(os.path.join(os.getcwd(), impulseRoot))
+ inputDir = os.path.dirname(totalInputPath)
+ baseInputName = os.path.basename(totalInputPath)
+ baseInputNameLen = len(baseInputName)
+ baseInputNameSuffStripped = baseInputName
+ if baseInputName.endswith(".vtk"):
+ baseInputNameSuffStripped = baseInputName[0:baseInputNameLen-4]
+ baseInputNameTimeStripped = baseInputNameSuffStripped
+ testFind = re.search('_t[0-9]*$', baseInputNameSuffStripped)
+ if testFind != None:
+ timeInd = baseInputNameSuffStripped.rfind(testFind.group(0))
+ baseInputNameTimeStripped = baseInputNameSuffStripped[0:timeInd]
+ self.impulseInputRoots.append(os.path.join(inputDir,
+ baseInputNameTimeStripped))
+ f.close()
+
+ # Read root filenames of response files.
+ f = open(self.responseInput, 'r')
+ lines = f.readlines()
+ for line in lines:
+ responseRoot = line.rstrip('\n')
+ totalInputPath = os.path.normpath(os.path.join(os.getcwd(), responseRoot))
+ inputDir = os.path.dirname(totalInputPath)
+ baseInputName = os.path.basename(totalInputPath)
+ baseInputNameLen = len(baseInputName)
+ baseInputNameSuffStripped = baseInputName
+ if baseInputName.endswith(".vtk"):
+ baseInputNameSuffStripped = baseInputName[0:baseInputNameLen-4]
+ baseInputNameTimeStripped = baseInputNameSuffStripped
+ testFind = re.search('_t[0-9]*$', baseInputNameSuffStripped)
+ if testFind != None:
+ timeInd = baseInputNameSuffStripped.rfind(testFind.group(0))
+ baseInputNameTimeStripped = baseInputNameSuffStripped[0:timeInd]
+ self.responseInputRoots.append(os.path.join(inputDir,
+ baseInputNameTimeStripped))
+ f.close()
+
+ print "Number of impulse patches: %i" % self.numPatches
+
+ return
+
+
+ def _setupOutput(self):
+ """
+ Function to setup information for moving files.
+ """
+ import os
+ import re
+
+ # Setup root filenames for output impulse files.
+ totalOutputPath = os.path.normpath(os.path.join(os.getcwd(),
+ self.impulseOutput))
+ self.impulseOutputDir = os.path.dirname(totalOutputPath)
+ baseOutputName = os.path.basename(totalOutputPath)
+ baseOutputNameLen = len(baseOutputName)
+ baseOutputNameSuffStripped = baseOutputName
+ if baseOutputName.endswith(".vtk"):
+ baseOutputNameSuffStripped = baseOutputName[0:baseOutputNameLen-4]
+ baseOutputNameTimeStripped = baseOutputNameSuffStripped
+ testFind = re.search('_t[0-9]*$', baseOutputNameSuffStripped)
+ if testFind != None:
+ timeInd = baseOutputNameSuffStripped.rfind(testFind.group(0))
+ baseOutputNameTimeStripped = baseOutputNameSuffStripped[0:timeInd]
+ self.impulseOutputRoot = os.path.join(self.impulseOutputDir,
+ baseOutputNameTimeStripped)
+
+ # Setup root filenames for output response files.
+ totalOutputPath = os.path.normpath(os.path.join(os.getcwd(),
+ self.responseOutput))
+ self.responseOutputDir = os.path.dirname(totalOutputPath)
+ baseOutputName = os.path.basename(totalOutputPath)
+ baseOutputNameLen = len(baseOutputName)
+ baseOutputNameSuffStripped = baseOutputName
+ if baseOutputName.endswith(".vtk"):
+ baseOutputNameSuffStripped = baseOutputName[0:baseOutputNameLen-4]
+ baseOutputNameTimeStripped = baseOutputNameSuffStripped
+ testFind = re.search('_t[0-9]*$', baseOutputNameSuffStripped)
+ if testFind != None:
+ timeInd = baseOutputNameSuffStripped.rfind(testFind.group(0))
+ baseOutputNameTimeStripped = baseOutputNameSuffStripped[0:timeInd]
+ self.responseOutputRoot = os.path.join(self.responseOutputDir,
+ baseOutputNameTimeStripped)
+
+ return
+
+
+ def _readMetadata(self):
+ """
+ Function to read metadata from each metadata file.
+ Results are stored as a list of numpy arrays.
+ """
+ fileNum = 0
+ for metadataFile in self.metadataInputFiles:
+ self.metadata.append(numpy.loadtxt(metadataFile, dtype=numpy.float64,
+ skiprows=1))
+ self.numImpulsesPerPatch.append(self.metadata[fileNum].shape[0])
+ self.numOriginalImpulses += self.numImpulsesPerPatch[fileNum]
+ print "Number of impulses in patch %i: %i" % (fileNum,
+ self.numImpulsesPerPatch[fileNum])
+ fileNum += 1
+
+ print "Total number of original impulses: %i" % self.numOriginalImpulses
+
+ return
+
+
+ def _getFilename(self, fileRoot, impulse, impulseWidth):
+ """
+ Function to create a filename given the root filename,
+ the impulse number, and the timestamp width.
+ """
+ impulseNum = int(impulse)
+ impulseString = repr(impulseNum).rjust(impulseWidth, '0')
+ filename = fileRoot + "_t" + impulseString + ".vtk"
+
+ return filename
+
+ def _excludeImpulses(self):
+ """
+ Function to remove redundant impulses, create the metadata and
+ correspondence files, and move files to the proper locations.
+ """
+ import scipy.spatial.distance
+ import os
+
+ newline = '\n'
+ tab = '\t'
+ impulseInFmt = '%0' + str(self.impulseInputWidth) + 'i'
+ impulseOutFmt = '%0' + str(self.impulseOutputWidth) + 'i'
+ cFmt = ' ' + impulseInFmt + ' ' + impulseOutFmt + newline
+ mFmt = impulseOutFmt + 12 * '\t%e' + newline
+
+ # Create output directories for impulses and responses if they don't exist.
+ if not os.path.isdir(self.impulseOutputDir):
+ os.makedirs(self.impulseOutputDir)
+ if not os.path.isdir(self.responseOutputDir):
+ os.makedirs(self.responseOutputDir)
+
+ # The first patch retains all impulses.
+ metadata = self.metadata[0]
+ c = open(self.correspondenceOutput, 'w')
+ m = open(self.metadataOutput, 'w')
+ patch = 0
+ self.numOutputImpulses = self.numImpulsesPerPatch[patch]
+ cPatch = 'Patch ' + str(patch) + newline
+ cHead = 'Old ID New ID' + newline
+ mHead = "Impulse #" + tab + "X-Coord" + tab + "Y-Coord" + tab + \
+ "Z-Coord" + tab + "Normal-X" + tab + "Normal-Y" + tab + \
+ "Normal-Z" + tab + "Strike-X" + tab + "Strike-Y" + tab + \
+ "Strike-Z" + tab + "Dip-X" + tab + "Dip-Y" + tab + "Dip-Z" \
+ + newline
+ c.write(cPatch)
+ c.write(cHead)
+ m.write(mHead)
+ newId = 0
+ patchId = 0
+ for impulse in range(self.numImpulsesPerPatch[patch]):
+ cOut = cFmt % (patchId, newId)
+ c.write(cOut)
+ mOut = mFmt % (int(round(metadata[impulse,0])),
+ metadata[impulse, 1], metadata[impulse, 2],
+ metadata[impulse, 3], metadata[impulse, 4],
+ metadata[impulse, 5], metadata[impulse, 6],
+ metadata[impulse, 7], metadata[impulse, 8],
+ metadata[impulse, 9], metadata[impulse,10],
+ metadata[impulse,11], metadata[impulse,12])
+ m.write(mOut)
+ impulseFrom = self._getFilename(self.impulseInputRoots[patch],
+ patchId, self.impulseInputWidth)
+ impulseTo = self._getFilename(self.impulseOutputRoot,
+ newId, self.impulseOutputWidth)
+ os.rename(impulseFrom, impulseTo)
+ responseFrom = self._getFilename(self.responseInputRoots[patch],
+ patchId, self.impulseInputWidth)
+ responseTo = self._getFilename(self.responseOutputRoot,
+ newId, self.impulseOutputWidth)
+ os.rename(responseFrom, responseTo)
+ newId += 1
+ patchId += 1
+
+ # Loop over remaining patches.
+ for patch in range(1, self.numPatches):
+ patchId = 0
+ coordsCurrent = metadata[:,1:4]
+ coordsPatch = self.metadata[patch][:,1:4]
+ distance = scipy.spatial.distance.cdist(coordsPatch, coordsCurrent,
+ 'euclidean')
+ minIndices = numpy.argmin(distance, axis=1)
+ cPatch = 'Patch ' + str(patch) + newline
+ c.write(cPatch)
+ c.write(cHead)
+ for impulse in range(self.numImpulsesPerPatch[patch]):
+ newOutputId = -minIndices[impulse]
+ if(distance[impulse, minIndices[impulse]] > self.distanceTol):
+ newOutputId = newId
+ metadata = numpy.vstack((metadata, self.metadata[patch][impulse,:]))
+ mOut = mFmt % (newId,
+ metadata[newId, 1], metadata[newId, 2],
+ metadata[newId, 3], metadata[newId, 4],
+ metadata[newId, 5], metadata[newId, 6],
+ metadata[newId, 7], metadata[newId, 8],
+ metadata[newId, 9], metadata[newId,10],
+ metadata[newId,11], metadata[newId,12])
+ m.write(mOut)
+ impulseFrom = self._getFilename(self.impulseInputRoots[patch],
+ patchId, self.impulseInputWidth)
+ impulseTo = self._getFilename(self.impulseOutputRoot,
+ newId, self.impulseOutputWidth)
+ os.rename(impulseFrom, impulseTo)
+ responseFrom = self._getFilename(self.responseInputRoots[patch],
+ patchId, self.impulseInputWidth)
+ responseTo = self._getFilename(self.responseOutputRoot,
+ newId, self.impulseOutputWidth)
+ os.rename(responseFrom, responseTo)
+ newId += 1
+ self.numOutputImpulses += 1
+ else:
+ self.numMergedImpulses += 1
+ cOut = cFmt % (patchId, newOutputId)
+ c.write(cOut)
+ patchId += 1
+
+ print 'Number of output impulses: %i' % self.numOutputImpulses
+ print 'Number of merged impulses: %i' % self.numMergedImpulses
+ c.close()
+ m.close()
+
+ return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = MergeGreens()
+ app.run()
+
+# End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/points2spatialdb.py (from rev 17287, short/3D/PyLith/trunk/examples/greensfns/hex8/points2spatialdb.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/points2spatialdb.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/points2spatialdb.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,213 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file greensfns/points2spatialdb
+
+## @brief Python application to create a spatialdb using a given set of points.
+## A subset of the points is read from a separate file, along with corresponding
+## parameter values. A spatial database containing all points is created, with
+## all values set to zero other than the subset.
+
+import math
+import numpy
+from pyre.units.length import km
+from pyre.units.length import m
+
+from pyre.applications.Script import Script as Application
+
+class Points2Spatialdb(Application):
+ """
+ Python application to create a spatialdb using a given set of points.
+ A subset of the points is read from a separate file, along with corresponding
+ parameter values. A spatial database containing all points is created, with
+ all values set to zero other than the subset.
+ """
+
+ class Inventory(Application.Inventory):
+ """
+ Python object for managing Points2Spatialdb facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing Points2Spatialdb facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b point_coord_file File containing all coordinates.
+ ## @li \b point_value_file File containing point subset with values.
+ ## @li \b parameter_names List of parameter names.
+ ## @li \b distance_tol Distance tolerance to determine coincident points.
+ ##
+ ## \b Facilities
+ ## @li \b geometry Geometry for output database.
+ ## @li \b iohandler Object for output database.
+
+ import pyre.inventory
+
+ pointCoordFile = pyre.inventory.str("point_coord_file",
+ default="point_coords.txt")
+ pointCoordFile.meta['tip'] = "File containing all coordinates."
+
+ pointValueFile = pyre.inventory.str("point_value_file",
+ default="point_values.txt")
+ pointValueFile.meta['tip'] = "File containing point subset with values."
+
+ parameterNames = pyre.inventory.list("parameter_names",
+ default=['left-lateral-slip',
+ 'reverse-slip',
+ 'fault-opening'])
+ parameterNames.meta['tip'] = "List of parameter names."
+
+ parameterUnits = pyre.inventory.list("parameter_units",
+ default=['m','m','m'])
+ parameterUnits.meta['tip'] = "List of parameter units."
+
+ distanceTol = pyre.inventory.dimensional("distance_tol",
+ default=10.0*m)
+ distanceTol.meta['tip'] = "Distance tolerance for coincident points."
+
+ from spatialdata.spatialdb.generator.Geometry import Geometry
+ geometry = pyre.inventory.facility("geometry", family="geometry",
+ factory=Geometry)
+ geometry.meta['tip'] = "Geometry for output database."
+
+ from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
+ iohandler = pyre.inventory.facility("iohandler", family="simpledb_io",
+ factory=SimpleIOAscii)
+ iohandler.meta['tip'] = "Object for writing database."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="points2spatialdb"):
+ Application.__init__(self, name)
+
+ self.numTotalPoints = 0
+ self.numSubsetPoints = 0
+ self.numParameters = 0
+
+ self.coincidentPoints = []
+
+ self.totalPoints = None
+ self.subsetPoints = None
+ self.subsetValues = None
+
+ return
+
+
+ def main(self):
+ # import pdb
+ # pdb.set_trace()
+ self._readPoints()
+ self._findCoincident()
+ self._writeSpatialdb()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Application._configure(self)
+ # import pdb
+ # pdb.set_trace()
+
+ # File info.
+ self.pointCoordFile = self.inventory.pointCoordFile
+ self.pointValueFile = self.inventory.pointValueFile
+
+ # Parameter info.
+ self.parameterNames = self.inventory.parameterNames
+ self.parameterUnits = self.inventory.parameterUnits
+
+ # Parameters.
+ self.distanceTol = self.inventory.distanceTol.value
+
+ # Spatialdb output facilities.
+ self.geometry = self.inventory.geometry
+ self.iohandler = self.inventory.iohandler
+
+ return
+
+
+ def _readPoints(self):
+ """
+ Function to read the file containing all points as well as the file
+ containing the point subset with values.
+ """
+ self.totalPoints = numpy.loadtxt(self.pointCoordFile, dtype=numpy.float64)
+ subsetData = numpy.loadtxt(self.pointValueFile, dtype=numpy.float64)
+ self.subsetPoints = subsetData[:,0:3]
+ self.subsetValues = subsetData[:,3:]
+ self.numTotalPoints = self.totalPoints.shape[0]
+ self.numSubsetPoints = self.subsetPoints.shape[0]
+ self.numParameters = self.subsetValues.shape[1]
+ if (self.numParameters != len(self.parameterNames)):
+ msg = "Number of parameters not consistent with parameter names."
+ raise ValueError(msg)
+
+ return
+
+
+ def _findCoincident(self):
+ """
+ Function to find points in the total set matching those in the subset.
+ """
+ import scipy.spatial.distance
+
+ distance = scipy.spatial.distance.cdist(self.subsetPoints, self.totalPoints,
+ 'euclidean')
+ minIndices = numpy.argmin(distance, axis=1)
+
+ for point in range(self.numSubsetPoints):
+ matchPoint = minIndices[point]
+ if (distance[point, minIndices[point]] < self.distanceTol):
+ self.coincidentPoints.append(matchPoint)
+ else:
+ msg = "No matching point found for subset point # %i." % point
+ raise ValueError(msg)
+
+ return
+
+
+ def _writeSpatialdb(self):
+ """
+ Function to write out the spatial database, after inserting the desired
+ values.
+ """
+ # Create info for each parameter.
+ values = []
+ for parameter in range(self.numParameters):
+ paramVals = numpy.zeros(self.numTotalPoints, dtype=numpy.float64)
+ paramVals[self.coincidentPoints] = self.subsetValues[:,parameter]
+ paramInfo = {'name': self.parameterNames[parameter],
+ 'units': self.parameterUnits[parameter],
+ 'data': paramVals.flatten()}
+ values.append(paramInfo)
+
+ # Write database.
+ data = {'points': self.totalPoints,
+ 'coordsys': self.geometry.coordsys,
+ 'data_dim': self.geometry.dataDim,
+ 'values': values}
+ self.iohandler.write(data)
+
+ return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = Points2Spatialdb()
+ app.run()
+
+# End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/examples/twocells/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/twocells/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/twocells/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -18,6 +18,7 @@
SUBDIRS = \
twohex8 \
+ twohex27-cubit \
twoquad4 \
twotet4 \
twotet4-geoproj \
Copied: short/3D/PyLith/branches/pylith-scecdynrup/examples/twocells/twohex27-cubit (from rev 17287, short/3D/PyLith/trunk/examples/twocells/twohex27-cubit)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -139,6 +139,16 @@
utils/TestArray.cc
+# TEMPORARY
+libpylith_la_SOURCES += \
+ topology/RefineEdges2.cc \
+ topology/CellRefinerTri3.cc \
+ topology/CellRefinerTet4.cc \
+ topology/RefineFace4Edges2.cc \
+ topology/CellRefinerQuad4.cc \
+ topology/MeshOrder.cc
+
+
libpylith_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
libpylith_la_LIBADD = \
-lspatialdata \
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/AbsorbingDampers.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/AbsorbingDampers.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -43,8 +43,9 @@
typedef pylith::topology::SubMesh::RealSection SubRealSection;
typedef pylith::topology::Mesh::SieveMesh SieveMesh;
typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-typedef pylith::topology::Mesh::UpdateAddVisitor UpdateAddVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::UpdateAddVisitor UpdateAddVisitor;
+typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveMesh::order_type,PetscInt> IndicesVisitor;
// ----------------------------------------------------------------------
// Default constructor.
@@ -149,9 +150,8 @@
const ALE::Obj<RealSection>& coordinates =
sieveSubMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
assert(0 != _normalizer);
const double lengthScale = _normalizer->lengthScale();
@@ -588,10 +588,9 @@
sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default",
solutionSection);
assert(!globalOrder.isNull());
- topology::Mesh::IndicesVisitor jacobianVisitor(*solutionSection,
- *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*solutionSection, *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
// Get sparse matrix
const PetscMat jacobianMat = jacobian->matrix();
@@ -754,8 +753,7 @@
const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
assert(!jacobianSection.isNull());
- topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection,
- &_cellVector[0]);
+ UpdateAddVisitor jacobianVisitor(*jacobianSection, &_cellVector[0]);
#if !defined(PRECOMPUTE_GEOMETRY)
double_array coordinatesCell(numBasis*spaceDim);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/Neumann.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/Neumann.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/bc/Neumann.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -40,8 +40,10 @@
typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
typedef pylith::topology::SubMesh::RealSection SubRealSection;
typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::UpdateAddVisitor UpdateAddVisitor;
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::bc::Neumann::Neumann(void)
@@ -115,8 +117,7 @@
_parameters->get("value").section();
assert(!tractionSection.isNull());
const ALE::Obj<RealSection>& residualSection = residual.section();
- topology::SubMesh::UpdateAddVisitor residualVisitor(*residualSection,
- &_cellVector[0]);
+ UpdateAddVisitor residualVisitor(*residualSection, &_cellVector[0]);
#if !defined(PRECOMPUTE_GEOMETRY)
double_array coordinatesCell(numBasis*spaceDim);
@@ -425,9 +426,8 @@
const ALE::Obj<RealSection>& coordinates =
subSieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
const ALE::Obj<RealSection>& section = field->section();
assert(!section.isNull());
@@ -538,9 +538,8 @@
const ALE::Obj<RealSection>& coordinates =
subSieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
const ALE::Obj<RealSection>& initialSection = (0 != _dbInitial) ?
_parameters->get("initial").section() : 0;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/CohesiveTopology.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/CohesiveTopology.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -545,7 +545,7 @@
<< cellNeighbors.size() << std::endl;
throw ALE::Exception("Invalid number of neighbors");
} // if
- } else if (numCorners == 4) {
+ } else if (numCorners == 4 || numCorners == 9) {
if (cellNeighbors.size() > 4) {
std::cout << "Cell " << *c_iter
<< " has an invalid number of neighbors "
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -56,8 +56,11 @@
typedef pylith::topology::Mesh::SieveMesh SieveMesh;
typedef pylith::topology::Mesh::RealSection RealSection;
typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::UpdateAddVisitor UpdateAddVisitor;
+typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveSubMesh::order_type,PetscInt> IndicesVisitor;
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::faults::FaultCohesiveDyn::FaultCohesiveDyn(void) :
@@ -1128,8 +1131,8 @@
assert(!forcesInitialSection.isNull());
double_array forcesInitialCell(numBasis*spaceDim);
double_array tractionQuadPt(spaceDim);
- topology::Mesh::UpdateAddVisitor forcesInitialVisitor(*forcesInitialSection,
- &forcesInitialCell[0]);
+ UpdateAddVisitor forcesInitialVisitor(*forcesInitialSection,
+ &forcesInitialCell[0]);
assert(0 != _dbInitialTract);
_dbInitialTract->open();
@@ -1639,10 +1642,10 @@
faultSieveMesh->getFactory()->getGlobalOrder(faultSieveMesh, "default", solutionFaultSection);
assert(!globalOrderFault.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::SubMesh::IndicesVisitor jacobianFaultVisitor(*solutionFaultSection,
- *globalOrderFault,
- (int) pow(faultSieveMesh->getSieve()->getMaxConeSize(),
- faultSieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianFaultVisitor(*solutionFaultSection,
+ *globalOrderFault,
+ (int) pow(faultSieveMesh->getSieve()->getMaxConeSize(),
+ faultSieveMesh->depth())*spaceDim);
const int iCone = (negativeSide) ? 0 : 1;
for (SieveMesh::label_sequence::iterator c_iter=cellsCohesiveBegin;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveLagrange.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveLagrange.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -52,7 +52,9 @@
typedef pylith::topology::Mesh::SieveMesh SieveMesh;
typedef pylith::topology::Mesh::RealSection RealSection;
typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::UpdateAddVisitor UpdateAddVisitor;
+typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveSubMesh::order_type,PetscInt> IndicesVisitor;
// ----------------------------------------------------------------------
// Default constructor.
@@ -857,7 +859,7 @@
_fields->get("orientation").section();
assert(!orientationSection.isNull());
RestrictVisitor orientationVisitor(*orientationSection,
- orientationCell.size(),
+ orientationCell.size(),
&orientationCell[0]);
const int numConstraintVert = numBasis;
@@ -885,9 +887,9 @@
solutionSection);
assert(!globalOrder.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::Mesh::IndicesVisitor jacobianVisitor(*solutionSection, *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*solutionSection, *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
@@ -1372,7 +1374,7 @@
} // if
// Check quadrature against mesh
- const int numCorners = _quadrature->refGeometry().numCorners();
+ const int numCorners = _quadrature->numBasis();
const ALE::Obj<SieveMesh::label_sequence>& cells =
sieveMesh->getLabelStratum("material-id", id());
assert(!cells.isNull());
@@ -1618,8 +1620,9 @@
const ALE::Obj<RealSection>& coordinatesSection =
faultSieveMesh->getRealSection("coordinates");
assert(!coordinatesSection.isNull());
- topology::Mesh::RestrictVisitor coordinatesVisitor(*coordinatesSection,
- coordinatesCell.size(), &coordinatesCell[0]);
+ RestrictVisitor coordinatesVisitor(*coordinatesSection,
+ coordinatesCell.size(),
+ &coordinatesCell[0]);
// Set orientation function
assert(cohesiveDim == _quadrature->cellDim());
@@ -1840,14 +1843,14 @@
area.zero();
const ALE::Obj<RealSection>& areaSection = area.section();
assert(!areaSection.isNull());
- topology::Mesh::UpdateAddVisitor areaVisitor(*areaSection, &areaCell[0]);
+ UpdateAddVisitor areaVisitor(*areaSection, &areaCell[0]);
double_array coordinatesCell(numBasis * spaceDim);
const ALE::Obj<RealSection>& coordinates = faultSieveMesh->getRealSection(
"coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(), &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
const ALE::Obj<SieveSubMesh::label_sequence>& cells =
faultSieveMesh->heightStratum(0);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveTract.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveTract.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveTract.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,11 +27,14 @@
// ----------------------------------------------------------------------
typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
+typedef pylith::topology::SubMesh::DomainSieveMesh SieveMesh;
typedef pylith::topology::SubMesh::RealSection SubRealSection;
typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::UpdateAddVisitor UpdateAddVisitor;
+typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveSubMesh::order_type,PetscInt> IndicesVisitor;
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::faults::FaultCohesiveTract::FaultCohesiveTract(void) :
@@ -232,9 +235,8 @@
const ALE::Obj<RealSection>& coordinates =
faultSieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
// :TODO: Use spaces to create subsections like in FaultCohesiveKin.
_fields->add("orientation", "orientation",
@@ -357,9 +359,8 @@
const ALE::Obj<RealSection>& coordinates =
faultSieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
const spatialdata::geocoords::CoordSys* cs = _faultMesh->coordsys();
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/TopologyOps.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/TopologyOps.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/TopologyOps.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -155,6 +155,7 @@
PointArray origVertices;
PointArray faceVertices;
+ faultSieve->setDebug(2);
if (!faultSieve->commRank()) {
numCorners = mesh->getNumCellCorners();
faceSize = selection::numFaceVertices(mesh);
@@ -226,12 +227,33 @@
if (dim == 0) {
f = *faceVertices.begin();
}
- if (faceSize != dim+1) {
+
+ std::cout << "dim: " << dim << ", faceSize: " << faceSize << ", numCorners: " << numCorners << std::endl;
+
+ if (2 == dim && 4 == faceSize){
if (debug) std::cout << " Adding hex face " << f << std::endl;
- ALE::SieveBuilder<ALE::Mesh>::buildHexFaces(faultSieve, orientation, dim, curElement, bdVertices, oFaultFaces, f, o);
+ ALE::SieveBuilder<ALE::Mesh>::buildHexFaces(
+ faultSieve, orientation, dim, curElement,
+ bdVertices, oFaultFaces, f, o);
+ } else if ((1 == dim && 3 == faceSize) ||
+ (2 == dim && 9 == faceSize)){
+ if (debug) std::cout << " Adding quadratic hex face " << f
+ << std::endl;
+ ALE::SieveBuilder<ALE::Mesh>::buildQuadraticHexFaces(
+ faultSieve, orientation, dim, curElement,
+ bdVertices, oFaultFaces, f, o);
+ } else if ((1 == dim && 3 == faceSize) ||
+ (2 == dim && 6 == faceSize)){
+ if (debug) std::cout << " Adding quadratic tri face " << f
+ << std::endl;
+ ALE::SieveBuilder<ALE::Mesh>::buildQuadraticTetFaces(
+ faultSieve, orientation, dim, curElement,
+ bdVertices, oFaultFaces, f, o);
} else {
if (debug) std::cout << " Adding simplicial face " << f << std::endl;
- ALE::SieveBuilder<ALE::Mesh>::buildFaces(faultSieve, orientation, dim, curElement, bdVertices, oFaultFaces, f, o);
+ ALE::SieveBuilder<ALE::Mesh>::buildFaces(
+ faultSieve, orientation, dim, curElement,
+ bdVertices, oFaultFaces, f, o);
}
faultSieve->addArrow(f, support[s]);
//faultSieve->view("");
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicit.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicit.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,12 +44,6 @@
//#define DETAILED_EVENT_LOGGING
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-typedef pylith::topology::Mesh::UpdateAddVisitor UpdateAddVisitor;
-
-// ----------------------------------------------------------------------
// Constructor
pylith::feassemble::ElasticityExplicit::ElasticityExplicit(void) :
_dtm1(-1.0)
@@ -675,17 +669,16 @@
sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default", solnSection);
assert(!globalOrder.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::Mesh::IndicesVisitor jacobianVisitor(*solnSection, *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*solnSection, *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
#if !defined(DETAILED_EVENT_LOGGING)
@@ -828,16 +821,14 @@
// Get sections
const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
assert(!jacobianSection.isNull());
- topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection,
- &_cellVector[0]);
+ UpdateAddVisitor jacobianVisitor(*jacobianSection, &_cellVector[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
#if !defined(DETAILED_EVENT_LOGGING)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitLgDeform.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitLgDeform.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -43,12 +43,6 @@
//#define PRECOMPUTE_GEOMETRY
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-typedef pylith::topology::Mesh::UpdateAddVisitor UpdateAddVisitor;
-
-// ----------------------------------------------------------------------
// Constructor
pylith::feassemble::ElasticityExplicitLgDeform::ElasticityExplicitLgDeform(void) :
_dtm1(-1.0)
@@ -194,16 +188,14 @@
RestrictVisitor dispVisitor(*dispSection, dispCell.size(), &dispCell[0]);
const ALE::Obj<RealSection>& residualSection = residual.section();
- topology::Mesh::UpdateAddVisitor residualVisitor(*residualSection,
- &_cellVector[0]);
+ UpdateAddVisitor residualVisitor(*residualSection, &_cellVector[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
assert(0 != _normalizer);
const double lengthScale = _normalizer->lengthScale();
@@ -408,16 +400,14 @@
RestrictVisitor dispVisitor(*dispSection, dispCell.size(), &dispCell[0]);
const ALE::Obj<RealSection>& residualSection = residual.section();
- topology::Mesh::UpdateAddVisitor residualVisitor(*residualSection,
- &_cellVector[0]);
+ UpdateAddVisitor residualVisitor(*residualSection, &_cellVector[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
assert(0 != _normalizer);
const double lengthScale = _normalizer->lengthScale();
@@ -592,17 +582,16 @@
sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default", solnSection);
assert(!globalOrder.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::Mesh::IndicesVisitor jacobianVisitor(*solnSection, *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*solnSection, *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
_logger->eventBegin(computeEvent);
@@ -718,16 +707,14 @@
// Get sections
const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
assert(!jacobianSection.isNull());
- topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection,
- &_cellVector[0]);
+ UpdateAddVisitor jacobianVisitor(*jacobianSection, &_cellVector[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
_logger->eventBegin(computeEvent);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -42,12 +42,6 @@
//#define DETAILED_EVENT_LOGGING
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-typedef pylith::topology::Mesh::UpdateAddVisitor UpdateAddVisitor;
-
-// ----------------------------------------------------------------------
const int pylith::feassemble::ElasticityExplicitTet4::_spaceDim = 3;
const int pylith::feassemble::ElasticityExplicitTet4::_cellDim = 3;
const int pylith::feassemble::ElasticityExplicitTet4::_tensorSize = 6;
@@ -752,17 +746,16 @@
sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default", dispSection);
assert(!globalOrder.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::Mesh::IndicesVisitor jacobianVisitor(*dispSection, *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*dispSection, *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
#if !defined(DETAILED_EVENT_LOGGING)
@@ -893,16 +886,14 @@
// Get sections
const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
assert(!jacobianSection.isNull());
- topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection,
- &_cellVector[0]);
+ UpdateAddVisitor jacobianVisitor(*jacobianSection, &_cellVector[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
#if !defined(DETAILED_EVENT_LOGGING)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTri3.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityExplicitTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -42,12 +42,6 @@
//#define DETAILED_EVENT_LOGGING
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-typedef pylith::topology::Mesh::UpdateAddVisitor UpdateAddVisitor;
-
-// ----------------------------------------------------------------------
const int pylith::feassemble::ElasticityExplicitTri3::_spaceDim = 2;
const int pylith::feassemble::ElasticityExplicitTri3::_cellDim = 2;
const int pylith::feassemble::ElasticityExplicitTri3::_tensorSize = 3;
@@ -684,17 +678,16 @@
sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default", dispSection);
assert(!globalOrder.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::Mesh::IndicesVisitor jacobianVisitor(*dispSection, *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*dispSection, *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
#if !defined(DETAILED_EVENT_LOGGING)
@@ -825,16 +818,14 @@
// Get sections
const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
assert(!jacobianSection.isNull());
- topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection,
- &_cellVector[0]);
+ UpdateAddVisitor jacobianVisitor(*jacobianSection, &_cellVector[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
#if !defined(DETAILED_EVENT_LOGGING)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicit.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicit.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -47,9 +47,11 @@
// ----------------------------------------------------------------------
typedef pylith::topology::Mesh::SieveMesh SieveMesh;
typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-typedef pylith::topology::Mesh::UpdateAddVisitor UpdateAddVisitor;
+typedef pylith::topology::Field<pylith::topology::Mesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::Mesh>::UpdateAddVisitor UpdateAddVisitor;
+typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveMesh::order_type,PetscInt> IndicesVisitor;
+
// ----------------------------------------------------------------------
// Constructor
pylith::feassemble::ElasticityImplicit::ElasticityImplicit(void) :
@@ -415,10 +417,10 @@
dispTSection);
assert(!globalOrder.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::Mesh::IndicesVisitor jacobianVisitor(*dispTSection,
- *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*dispTSection,
+ *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicitLgDeform.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/ElasticityImplicitLgDeform.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -45,10 +45,6 @@
//#define PRECOMPUTE_GEOMETRY
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-
-// ----------------------------------------------------------------------
// Constructor
pylith::feassemble::ElasticityImplicitLgDeform::ElasticityImplicitLgDeform(void) :
_dtm1(-1.0)
@@ -188,27 +184,23 @@
const ALE::Obj<RealSection>& dispTSection =
fields->get("disp(t)").section();
assert(!dispTSection.isNull());
- topology::Mesh::RestrictVisitor dispTVisitor(*dispTSection,
- numBasis*spaceDim,
- &dispTCell[0]);
+ RestrictVisitor dispTVisitor(*dispTSection,
+ numBasis*spaceDim, &dispTCell[0]);
const ALE::Obj<RealSection>& dispTIncrSection =
fields->get("dispIncr(t->t+dt)").section();
assert(!dispTIncrSection.isNull());
- topology::Mesh::RestrictVisitor dispTIncrVisitor(*dispTIncrSection,
- numBasis*spaceDim,
- &dispTIncrCell[0]);
+ RestrictVisitor dispTIncrVisitor(*dispTIncrSection,
+ numBasis*spaceDim, &dispTIncrCell[0]);
const ALE::Obj<RealSection>& residualSection = residual.section();
- topology::Mesh::UpdateAddVisitor residualVisitor(*residualSection,
- &_cellVector[0]);
+ UpdateAddVisitor residualVisitor(*residualSection, &_cellVector[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
assert(0 != _normalizer);
const double lengthScale = _normalizer->lengthScale();
@@ -392,15 +384,13 @@
const ALE::Obj<RealSection>& dispTSection =
fields->get("disp(t)").section();
assert(!dispTSection.isNull());
- topology::Mesh::RestrictVisitor dispTVisitor(*dispTSection,
- numBasis*spaceDim,
- &dispTCell[0]);
+ RestrictVisitor dispTVisitor(*dispTSection,
+ numBasis*spaceDim, &dispTCell[0]);
const ALE::Obj<RealSection>& dispTIncrSection =
fields->get("dispIncr(t->t+dt)").section();
assert(!dispTIncrSection.isNull());
- topology::Mesh::RestrictVisitor dispTIncrVisitor(*dispTIncrSection,
- numBasis*spaceDim,
- &dispTIncrCell[0]);
+ RestrictVisitor dispTIncrVisitor(*dispTIncrSection,
+ numBasis*spaceDim, &dispTIncrCell[0]);
// Get sparse matrix
const PetscMat jacobianMat = jacobian->matrix();
@@ -415,18 +405,17 @@
dispTSection);
assert(!globalOrder.isNull());
// We would need to request unique points here if we had an interpolated mesh
- topology::Mesh::IndicesVisitor jacobianVisitor(*dispTSection,
- *globalOrder,
- (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
- sieveMesh->depth())*spaceDim);
+ IndicesVisitor jacobianVisitor(*dispTSection,
+ *globalOrder,
+ (int) pow(sieveMesh->getSieve()->getMaxConeSize(),
+ sieveMesh->depth())*spaceDim);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
_logger->eventEnd(setupEvent);
_logger->eventBegin(computeEvent);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryHex3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryHex3D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryHex3D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -172,7 +172,8 @@
assert(0 != jacobian);
assert(0 != det);
- assert(numCorners()*spaceDim() == vertices.size());
+ assert( (numCorners()*spaceDim() == vertices.size()) || // linear hex
+ ((numCorners()+19)*spaceDim() == vertices.size()) ); // quadratic hex
assert(cellDim() == location.size());
assert(spaceDim()*cellDim() == jacobian->size());
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine1D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine1D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine1D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -99,7 +99,8 @@
assert(0 != jacobian);
assert(0 != det);
- assert(numCorners()*spaceDim() == vertices.size());
+ assert( (numCorners()*spaceDim() == vertices.size()) || // linear edge
+ ((numCorners()+1)*spaceDim() == vertices.size()) ); // quadratic edge
assert(spaceDim()*cellDim() == jacobian->size());
const double x0 = vertices[0];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine2D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine2D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine2D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -106,7 +106,8 @@
assert(0 != jacobian);
assert(0 != det);
- assert(numCorners()*spaceDim() == vertices.size());
+ assert( (numCorners()*spaceDim() == vertices.size()) || // linear
+ ((numCorners()+1)*spaceDim() == vertices.size()) ); // quadratic
assert(spaceDim()*cellDim() == jacobian->size());
const double x0 = vertices[0];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine3D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryLine3D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -110,7 +110,8 @@
assert(0 != jacobian);
assert(0 != det);
- assert(numCorners()*spaceDim() == vertices.size());
+ assert( (numCorners()*spaceDim() == vertices.size()) || // linear edge
+ ((numCorners()+1)*spaceDim() == vertices.size()) ); // quadratic edge
assert(spaceDim()*cellDim() == jacobian->size());
const double x0 = vertices[0];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad2D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad2D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad2D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -121,7 +121,8 @@
assert(0 != jacobian);
assert(0 != det);
- assert(numCorners()*spaceDim() == vertices.size());
+ assert( (numCorners()*spaceDim() == vertices.size()) || // linear quad
+ ((numCorners()+5)*spaceDim() == vertices.size()) ); // quadratic quad
assert(cellDim() == location.size());
assert(spaceDim()*cellDim() == jacobian->size());
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad3D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/GeometryQuad3D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -131,7 +131,8 @@
assert(0 != jacobian);
assert(0 != det);
- assert(numCorners()*spaceDim() == vertices.size());
+ assert( (numCorners()*spaceDim() == vertices.size()) || // linear quad
+ ((numCorners()+5)*spaceDim() == vertices.size()) ); // quadratic quad
assert(cellDim() == location.size());
assert(spaceDim()*cellDim() == jacobian->size());
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -41,10 +41,6 @@
//#define PRECOMPUTE_GEOMETRY
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-
-// ----------------------------------------------------------------------
// Constructor
pylith::feassemble::IntegratorElasticity::IntegratorElasticity(void) :
_material(0),
@@ -211,17 +207,15 @@
const topology::Field<topology::Mesh>& disp = fields->get("disp(t)");
const ALE::Obj<RealSection>& dispSection = disp.section();
assert(!dispSection.isNull());
- topology::Mesh::RestrictVisitor dispVisitor(*dispSection,
- dispCell.size(), &dispCell[0]);
+ RestrictVisitor dispVisitor(*dispSection, dispCell.size(), &dispCell[0]);
#if !defined(PRECOMPUTE_GEOMETRY)
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
#endif
// Loop over cells
@@ -537,17 +531,15 @@
const topology::Field<topology::Mesh>& disp = fields->get("disp(t)");
const ALE::Obj<RealSection>& dispSection = disp.section();
assert(!dispSection.isNull());
- topology::Mesh::RestrictVisitor dispVisitor(*dispSection,
- dispCell.size(), &dispCell[0]);
+ RestrictVisitor dispVisitor(*dispSection, dispCell.size(), &dispCell[0]);
#if !defined(PRECOMPUTE_GEOMETRY)
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
#endif
const ALE::Obj<RealSection>& fieldSection = field->section();
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticity.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -270,6 +270,16 @@
/// Buffers for output.
topology::Fields<topology::Field<topology::Mesh> >* _outputFields;
+// PROTECTED TYPEDEFS ///////////////////////////////////////////////////
+protected :
+
+ typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+ typedef pylith::topology::Mesh::RealSection RealSection;
+
+ typedef pylith::topology::Field<pylith::topology::Mesh>::RestrictVisitor RestrictVisitor;
+ typedef pylith::topology::Field<pylith::topology::Mesh>::UpdateAddVisitor UpdateAddVisitor;
+ typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveMesh::order_type,PetscInt> IndicesVisitor;
+
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticityLgDeform.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticityLgDeform.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/IntegratorElasticityLgDeform.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -41,10 +41,6 @@
//#define PRECOMPUTE_GEOMETRY
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-
-// ----------------------------------------------------------------------
// Constructor
pylith::feassemble::IntegratorElasticityLgDeform::IntegratorElasticityLgDeform(void)
{ // constructor
@@ -123,16 +119,14 @@
const topology::Field<topology::Mesh>& disp = fields->get("disp(t)");
const ALE::Obj<RealSection>& dispSection = disp.section();
assert(!dispSection.isNull());
- topology::Mesh::RestrictVisitor dispVisitor(*dispSection,
- dispCell.size(), &dispCell[0]);
+ RestrictVisitor dispVisitor(*dispSection, dispCell.size(), &dispCell[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
// Loop over cells
for (SieveMesh::label_sequence::iterator c_iter=cellsBegin;
@@ -221,16 +215,14 @@
const topology::Field<topology::Mesh>& disp = fields->get("disp(t)");
const ALE::Obj<RealSection>& dispSection = disp.section();
assert(!dispSection.isNull());
- topology::Mesh::RestrictVisitor dispVisitor(*dispSection,
- dispCell.size(), &dispCell[0]);
+ RestrictVisitor dispVisitor(*dispSection, dispCell.size(), &dispCell[0]);
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
const ALE::Obj<RealSection>& fieldSection = field->section();
assert(!fieldSection.isNull());
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,7 +27,7 @@
#include <cassert> // USES assert()
-//#define ISOPARAMETRIC
+#define ISOPARAMETRIC
// ----------------------------------------------------------------------
// Constructor
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din2D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din2D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din2D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,7 +27,7 @@
#include <cassert> // USES assert()
-//#define ISOPARAMETRIC
+#define ISOPARAMETRIC
// ----------------------------------------------------------------------
// Constructor
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din3D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature1Din3D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,7 +27,7 @@
#include <cassert> // USES assert()
-//#define ISOPARAMETRIC
+#define ISOPARAMETRIC
// ----------------------------------------------------------------------
// Constructor
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,7 +27,7 @@
#include <cassert> // USES assert()
-//#define ISOPARAMETRIC
+#define ISOPARAMETRIC
// ----------------------------------------------------------------------
// Constructor
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2Din3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2Din3D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature2Din3D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -29,7 +29,7 @@
#include <cassert> // USES assert()
#include <stdexcept> // USES std::runtime_error()
-//#define ISOPARAMETRIC
+#define ISOPARAMETRIC
// ----------------------------------------------------------------------
// Constructor
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature3D.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/feassemble/Quadrature3D.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,7 +27,7 @@
#include <cassert> // USES assert()
-//#define ISOPARAMETRIC
+#define ISOPARAMETRIC
// ----------------------------------------------------------------------
// Constructor
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/friction/FrictionModel.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/friction/FrictionModel.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/friction/FrictionModel.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -39,8 +39,10 @@
// ----------------------------------------------------------------------
typedef pylith::topology::Mesh::SieveSubMesh SieveSubMesh;
typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::UpdateAddVisitor UpdateAddVisitor;
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::friction::FrictionModel::FrictionModel(const materials::Metadata& metadata) :
@@ -171,8 +173,7 @@
const ALE::Obj<RealSection>& propertiesSection = _properties->section();
assert(!propertiesSection.isNull());
double_array propertiesCell(numBasis*numDBProperties);
- topology::Mesh::UpdateAddVisitor propertiesVisitor(*propertiesSection,
- &propertiesCell[0]);
+ UpdateAddVisitor propertiesVisitor(*propertiesSection, &propertiesCell[0]);
// Setup database for querying for physical properties
assert(0 != _dbProperties);
@@ -287,8 +288,7 @@
const ALE::Obj<RealSection>& stateVarsSection =_stateVars->section();
assert(!stateVarsSection.isNull());
double_array stateVarsCell(numBasis*numDBStateVars);
- topology::Mesh::UpdateAddVisitor stateVarsVisitor(*stateVarsSection,
- &stateVarsCell[0]);
+ UpdateAddVisitor stateVarsVisitor(*stateVarsSection, &stateVarsCell[0]);
for (SieveSubMesh::label_sequence::iterator c_iter=cellsBegin;
c_iter != cellsEnd;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/ElasticMaterial.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/ElasticMaterial.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -40,6 +40,9 @@
typedef pylith::topology::Mesh::SieveMesh SieveMesh;
typedef pylith::topology::Mesh::RealSection RealSection;
+typedef pylith::topology::Field<pylith::topology::Mesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::Mesh>::UpdateAddVisitor UpdateAddVisitor;
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::materials::ElasticMaterial::ElasticMaterial(const int dimension,
@@ -323,9 +326,8 @@
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
#endif
// Create arrays for querying
@@ -470,9 +472,8 @@
double_array coordinatesCell(numBasis*spaceDim);
const ALE::Obj<RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
#endif
// Create arrays for querying
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/Material.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/Material.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -39,8 +39,10 @@
// ----------------------------------------------------------------------
typedef pylith::topology::Mesh::SieveMesh SieveMesh;
typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::Mesh>::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::Mesh>::UpdateAddVisitor UpdateAddVisitor;
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::materials::Material::Material(const int dimension,
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/MaxwellPlaneStrain.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/MaxwellPlaneStrain.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/materials/MaxwellPlaneStrain.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -408,6 +408,9 @@
// Initial stress and strain values
const double meanStrainInitial = (initialStrain[0] + initialStrain[1]) / 3.0;
+ // :BUG:? CHARLES - Doesn't sigma_zz contribute to
+ // meanStressInitial? Isn't sigma_zz nonzero and found from sigma_xx
+ // and sigma_yy?
const double meanStressInitial = (initialStress[0] + initialStress[1]) / 3.0;
const double devStrainInitial[] = {initialStrain[0] - meanStrainInitial,
initialStrain[1] - meanStrainInitial,
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilter.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilter.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilter.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -85,7 +85,7 @@
* @returns Averaged field.
*/
virtual
- const field_type&
+ field_type&
filter(const field_type& fieldIn,
const char* label =0,
const int labelId =0) = 0;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -80,7 +80,7 @@
// ----------------------------------------------------------------------
// Filter field.
template<typename mesh_type, typename field_type>
-const field_type&
+field_type&
pylith::meshio::CellFilterAvg<mesh_type,field_type>::filter(
const field_type& fieldIn,
const char* label,
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/CellFilterAvg.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -69,7 +69,7 @@
*
* @returns Averaged field.
*/
- const field_type&
+ field_type&
filter(const field_type& fieldIn,
const char* label =0,
const int labelId =0);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriter.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriter.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriter.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -101,7 +101,7 @@
*/
virtual
void writeVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh) = 0;
/** Write field over cells to file.
@@ -114,7 +114,7 @@
*/
virtual
void writeCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0) = 0;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,6 +19,7 @@
#include <portinfo>
#include <petscmesh_viewers.hh> // USES HDF5Viewer
+#include <petscmesh_formats.hh> // USES PCICE output
#include <cassert> // USES assert()
#include <sstream> // USES std::ostringstream
@@ -71,44 +72,58 @@
const char* label,
const int labelId)
{ // openTimeStep
-#if 0
- // MATT - This stuff needs to be updated for HDF5.
-
try {
PetscErrorCode err = 0;
- const std::string& filename = _hdf5Filename(t);
+ const std::string& filename = _hdf5Filename();
err = PetscViewerCreate(mesh.comm(), &_viewer);
CHECK_PETSC_ERROR(err);
- err = PetscViewerSetType(_viewer, PETSCVIEWERASCII);
+ err = PetscViewerSetType(_viewer, PETSCVIEWERHDF5);
CHECK_PETSC_ERROR(err);
- err = PetscViewerSetFormat(_viewer, PETSC_VIEWER_ASCII_HDF5);
+ err = PetscViewerFileSetMode(_viewer, FILE_MODE_WRITE);
CHECK_PETSC_ERROR(err);
err = PetscViewerFileSetName(_viewer, filename.c_str());
CHECK_PETSC_ERROR(err);
const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = mesh.sieveMesh();
-
- err = HDF5Viewer::writeHeader(sieveMesh, _viewer);
- CHECK_PETSC_ERROR(err);
- //std::cout << "Wrote header for " << filename << std::endl;
- err = HDF5Viewer::writeVertices(sieveMesh, _viewer);
- CHECK_PETSC_ERROR(err);
- //std::cout << "Wrote vertices for " << filename << std::endl;
- if (0 == label) {
- err = HDF5Viewer::writeElements(sieveMesh, _viewer);
- CHECK_PETSC_ERROR(err);
- } else {
- const std::string labelName =
- (sieveMesh->hasLabel("censored depth")) ? "censored depth" : "depth";
- err = HDF5Viewer::writeElements(sieveMesh, label, labelId, labelName, 0, _viewer);
- CHECK_PETSC_ERROR(err);
- } // if
- //std::cout << "Wrote elements for " << filename << std::endl;
+ const ALE::Obj<typename mesh_type::RealSection>& coordinatesSection =
+ sieveMesh->getRealSection("coordinates");
+ topology::FieldBase::Metadata metadata;
+ // :KLUDGE: We would like to use field_type for the coordinates
+ // field. However, the mesh coordinates are Field<mesh_type> and
+ // field_type can be Field<Mesh> (e.g., displacement field over a
+ // SubMesh).
+ topology::Field<mesh_type> coordinates(mesh, coordinatesSection, metadata);
+ coordinates.label("vertices");
+ coordinates.createVector();
+ coordinates.createScatter();
+ coordinates.scatterSectionToVector();
+ err = VecView(coordinates.vector(), _viewer);CHECK_PETSC_ERROR(err);
- _wroteVertexHeader = false;
- _wroteCellHeader = false;
+ Vec elemVec;
+ PetscScalar *tmpVertices;
+ PetscBool columnMajor = PETSC_FALSE;
+
+ ///ALE::PCICE::Builder::outputElementsLocal(sieveMesh, &numElements, &numCorners, &vertices, columnMajor);
+ typedef ALE::OrientedConeSectionV<typename mesh_type::SieveMesh::sieve_type> oriented_cones_wrapper_type;
+ Obj<oriented_cones_wrapper_type> cones = new oriented_cones_wrapper_type(sieveMesh->getSieve());
+
+ // Hack right now, move to HDF5 Section viewer
+ err = PetscMalloc(sizeof(PetscScalar)*cones->size(), &tmpVertices);CHECK_PETSC_ERROR(err);
+ for(int p = sieveMesh->getSieve()->getChart().min(), i = 0; p < sieveMesh->getSieve()->getChart().max(); ++p) {
+ const int coneSize = cones->getFiberDimension(p);
+ const typename oriented_cones_wrapper_type::value_type *vertices = cones->restrictPoint(p);
+
+ for(int c = 0; c < coneSize; ++c, ++i) {
+ tmpVertices[i] = vertices[c].first;
+ }
+ }
+ err = VecCreateMPIWithArray(sieveMesh->comm(), cones->size(), PETSC_DETERMINE, tmpVertices, &elemVec);CHECK_PETSC_ERROR(err);
+ err = PetscObjectSetName((PetscObject) elemVec, "cells");CHECK_PETSC_ERROR(err);
+ err = VecView(elemVec, _viewer);CHECK_PETSC_ERROR(err);
+ err = VecDestroy(elemVec);CHECK_PETSC_ERROR(err);
+ err = PetscFree(tmpVertices);CHECK_PETSC_ERROR(err);
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while preparing for writing data to HDF5 file "
@@ -125,8 +140,6 @@
<< _filename << " at time " << t << ".\n";
throw std::runtime_error(msg.str());
} // try/catch
-
-#endif
} // openTimeStep
// ----------------------------------------------------------------------
@@ -144,51 +157,34 @@
void
pylith::meshio::DataWriterHDF5<mesh_type,field_type>::writeVertexField(
const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh)
{ // writeVertexField
-#if 0
- // MATT - This stuff needs to be update for HDF5.
-
- typedef typename mesh_type::SieveMesh SieveMesh;
- typedef typename field_type::Mesh::RealSection RealSection;
-
try {
- int rank = 0;
- MPI_Comm_rank(field.mesh().comm(), &rank);
+ // We will try the simplest thing, using the embedded vector. If this is not
+ // general enough, due to ordering, etc., we can construct an auxiliary vector.
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- assert(!sieveMesh.isNull());
- const std::string labelName =
- (sieveMesh->hasLabel("censored depth")) ? "censored depth" : "depth";
- const ALE::Obj<typename SieveMesh::numbering_type>& numbering =
- sieveMesh->getFactory()->getNumbering(sieveMesh, labelName, 0);
- assert(!numbering.isNull());
+ PetscVec vector = field.vector();
+ if (vector == PETSC_NULL) {
+ field.createVector();
+ vector = field.vector();
+ }
- const ALE::Obj<RealSection>& section = field.section();
- assert(!section.isNull());
- assert(!sieveMesh->getLabelStratum(labelName, 0).isNull());
-
- const int localFiberDim =
- (sieveMesh->getLabelStratum(labelName, 0)->size() > 0) ?
- section->getFiberDimension(*sieveMesh->getLabelStratum(labelName, 0)->begin()) : 0;
- int fiberDim = 0;
- MPI_Allreduce((void *) &localFiberDim, (void *) &fiberDim, 1,
- MPI_INT, MPI_MAX, field.mesh().comm());
- assert(fiberDim > 0);
- const int enforceDim =
- (field.vectorFieldType() != topology::FieldBase::VECTOR) ? fiberDim : 3;
+#if 0 // TEMPORARY DEBUGGING
+ const char* vecname = 0;
+ PetscObjectGetName((PetscObject) vector, &vecname);
+ std::cout << "NAME field: " << field.label()
+ << ", section: " << field.section()->getName()
+ << ", vec: " << vecname
+ << std::endl;
+#endif
- PetscErrorCode err = 0;
- if (!_wroteVertexHeader) {
- err = PetscViewerASCIIPrintf(_viewer, "POINT_DATA %d\n",
- numbering->getGlobalSize());
- CHECK_PETSC_ERROR(err);
- _wroteVertexHeader = true;
- } // if
+ // TODO: Create scatter if necessary
+ field.createScatter();
+ field.scatterSectionToVector();
- err = HDF5Viewer::writeField(section, field.label(), fiberDim, numbering,
- _viewer, enforceDim, _precision);
+ PetscErrorCode err = 0;
+ err = VecView(vector, _viewer);
CHECK_PETSC_ERROR(err);
} catch (const std::exception& err) {
std::ostringstream msg;
@@ -201,8 +197,6 @@
<< t << " to HDF5 file '" << _filename << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
-
-#endif
} // writeVertexField
// ----------------------------------------------------------------------
@@ -211,57 +205,35 @@
void
pylith::meshio::DataWriterHDF5<mesh_type,field_type>::writeCellField(
const double t,
- const field_type& field,
+ field_type& field,
const char* label,
const int labelId)
{ // writeCellField
-#if 0
- // MATT - This stuff needs to be update to HDF5.
-
- typedef typename field_type::Mesh::SieveMesh SieveMesh;
- typedef typename field_type::Mesh::RealSection RealSection;
-
try {
- int rank = 0;
- MPI_Comm_rank(field.mesh().comm(), &rank);
+ // We will try the simplest thing, using the embedded vector. If this is not
+ // general enough, due to ordering, etc., we can construct an auxiliary vector.
- // Correctly handle boundary and fault meshes
- // Cannot just use mesh->depth() because boundaries report the wrong thing
- const ALE::Obj<SieveMesh>& sieveMesh = field.mesh().sieveMesh();
- assert(!sieveMesh.isNull());
- const int cellDepth = (sieveMesh->depth() == -1) ? -1 : 1;
- const int depth = (0 == label) ? cellDepth : labelId;
- const std::string labelName = (0 == label) ?
- ((sieveMesh->hasLabel("censored depth")) ?
- "censored depth" : "depth") : label;
- assert(!sieveMesh->getFactory().isNull());
- const ALE::Obj<typename SieveMesh::numbering_type>& numbering =
- sieveMesh->getFactory()->getNumbering(sieveMesh, labelName, depth);
- assert(!numbering.isNull());
- assert(!sieveMesh->getLabelStratum(labelName, depth).isNull());
- const ALE::Obj<RealSection>& section = field.section();
- assert(!section.isNull());
+ PetscVec vector = field.vector();
+ if (vector == PETSC_NULL) {
+ field.createVector();
+ vector = field.vector();
+ }
- const int localFiberDim =
- (sieveMesh->getLabelStratum(labelName, depth)->size() > 0) ?
- section->getFiberDimension(*sieveMesh->getLabelStratum(labelName, depth)->begin()) : 0;
- int fiberDim = 0;
- MPI_Allreduce((void *) &localFiberDim, (void *) &fiberDim, 1,
- MPI_INT, MPI_MAX, field.mesh().comm());
- assert(fiberDim > 0);
- const int enforceDim =
- (field.vectorFieldType() != topology::FieldBase::VECTOR) ? fiberDim : 3;
+#if 0 // TEMPORARY DEBUGGING
+ const char* vecname = 0;
+ PetscObjectGetName((PetscObject) vector, &vecname);
+ std::cout << "NAME field: " << field.label()
+ << ", section: " << field.section()->getName()
+ << ", vec: " << vecname
+ << std::endl;
+#endif
+ // TODO: Create scatter only if necessary
+ field.createScatter();
+ field.scatterSectionToVector();
PetscErrorCode err = 0;
- if (!_wroteCellHeader) {
- err = PetscViewerASCIIPrintf(_viewer, "CELL_DATA %d\n",
- numbering->getGlobalSize());
- CHECK_PETSC_ERROR(err);
- _wroteCellHeader = true;
- } // if
-
- HDF5Viewer::writeField(section, field.label(), fiberDim, numbering,
- _viewer, enforceDim, _precision);
+ err = VecView(vector, _viewer);
+ CHECK_PETSC_ERROR(err);
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
@@ -273,21 +245,22 @@
<< t << " to HDF5 file '" << _filename << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
-
-#endif
} // writeCellField
// ----------------------------------------------------------------------
// Generate filename for HDF5 file.
template<typename mesh_type, typename field_type>
std::string
-pylith::meshio::DataWriterHDF5<mesh_type,field_type>::_hdf5Filename(const double t) const
+pylith::meshio::DataWriterHDF5<mesh_type,field_type>::_hdf5Filename(void) const
{ // _hdf5Filename
std::ostringstream filename;
const int indexExt = _filename.find(".h5");
const int numTimeSteps = DataWriter<mesh_type, field_type>::_numTimeSteps;
- if (0 == numTimeSteps)
- filename << std::string(_filename, 0, indexExt) << "_info.hdf5";
+ if (0 == numTimeSteps) {
+ filename << std::string(_filename, 0, indexExt) << "_info.h5";
+ } else {
+ filename << _filename;
+ } // if/else
return std::string(filename.str());
} // _hdf5Filename
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterHDF5.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -101,7 +101,7 @@
* @param mesh Mesh associated with output.
*/
void writeVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh);
/** Write field over cells to file.
@@ -113,7 +113,7 @@
* @param labelId Value of label defining which cells to include.
*/
void writeCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0);
@@ -126,11 +126,8 @@
*/
DataWriterHDF5(const DataWriterHDF5& w);
- /** Generate filename for HDF5 file.
- *
- * @param t Time in seconds.
- */
- std::string _hdf5Filename(const double t) const;
+ /// Generate filename for HDF5 file.
+ std::string _hdf5Filename(void) const;
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -181,7 +181,7 @@
void
pylith::meshio::DataWriterVTK<mesh_type,field_type>::writeVertexField(
const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh)
{ // writeVertexField
typedef typename mesh_type::SieveMesh SieveMesh;
@@ -243,7 +243,7 @@
void
pylith::meshio::DataWriterVTK<mesh_type,field_type>::writeCellField(
const double t,
- const field_type& field,
+ field_type& field,
const char* label,
const int labelId)
{ // writeCellField
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/DataWriterVTK.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -106,7 +106,7 @@
* @param mesh Mesh associated with output.
*/
void writeVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh);
/** Write field over cells to file.
@@ -118,7 +118,7 @@
* @param labelId Value of label defining which cells to include.
*/
void writeCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -186,7 +186,9 @@
++e_iter) {
sieve->cone(*e_iter, pV);
const SieveMesh::point_type *cone = pV.getPoints();
- for(int p = 0; p < pV.getSize(); ++p, ++i) {
+ const int coneSize = pV.getSize();
+ assert(coneSize == *numCorners);
+ for(int p = 0; p < coneSize; ++p, ++i) {
(*cells)[i] = vNumbering->getIndex(cone[p]);
}
pV.clear();
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIOCubit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIOCubit.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIOCubit.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -392,38 +392,98 @@
assert(0 != cells);
assert(cells->size() == numCells*numCorners);
- if (2 == meshDim && 4 == numCorners) // QUAD
-#if 0 // OLD
- // 0 1 2 3 -> 0 1 3 2
+ if (2 == meshDim && 4 == numCorners) { // QUAD4
+ ; // do nothing
+
+ } else if (3 == meshDim && 8 == numCorners) { // HEX8
+ ; // do nothing
+
+ } else if (2 == meshDim && 6 == numCorners) { // TRI6
+ // CUBIT
+ // corners,
+ // bottom edges, middle edges, top edges
+
+ // PyLith (Sieve)
+ // bottom edge, right edge, left edge, corners
+
+ // Permutation: 3, 4, 5, 0, 1, 2
+ int tmp = 0;
for (int iCell=0; iCell < numCells; ++iCell) {
- const int i2 = iCell*numCorners+2;
- const int i3 = iCell*numCorners+3;
- const int tmp = (*cells)[i2];
- (*cells)[i2] = (*cells)[i3];
- (*cells)[i3] = tmp;
+ const int ii = iCell*numCorners;
+ tmp = (*cells)[ii+0];
+ (*cells)[ii+0] = (*cells)[ii+3];
+ (*cells)[ii+3] = tmp;
+
+ tmp = (*cells)[ii+1];
+ (*cells)[ii+1] = (*cells)[ii+4];
+ (*cells)[ii+4] = tmp;
+
+ tmp = (*cells)[ii+2];
+ (*cells)[ii+2] = (*cells)[ii+5];
+ (*cells)[ii+5] = tmp;
} // for
-#else
- ; // do nothing
-#endif
- else if (3 == meshDim && 8 == numCorners) // HEX
-#if 0 // OLD
- // 0 1 2 3 4 5 6 7 -> 0 1 3 2 4 5 7 6
+
+ } else if (3 == meshDim && 27 == numCorners) { // HEX27
+ // CUBIT
+ // corners,
+ // bottom edges, middle edges, top edges
+ // interior
+ // bottom/top, left/right, front/back
+
+ // PyLith
+ // corners,
+ // bottom edges, top edges, middle edges
+ // left/right, front/back, bottom/top
+ // interior
+ int tmp = 0;
for (int iCell=0; iCell < numCells; ++iCell) {
- const int i2 = iCell*numCorners+2;
- const int i3 = iCell*numCorners+3;
- int tmp = (*cells)[i2];
- (*cells)[i2] = (*cells)[i3];
- (*cells)[i3] = tmp;
+ const int i12 = iCell*numCorners+12;
+ const int i13 = iCell*numCorners+13;
+ const int i14 = iCell*numCorners+14;
+ const int i15 = iCell*numCorners+15;
+ const int i16 = iCell*numCorners+16;
+ const int i17 = iCell*numCorners+17;
+ const int i18 = iCell*numCorners+18;
+ const int i19 = iCell*numCorners+19;
+ const int i20 = iCell*numCorners+20;
+ const int i21 = iCell*numCorners+21;
+ const int i22 = iCell*numCorners+22;
+ const int i23 = iCell*numCorners+23;
+ const int i24 = iCell*numCorners+24;
+ const int i25 = iCell*numCorners+25;
+ const int i26 = iCell*numCorners+26;
- const int i6 = iCell*numCorners+6;
- const int i7 = iCell*numCorners+7;
- tmp = (*cells)[i6];
- (*cells)[i6] = (*cells)[i7];
- (*cells)[i7] = tmp;
+ tmp = (*cells)[i12];
+ (*cells)[i12] = (*cells)[i16];
+ (*cells)[i16] = tmp;
+
+ tmp = (*cells)[i13];
+ (*cells)[i13] = (*cells)[i17];
+ (*cells)[i17] = tmp;
+
+ tmp = (*cells)[i14];
+ (*cells)[i14] = (*cells)[i18];
+ (*cells)[i18] = tmp;
+
+ tmp = (*cells)[i15];
+ (*cells)[i15] = (*cells)[i19];
+ (*cells)[i19] = tmp;
+
+ tmp = (*cells)[i20];
+ (*cells)[i20] = (*cells)[i23];
+ (*cells)[i23] = (*cells)[i26];
+ (*cells)[i26] = tmp;
+
+ tmp = (*cells)[i21];
+ (*cells)[i21] = (*cells)[i24];
+ (*cells)[i24] = tmp;
+
+ tmp = (*cells)[i22];
+ (*cells)[i22] = (*cells)[i25];
+ (*cells)[i25] = tmp;
} // for
-#else
- ; // do nothing
-#endif
+ } // if/else
+
} // _orientCells
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -163,12 +163,12 @@
void
pylith::meshio::OutputManager<mesh_type, field_type>::appendVertexField(
const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh)
{ // appendVertexField
- const field_type& fieldFiltered =
+ field_type& fieldFiltered =
(0 == _vertexFilter) ? field : _vertexFilter->filter(field);
- const field_type& fieldDimensioned = _dimension(fieldFiltered);
+ field_type& fieldDimensioned = _dimension(fieldFiltered);
_writer->writeVertexField(t, fieldDimensioned, mesh);
} // appendVertexField
@@ -179,13 +179,13 @@
void
pylith::meshio::OutputManager<mesh_type, field_type>::appendCellField(
const double t,
- const field_type& field,
+ field_type& field,
const char* label,
const int labelId)
{ // appendCellField
- const field_type& fieldFiltered =
+ field_type& fieldFiltered =
(0 == _cellFilter) ? field : _cellFilter->filter(field, label, labelId);
- const field_type& fieldDimensioned = _dimension(fieldFiltered);
+ field_type& fieldDimensioned = _dimension(fieldFiltered);
_writer->writeCellField(t, fieldDimensioned, label, labelId);
} // appendCellField
@@ -193,8 +193,8 @@
// ----------------------------------------------------------------------
// Dimension field.
template<typename mesh_type, typename field_type>
-const field_type&
-pylith::meshio::OutputManager<mesh_type, field_type>::_dimension(const field_type& fieldIn)
+field_type&
+pylith::meshio::OutputManager<mesh_type, field_type>::_dimension(field_type& fieldIn)
{ // _dimension
if (1.0 == fieldIn.scale())
return fieldIn;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/OutputManager.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -122,7 +122,7 @@
* @param mesh Mesh for output.
*/
void appendVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh);
/** Append finite-element cell field to file.
@@ -134,7 +134,7 @@
* @param labelId Value of label defining which cells to include.
*/
void appendCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0);
@@ -145,7 +145,7 @@
*
* @param fieldIn Field to dimensionalize.
*/
- const field_type& _dimension(const field_type& fieldIn);
+ field_type& _dimension(field_type& fieldIn);
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilter.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilter.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilter.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -65,7 +65,7 @@
* @param fieldIn Field to filter.
*/
virtual
- const field_type&
+ field_type&
filter(const field_type& fieldIn) = 0;
// PROTECTED METHODS ////////////////////////////////////////////////////
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -68,7 +68,7 @@
// ----------------------------------------------------------------------
// Filter field.
template<typename field_type>
-const field_type&
+field_type&
pylith::meshio::VertexFilterVecNorm<field_type>::filter(
const field_type& fieldIn)
{ // filter
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/VertexFilterVecNorm.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,7 +59,7 @@
*
* @param fieldIn Field to filter.
*/
- const field_type&
+ field_type&
filter(const field_type& fieldIn);
// PROTECTED METHODS ////////////////////////////////////////////////////
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -183,7 +183,7 @@
PetscReal xnorm,
PetscReal *ynorm,
PetscReal *gnorm,
- PetscTruth *flag)
+ PetscBool *flag)
{ // lineSearch
// Note that for line search purposes we work with with the related
// minimization problem:
@@ -198,7 +198,7 @@
PetscErrorCode ierr;
PetscInt count;
SNES_LS *neP = (SNES_LS*)snes->data;
- PetscTruth changed_w = PETSC_FALSE,changed_y = PETSC_FALSE;
+ PetscBool changed_w = PETSC_FALSE,changed_y = PETSC_FALSE;
PetscFunctionBegin;
ierr = PetscLogEventBegin(SNES_LineSearch,snes,x,f,g);CHKERRQ(ierr);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/problems/SolverNonlinear.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -139,7 +139,7 @@
PetscReal xnorm,
PetscReal *ynorm,
PetscReal *gnorm,
- PetscTruth *flag);
+ PetscBool *flag);
// PRIVATE METHODS //////////////////////////////////////////////////////
private :
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/CellRefinerQuad4.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,423 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "CellRefinerQuad4.hh" // implementation of class methods
+
+#include "MeshOrder.hh" // USES MeshOrder
+
+#include <cassert> // USES assert()
+
+#include <iostream> // TEMPORARY
+// ----------------------------------------------------------------------
+// Constructor
+ALE::CellRefinerQuad4::CellRefinerQuad4(const mesh_type& mesh) :
+ RefineFace4Edges2(mesh)
+{ // constructor
+ assert(2 == mesh.getDimension());
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+ALE::CellRefinerQuad4::~CellRefinerQuad4(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Get number of refined cells for each original cell.
+int
+ALE::CellRefinerQuad4::numNewCells(const point_type cell)
+{ // numNewCells
+ switch (_cellType(cell)) {
+ case QUADRILATERAL:
+ return 4;
+ case LINE_COHESIVE_LAGRANGE:
+ return 2;
+ default:
+ assert(0);
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+} // numNewCells
+
+// ----------------------------------------------------------------------
+// Split cell into smaller cells of same type.
+void
+ALE::CellRefinerQuad4::splitCell(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex)
+{ // splitCell
+ assert(curNewVertex);
+
+ int numEdges = 0;
+ const EdgeType* edges;
+
+ int numFaces = 0;
+ const FaceType* faces;
+
+ switch (_cellType(cell)) {
+ case QUADRILATERAL:
+ _edges_QUADRILATERAL(&edges, &numEdges, cone, coneSize);
+ _faces_QUADRILATERAL(&faces, &numFaces, cone, coneSize);
+ break;
+ case LINE_COHESIVE_LAGRANGE:
+ _edges_LINE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize);
+ break;
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+
+ for(int iEdge=0; iEdge < numEdges; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ // if vertex does not exist
+ std::cout << "Edge: " << edges[iEdge] << ", new vertex: " << *curNewVertex << std::endl;
+ _edgeToVertex[edges[iEdge]] = *curNewVertex;
+ ++(*curNewVertex);
+ } // if
+ } // for
+
+ for(int iFace=0; iFace < numFaces; ++iFace) {
+ if (_faceToVertex.find(faces[iFace]) == _faceToVertex.end()) {
+ // if vertex does not exist
+ std::cout << "Face: " << faces[iFace] << ", new vertex: " << *curNewVertex << std::endl;
+ _faceToVertex[faces[iFace]] = *curNewVertex;
+ ++(*curNewVertex);
+ } // if
+ } // for
+} // splitCell
+
+// ----------------------------------------------------------------------
+// Split cell into smaller cells of same type.
+void
+ALE::CellRefinerQuad4::splitCellUncensored(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex)
+{ // splitCellUncensored
+ assert(curNewVertex);
+
+ int numEdges = 0;
+ const EdgeType* edges;
+
+ const bool uncensored = true;
+
+ switch (_cellType(cell)) {
+ case QUADRILATERAL:
+ // No censored vertices on normal cell.
+ break;
+ case LINE_COHESIVE_LAGRANGE:
+ _edges_LINE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize, uncensored);
+ break;
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+
+ for(int iEdge=0; iEdge < numEdges; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ // if vertex does not exist
+ std::cout << "Edge: " << edges[iEdge] << ", new vertex: " << *curNewVertex << std::endl;
+ _edgeToVertex[edges[iEdge]] = *curNewVertex;
+ ++(*curNewVertex);
+ } // if
+ } // for
+
+} // splitCellUncensored
+
+// ----------------------------------------------------------------------
+// Get refined cells.
+void
+ALE::CellRefinerQuad4::getNewCells(const point_type** cells,
+ int* numCells,
+ const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ const MeshOrder& orderOldMesh,
+ const MeshOrder& orderNewMesh)
+{ // getNewCells
+ assert(cells);
+ assert(numCells);
+
+ switch (_cellType(cell)) {
+ case QUADRILATERAL: {
+ const int coneVertexOffset = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+ _newCells_QUADRILATERAL(cells, numCells, cone, coneSize, coneVertexOffset);
+ break;
+ } // QUADRILATERAL
+ case LINE_COHESIVE_LAGRANGE: {
+ const int coneVertexOffsetNormal = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+ const int coneVertexOffsetCensored = orderNewMesh.verticesCensored().min() - orderOldMesh.verticesCensored().min();
+ _newCells_LINE_COHESIVE_LAGRANGE(cells, numCells, cone, coneSize, coneVertexOffsetNormal, coneVertexOffsetCensored);
+ break;
+ } // LINE_COHESIVE_LAGRANGE
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+} // getNewCells
+
+// ----------------------------------------------------------------------
+// Get cell type.
+ALE::CellRefinerQuad4::CellEnum
+ALE::CellRefinerQuad4::_cellType(const point_type cell)
+{ // _cellType
+ assert(!_mesh.getSieve().isNull());
+
+ switch (_mesh.getSieve()->getConeSize(cell)) {
+ case 4:
+ return QUADRILATERAL;
+ case 6:
+ return LINE_COHESIVE_LAGRANGE;
+ case 0: {
+ std::ostringstream msg;
+ std::cerr << "Internal error. Cone size for mesh point " << cell << " is zero. May be a vertex.";
+ assert(0);
+ throw ALE::Exception("Could not determine cell type during uniform global refinement.");
+ } // case 0
+ default : {
+ std::ostringstream msg;
+ std::cerr << "Internal error. Unknown cone size for mesh point " << cell << ". Unknown cell type.";
+ assert(0);
+ throw ALE::Exception("Could not determine cell type during uniform global refinement.");
+ } // default
+ } // switch
+} // _cellType
+
+// ----------------------------------------------------------------------
+// Get edges of quadrilateral cell.
+void
+ALE::CellRefinerQuad4::_edges_QUADRILATERAL(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize)
+{ // _edges_QUADRILATERAL
+ static EdgeType quadEdges[4];
+
+ assert(coneSize == 4);
+ quadEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ quadEdges[1] = EdgeType(std::min(cone[1], cone[2]), std::max(cone[1], cone[2]));
+ quadEdges[2] = EdgeType(std::min(cone[2], cone[3]), std::max(cone[2], cone[3]));
+ quadEdges[3] = EdgeType(std::min(cone[3], cone[0]), std::max(cone[3], cone[0]));
+ *numEdges = 4;
+ *edges = quadEdges;
+} // _edges_QUADRILATERAL
+
+// ----------------------------------------------------------------------
+// Get edges of line cohesive cell with Lagrange multipler vertices.
+void
+ALE::CellRefinerQuad4::_edges_LINE_COHESIVE_LAGRANGE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize,
+ const bool uncensored)
+{ // _edges_LINE_COHESIVE_LAGRANGE
+ if (uncensored) {
+ // Include all edges
+ static EdgeType lineEdges[3];
+
+ assert(coneSize == 6);
+ lineEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ lineEdges[1] = EdgeType(std::min(cone[2], cone[3]), std::max(cone[2], cone[3]));
+ lineEdges[2] = EdgeType(std::min(cone[4], cone[5]), std::max(cone[4], cone[5]));
+ *numEdges = 3;
+ *edges = lineEdges;
+ } else {
+ // Omit edges with censored (Lagrange multiplier) vertices.
+ static EdgeType lineEdges[2];
+
+ assert(coneSize == 6);
+ lineEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ lineEdges[1] = EdgeType(std::min(cone[2], cone[3]), std::max(cone[2], cone[3]));
+ *numEdges = 2;
+ *edges = lineEdges;
+ } // if/else
+} // _edges_LINE_COHESIVE_LAGRANGE
+
+// ----------------------------------------------------------------------
+// Get faces of quadrilateral cell.
+void
+ALE::CellRefinerQuad4::_faces_QUADRILATERAL(const FaceType** faces,
+ int* numFaces,
+ const point_type cone[],
+ const int coneSize)
+{ // _faces_QUADRILATERAL
+ static FaceType quadFaces[1];
+
+ assert(coneSize == 4);
+
+ int sortedCone[4];
+ for (int i=0; i < 4; ++i)
+ sortedCone[i] = cone[i];
+ std::sort(sortedCone, sortedCone+coneSize);
+ const point_type pMin = sortedCone[0];
+
+ if (pMin == cone[0]) {
+ if (cone[1] < cone[3]) {
+ quadFaces[0] = FaceType(cone[0], cone[1], cone[2], cone[3]);
+ } else {
+ quadFaces[0] = FaceType(cone[0], cone[3], cone[2], cone[1]);
+ } // if/else
+
+ } else if (pMin == cone[1]) {
+ if (cone[2] < cone[0]) {
+ quadFaces[0] = FaceType(cone[1], cone[2], cone[3], cone[0]);
+ } else {
+ quadFaces[0] = FaceType(cone[1], cone[0], cone[3], cone[2]);
+ } // if/else
+
+ } else if (pMin == cone[2]) {
+ if (cone[3] < cone[1]) {
+ quadFaces[0] = FaceType(cone[2], cone[3], cone[0], cone[1]);
+ } else {
+ quadFaces[0] = FaceType(cone[2], cone[1], cone[3], cone[0]);
+ } // if/else
+
+ } else if (pMin == cone[3]) {
+ if (cone[0] < cone[2]) {
+ quadFaces[0] = FaceType(cone[3], cone[0], cone[1], cone[2]);
+ } else {
+ quadFaces[0] = FaceType(cone[3], cone[2], cone[1], cone[0]);
+ } // if/else
+ } else {
+ assert(0);
+ throw ALE::Exception("Could not determine quad face orientation during uniform global refinement.");
+ } // if/else
+ *numFaces = 1;
+ *faces = quadFaces;
+} // _faces_QUADRILATERAL
+
+// ----------------------------------------------------------------------
+// Get new cells from refinement of a triangular cell.
+void
+ ALE::CellRefinerQuad4::_newCells_QUADRILATERAL(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffset)
+{ // _newCells_QUADRILATERAL
+ const int coneSizeQuad4 = 4;
+ const int numEdgesQuad4 = 4;
+ const int numFacesQuad4 = 1;
+ const int numNewCells = 4;
+ const int numNewVertices = 5;
+
+ int numEdges = 0;
+ const EdgeType *edges;
+ _edges_QUADRILATERAL(&edges, &numEdges, cone, coneSize);
+ assert(numEdgesQuad4 == numEdges);
+
+ int numFaces = 0;
+ const FaceType *faces;
+ _faces_QUADRILATERAL(&faces, &numFaces, cone, coneSize);
+ assert(numFacesQuad4 == numFaces);
+
+ static point_type quadCells[numNewCells*coneSizeQuad4];
+ point_type newVertices[numNewVertices];
+ int iNewVertex = 0;
+ for(int iEdge=0; iEdge < numEdgesQuad4; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ throw ALE::Exception("Missing edge in refined mesh");
+ } // if
+ newVertices[iNewVertex++] = _edgeToVertex[edges[iEdge]];
+ } // for
+ for(int iFace=0; iFace < numFacesQuad4; ++iFace) {
+ if (_faceToVertex.find(faces[iFace]) == _faceToVertex.end()) {
+ throw ALE::Exception("Missing face in refined mesh");
+ } // if
+ newVertices[iNewVertex++] = _faceToVertex[faces[iFace]];
+ } // for
+
+ // new cell 0
+ quadCells[0*4+0] = cone[0] + coneVertexOffset;
+ quadCells[0*4+1] = newVertices[0];
+ quadCells[0*4+2] = newVertices[4];
+ quadCells[0*4+3] = newVertices[3];
+
+ // new cell 1
+ quadCells[1*4+0] = cone[1] + coneVertexOffset;
+ quadCells[1*4+1] = newVertices[1];
+ quadCells[1*4+2] = newVertices[4];
+ quadCells[1*4+3] = newVertices[0];
+
+ // new cell 2
+ quadCells[2*4+0] = cone[3] + coneVertexOffset;
+ quadCells[2*4+1] = newVertices[3];
+ quadCells[2*4+2] = newVertices[4];
+ quadCells[2*4+3] = newVertices[2];
+
+ // new cell 3
+ quadCells[3*4+0] = cone[2] + coneVertexOffset;
+ quadCells[3*4+1] = newVertices[2];
+ quadCells[3*4+2] = newVertices[4];
+ quadCells[3*4+3] = newVertices[1];
+
+ *numCells = numNewCells;
+ *cells = quadCells;
+} // _newCells_QUADRILATERAL
+
+// ----------------------------------------------------------------------
+// Get new cells from refinement of a line cohseive cell with Lagrange
+// multiplier vertices.
+void
+ALE::CellRefinerQuad4::_newCells_LINE_COHESIVE_LAGRANGE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffsetNormal,
+ const int coneVertexOffsetCensored)
+{ // _newCells_LINE_COHESIVE_LAGRANGE
+ const int coneSizeLine6 = 6;
+ const int numEdgesLine6 = 3;
+ const int numNewCells = 2;
+ const int numNewVertices = 3;
+
+ int numEdges = 0;
+ const EdgeType *edges;
+ _edges_LINE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize, true);
+ assert(numEdgesLine6 == numEdges);
+
+ static point_type lineCells[numNewCells*coneSizeLine6];
+ point_type newVertices[numNewVertices];
+ for(int iEdge=0, iNewVertex=0; iEdge < numEdgesLine6; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ throw ALE::Exception("Missing edge in refined mesh");
+ } // if
+ newVertices[iNewVertex++] = _edgeToVertex[edges[iEdge]];
+ } // for
+
+ // new cell 0
+ lineCells[0*6+0] = cone[0] + coneVertexOffsetNormal;
+ lineCells[0*6+1] = newVertices[0];
+ lineCells[0*6+2] = cone[2] + coneVertexOffsetNormal;
+ lineCells[0*6+3] = newVertices[1];
+ lineCells[0*6+4] = cone[4] + coneVertexOffsetCensored;
+ lineCells[0*6+5] = newVertices[2];
+
+ // new cell 1
+ lineCells[1*6+0] = newVertices[0];
+ lineCells[1*6+1] = cone[1] + coneVertexOffsetNormal;
+ lineCells[1*6+2] = newVertices[1];
+ lineCells[1*6+3] = cone[3] + coneVertexOffsetNormal;
+ lineCells[1*6+4] = newVertices[2];
+ lineCells[1*6+5] = cone[5] + coneVertexOffsetCensored;
+
+ *numCells = 2;
+ *cells = lineCells;
+} // _newCells_LINE_COHESIVE_LAGRANGE
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/CellRefinerQuad4.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerQuad4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,210 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/CellRefinerQuad4.hh
+ *
+ * @brief Object for quad4 refinement of cells.
+ */
+
+#if !defined(pylith_topology_cellrefinerquad4_hh)
+#define pylith_topology_cellrefinerquad4_hh
+
+// Include directives ---------------------------------------------------
+#include "RefineFace4Edges2.hh" // ISA RefineFace4Edges2
+
+// CellRefinerQuad4 ------------------------------------------------------
+/// Object for quad4 refinement of cells.
+class ALE::CellRefinerQuad4 : public RefineFace4Edges2
+{ // CellRefinerQuad4
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /** Constructor
+ *
+ * @param mesh Finite-element mesh.
+ */
+ CellRefinerQuad4(const mesh_type& mesh);
+
+ /// Destructor
+ ~CellRefinerQuad4(void);
+
+ /** Get number of refined cells for each original cell.
+ *
+ * @param cell Original cell.
+ *
+ * @returns Number of refined cells.
+ */
+ int numNewCells(const point_type cell);
+
+ /** Split cell into smaller cells of same type. Do not create
+ * censored vertices on censored cells.
+ *
+ * @param cell Original cell.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param curNewVertex Value for next new vertex.
+ */
+ void splitCell(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex);
+
+ /** Split cell into smaller cells of same type. Create only censored
+ * vertices on censored cells.
+ *
+ * @param cell Original cell.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param curNewVertex Value for next new vertex.
+ */
+ void splitCellUncensored(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex);
+
+ /** Get refined cells.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param orderOldMesh Order in old mesh.
+ * @param orderNewMesh Order in new mesh.
+ */
+ void getNewCells(const point_type** cells,
+ int* numCells,
+ const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ const MeshOrder& orderOldMesh,
+ const MeshOrder& orderNewMesh);
+
+// PRIVATE ENUMS ////////////////////////////////////////////////////////
+private :
+
+ enum CellEnum {
+ QUADRILATERAL, // Normal quadrilateral cell
+ LINE_COHESIVE_LAGRANGE, // Cohesive cell with Lagrange multiplier vertices
+ };
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /** Get cell type.
+ *
+ * @param cell Cell in original mesh.
+ * @returns Cell type.
+ */
+ CellEnum _cellType(const point_type cell);
+
+ /** Get edges of quadrilateral cell.
+ *
+ * @param edges Edges of cell.
+ * @param numEdges Number of edges.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ */
+ void _edges_QUADRILATERAL(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize);
+
+ /** Get edges of line cohesive cell with Lagrange multipler vertices.
+ *
+ * @param edges Edges of cell.
+ * @param numEdges Number of edges.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param uncensored True if including edges with censored vertices.
+ */
+ void _edges_LINE_COHESIVE_LAGRANGE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize,
+ const bool uncensored =false);
+
+ /** Get faces of quadrilateral cell.
+ *
+ * @param faces Faces of cell.
+ * @param numFaces Number of faces.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ */
+ void _faces_QUADRILATERAL(const FaceType** faces,
+ int* numFaces,
+ const point_type cone[],
+ const int coneSize);
+
+ /** Get faces of line cohesive cell with Lagrange multipler vertices.
+ *
+ * @param faces Faces of cell.
+ * @param numFaces Number of faces.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param uncensored True if including faces with censored vertices.
+ */
+ void _faces_LINE_COHESIVE_LAGRANGE(const FaceType** faces,
+ int* numFaces,
+ const point_type cone[],
+ const int coneSize,
+ const bool uncensored =false);
+
+ /** Get new cells from refinement of a quadrilateral cell.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param coneVertexOffset Offset for cone vertices.
+ */
+ void _newCells_QUADRILATERAL(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffset);
+
+ /** Get new cells from refinement of a line cohseive cell with
+ * Lagrange multiplier vertices.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param coneVertexOffsetNormal Offset for normal cone vertices.
+ * @param coneVertexOffset Offset for censored cone vertices.
+ */
+ void _newCells_LINE_COHESIVE_LAGRANGE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffsetNormal,
+ const int coneVertexOffsetCensored);
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ CellRefinerQuad4(const CellRefinerQuad4&); ///< Not implemented
+ const CellRefinerQuad4& operator=(const CellRefinerQuad4&); ///< Not implemented
+
+}; // CellRefinerQuad4
+
+#endif // pylith_topology_cellrefinerquad4_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/CellRefinerTet4.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,403 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "CellRefinerTet4.hh" // implementation of class methods
+
+#include "MeshOrder.hh" // USES MeshOrder
+
+#include <cassert> // USES assert()
+
+#include <iostream> // TEMPORARY
+// ----------------------------------------------------------------------
+// Constructor
+ALE::CellRefinerTet4::CellRefinerTet4(const mesh_type& mesh) :
+ RefineEdges2(mesh)
+{ // constructor
+ assert(3 == mesh.getDimension());
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+ALE::CellRefinerTet4::~CellRefinerTet4(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Get number of refined cells for each original cell.
+int
+ALE::CellRefinerTet4::numNewCells(const point_type cell)
+{ // numNewCells
+ switch (_cellType(cell)) {
+ case TETRAHEDRON:
+ return 8;
+ case TRIANGLE_COHESIVE_LAGRANGE:
+ return 4;
+ default:
+ assert(0);
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+} // numNewCells
+
+// ----------------------------------------------------------------------
+// Split cell into smaller cells of same type.
+void
+ALE::CellRefinerTet4::splitCell(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex)
+{ // splitCell
+ assert(curNewVertex);
+
+ int numEdges = 0;
+ const EdgeType* edges;
+
+ switch (_cellType(cell)) {
+ case TETRAHEDRON:
+ _edges_TETRAHEDRON(&edges, &numEdges, cone, coneSize);
+ break;
+ case TRIANGLE_COHESIVE_LAGRANGE:
+ _edges_TRIANGLE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize);
+ break;
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+
+ for(int iEdge=0; iEdge < numEdges; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ // if vertex does not exist
+ std::cout << "Edge: " << edges[iEdge] << ", new vertex: " << *curNewVertex << std::endl;
+ _edgeToVertex[edges[iEdge]] = *curNewVertex;
+ ++(*curNewVertex);
+ } // if
+ } // for
+} // splitCell
+
+// ----------------------------------------------------------------------
+// Split cell into smaller cells of same type.
+void
+ALE::CellRefinerTet4::splitCellUncensored(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex)
+{ // splitCellUncensored
+ assert(curNewVertex);
+
+ int numEdges = 0;
+ const EdgeType* edges;
+
+ const bool uncensored = true;
+
+ switch (_cellType(cell)) {
+ case TETRAHEDRON:
+ // No censored vertices on normal cell.
+ break;
+ case TRIANGLE_COHESIVE_LAGRANGE:
+ _edges_TRIANGLE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize, uncensored);
+ break;
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+
+ for(int iEdge=0; iEdge < numEdges; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ // if vertex does not exist
+ std::cout << "Edge: " << edges[iEdge] << ", new vertex: " << *curNewVertex << std::endl;
+ _edgeToVertex[edges[iEdge]] = *curNewVertex;
+ ++(*curNewVertex);
+ } // if
+ } // for
+} // splitCellUncensored
+
+// ----------------------------------------------------------------------
+// Get refined cells.
+void
+ALE::CellRefinerTet4::getNewCells(const point_type** cells,
+ int* numCells,
+ const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ const MeshOrder& orderOldMesh,
+ const MeshOrder& orderNewMesh)
+{ // getNewCells
+ assert(cells);
+ assert(numCells);
+
+ switch (_cellType(cell)) {
+ case TETRAHEDRON: {
+ const int coneVertexOffset = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+ _newCells_TETRAHEDRON(cells, numCells, cone, coneSize, coneVertexOffset);
+ break;
+ } // TETRAHEDRON
+ case TRIANGLE_COHESIVE_LAGRANGE: {
+ const int coneVertexOffsetNormal = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+ const int coneVertexOffsetCensored = orderNewMesh.verticesCensored().min() - orderOldMesh.verticesCensored().min();
+ _newCells_TRIANGLE_COHESIVE_LAGRANGE(cells, numCells, cone, coneSize, coneVertexOffsetNormal, coneVertexOffsetCensored);
+ break;
+ } // TRIANGLE_COHESIVE_LAGRANGE
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+} // getNewCells
+
+// ----------------------------------------------------------------------
+// Get cell type.
+ALE::CellRefinerTet4::CellEnum
+ALE::CellRefinerTet4::_cellType(const point_type cell)
+{ // _cellType
+ assert(!_mesh.getSieve().isNull());
+
+ switch (_mesh.getSieve()->getConeSize(cell)) {
+ case 4:
+ return TETRAHEDRON;
+ case 9:
+ return TRIANGLE_COHESIVE_LAGRANGE;
+ case 0: {
+ std::ostringstream msg;
+ std::cerr << "Internal error. Cone size for mesh point " << cell << " is zero. May be a vertex.";
+ assert(0);
+ throw ALE::Exception("Could not determine cell type during uniform global refinement.");
+ } // case 0
+ default : {
+ std::ostringstream msg;
+ std::cerr << "Internal error. Unknown cone size for mesh point " << cell << ". Unknown cell type.";
+ assert(0);
+ throw ALE::Exception("Could not determine cell type during uniform global refinement.");
+ } // default
+ } // switch
+} // _cellType
+
+// ----------------------------------------------------------------------
+// Get edges of triangular cell.
+void
+ALE::CellRefinerTet4::_edges_TETRAHEDRON(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize)
+{ // _edges_TETRAHEDRON
+ static EdgeType splitEdges[6];
+
+ assert(coneSize == 4);
+ splitEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ splitEdges[1] = EdgeType(std::min(cone[1], cone[2]), std::max(cone[1], cone[2]));
+ splitEdges[2] = EdgeType(std::min(cone[2], cone[0]), std::max(cone[2], cone[0]));
+ splitEdges[3] = EdgeType(std::min(cone[0], cone[3]), std::max(cone[0], cone[3]));
+ splitEdges[4] = EdgeType(std::min(cone[1], cone[3]), std::max(cone[1], cone[3]));
+ splitEdges[5] = EdgeType(std::min(cone[2], cone[3]), std::max(cone[2], cone[3]));
+ *numEdges = 6;
+ *edges = splitEdges;
+} // _edges_TETRAHEDRON
+
+// ----------------------------------------------------------------------
+// Get edges of line cohesive cell with Lagrange multipler vertices.
+void
+ALE::CellRefinerTet4::_edges_TRIANGLE_COHESIVE_LAGRANGE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize,
+ const bool uncensored)
+{ // _edges_TRIANGLE_COHESIVE_LAGRANGE
+ if (uncensored) {
+ // Use all vertices
+ static EdgeType splitEdges[9];
+
+ assert(coneSize == 9);
+ splitEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ splitEdges[1] = EdgeType(std::min(cone[1], cone[2]), std::max(cone[1], cone[2]));
+ splitEdges[2] = EdgeType(std::min(cone[2], cone[0]), std::max(cone[2], cone[0]));
+ splitEdges[3] = EdgeType(std::min(cone[3], cone[4]), std::max(cone[3], cone[4]));
+ splitEdges[4] = EdgeType(std::min(cone[4], cone[5]), std::max(cone[4], cone[5]));
+ splitEdges[5] = EdgeType(std::min(cone[5], cone[3]), std::max(cone[5], cone[3]));
+ splitEdges[6] = EdgeType(std::min(cone[6], cone[7]), std::max(cone[6], cone[7]));
+ splitEdges[7] = EdgeType(std::min(cone[7], cone[8]), std::max(cone[7], cone[8]));
+ splitEdges[8] = EdgeType(std::min(cone[8], cone[6]), std::max(cone[8], cone[6]));
+ *numEdges = 9;
+ *edges = splitEdges;
+ } else {
+ // Omit edges with censored (Lagrange multipler) vertices.
+ static EdgeType splitEdges[6];
+
+ assert(coneSize == 9);
+ splitEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ splitEdges[1] = EdgeType(std::min(cone[1], cone[2]), std::max(cone[1], cone[2]));
+ splitEdges[2] = EdgeType(std::min(cone[2], cone[0]), std::max(cone[2], cone[0]));
+ splitEdges[3] = EdgeType(std::min(cone[3], cone[4]), std::max(cone[3], cone[4]));
+ splitEdges[4] = EdgeType(std::min(cone[4], cone[5]), std::max(cone[4], cone[5]));
+ splitEdges[5] = EdgeType(std::min(cone[5], cone[3]), std::max(cone[5], cone[3]));
+ *numEdges = 6;
+ *edges = splitEdges;
+ } // if/else
+} // _edges_TRIANGLE_COHESIVE_LAGRANGE
+
+// ----------------------------------------------------------------------
+// Get new cells from refinement of a triangular cell.
+void
+ALE::CellRefinerTet4::_newCells_TETRAHEDRON(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffset)
+{ // _newCells_TETRAHEDRON
+ const int coneSizeTet4 = 4;
+ const int numEdgesTet4 = 6;
+ const int numNewCells = 8;
+ const int numNewVertices = 6;
+
+ int numEdges = 0;
+ const EdgeType *edges;
+ _edges_TETRAHEDRON(&edges, &numEdges, cone, coneSize);
+ assert(numEdgesTet4 == numEdges);
+
+ static point_type newCells[numNewCells*coneSizeTet4];
+ point_type newVertices[numNewVertices];
+ for(int iEdge=0, iNewVertex=0; iEdge < numEdgesTet4; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ throw ALE::Exception("Missing edge in refined mesh");
+ } // if
+ newVertices[iNewVertex++] = _edgeToVertex[edges[iEdge]];
+ } // for
+
+ // new cell 0
+ newCells[0*4+0] = cone[0]+coneVertexOffset;
+ newCells[0*4+1] = newVertices[3];
+ newCells[0*4+2] = newVertices[0];
+ newCells[0*4+3] = newVertices[2];
+
+ // new cell 1
+ newCells[1*4+0] = newVertices[0];
+ newCells[1*4+1] = newVertices[1];
+ newCells[1*4+2] = newVertices[2];
+ newCells[1*4+3] = newVertices[3];
+
+ // new cell 2
+ newCells[2*4+0] = newVertices[0];
+ newCells[2*4+1] = newVertices[3];
+ newCells[2*4+2] = newVertices[4];
+ newCells[2*4+3] = newVertices[1];
+
+ // new cell 3
+ newCells[3*4+0] = cone[1]+coneVertexOffset;
+ newCells[3*4+1] = newVertices[4];
+ newCells[3*4+2] = newVertices[1];
+ newCells[3*4+3] = newVertices[0];
+
+ // new cell 4
+ newCells[4*4+0] = newVertices[2];
+ newCells[4*4+1] = newVertices[5];
+ newCells[4*4+2] = newVertices[3];
+ newCells[4*4+3] = newVertices[1];
+
+ // new cell 5
+ newCells[5*4+0] = cone[2]+coneVertexOffset;
+ newCells[5*4+1] = newVertices[5];
+ newCells[5*4+2] = newVertices[2];
+ newCells[5*4+3] = newVertices[1];
+
+ // new cell 6
+ newCells[6*4+0] = newVertices[1];
+ newCells[6*4+1] = newVertices[4];
+ newCells[6*4+2] = newVertices[5];
+ newCells[6*4+3] = newVertices[3];
+
+ // new cell 7
+ newCells[7*4+0] = cone[3]+coneVertexOffset;
+ newCells[7*4+1] = newVertices[3];
+ newCells[7*4+2] = newVertices[5];
+ newCells[7*4+3] = newVertices[4];
+
+ *numCells = numNewCells;
+ *cells = newCells;
+} // _newCells_TETRAHEDRON
+
+// ----------------------------------------------------------------------
+// Get new cells from refinement of a line cohseive cell with Lagrange
+// multiplier vertices.
+void
+ALE::CellRefinerTet4::_newCells_TRIANGLE_COHESIVE_LAGRANGE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffsetNormal,
+ const int coneVertexOffsetCensored)
+{ // _newCells_TRIANGLE_COHESIVE_LAGRANGE
+ const int coneSizeTriPrism9 = 9;
+ const int numEdgesTriPrism9 = 9;
+ const int numNewCells = 4;
+ const int numNewVertices = 9;
+
+ int numEdges = 0;
+ const EdgeType *edges;
+ _edges_TRIANGLE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize, true);
+ assert(numEdgesTriPrism9 == numEdges);
+
+ static point_type newCells[numNewCells*coneSizeTriPrism9];
+ point_type newVertices[numNewVertices];
+ for(int iEdge=0, iNewVertex=0; iEdge < numEdgesTriPrism9; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ throw ALE::Exception("Missing edge in refined mesh");
+ } // if
+ newVertices[iNewVertex++] = _edgeToVertex[edges[iEdge]];
+ } // for
+
+ newCells[0*9+0] = cone[0]+coneVertexOffsetNormal; // New cell 0
+ newCells[0*9+1] = newVertices[0];
+ newCells[0*9+2] = newVertices[2];
+ newCells[0*9+3] = cone[3]+coneVertexOffsetNormal;
+ newCells[0*9+4] = newVertices[3];
+ newCells[0*9+5] = newVertices[5];
+ newCells[0*9+6] = cone[6]+coneVertexOffsetCensored;
+ newCells[0*9+7] = newVertices[6];
+ newCells[0*9+8] = newVertices[8];
+
+ newCells[1*9+0] = newVertices[0]; // New cell 1
+ newCells[1*9+1] = newVertices[1];
+ newCells[1*9+2] = newVertices[2];
+ newCells[1*9+3] = newVertices[3];
+ newCells[1*9+4] = newVertices[4];
+ newCells[1*9+5] = newVertices[5];
+ newCells[1*9+6] = newVertices[6];
+ newCells[1*9+7] = newVertices[7];
+ newCells[1*9+8] = newVertices[8];
+
+ newCells[2*9+0] = cone[1]+coneVertexOffsetNormal; // New cell 2
+ newCells[2*9+1] = newVertices[1];
+ newCells[2*9+2] = newVertices[0];
+ newCells[2*9+3] = cone[4]+coneVertexOffsetNormal;
+ newCells[2*9+4] = newVertices[4];
+ newCells[2*9+5] = newVertices[3];
+ newCells[2*9+6] = cone[7]+coneVertexOffsetCensored;
+ newCells[2*9+7] = newVertices[7];
+ newCells[2*9+8] = newVertices[6];
+
+ newCells[3*9+0] = cone[2]+coneVertexOffsetNormal; // New cell 3
+ newCells[3*9+1] = newVertices[2];
+ newCells[3*9+2] = newVertices[1];
+ newCells[3*9+3] = cone[5]+coneVertexOffsetNormal;
+ newCells[3*9+4] = newVertices[5];
+ newCells[3*9+5] = newVertices[4];
+ newCells[3*9+6] = cone[8]+coneVertexOffsetCensored;
+ newCells[3*9+7] = newVertices[8];
+ newCells[3*9+8] = newVertices[7];
+
+ *numCells = numNewCells;
+ *cells = newCells;
+} // _newCells_TRIANGLE_COHESIVE_LAGRANGE
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/CellRefinerTet4.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTet4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,184 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/CellRefinerTet4.hh
+ *
+ * @brief Object for tet4 refinement of cells.
+ */
+
+#if !defined(pylith_topology_cellrefinertet4_hh)
+#define pylith_topology_cellrefinertet4_hh
+
+// Include directives ---------------------------------------------------
+#include "RefineEdges2.hh" // ISA RefineEdges2
+
+// CellRefinerTet4 ------------------------------------------------------
+/// Object for tet4 refinement of cells.
+class ALE::CellRefinerTet4 : public RefineEdges2
+{ // CellRefinerTet4
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /** Constructor
+ *
+ * @param mesh Finite-element mesh.
+ */
+ CellRefinerTet4(const mesh_type& mesh);
+
+ /// Destructor
+ ~CellRefinerTet4(void);
+
+ /** Get number of refined cells for each original cell.
+ *
+ * @param cell Original cell.
+ *
+ * @returns Number of refined cells.
+ */
+ int numNewCells(const point_type cell);
+
+ /** Split cell into smaller cells of same type. Do not create
+ * censored vertices on censored cells.
+ *
+ * @param cell Original cell.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param curNewVertex Value for next new vertex.
+ */
+ void splitCell(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex);
+
+ /** Split cell into smaller cells of same type. Create only censored
+ * vertices on censored cells.
+ *
+ * @param cell Original cell.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param curNewVertex Value for next new vertex.
+ */
+ void splitCellUncensored(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex);
+
+ /** Get refined cells.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param orderOldMesh Order in old mesh.
+ * @param orderNewMesh Order in new mesh.
+ */
+ void getNewCells(const point_type** cells,
+ int* numCells,
+ const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ const MeshOrder& orderOldMesh,
+ const MeshOrder& orderNewMesh);
+
+// PRIVATE ENUMS ////////////////////////////////////////////////////////
+private :
+
+ enum CellEnum {
+ TETRAHEDRON, // Normal tetrahedral cell
+ TRIANGLE_COHESIVE_LAGRANGE, // Cohesive cell with Lagrange multiplier vertices
+ };
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /** Get cell type.
+ *
+ * @param cell Cell in original mesh.
+ * @returns Cell type.
+ */
+ CellEnum _cellType(const point_type cell);
+
+ /** Get edges of triangular cell.
+ *
+ * @param edges Edges of cell.
+ * @param numEdges Number of edges.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ */
+ void _edges_TETRAHEDRON(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize);
+
+ /** Get edges of line cohesive cell with Lagrange multipler vertices.
+ *
+ * @param edges Edges of cell.
+ * @param numEdges Number of edges.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param uncensored True if including edges with censored vertices.
+ */
+ void _edges_TRIANGLE_COHESIVE_LAGRANGE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize,
+ const bool uncensored =false);
+
+ /** Get new cells from refinement of a triangular cell.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param coneVertexOffset Offset for cone vertices.
+ */
+ void _newCells_TETRAHEDRON(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffset);
+
+ /** Get new cells from refinement of a line cohseive cell with
+ * Lagrange multiplier vertices.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param coneVertexOffsetNormal Offset for normal cone vertices.
+ * @param coneVertexOffset Offset for censored cone vertices.
+ */
+ void _newCells_TRIANGLE_COHESIVE_LAGRANGE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffsetNormal,
+ const int coneVertexOffsetCensored);
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ CellRefinerTet4(const CellRefinerTet4&); ///< Not implemented
+ const CellRefinerTet4& operator=(const CellRefinerTet4&); ///< Not implemented
+
+}; // CellRefinerTet4
+
+#endif // pylith_topology_cellrefinertet4_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/CellRefinerTri3.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,338 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "CellRefinerTri3.hh" // implementation of class methods
+
+#include "MeshOrder.hh" // USES MeshOrder
+
+#include <cassert> // USES assert()
+
+#include <iostream> // TEMPORARY
+// ----------------------------------------------------------------------
+// Constructor
+ALE::CellRefinerTri3::CellRefinerTri3(const mesh_type& mesh) :
+ RefineEdges2(mesh)
+{ // constructor
+ assert(2 == mesh.getDimension());
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+ALE::CellRefinerTri3::~CellRefinerTri3(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Get number of refined cells for each original cell.
+int
+ALE::CellRefinerTri3::numNewCells(const point_type cell)
+{ // numNewCells
+ switch (_cellType(cell)) {
+ case TRIANGLE:
+ return 4;
+ case LINE_COHESIVE_LAGRANGE:
+ return 2;
+ default:
+ assert(0);
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+} // numNewCells
+
+// ----------------------------------------------------------------------
+// Split cell into smaller cells of same type.
+void
+ALE::CellRefinerTri3::splitCell(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex)
+{ // splitCell
+ assert(curNewVertex);
+
+ int numEdges = 0;
+ const EdgeType* edges;
+
+ switch (_cellType(cell)) {
+ case TRIANGLE:
+ _edges_TRIANGLE(&edges, &numEdges, cone, coneSize);
+ break;
+ case LINE_COHESIVE_LAGRANGE:
+ _edges_LINE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize);
+ break;
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+
+ for(int iEdge=0; iEdge < numEdges; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ // if vertex does not exist
+ std::cout << "Edge: " << edges[iEdge] << ", new vertex: " << *curNewVertex << std::endl;
+ _edgeToVertex[edges[iEdge]] = *curNewVertex;
+ ++(*curNewVertex);
+ } // if
+ } // for
+} // splitCell
+
+// ----------------------------------------------------------------------
+// Split cell into smaller cells of same type.
+void
+ALE::CellRefinerTri3::splitCellUncensored(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex)
+{ // splitCellUncensored
+ assert(curNewVertex);
+
+ int numEdges = 0;
+ const EdgeType* edges;
+
+ const bool uncensored = true;
+
+ switch (_cellType(cell)) {
+ case TRIANGLE:
+ // No censored vertices on normal cell.
+ break;
+ case LINE_COHESIVE_LAGRANGE:
+ _edges_LINE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize, uncensored);
+ break;
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+
+ for(int iEdge=0; iEdge < numEdges; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ // if vertex does not exist
+ std::cout << "Edge: " << edges[iEdge] << ", new vertex: " << *curNewVertex << std::endl;
+ _edgeToVertex[edges[iEdge]] = *curNewVertex;
+ ++(*curNewVertex);
+ } // if
+ } // for
+} // splitCellUncensored
+
+// ----------------------------------------------------------------------
+// Get refined cells.
+void
+ALE::CellRefinerTri3::getNewCells(const point_type** cells,
+ int* numCells,
+ const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ const MeshOrder& orderOldMesh,
+ const MeshOrder& orderNewMesh)
+{ // getNewCells
+ assert(cells);
+ assert(numCells);
+
+ switch (_cellType(cell)) {
+ case TRIANGLE: {
+ const int coneVertexOffset = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+ _newCells_TRIANGLE(cells, numCells, cone, coneSize, coneVertexOffset);
+ break;
+ } // TRIANGLE
+ case LINE_COHESIVE_LAGRANGE: {
+ const int coneVertexOffsetNormal = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+ const int coneVertexOffsetCensored = orderNewMesh.verticesCensored().min() - orderOldMesh.verticesCensored().min();
+ _newCells_LINE_COHESIVE_LAGRANGE(cells, numCells, cone, coneSize, coneVertexOffsetNormal, coneVertexOffsetCensored);
+ break;
+ } // LINE_COHESIVE_LAGRANGE
+ default:
+ throw ALE::Exception("Unknown cell type.");
+ } // switch
+} // getNewCells
+
+// ----------------------------------------------------------------------
+// Get cell type.
+ALE::CellRefinerTri3::CellEnum
+ALE::CellRefinerTri3::_cellType(const point_type cell)
+{ // _cellType
+ assert(!_mesh.getSieve().isNull());
+
+ switch (_mesh.getSieve()->getConeSize(cell)) {
+ case 3:
+ return TRIANGLE;
+ case 6:
+ return LINE_COHESIVE_LAGRANGE;
+ case 0: {
+ std::ostringstream msg;
+ std::cerr << "Internal error. Cone size for mesh point " << cell << " is zero. May be a vertex.";
+ assert(0);
+ throw ALE::Exception("Could not determine cell type during uniform global refinement.");
+ } // case 0
+ default : {
+ std::ostringstream msg;
+ std::cerr << "Internal error. Unknown cone size for mesh point " << cell << ". Unknown cell type.";
+ assert(0);
+ throw ALE::Exception("Could not determine cell type during uniform global refinement.");
+ } // default
+ } // switch
+} // _cellType
+
+// ----------------------------------------------------------------------
+// Get edges of triangular cell.
+void
+ALE::CellRefinerTri3::_edges_TRIANGLE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize)
+{ // _edges_TRIANGLE
+ static EdgeType triEdges[3];
+
+ assert(coneSize == 3);
+ triEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ triEdges[1] = EdgeType(std::min(cone[1], cone[2]), std::max(cone[1], cone[2]));
+ triEdges[2] = EdgeType(std::min(cone[2], cone[0]), std::max(cone[2], cone[0]));
+ *numEdges = 3;
+ *edges = triEdges;
+} // _edges_TRIANGLE
+
+// ----------------------------------------------------------------------
+// Get edges of line cohesive cell with Lagrange multipler vertices.
+void
+ALE::CellRefinerTri3::_edges_LINE_COHESIVE_LAGRANGE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize,
+ const bool uncensored)
+{ // _edges_LINE_COHESIVE_LAGRANGE
+ if (uncensored) {
+ // Include all edges
+ static EdgeType lineEdges[3];
+
+ assert(coneSize == 6);
+ lineEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ lineEdges[1] = EdgeType(std::min(cone[2], cone[3]), std::max(cone[2], cone[3]));
+ lineEdges[2] = EdgeType(std::min(cone[4], cone[5]), std::max(cone[4], cone[5]));
+ *numEdges = 3;
+ *edges = lineEdges;
+ } else {
+ // Omit edges with censored (Lagrange multiplier) vertices.
+ static EdgeType lineEdges[2];
+
+ assert(coneSize == 6);
+ lineEdges[0] = EdgeType(std::min(cone[0], cone[1]), std::max(cone[0], cone[1]));
+ lineEdges[1] = EdgeType(std::min(cone[2], cone[3]), std::max(cone[2], cone[3]));
+ *numEdges = 2;
+ *edges = lineEdges;
+ } // if/else
+} // _edges_LINE_COHESIVE_LAGRANGE
+
+// ----------------------------------------------------------------------
+// Get new cells from refinement of a triangular cell.
+void
+ALE::CellRefinerTri3::_newCells_TRIANGLE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffset)
+{ // _newCells_TRIANGLE
+ const int coneSizeTri3 = 3;
+ const int numEdgesTri3 = 3;
+ const int numNewCells = 4;
+ const int numNewVertices = 3;
+
+ int numEdges = 0;
+ const EdgeType *edges;
+ _edges_TRIANGLE(&edges, &numEdges, cone, coneSize);
+ assert(numEdgesTri3 == numEdges);
+
+ static point_type triCells[numNewCells*coneSizeTri3];
+ point_type newVertices[numNewVertices];
+ for(int iEdge=0, iNewVertex=0; iEdge < numEdgesTri3; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ throw ALE::Exception("Missing edge in refined mesh");
+ } // if
+ newVertices[iNewVertex++] = _edgeToVertex[edges[iEdge]];
+ } // for
+
+ // new cell 0
+ triCells[0*3+0] = cone[0] + coneVertexOffset;
+ triCells[0*3+1] = newVertices[0];
+ triCells[0*3+2] = newVertices[2];
+
+ // new cell 1
+ triCells[1*3+0] = newVertices[0];
+ triCells[1*3+1] = newVertices[1];
+ triCells[1*3+2] = newVertices[2];
+
+ // new cell 2
+ triCells[2*3+0] = cone[1] + coneVertexOffset;
+ triCells[2*3+1] = newVertices[1];
+ triCells[2*3+2] = newVertices[0];
+
+ // new cell 3
+ triCells[3*3+0] = cone[2] + coneVertexOffset;
+ triCells[3*3+1] = newVertices[2];
+ triCells[3*3+2] = newVertices[1];
+
+ *numCells = numNewCells;
+ *cells = triCells;
+} // _newCells_TRIANGLE
+
+// ----------------------------------------------------------------------
+// Get new cells from refinement of a line cohseive cell with Lagrange
+// multiplier vertices.
+void
+ALE::CellRefinerTri3::_newCells_LINE_COHESIVE_LAGRANGE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffsetNormal,
+ const int coneVertexOffsetCensored)
+{ // _newCells_LINE_COHESIVE_LAGRANGE
+ const int coneSizeLine6 = 6;
+ const int numEdgesLine6 = 3;
+ const int numNewCells = 2;
+ const int numNewVertices = 3;
+
+ int numEdges = 0;
+ const EdgeType *edges;
+ _edges_LINE_COHESIVE_LAGRANGE(&edges, &numEdges, cone, coneSize, true);
+ assert(numEdgesLine6 == numEdges);
+
+ static point_type lineCells[numNewCells*coneSizeLine6];
+ point_type newVertices[numNewVertices];
+ for(int iEdge=0, iNewVertex=0; iEdge < numEdgesLine6; ++iEdge) {
+ if (_edgeToVertex.find(edges[iEdge]) == _edgeToVertex.end()) {
+ throw ALE::Exception("Missing edge in refined mesh");
+ } // if
+ newVertices[iNewVertex++] = _edgeToVertex[edges[iEdge]];
+ } // for
+
+ // new cell 0
+ lineCells[0*6+0] = cone[0] + coneVertexOffsetNormal;
+ lineCells[0*6+1] = newVertices[0];
+ lineCells[0*6+2] = cone[2] + coneVertexOffsetNormal;
+ lineCells[0*6+3] = newVertices[1];
+ lineCells[0*6+4] = cone[4] + coneVertexOffsetCensored;
+ lineCells[0*6+5] = newVertices[2];
+
+ // new cell 1
+ lineCells[1*6+0] = newVertices[0];
+ lineCells[1*6+1] = cone[1] + coneVertexOffsetNormal;
+ lineCells[1*6+2] = newVertices[1];
+ lineCells[1*6+3] = cone[3] + coneVertexOffsetNormal;
+ lineCells[1*6+4] = newVertices[2];
+ lineCells[1*6+5] = cone[5] + coneVertexOffsetCensored;
+
+ *numCells = 2;
+ *cells = lineCells;
+} // _newCells_LINE_COHESIVE_LAGRANGE
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/CellRefinerTri3.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/CellRefinerTri3.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,184 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/CellRefinerTri3.hh
+ *
+ * @brief Object for tri3 refinement of cells.
+ */
+
+#if !defined(pylith_topology_cellrefinertri3_hh)
+#define pylith_topology_cellrefinertri3_hh
+
+// Include directives ---------------------------------------------------
+#include "RefineEdges2.hh" // ISA RefineEdges2
+
+// CellRefinerTri3 ------------------------------------------------------
+/// Object for tri3 refinement of cells.
+class ALE::CellRefinerTri3 : public RefineEdges2
+{ // CellRefinerTri3
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /** Constructor
+ *
+ * @param mesh Finite-element mesh.
+ */
+ CellRefinerTri3(const mesh_type& mesh);
+
+ /// Destructor
+ ~CellRefinerTri3(void);
+
+ /** Get number of refined cells for each original cell.
+ *
+ * @param cell Original cell.
+ *
+ * @returns Number of refined cells.
+ */
+ int numNewCells(const point_type cell);
+
+ /** Split cell into smaller cells of same type. Do not create
+ * censored vertices on censored cells.
+ *
+ * @param cell Original cell.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param curNewVertex Value for next new vertex.
+ */
+ void splitCell(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex);
+
+ /** Split cell into smaller cells of same type. Create only censored
+ * vertices on censored cells.
+ *
+ * @param cell Original cell.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param curNewVertex Value for next new vertex.
+ */
+ void splitCellUncensored(const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ point_type* curNewVertex);
+
+ /** Get refined cells.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param orderOldMesh Order in old mesh.
+ * @param orderNewMesh Order in new mesh.
+ */
+ void getNewCells(const point_type** cells,
+ int* numCells,
+ const point_type cell,
+ const point_type cone[],
+ const int coneSize,
+ const MeshOrder& orderOldMesh,
+ const MeshOrder& orderNewMesh);
+
+// PRIVATE ENUMS ////////////////////////////////////////////////////////
+private :
+
+ enum CellEnum {
+ TRIANGLE, // Normal triangular cell
+ LINE_COHESIVE_LAGRANGE, // Cohesive cell with Lagrange multiplier vertices
+ };
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /** Get cell type.
+ *
+ * @param cell Cell in original mesh.
+ * @returns Cell type.
+ */
+ CellEnum _cellType(const point_type cell);
+
+ /** Get edges of triangular cell.
+ *
+ * @param edges Edges of cell.
+ * @param numEdges Number of edges.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ */
+ void _edges_TRIANGLE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize);
+
+ /** Get edges of line cohesive cell with Lagrange multipler vertices.
+ *
+ * @param edges Edges of cell.
+ * @param numEdges Number of edges.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param uncensored True if including edges with censored vertices.
+ */
+ void _edges_LINE_COHESIVE_LAGRANGE(const EdgeType** edges,
+ int* numEdges,
+ const point_type cone[],
+ const int coneSize,
+ const bool uncensored =false);
+
+ /** Get new cells from refinement of a triangular cell.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param coneVertexOffset Offset for cone vertices.
+ */
+ void _newCells_TRIANGLE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffset);
+
+ /** Get new cells from refinement of a line cohseive cell with
+ * Lagrange multiplier vertices.
+ *
+ * @param cells Vertices in refined cells (refined mesh).
+ * @param numCells Number of refined cells.
+ * @param cone Vertices in cell (original mesh).
+ * @param coneSize Number of vertices in cell.
+ * @param coneVertexOffsetNormal Offset for normal cone vertices.
+ * @param coneVertexOffset Offset for censored cone vertices.
+ */
+ void _newCells_LINE_COHESIVE_LAGRANGE(const point_type** cells,
+ int *numCells,
+ const point_type cone[],
+ const int coneSize,
+ const int coneVertexOffsetNormal,
+ const int coneVertexOffsetCensored);
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ CellRefinerTri3(const CellRefinerTri3&); ///< Not implemented
+ const CellRefinerTri3& operator=(const CellRefinerTri3&); ///< Not implemented
+
+}; // CellRefinerTri3
+
+#endif // pylith_topology_cellrefinertri3_hh
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -32,32 +32,48 @@
// ----------------------------------------------------------------------
// Default constructor.
-template<typename mesh_type>
-pylith::topology::Field<mesh_type>::Field(const mesh_type& mesh) :
- _scale(1.0),
- _label("unknown"),
+template<typename mesh_type, typename section_type>
+pylith::topology::Field<mesh_type, section_type>::Field(const mesh_type& mesh) :
_mesh(mesh),
_vector(0),
_scatter(0),
- _scatterVec(0),
- _vecFieldType(OTHER),
- _dimensionsOkay(false)
+ _scatterVec(0)
{ // constructor
+ _metadata.label = "unknown";
+ _metadata.vectorFieldType = OTHER;
+ _metadata.scale = 1.0;
+ _metadata.dimsOkay = false;
} // constructor
// ----------------------------------------------------------------------
+// Constructor with mesh, section, and metadata.
+template<typename mesh_type, typename section_type>
+pylith::topology::Field<mesh_type, section_type>::Field(const mesh_type& mesh,
+ const ALE::Obj<section_type>& section,
+ const Metadata& metadata) :
+ _metadata(metadata),
+ _mesh(mesh),
+ _section(section),
+ _vector(0),
+ _scatter(0),
+ _scatterVec(0)
+{ // constructor
+ assert(!section.isNull());
+} // constructor
+
+// ----------------------------------------------------------------------
// Destructor.
-template<typename mesh_type>
-pylith::topology::Field<mesh_type>::~Field(void)
+template<typename mesh_type, typename section_type>
+pylith::topology::Field<mesh_type, section_type>::~Field(void)
{ // destructor
deallocate();
} // destructor
// ----------------------------------------------------------------------
// Deallocate PETSc and local data structures.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::deallocate(void)
+pylith::topology::Field<mesh_type, section_type>::deallocate(void)
{ // deallocate
PetscErrorCode err = 0;
if (0 != _vector) {
@@ -78,9 +94,9 @@
// ----------------------------------------------------------------------
// Get spatial dimension of domain.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
int
-pylith::topology::Field<mesh_type>::spaceDim(void) const
+pylith::topology::Field<mesh_type, section_type>::spaceDim(void) const
{ // spaceDim
const spatialdata::geocoords::CoordSys* cs = _mesh.coordsys();
return (0 != cs) ? cs->spaceDim() : 0;
@@ -88,57 +104,61 @@
// ----------------------------------------------------------------------
// Get the chart size.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
int
-pylith::topology::Field<mesh_type>::chartSize(void) const
+pylith::topology::Field<mesh_type, section_type>::chartSize(void) const
{ // chartSize
return _section.isNull() ? 0 : _section->getChart().size();
} // chartSize
// ----------------------------------------------------------------------
// Get the number of degrees of freedom.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
int
-pylith::topology::Field<mesh_type>::sectionSize(void) const
+pylith::topology::Field<mesh_type, section_type>::sectionSize(void) const
{ // sectionSize
return _section.isNull() ? 0 : _section->size();
} // sectionSize
// ----------------------------------------------------------------------
// Create seive section.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::newSection(void)
+pylith::topology::Field<mesh_type, section_type>::newSection(void)
{ // newSection
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- //std::cout << "Making Field " << _label << " empty section" << std::endl;
logger.stagePush("Field");
- _section = new RealSection(_mesh.comm(), _mesh.debug());
+
+ _section = new section_type(_mesh.comm(), _mesh.debug());
+ assert(!_section.isNull());
+ _section->setName(_metadata.label);
+
logger.stagePop();
} // newSection
// ----------------------------------------------------------------------
// Create sieve section and set chart and fiber dimesion for a
// sequence of points.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::newSection(
+pylith::topology::Field<mesh_type, section_type>::newSection(
const ALE::Obj<label_sequence>& points,
const int fiberDim)
{ // newSection
typedef typename mesh_type::SieveMesh::point_type point_type;
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- //std::cout << "Making Field " << _label << " section type 1" << std::endl;
logger.stagePush("Field");
if (fiberDim < 0) {
std::ostringstream msg;
- msg << "Fiber dimension (" << fiberDim << ") for field '" << _label
+ msg << "Fiber dimension (" << fiberDim << ") for field '" << _metadata.label
<< "' must be nonnegative.";
throw std::runtime_error(msg.str());
} // if
- _section = new RealSection(_mesh.comm(), _mesh.debug());
+ _section = new section_type(_mesh.comm(), _mesh.debug());
+ assert(!_section.isNull());
+ _section->setName(_metadata.label);
if (points->size() > 0) {
const point_type pointMin =
@@ -156,24 +176,25 @@
// ----------------------------------------------------------------------
// Create sieve section and set chart and fiber dimesion for a list of
// points.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::newSection(const int_array& points,
+pylith::topology::Field<mesh_type, section_type>::newSection(const int_array& points,
const int fiberDim)
{ // newSection
typedef typename mesh_type::SieveMesh::point_type point_type;
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- //std::cout << "Making Field " << _label << " section type 1b" << std::endl;
logger.stagePush("Field");
if (fiberDim < 0) {
std::ostringstream msg;
- msg << "Fiber dimension (" << fiberDim << ") for field '" << _label
+ msg << "Fiber dimension (" << fiberDim << ") for field '" << _metadata.label
<< "' must be nonnegative.";
throw std::runtime_error(msg.str());
} // if
- _section = new RealSection(_mesh.comm(), _mesh.debug());
+ _section = new section_type(_mesh.comm(), _mesh.debug());
+ assert(!_section.isNull());
+ _section->setName(_metadata.label);
const int npts = points.size();
if (npts > 0) {
@@ -190,9 +211,9 @@
// ----------------------------------------------------------------------
// Create sieve section and set chart and fiber dimesion.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::newSection(const DomainEnum domain,
+pylith::topology::Field<mesh_type, section_type>::newSection(const DomainEnum domain,
const int fiberDim,
const int stratum)
{ // newSection
@@ -215,14 +236,14 @@
// ----------------------------------------------------------------------
// Create section given chart.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::newSection(const Field& src,
+pylith::topology::Field<mesh_type, section_type>::newSection(const Field& src,
const int fiberDim)
{ // newSection
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- //std::cout << "Making Field " << _label << " section type 2" << std::endl;
logger.stagePush("Field");
+
if (_section.isNull()) {
logger.stagePop();
newSection();
@@ -230,12 +251,12 @@
} // if
if (fiberDim < 0) {
std::ostringstream msg;
- msg << "Fiber dimension (" << fiberDim << ") for field '" << _label
+ msg << "Fiber dimension (" << fiberDim << ") for field '" << _metadata.label
<< "' must be nonnegative.";
throw std::runtime_error(msg.str());
} // if
- const ALE::Obj<RealSection>& srcSection = src.section();
+ const ALE::Obj<section_type>& srcSection = src.section();
if (!srcSection.isNull()) {
_section->setChart(srcSection->getChart());
const chart_type& chart = _section->getChart();
@@ -249,26 +270,24 @@
_section->setFiberDimension(*c_iter, fiberDim);
} // if
- //std::cout << "Done making Field " << _label << " section type 2" << std::endl;
logger.stagePop();
} // newSection
// ----------------------------------------------------------------------
// Create section with same layout as another section.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::cloneSection(const Field& src)
+pylith::topology::Field<mesh_type, section_type>::cloneSection(const Field& src)
{ // cloneSection
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- //std::cout << "Making Field " << _label << " section type 3" << std::endl;
logger.stagePush("Field");
deallocate();
- _vecFieldType = src._vecFieldType;
- _scale = src._scale;
- _dimensionsOkay = false;
+ std::string origLabel = _metadata.label;
+ _metadata = src._metadata;
+ label(origLabel.c_str());
- const ALE::Obj<RealSection>& srcSection = src.section();
+ const ALE::Obj<section_type>& srcSection = src.section();
if (!srcSection.isNull() && _section.isNull()) {
logger.stagePop();
newSection();
@@ -300,9 +319,9 @@
// ----------------------------------------------------------------------
// Clear variables associated with section.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::clear(void)
+pylith::topology::Field<mesh_type, section_type>::clear(void)
{ // clear
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("Field");
@@ -311,18 +330,18 @@
if (!_section.isNull())
_section->clear();
- _scale = 1.0;
- _vecFieldType = OTHER;
- _dimensionsOkay = false;
+ _metadata.scale = 1.0;
+ _metadata.vectorFieldType = OTHER;
+ _metadata.dimsOkay = false;
logger.stagePop();
} // clear
// ----------------------------------------------------------------------
// Allocate Sieve section.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::allocate(void)
+pylith::topology::Field<mesh_type, section_type>::allocate(void)
{ // allocate
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("Field");
@@ -338,9 +357,9 @@
// ----------------------------------------------------------------------
// Zero section values (excluding constrained DOF).
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::zero(void)
+pylith::topology::Field<mesh_type, section_type>::zero(void)
{ // zero
if (!_section.isNull())
_section->zero(); // Does not zero BC.
@@ -348,9 +367,9 @@
// ----------------------------------------------------------------------
// Zero section values (including constrained DOF).
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::zeroAll(void)
+pylith::topology::Field<mesh_type, section_type>::zeroAll(void)
{ // zeroAll
if (!_section.isNull()) {
const chart_type& chart = _section->getChart();
@@ -376,9 +395,9 @@
// ----------------------------------------------------------------------
// Complete section by assembling across processors.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::complete(void)
+pylith::topology::Field<mesh_type, section_type>::complete(void)
{ // complete
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("Completion");
@@ -396,29 +415,30 @@
// ----------------------------------------------------------------------
// Copy field values and metadata.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::copy(const Field& field)
+pylith::topology::Field<mesh_type, section_type>::copy(const Field& field)
{ // copy
// Check compatibility of sections
const int srcSize = field.chartSize();
const int dstSize = chartSize();
if (field.spaceDim() != spaceDim() ||
- field._vecFieldType != _vecFieldType ||
+ field._metadata.vectorFieldType != _metadata.vectorFieldType ||
srcSize != dstSize) {
std::ostringstream msg;
- msg << "Cannot copy values from section '" << field._label
- << "' to section '" << _label << "'. Sections are incompatible.\n"
+ msg << "Cannot copy values from section '" << field._metadata.label
+ << "' to section '" << _metadata.label
+ << "'. Sections are incompatible.\n"
<< " Source section:\n"
<< " space dim: " << field.spaceDim() << "\n"
- << " vector field type: " << field._vecFieldType << "\n"
- << " scale: " << field._scale << "\n"
+ << " vector field type: " << field._metadata.vectorFieldType << "\n"
+ << " scale: " << field._metadata.scale << "\n"
<< " size: " << srcSize << "\n"
<< " Destination section:\n"
<< " space dim: " << spaceDim() << "\n"
- << " vector field type: " << _vecFieldType << "\n"
- << " scale: " << _scale << "\n"
+ << " vector field type: " << _metadata.vectorFieldType << "\n"
+ << " scale: " << _metadata.scale << "\n"
<< " size: " << dstSize;
throw std::runtime_error(msg.str());
} // if
@@ -440,15 +460,15 @@
} // for
} // if
- _label = field._label;
- _scale = field._scale;
+ label(field._metadata.label.c_str()); // Update label
+ _metadata.scale = field._metadata.scale;
} // copy
// ----------------------------------------------------------------------
// Copy field values.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::copy(const ALE::Obj<typename mesh_type::RealSection>& osection)
+pylith::topology::Field<mesh_type, section_type>::copy(const ALE::Obj<section_type>& osection)
{ // copy
// Check compatibility of sections
const int srcSize = osection->getChart().size();
@@ -457,13 +477,13 @@
std::ostringstream msg;
msg << "Cannot copy values from Sieve section "
- << _label << "'. Sections are incompatible.\n"
+ << _metadata.label << "'. Sections are incompatible.\n"
<< " Source section:\n"
<< " size: " << srcSize << "\n"
<< " Destination section:\n"
<< " space dim: " << spaceDim() << "\n"
- << " vector field type: " << _vecFieldType << "\n"
- << " scale: " << _scale << "\n"
+ << " vector field type: " << _metadata.vectorFieldType << "\n"
+ << " scale: " << _metadata.scale << "\n"
<< " size: " << dstSize;
throw std::runtime_error(msg.str());
} // if
@@ -487,30 +507,31 @@
// ----------------------------------------------------------------------
// Add two fields, storing the result in one of the fields.
-template<typename mesh_type>
-pylith::topology::Field<mesh_type>&
-pylith::topology::Field<mesh_type>::operator+=(const Field& field)
+template<typename mesh_type, typename section_type>
+pylith::topology::Field<mesh_type, section_type>&
+pylith::topology::Field<mesh_type, section_type>::operator+=(const Field& field)
{ // operator+=
// Check compatibility of sections
const int srcSize = field.chartSize();
const int dstSize = chartSize();
if (field.spaceDim() != spaceDim() ||
- field._vecFieldType != _vecFieldType ||
- field._scale != _scale ||
+ field._metadata.vectorFieldType != _metadata.vectorFieldType ||
+ field._metadata.scale != _metadata.scale ||
srcSize != dstSize) {
std::ostringstream msg;
- msg << "Cannot add values from section '" << field._label
- << "' to section '" << _label << "'. Sections are incompatible.\n"
+ msg << "Cannot add values from section '" << field._metadata.label
+ << "' to section '" << _metadata.label
+ << "'. Sections are incompatible.\n"
<< " Source section:\n"
<< " space dim: " << field.spaceDim() << "\n"
- << " vector field type: " << field._vecFieldType << "\n"
- << " scale: " << field._scale << "\n"
+ << " vector field type: " << field._metadata.vectorFieldType << "\n"
+ << " scale: " << field._metadata.scale << "\n"
<< " size: " << srcSize << "\n"
<< " Destination section:\n"
<< " space dim: " << spaceDim() << "\n"
- << " vector field type: " << _vecFieldType << "\n"
- << " scale: " << _scale << "\n"
+ << " vector field type: " << _metadata.vectorFieldType << "\n"
+ << " scale: " << _metadata.scale << "\n"
<< " size: " << dstSize;
throw std::runtime_error(msg.str());
} // if
@@ -545,13 +566,14 @@
// ----------------------------------------------------------------------
// Dimensionalize field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::dimensionalize(void) const
+pylith::topology::Field<mesh_type, section_type>::dimensionalize(void) const
{ // dimensionalize
- if (!_dimensionsOkay) {
+ if (!_metadata.dimsOkay) {
std::ostringstream msg;
- msg << "Cannot dimensionalize field '" << _label << "' because the flag "
+ msg << "Cannot dimensionalize field '" << _metadata.label
+ << "' because the flag "
<< "has been set to keep field nondimensional.";
throw std::runtime_error(msg.str());
} // if
@@ -574,7 +596,7 @@
assert(fiberDim == _section->getFiberDimension(*c_iter));
_section->restrictPoint(*c_iter, &values[0], values.size());
- normalizer.dimensionalize(&values[0], values.size(), _scale);
+ normalizer.dimensionalize(&values[0], values.size(), _metadata.scale);
_section->updatePointAll(*c_iter, &values[0]);
} // if
} // if
@@ -582,12 +604,12 @@
// ----------------------------------------------------------------------
// Print field to standard out.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::view(const char* label) const
+pylith::topology::Field<mesh_type, section_type>::view(const char* label) const
{ // view
std::string vecFieldString;
- switch(_vecFieldType)
+ switch(_metadata.vectorFieldType)
{ // switch
case SCALAR:
vecFieldString = "scalar";
@@ -614,25 +636,25 @@
vecFieldString = "multiple other values";
break;
default :
- std::cerr << "Unknown vector field value '" << _vecFieldType
+ std::cerr << "Unknown vector field value '" << _metadata.vectorFieldType
<< "'." << std::endl;
assert(0);
throw std::logic_error("Bad vector field type in Field.");
} // switch
- std::cout << "Viewing field '" << _label << "' "<< label << ".\n"
+ std::cout << "Viewing field '" << _metadata.label << "' "<< label << ".\n"
<< " vector field type: " << vecFieldString << "\n"
- << " scale: " << _scale << "\n"
- << " dimensionalize flag: " << _dimensionsOkay << std::endl;
+ << " scale: " << _metadata.scale << "\n"
+ << " dimensionalize flag: " << _metadata.dimsOkay << std::endl;
if (!_section.isNull())
_section->view(label);
} // view
// ----------------------------------------------------------------------
// Create PETSc vector for field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::createVector(void)
+pylith::topology::Field<mesh_type, section_type>::createVector(void)
{ // createVector
PetscErrorCode err = 0;
@@ -652,6 +674,8 @@
err = VecCreate(_mesh.comm(), &_vector);
CHECK_PETSC_ERROR(err);
+ err = PetscObjectSetName((PetscObject)_vector, _metadata.label.c_str());
+ CHECK_PETSC_ERROR(err);
err = VecSetSizes(_vector, order->getLocalSize(), order->getGlobalSize());
CHECK_PETSC_ERROR(err);
@@ -664,9 +688,9 @@
// Create PETSc vector scatter for field. This is used to transfer
// information from the "global" PETSc vector view to the "local"
// Sieve section view.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::createScatter(void)
+pylith::topology::Field<mesh_type, section_type>::createScatter(void)
{ // createScatter
assert(!_section.isNull());
assert(!_mesh.sieveMesh().isNull());
@@ -684,6 +708,7 @@
CHECK_PETSC_ERROR(err);
} // if
assert(_section->sizeWithBC() > 0);
+ assert(_section->restrictSpace());
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
_section->sizeWithBC(), _section->restrictSpace(),
&_scatterVec); CHECK_PETSC_ERROR(err);
@@ -692,9 +717,9 @@
// ----------------------------------------------------------------------
// Scatter section information across processors to update the
// PETSc vector view of the field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::scatterSectionToVector(void) const
+pylith::topology::Field<mesh_type, section_type>::scatterSectionToVector(void) const
{ // scatterSectionToVector
scatterSectionToVector(_vector);
} // scatterSectionToVector
@@ -702,9 +727,9 @@
// ----------------------------------------------------------------------
// Scatter section information across processors to update the
// PETSc vector view of the field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::scatterSectionToVector(const PetscVec vector) const
+pylith::topology::Field<mesh_type, section_type>::scatterSectionToVector(const PetscVec vector) const
{ // scatterSectionToVector
assert(!_section.isNull());
assert(0 != _scatter);
@@ -721,9 +746,9 @@
// ----------------------------------------------------------------------
// Scatter PETSc vector information across processors to update the
// section view of the field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::scatterVectorToSection(void) const
+pylith::topology::Field<mesh_type, section_type>::scatterVectorToSection(void) const
{ // scatterVectorToSection
scatterVectorToSection(_vector);
} // scatterVectorToSection
@@ -731,9 +756,9 @@
// ----------------------------------------------------------------------
// Scatter PETSc vector information across processors to update the
// section view of the field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::scatterVectorToSection(const PetscVec vector) const
+pylith::topology::Field<mesh_type, section_type>::scatterVectorToSection(const PetscVec vector) const
{ // scatterVectorToSection
assert(!_section.isNull());
assert(0 != _scatter);
@@ -749,9 +774,9 @@
// ----------------------------------------------------------------------
// Setup split field with all one space per spatial dimension.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
void
-pylith::topology::Field<mesh_type>::splitDefault(void)
+pylith::topology::Field<mesh_type, section_type>::splitDefault(void)
{ // splitDefault
assert(!_section.isNull());
const int spaceDim = _mesh.dimension();
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -40,7 +40,8 @@
*
* Extends Sieve real general section by adding metadata.
*/
-template<typename mesh_type>
+template<typename mesh_type,
+ typename section_type>
class pylith::topology::Field : public FieldBase
{ // Field
friend class TestFieldMesh; // unit testing
@@ -52,14 +53,17 @@
// Convenience typedefs
typedef mesh_type Mesh;
+ typedef ALE::ISieveVisitor::RestrictVisitor<section_type> RestrictVisitor;
+ typedef ALE::ISieveVisitor::UpdateAddVisitor<section_type> UpdateAddVisitor;
+ typedef ALE::ISieveVisitor::UpdateAllVisitor<section_type> UpdateAllVisitor;
+
// PRIVATE TYPEDEFS /////////////////////////////////////////////////////
private:
// Convenience typedefs
- typedef typename mesh_type::RealSection RealSection;
typedef typename mesh_type::SieveMesh SieveMesh;
typedef typename SieveMesh::label_sequence label_sequence;
- typedef typename RealSection::chart_type chart_type;
+ typedef typename section_type::chart_type chart_type;
// PUBLIC MEMBERS ///////////////////////////////////////////////////////
public :
@@ -70,6 +74,14 @@
*/
Field(const mesh_type& mesh);
+ /** Constructor with mesh, section, and metadata.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ Field(const mesh_type& mesh,
+ const ALE::Obj<section_type>& section,
+ const Metadata& metadata);
+
/// Destructor.
~Field(void);
@@ -80,7 +92,7 @@
*
* @returns Sieve section.
*/
- const ALE::Obj<RealSection>& section(void) const;
+ const ALE::Obj<section_type>& section(void) const;
/** Get mesh associated with field.
*
@@ -227,7 +239,7 @@
*
* @param field Field to copy.
*/
- void copy(const ALE::Obj<typename mesh_type::RealSection>& field);
+ void copy(const ALE::Obj<section_type>& field);
/** Add two fields, storing the result in one of the fields.
*
@@ -294,15 +306,12 @@
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
- double _scale; ///< Dimensional scale associated with field.
- std::string _label; ///< Label for field.
+ Metadata _metadata;
const mesh_type& _mesh; ///< Mesh associated with section.
- ALE::Obj<RealSection> _section; ///< Real section with data.
+ ALE::Obj<section_type> _section; ///< Real section with data.
PetscVec _vector; ///< PETSc vector associated with field.
PetscVecScatter _scatter; ///< PETSc scatter associated with field.
PetscVec _scatterVec; ///< PETSC vector used in scattering.
- VectorFieldEnum _vecFieldType; ///< Type of vector field.
- bool _dimensionsOkay; ///< Flag indicating it is okay to dimensionalize.
// NOT IMPLEMENTED //////////////////////////////////////////////////////
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.icc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.icc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Field.icc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -20,100 +20,109 @@
#error "Field.icc must be included only from Field.hh"
#else
+#include "pylith/utils/petscerror.h" // USES CHECK_PETSC_ERROR
+
// Get Sieve section.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
-const ALE::Obj<typename mesh_type::RealSection>&
-pylith::topology::Field<mesh_type>::section(void) const {
+const ALE::Obj<section_type>&
+pylith::topology::Field<mesh_type, section_type>::section(void) const {
return _section;
}
// Get mesh associated with field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
const
mesh_type&
-pylith::topology::Field<mesh_type>::mesh(void) const {
+pylith::topology::Field<mesh_type, section_type>::mesh(void) const {
return _mesh;
}
// Set label for field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
void
-pylith::topology::Field<mesh_type>::label(const char* value) {
- _label = value;
+pylith::topology::Field<mesh_type, section_type>::label(const char* value) {
+ _metadata.label = value;
+ if (!_section.isNull()) {
+ _section->setName(value);
+ } // if
+ if (_vector) {
+ PetscErrorCode err = PetscObjectSetName((PetscObject)_vector, value);
+ CHECK_PETSC_ERROR(err);
+ } // if
}
// Get label for field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
const char*
-pylith::topology::Field<mesh_type>::label(void) const {
- return _label.c_str();
+pylith::topology::Field<mesh_type, section_type>::label(void) const {
+ return _metadata.label.c_str();
}
// Set vector field type
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
void
-pylith::topology::Field<mesh_type>::vectorFieldType(const VectorFieldEnum value) {
- _vecFieldType = value;
+pylith::topology::Field<mesh_type, section_type>::vectorFieldType(const VectorFieldEnum value) {
+ _metadata.vectorFieldType = value;
}
// Get vector field type
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
-typename pylith::topology::Field<mesh_type>::VectorFieldEnum
-pylith::topology::Field<mesh_type>::vectorFieldType(void) const {
- return _vecFieldType;
+typename pylith::topology::Field<mesh_type, section_type>::VectorFieldEnum
+pylith::topology::Field<mesh_type, section_type>::vectorFieldType(void) const {
+ return _metadata.vectorFieldType;
}
// Set scale for dimensionalizing field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
void
-pylith::topology::Field<mesh_type>::scale(const double value) {
- _scale = value;
+pylith::topology::Field<mesh_type, section_type>::scale(const double value) {
+ _metadata.scale = value;
}
// Get scale for dimensionalizing field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
double
-pylith::topology::Field<mesh_type>::scale(void) const {
- return _scale;
+pylith::topology::Field<mesh_type, section_type>::scale(void) const {
+ return _metadata.scale;
}
// Set flag indicating whether it is okay to dimensionalize field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
void
-pylith::topology::Field<mesh_type>::addDimensionOkay(const bool value) {
- _dimensionsOkay = value;
+pylith::topology::Field<mesh_type, section_type>::addDimensionOkay(const bool value) {
+ _metadata.dimsOkay = value;
}
// Set flag indicating whether it is okay to dimensionalize field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
bool
-pylith::topology::Field<mesh_type>::addDimensionOkay(void) const {
- return _dimensionsOkay;
+pylith::topology::Field<mesh_type, section_type>::addDimensionOkay(void) const {
+ return _metadata.dimsOkay;
}
// Get PETSc vector associated with field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
PetscVec
-pylith::topology::Field<mesh_type>::vector(void) {
+pylith::topology::Field<mesh_type, section_type>::vector(void) {
return _vector;
}
// Get PETSc vector associated with field.
-template<typename mesh_type>
+template<typename mesh_type, typename section_type>
inline
const PetscVec
-pylith::topology::Field<mesh_type>::vector(void) const {
+pylith::topology::Field<mesh_type, section_type>::vector(void) const {
return _vector;
}
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldBase.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldBase.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldBase.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -29,6 +29,8 @@
// Include directives ---------------------------------------------------
#include "topologyfwd.hh" // forward declarations
+#include <string> // USES std::string
+
// FieldBase ------------------------------------------------------------
/** @brief Basic information related to a vector field over the
* vertices or cells of a finite-element mesh.
@@ -55,6 +57,17 @@
CELLS_FIELD=1, ///< FieldBase over cells.
}; // DomainEnum
+// PUBLIC STRUCTS ///////////////////////////////////////////////////////
+public :
+
+ struct Metadata {
+ std::string label; // Label for field.
+ VectorFieldEnum vectorFieldType; ///< Type of vector field.
+ double scale; // Dimension scale associated with values.
+ bool dimsOkay; // Ok to replace nondimensionalized values
+ // with dimensionalized values.
+ }; // Metadata
+
// PUBLIC MEMBERS ///////////////////////////////////////////////////////
public :
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/FieldsNew.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,335 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+
+// ----------------------------------------------------------------------
+// Default constructor.
+template<typename mesh_type>
+pylith::topology::FieldsNew<mesh_type>::FieldsNew(const mesh_type& mesh) :
+ _mesh(mesh)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+template<typename mesh_type>
+pylith::topology::FieldsNew<mesh_type>::~FieldsNew(void)
+{ // destructor
+ deallocate();
+} // destructor
+
+// ----------------------------------------------------------------------
+// Deallocate PETSc and local data structures.
+template<typename mesh_type>
+void
+pylith::topology::FieldsNew<mesh_type>::deallocate(void)
+{ // deallocate
+ if (!_section.isNull())
+ _section->clear();
+
+ const typename map_type::const_iterator fieldsEnd = _fields.end();
+ for (typename map_type::iterator f_iter = _fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter) {
+ delete f_iter->second.field; f_iter->second.field = 0;
+ } // for
+} // deallocate
+
+// ----------------------------------------------------------------------
+// Add field.
+template<typename mesh_type>
+void
+pylith::topology::FieldsNew<mesh_type>::add(const char* name,
+ const char* label,
+ const int fiberDim,
+ const FieldBase::VectorFieldEnum vectorFieldType,
+ const double scale,
+ const bool dimsOkay)
+{ // add
+ if (hasField(name)) {
+ std::ostringstream msg;
+ msg << "Could not add field '" << name
+ << "' to fields manager, because it already exists.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ // Set metadata
+ FieldInfo info;
+ info.metadata.label = label;
+ info.metadata.vectorFieldType = vectorFieldType;
+ info.metadata.scale = scale;
+ info.metadata.dimsOkay = dimsOkay;
+
+ // Set fibration and fiber dimension
+ info.fibration = _fields.size();
+ info.fiberDim = fiberDim;
+ int sindex = 0;
+ const typename map_type::const_iterator fieldsEnd = _fields.end();
+ for (typename map_type::iterator f_iter=_fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter)
+ sindex += f_iter->second.fiberDim;
+ info.sindex = sindex;
+
+ info.field = 0;
+
+ _fields[name] = info;
+} // add
+
+// ----------------------------------------------------------------------
+// Create and allocate Sieve section.
+template<typename mesh_type>
+void
+pylith::topology::FieldsNew<mesh_type>::allocate(const ALE::Obj<typename mesh_type::SieveMesh::label_sequence>& points)
+{ // allocate
+ typedef typename mesh_type::SieveMesh::point_type point_type;
+
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Fields");
+
+ // Set fiber dimension
+ const int fiberDim = _fiberDim();
+ assert(fiberDim > 0);
+#if defined(USE_UNIFORMSECTION)
+ _section = new section_type(_mesh.comm(), fiberDim, _mesh.debug());
+#else
+ _section = new section_type(_mesh.comm(), _mesh.debug());
+#endif
+ assert(!_section.isNull());
+
+ // Set spaces
+ const typename map_type::const_iterator fieldsEnd = _fields.end();
+ for (typename map_type::iterator f_iter=_fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter)
+ _section->addSpace();
+
+ assert(!points.isNull());
+ if (points->size() > 0) {
+ const point_type pointMin =
+ *std::min_element(points->begin(), points->end());
+ const point_type pointMax =
+ *std::max_element(points->begin(), points->end());
+ _section->setChart(typename section_type::chart_type(pointMin, pointMax+1));
+ _section->setFiberDimension(points, fiberDim);
+
+ int fibration = 0;
+ for (typename map_type::iterator f_iter=_fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter, ++fibration)
+ _section->setFiberDimension(points, f_iter->second.fiberDim, fibration);
+ } else // Create empty chart
+ _section->setChart(typename section_type::chart_type(0, 0));
+
+ // Allocate section
+ const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = _mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
+ sieveMesh->allocate(_section);
+
+ logger.stagePop();
+} // allocate
+
+// ----------------------------------------------------------------------
+// Create and allocate Sieve section.
+template<typename mesh_type>
+void
+pylith::topology::FieldsNew<mesh_type>::allocate(const int_array& points)
+{ // allocate
+ typedef typename mesh_type::SieveMesh::point_type point_type;
+
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
+
+ // Set fiber dimension
+ const int fiberDim = _fiberDim();
+ assert(fiberDim > 0);
+#if defined(USE_UNIFORMSECTION)
+ _section = new section_type(_mesh.comm(), fiberDim, _mesh.debug());
+#else
+ _section = new section_type(_mesh.comm(), _mesh.debug());
+#endif
+ assert(!_section.isNull());
+
+ // Set spaces
+ const typename map_type::const_iterator fieldsEnd = _fields.end();
+ for (typename map_type::iterator f_iter=_fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter)
+ _section->addSpace();
+
+ const int npts = points.size();
+ if (npts > 0) {
+ const point_type pointMin = points.min();
+ const point_type pointMax = points.max();
+ _section->setChart(typename section_type::chart_type(pointMin, pointMax+1));
+ for (int i=0; i < npts; ++i)
+ _section->setFiberDimension(points[i], fiberDim);
+
+ int fibration = 0;
+ for (typename map_type::iterator f_iter=_fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter, ++fibration)
+ for (int i=0; i < npts; ++i)
+ _section->setFiberDimension(points[i],
+ f_iter->second.fiberDim, fibration);
+ } else // create empty chart
+ _section->setChart(typename section_type::chart_type(0, 0));
+
+ // Allocate section
+ const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = _mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
+ sieveMesh->allocate(_section);
+
+ logger.stagePop();
+} // allocate
+
+// ----------------------------------------------------------------------
+// Create and allocate Sieve section.
+template<typename mesh_type>
+void
+pylith::topology::FieldsNew<mesh_type>::allocate(const FieldBase::DomainEnum domain,
+ const int stratum)
+{ // allocate
+ const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = _mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
+
+ ALE::Obj<typename mesh_type::SieveMesh::label_sequence> points;
+ if (FieldBase::VERTICES_FIELD == domain)
+ points = sieveMesh->depthStratum(stratum);
+ else if (FieldBase::CELLS_FIELD == domain)
+ points = sieveMesh->heightStratum(stratum);
+ else {
+ std::cerr << "Unknown value for DomainEnum: " << domain << std::endl;
+ assert(0);
+ throw std::logic_error("Bad domain enum in Field.");
+ } // else
+
+ allocate(points);
+} // allocate
+
+// ----------------------------------------------------------------------
+// Get field.
+template<typename mesh_type>
+const pylith::topology::Field<mesh_type>&
+pylith::topology::FieldsNew<mesh_type>::get(const char* name) const
+{ // get
+ typename map_type::const_iterator f_iter = _fields.find(name);
+ if (f_iter == _fields.end()) {
+ std::ostringstream msg;
+ msg << "Could not find field '" << name
+ << "' in fields manager for retrieval.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ const int fibration = f_iter->second.fibration;
+ assert(fibration >= 0 && fibration < _fields.size());
+
+ delete f_iter->second.field; f_iter->second.field = 0;
+ assert(!_section.isNull());
+ f_iter->second.field =
+ new Field<mesh_type>(_mesh, _section->getFibration(fibration),
+ f_iter->second.metadata);
+ assert(0 != f_iter->second.field);
+
+ return *f_iter->second.field;
+} // get
+
+// ----------------------------------------------------------------------
+// Get field.
+template<typename mesh_type>
+pylith::topology::Field<mesh_type>&
+pylith::topology::FieldsNew<mesh_type>::get(const char* name)
+{ // get
+ typename map_type::iterator f_iter = _fields.find(name);
+ if (f_iter == _fields.end()) {
+ std::ostringstream msg;
+ msg << "Could not find field '" << name
+ << "' in fields manager for retrieval.";
+ throw std::runtime_error(msg.str());
+ } // if
+ const int fibration = f_iter->second.fibration;
+ assert(fibration >= 0 && fibration < _fields.size());
+
+ delete f_iter->second.field; f_iter->second.field = 0;
+ assert(!_section.isNull());
+ f_iter->second.field =
+ new Field<mesh_type>(_mesh, _section->getFibration(fibration),
+ f_iter->second.metadata);
+ assert(0 != f_iter->second.field);
+
+ return *f_iter->second.field;
+} // get
+
+// ----------------------------------------------------------------------
+// Get index of first value of field in section.
+template<typename mesh_type>
+int
+pylith::topology::FieldsNew<mesh_type>::sectionIndex(const char* name) const
+{ // sectionIndex
+ typename map_type::const_iterator f_iter = _fields.find(name);
+ if (f_iter == _fields.end()) {
+ std::ostringstream msg;
+ msg << "Could not find field '" << name
+ << "' in fields manager for retrieval of section index.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ return f_iter->second.sindex;
+} // sectionIndex
+
+// ----------------------------------------------------------------------
+// Get names of all fields
+template<typename mesh_type>
+void
+pylith::topology::FieldsNew<mesh_type>::fieldNames(int *numNames,
+ std::string** names) const
+{ // fieldNames
+ const int size = _fields.size();
+ *numNames = size;
+ *names = new std::string[size];
+
+ int i = 0;
+ const typename map_type::const_iterator fieldsEnd = _fields.end();
+ for (typename map_type::const_iterator f_iter = _fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter)
+ (*names)[i++] = f_iter->first;
+} // fieldNames
+
+// ----------------------------------------------------------------------
+// Compute total fiber dimension for section.
+template<typename mesh_type>
+int
+pylith::topology::FieldsNew<mesh_type>::_fiberDim(void) const
+{ // _fiberDim
+ int fiberDim = 0;
+ const typename map_type::const_iterator fieldsEnd = _fields.end();
+ for (typename map_type::const_iterator f_iter=_fields.begin();
+ f_iter != fieldsEnd;
+ ++f_iter)
+ fiberDim += f_iter->second.fiberDim;
+
+ if (fiberDim < 0) {
+ std::ostringstream msg;
+ msg << "Fiber dimension (" << fiberDim << ") for Fields object must "
+ << "be nonnegative.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+
+ return fiberDim;
+} // _fiberDim
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/FieldsNew.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,195 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/Fields.hh
+ *
+ * @brief Set of real fields over a finite-element mesh. All fields are
+ * associated with the same points. We use uniform sections so the
+ * fiber dimension is set at compile time.
+ */
+
+#if !defined(pylith_topology_fields_hh)
+#define pylith_topology_fields_hh
+
+#define USE_UNIFORMSECTION
+
+// Include directives ---------------------------------------------------
+#include "topologyfwd.hh" // forward declarations
+
+#include "pylith/topology/FieldBase.hh" // USES FieldBase::Metadata
+
+#include <string> // USES std::string
+
+// Fields ---------------------------------------------------------------
+/// Container for managing multiple fields over a finite-element mesh.
+template<typename mesh_type>
+class pylith::topology::FieldsNew
+{ // Fields
+ friend class TestFieldsNewMesh; // unit testing
+ friend class TestFieldsNewSubMesh; // unit testing
+
+#if defined(USE_UNIFORMSECTION)
+ typedef typename mesh_type::RealUniformSection section_type;
+#else
+ typedef typename mesh_type::RealSection section_type;
+#endif
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /** Default constructor.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ FieldsNew(const mesh_type& mesh);
+
+ /// Destructor.
+ virtual
+ ~FieldsNew(void);
+
+ /// Deallocate PETSc and local data structures.
+ virtual
+ void deallocate(void);
+
+ /** Check if fields contains a given field.
+ *
+ * @param name Name of field.
+ * @return True if fields contains field, false otherwise.
+ */
+ bool hasField(const char* name) const;
+
+ /** Add field.
+ *
+ * @param name Name of field.
+ * @param label Label for field.
+ * @param fiberDim Fiber dimension for field.
+ */
+ void add(const char* name,
+ const char* label,
+ const int fiberDim,
+ FieldBase::VectorFieldEnum vectorFieldType =FieldBase::OTHER,
+ const double scale =1.0,
+ const bool dimsOkay =false);
+
+ /** Create and allocate Sieve section.
+ *
+ * @param points Points over which to define section.
+ */
+ void allocate(const ALE::Obj<typename mesh_type::SieveMesh::label_sequence>& points);
+
+ /** Create and allocate Sieve section.
+ *
+ * @param points Points over which to define section.
+ */
+ void allocate(const int_array& points);
+
+ /** Create and allocate Sieve section.
+ *
+ * @param domain Type of points over which to define section.
+ * @param stratum Stratum depth (for vertices) and height (for cells).
+ */
+ void allocate(const FieldBase::DomainEnum domain,
+ const int stratum =0);
+
+ /** Get field.
+ *
+ * @param name Name of field.
+ */
+ const Field<mesh_type>& get(const char* name) const;
+
+ /** Get field.
+ *
+ * @param name Name of field.
+ */
+ Field<mesh_type>& get(const char* name);
+
+ /** Get mesh associated with fields.
+ *
+ * @returns Finite-element mesh.
+ */
+ const mesh_type& mesh(void) const;
+
+ /** Get section containing fields.
+ *
+ * @returns Sieve section
+ */
+ const ALE::Obj<section_type>& section(void) const;
+
+ /** Get index of first value of field in section.
+ *
+ * @param name Name of field.
+ * @returns Index of first value of field in section.
+ */
+ int sectionIndex(const char* name) const;
+
+ /** Return the names of all fields.
+ *
+ * @param numNames Number of fields,
+ * @param names Names of fields.
+ */
+ void fieldNames(int* numNames,
+ std::string** names) const;
+
+// PROTECTED STRUCTS ////////////////////////////////////////////////////
+protected :
+
+ struct FieldInfo {
+ FieldBase::Metadata metadata; ///< Metadata for field.
+ Field<mesh_type>* field; ///< Single field.
+ int fiberDim; ///< Fiber dimension of field.
+ int fibration; ///< Index of fibration associated with field.
+ int sindex; ///< Index of first value of field in section.
+ }; // FieldInfo
+
+// PROTECTED TYPEDEFS ///////////////////////////////////////////////////
+protected :
+
+ typedef std::map< std::string, FieldInfo > map_type;
+
+// PROTECTED METHODS ////////////////////////////////////////////////////
+protected :
+
+ /** Compute total fiber dimension for section.
+ *
+ * @returns Fiber dimension.
+ */
+ int _fiberDim(void) const;
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
+protected :
+
+ map_type _fields; ///< Fields without constraints over a common set of points.
+ ALE::Obj<section_type> _section; ///< Section containing fields.
+ const mesh_type& _mesh; ///< Mesh associated with fields.
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ FieldsNew(const FieldsNew&); ///< Not implemented
+ const FieldsNew& operator=(const FieldsNew&); ///< Not implemented
+
+}; // FieldsNew
+
+#include "FieldsNew.icc"
+#include "FieldsNew.cc"
+
+#endif // pylith_topology_fields_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.icc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/FieldsNew.icc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.icc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/FieldsNew.icc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_fields_hh)
+#error "FieldsNew.icc must be included only from FieldsNew.hh"
+#endif
+
+// ----------------------------------------------------------------------
+// Check if fields contains a given field.
+template<typename mesh_type>
+bool
+pylith::topology::FieldsNew<mesh_type>::hasField(const char* name) const
+{ // hasField
+ typename map_type::const_iterator iter = _fields.find(name);
+ return iter != _fields.end();
+} // hasField
+
+// ----------------------------------------------------------------------
+// Get mesh associated with fields.
+template<typename mesh_type>
+const mesh_type&
+pylith::topology::FieldsNew<mesh_type>::mesh(void) const
+{ // mesh
+ return _mesh;
+} // mesh
+
+// ----------------------------------------------------------------------
+// Get section containing fields.
+template<typename mesh_type>
+const ALE::Obj<typename pylith::topology::FieldsNew<mesh_type>::section_type>&
+pylith::topology::FieldsNew<mesh_type>::section(void) const
+{ // section
+ return _section;
+} // section
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,6 +27,9 @@
Field.cc \
Fields.hh \
Fields.icc \
+ FieldsNew.hh \
+ FieldsNew.icc \
+ FieldsNew.cc \
Jacobian.hh \
Mesh.hh \
Mesh.icc \
@@ -37,10 +40,24 @@
SubMesh.hh \
SubMesh.icc \
SubMesh.cc \
+ UniformSectionDS.hh \
+ UniformSectionDS.cc \
topologyfwd.hh
noinst_HEADERS =
+# TEMPORARY
+noinst_HEADERS += \
+ MeshRefiner.hh \
+ MeshRefiner.cc \
+ RefineEdges2.hh \
+ CellRefinerTri3.hh \
+ CellRefinerTet4.hh \
+ RefineFace4Edges2.hh \
+ CellRefinerQuad4.hh \
+ MeshOrder.hh
+
+
# export
clean-local: clean-subpkgincludeHEADERS
BUILT_SOURCES = export-subpkgincludeHEADERS
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -30,6 +30,8 @@
#include "spatialdata/geocoords/geocoordsfwd.hh" // forward declarations
#include "spatialdata/units/unitsfwd.hh" // forward declarations
+#include "UniformSectionDS.hh" // USES IUniformSectionDS
+
#include <petscmesh.hh> // HASA ALE::IMesh
// Mesh -----------------------------------------------------------------
@@ -57,13 +59,11 @@
*/
//@{
typedef ALE::IMesh<> SieveMesh;
+ typedef ALE::IMesh<ALE::LabelSifter<int, SieveMesh::point_type> > SieveSubMesh;
+
+ typedef SieveMesh::int_section_type IntSection;
typedef SieveMesh::real_section_type RealSection;
- typedef SieveMesh::int_section_type IntSection;
- typedef ALE::IMesh<ALE::LabelSifter<int, SieveMesh::point_type> > SieveSubMesh;
- typedef ALE::ISieveVisitor::RestrictVisitor<RealSection> RestrictVisitor;
- typedef ALE::ISieveVisitor::UpdateAddVisitor<RealSection> UpdateAddVisitor;
- typedef ALE::ISieveVisitor::UpdateAllVisitor<RealSection> UpdateAllVisitor;
- typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveMesh::order_type,PetscInt> IndicesVisitor;
+ typedef ALE::IUniformSectionDS<SieveMesh::point_type, double> RealUniformSection;
//@}
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/MeshOrder.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,151 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "MeshOrder.hh" // implementation of class methods
+
+#include <cassert> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor
+ALE::MeshOrder::MeshOrder(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+ALE::MeshOrder::~MeshOrder(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Determine order from pre-existing mesh.
+void
+ALE::MeshOrder::initialize(const ALE::Obj<mesh_type>& mesh)
+{ // initialize
+ assert(!mesh.isNull());
+
+ const ALE::Obj<mesh_type::label_sequence>& cells = mesh->heightStratum(0);
+ assert(!cells.isNull());
+
+ const Obj<mesh_type::label_sequence>& vertices = mesh->depthStratum(0);
+ assert(!vertices.isNull());
+
+ if (mesh->hasLabel("censored depth")) {
+ // Count number of cells in censored depth (normal cells).
+ const Obj<mesh_type::label_sequence>& cellsNormal = mesh->getLabelStratum("censored depth", mesh->depth());
+ assert(!cellsNormal.isNull());
+ const mesh_type::label_sequence::iterator cellsNormalEnd = cellsNormal->end();
+ const int numCellsNormal = cellsNormal->size();
+
+ // Count number of remaining cells (censored cells).
+ const int numCellsCensored = cells->size() - numCellsNormal;
+
+ // Get number of normal vertices.
+ assert(!mesh->getFactory().isNull());
+ Obj<mesh_type::numbering_type> vNumbering = mesh->getFactory()->getNumbering(mesh, "censored depth", 0);
+ assert(!vNumbering.isNull());
+ const int numVerticesNormal = vNumbering->size();
+
+ // Count number of remaining vertices (censored vertices).
+ const int numVerticesCensored = vertices->size() - numVerticesNormal;
+
+ _cellsNormal = ALE::Interval<point_type>(0, numCellsNormal);
+ _verticesNormal = ALE::Interval<point_type>(numCellsNormal, numCellsNormal+numVerticesNormal);
+ _verticesCensored = ALE::Interval<point_type>(numCellsNormal+numVerticesNormal, numCellsNormal+numVerticesNormal+numVerticesCensored);
+ _cellsCensored = ALE::Interval<point_type>(numCellsNormal+numVerticesNormal+numVerticesCensored,
+ numCellsNormal+numVerticesNormal+numVerticesCensored+numCellsCensored);
+ } else {
+ const int numCells = cells->size();
+ const int numVertices = vertices->size();
+ const int numEntities = numCells + numVertices;
+
+ _cellsNormal = ALE::Interval<point_type>(0, numCells);
+ _verticesNormal = ALE::Interval<point_type>(numCells, numCells+numVertices);
+ _cellsCensored = ALE::Interval<point_type>(numEntities, numEntities);
+ _verticesCensored = ALE::Interval<point_type>(numEntities, numEntities);
+ } // if/else
+} // initialize
+
+// ----------------------------------------------------------------------
+// Set range for normal cells.
+void
+ALE::MeshOrder::cellsNormal(const point_type min, const point_type max)
+{ // cellsNormal
+ _cellsNormal = ALE::Interval<point_type>(min, max);
+} // cellsNormal
+
+// ----------------------------------------------------------------------
+// Get range for normal cells.
+const ALE::Interval<ALE::MeshOrder::point_type>&
+ALE::MeshOrder::cellsNormal(void) const
+{ // cellsNormal
+ return _cellsNormal;
+} // cellsNormal
+
+// ----------------------------------------------------------------------
+// Set range for normal vertices.
+void
+ALE::MeshOrder::verticesNormal(const point_type min, const point_type max)
+{ // verticesNormal
+ _verticesNormal = ALE::Interval<point_type>(min, max);
+} // verticesNormal
+
+// ----------------------------------------------------------------------
+// Get range for normal vertices.
+const ALE::Interval<ALE::MeshOrder::point_type>&
+ALE::MeshOrder::verticesNormal(void) const
+{ // verticesNormal
+ return _verticesNormal;
+} // verticesNormal
+
+// ----------------------------------------------------------------------
+// Set range for censored cells.
+void
+ALE::MeshOrder::cellsCensored(const point_type min, const point_type max)
+{ // cellsCensored
+ _cellsCensored = ALE::Interval<point_type>(min, max);
+} // cellsCensored
+
+// ----------------------------------------------------------------------
+// Get range for censored cells.
+const ALE::Interval<ALE::MeshOrder::point_type>&
+ALE::MeshOrder::cellsCensored(void) const
+{ // cellsCensored
+ return _cellsCensored;
+} // cellsCensored
+
+// ----------------------------------------------------------------------
+// Set range for censored vertices.
+void
+ALE::MeshOrder::verticesCensored(const point_type min, const point_type max)
+{ // verticesCensored
+ _verticesCensored = ALE::Interval<point_type>(min, max);
+} // verticesCensored
+
+// ----------------------------------------------------------------------
+// Get range for censored vertices.
+const ALE::Interval<ALE::MeshOrder::point_type>&
+ALE::MeshOrder::verticesCensored(void) const
+{ // verticesCensored
+ return _verticesCensored;
+} // verticesCensored
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/MeshOrder.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,129 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/MeshOrder.hh
+ *
+ * @brief Object for managing order of mesh entities.
+ *
+ * Entities are stored in contiguous ranges.
+ */
+
+#if !defined(pylith_topology_meshorder_hh)
+#define pylith_topology_meshorder_hh
+
+// Include directives ---------------------------------------------------
+#include "topologyfwd.hh" // forward declarations
+
+#include <petscmesh.hh> // HASA ALE::IMesh
+
+// MeshOrder ------------------------------------------------------------
+/// Object for managing order of mesh entities.
+class ALE::MeshOrder
+{ // MeshOrder
+ typedef int point_type;
+ typedef ALE::IMesh<> mesh_type;
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ MeshOrder(void);
+
+ /// Destructor
+ ~MeshOrder(void);
+
+ /** Determine order from pre-existing mesh.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ void initialize(const ALE::Obj<mesh_type>& mesh);
+
+ /** Set range for normal cells.
+ *
+ * @param min Minimum cell label.
+ * @param max Maximum cell label.
+ */
+ void cellsNormal(const point_type min, const point_type max);
+
+ /** Get range for normal cells.
+ *
+ * @returns Interval with range of normal cells.
+ */
+ const ALE::Interval<point_type>& cellsNormal(void) const;
+
+ /** Set range for normal vertices.
+ *
+ * @param min Minimum vertex label.
+ * @param max Maximum vertex label.
+ */
+ void verticesNormal(const point_type min, const point_type max);
+
+ /** Get range for normal vertices.
+ *
+ * @returns Interval with range of normal vertices.
+ */
+ const ALE::Interval<point_type>& verticesNormal(void) const;
+
+ /** Set range for censored cells.
+ *
+ * @param min Minimum cell label.
+ * @param max Maximum cell label.
+ */
+ void cellsCensored(const point_type min, const point_type max);
+
+ /** Get range for censored cells.
+ *
+ * @returns Interval with range of censored cells.
+ */
+ const ALE::Interval<point_type>& cellsCensored(void) const;
+
+ /** Set range for censored vertices.
+ *
+ * @param min Minimum vertex label.
+ * @param max Maximum vertex label.
+ */
+ void verticesCensored(const point_type min, const point_type max);
+
+ /** Get range for censored vertices.
+ *
+ * @returns Interval with range of censored vertices.
+ */
+ const ALE::Interval<point_type>& verticesCensored(void) const;
+
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
+
+ ALE::Interval<point_type> _cellsNormal;
+ ALE::Interval<point_type> _verticesNormal;
+ ALE::Interval<point_type> _verticesCensored;
+ ALE::Interval<point_type> _cellsCensored;
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ MeshOrder(const MeshOrder&); ///< Not implemented
+ const MeshOrder& operator=(const MeshOrder&); ///< Not implemented
+
+}; // MeshOrder
+
+#endif // pylith_topology_meshorder_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.icc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/MeshOrder.icc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.icc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshOrder.icc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,26 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshorder_hh)
+#error "MeshOrder.icc must be included only from MeshOrder.hh"
+#else
+
+#endif
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/MeshRefiner.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,685 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "MeshRefiner.hh" // implementation of class methods
+
+#include "MeshOrder.hh" // USES MeshOrder
+
+#include <cassert> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor
+template<typename cellrefiner_type>
+ALE::MeshRefiner<cellrefiner_type>::MeshRefiner(void) :
+ _orderOldMesh(new MeshOrder),
+ _orderNewMesh(new MeshOrder)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+template<typename cellrefiner_type>
+ALE::MeshRefiner<cellrefiner_type>::~MeshRefiner(void)
+{ // destructor
+ delete _orderOldMesh; _orderOldMesh = PETSC_NULL;
+ delete _orderNewMesh; _orderNewMesh = PETSC_NULL;
+} // destructor
+
+// ----------------------------------------------------------------------
+// Refine mesh.
+template<typename cellrefiner_type>
+void
+ALE::MeshRefiner<cellrefiner_type>::refine(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner)
+{ // refine
+ assert(!mesh.isNull());
+ if (mesh->hasLabel("censored depth")) {
+ _refineCensored(newMesh, mesh, refiner);
+ } else {
+ _refine(newMesh, mesh, refiner);
+ } // if/else
+} // refine
+
+// ----------------------------------------------------------------------
+// Refine mesh.
+template<typename cellrefiner_type>
+void
+ALE::MeshRefiner<cellrefiner_type>::_refine(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner)
+{ // _refine
+ typedef Interval<point_type>::const_iterator interval_type;
+
+ assert(_orderOldMesh);
+ assert(_orderNewMesh);
+
+ // Calculate order in old mesh.
+ _orderOldMesh->initialize(mesh);
+
+ assert(!mesh.isNull());
+ assert(!newMesh.isNull());
+
+ // Get original mesh stuff.
+ const Obj<mesh_type::label_sequence>& cells = mesh->heightStratum(0);
+ assert(!cells.isNull());
+ const mesh_type::label_sequence::iterator cellsEnd = cells->end();
+
+ const Obj<mesh_type::label_sequence>& vertices = mesh->depthStratum(0);
+ assert(!vertices.isNull());
+
+ const Obj<mesh_type::sieve_type>& sieve = mesh->getSieve();
+ assert(!sieve.isNull());
+ ALE::ISieveVisitor::PointRetriever<mesh_type::sieve_type> cV(std::max(1, sieve->getMaxConeSize()));
+
+ // Count number of cells.
+ int newNumCells = 0;
+ for (mesh_type::label_sequence::iterator c_iter = cells->begin(); c_iter != cellsEnd; ++c_iter) {
+ newNumCells += refiner.numNewCells(*c_iter);
+ } // for
+
+ // Count number of vertices.
+ const int oldNumVertices = vertices->size();
+ int counterBegin = newNumCells + oldNumVertices;
+ point_type curNewVertex = counterBegin;
+ for(mesh_type::label_sequence::iterator c_iter = cells->begin(); c_iter != cellsEnd; ++c_iter) {
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ refiner.splitCell(*c_iter, cV.getPoints(), cV.getSize(), &curNewVertex);
+ } // for
+ const int newNumVertices = oldNumVertices + curNewVertex - counterBegin;
+
+ _orderNewMesh->cellsNormal(0, newNumCells);
+ _orderNewMesh->verticesNormal(newNumCells, newNumCells+newNumVertices);
+ _orderNewMesh->verticesCensored(newNumCells+newNumVertices, newNumCells+newNumVertices);
+ _orderNewMesh->cellsCensored(newNumCells+newNumVertices, newNumCells+newNumVertices);
+
+ // Allocate chart for new sieve.
+ const Obj<mesh_type::sieve_type>& newSieve = newMesh->getSieve();
+ assert(!newSieve.isNull());
+ newSieve->setChart(mesh_type::sieve_type::chart_type(0, _orderNewMesh->cellsCensored().max()));
+
+ // Create new sieve with correct sizes for refined cells
+ point_type curNewCell = _orderNewMesh->cellsNormal().min();
+ const interval_type::const_iterator oldCellsEnd = _orderOldMesh->cellsNormal().end();
+ for (interval_type::const_iterator c_iter=_orderOldMesh->cellsNormal().begin(); c_iter != oldCellsEnd; ++c_iter) {
+ // Set new cone and support sizes
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ const point_type* cone = cV.getPoints();
+ const int coneSize = cV.getSize();
+
+ const point_type* newCells;
+ int numNewCells = 0;
+ refiner.getNewCells(&newCells, &numNewCells, *c_iter, cone, coneSize, *_orderOldMesh, *_orderNewMesh);
+
+ for(int iCell=0; iCell < numNewCells; ++iCell, ++curNewCell) {
+ newSieve->setConeSize(curNewCell, coneSize);
+ for(int iVertex=0; iVertex < coneSize; ++iVertex) {
+ newSieve->addSupportSize(newCells[iCell*coneSize+iVertex], 1);
+ } // for
+ } // for
+
+ } // for
+ newSieve->allocate();
+
+ // Create refined cells in new sieve.
+ curNewCell = _orderNewMesh->cellsNormal().min();
+ for (interval_type::const_iterator c_iter=_orderOldMesh->cellsNormal().begin(); c_iter != oldCellsEnd; ++c_iter) {
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ const point_type *cone = cV.getPoints();
+ const int coneSize = cV.getSize();
+
+ const point_type* newCells;
+ int numNewCells = 0;
+ refiner.getNewCells(&newCells, &numNewCells, *c_iter, cone, coneSize, *_orderOldMesh, *_orderNewMesh);
+
+ for(int iCell=0; iCell < numNewCells; ++iCell, ++curNewCell) {
+ newSieve->setCone(&newCells[iCell*coneSize], curNewCell);
+ } // for
+ } // for
+ newSieve->symmetrize();
+
+ // Set coordinates in refined mesh.
+ const Obj<mesh_type::real_section_type>& coordinates = mesh->getRealSection("coordinates");
+ assert(!coordinates.isNull());
+ const Obj<mesh_type::real_section_type>& newCoordinates = newMesh->getRealSection("coordinates");
+ assert(!newCoordinates.isNull());
+
+ const mesh_type::label_sequence::const_iterator verticesEnd = vertices->end();
+ assert(vertices->size() > 0);
+ const int spaceDim = coordinates->getFiberDimension(*vertices->begin());
+ assert(spaceDim > 0);
+ newCoordinates->setChart(mesh_type::sieve_type::chart_type(_orderNewMesh->verticesNormal().min(), _orderNewMesh->verticesCensored().max()));
+
+ interval_type::const_iterator newVerticesEnd = _orderNewMesh->verticesCensored().end();
+ for (interval_type::const_iterator v_iter=_orderNewMesh->verticesNormal().begin(); v_iter != newVerticesEnd; ++v_iter) {
+ newCoordinates->setFiberDimension(*v_iter, spaceDim);
+ } // for
+ newCoordinates->allocatePoint();
+
+ const interval_type::const_iterator oldVerticesEnd = _orderOldMesh->verticesCensored().end();
+ for (interval_type::const_iterator vOld_iter=_orderOldMesh->verticesNormal().begin(), vNew_iter=_orderNewMesh->verticesNormal().begin(); vOld_iter != oldVerticesEnd; ++vOld_iter, ++vNew_iter) {
+ std::cout << "Copy coordinates from old vertex " << *vOld_iter << " to new vertex " << *vNew_iter << std::endl;
+ newCoordinates->updatePoint(*vNew_iter, coordinates->restrictPoint(*vOld_iter));
+ } // for
+
+ refiner.setCoordsNewVertices(newCoordinates, coordinates);
+
+ _stratify(newMesh);
+ _calcNewOverlap(newMesh, mesh, refiner);
+ _createIntSections(newMesh, mesh, refiner);
+ _createLabels(newMesh, mesh, refiner);
+} // _refine
+
+// ----------------------------------------------------------------------
+// Refine mesh with a censored depth.
+template<typename cellrefiner_type>
+void
+ALE::MeshRefiner<cellrefiner_type>::_refineCensored(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner)
+{ // _refineCensored
+ typedef Interval<point_type>::const_iterator interval_type;
+
+ assert(_orderOldMesh);
+ assert(_orderNewMesh);
+
+ // Calculate order in old mesh.
+ _orderOldMesh->initialize(mesh);
+
+ assert(!mesh.isNull());
+ assert(!newMesh.isNull());
+
+ // Get original mesh stuff.
+ const Obj<mesh_type::label_sequence>& cells = mesh->heightStratum(0);
+ assert(!cells.isNull());
+ const mesh_type::label_sequence::iterator cellsEnd = cells->end();
+
+ const Obj<mesh_type::label_sequence>& vertices = mesh->depthStratum(0);
+ assert(!vertices.isNull());
+
+ const Obj<mesh_type::sieve_type>& sieve = mesh->getSieve();
+ assert(!sieve.isNull());
+ ALE::ISieveVisitor::PointRetriever<mesh_type::sieve_type> cV(std::max(1, sieve->getMaxConeSize()));
+
+ // Count number of cells in censored depth (normal cells).
+ const Obj<mesh_type::label_sequence>& cellsNormal = mesh->getLabelStratum("censored depth", mesh->depth());
+ assert(!cellsNormal.isNull());
+ const mesh_type::label_sequence::iterator cellsNormalEnd = cellsNormal->end();
+ int newNumCellsNormal = 0;
+ for(mesh_type::label_sequence::iterator c_iter = cellsNormal->begin(); c_iter != cellsNormalEnd; ++c_iter)
+ newNumCellsNormal += refiner.numNewCells(*c_iter);
+
+ // Count number of remaining cells (other cells).
+ const int numSkip = cellsNormal->size();
+ mesh_type::label_sequence::const_iterator c_iter = cells->begin();
+ for (int i=0; i < numSkip; ++i)
+ ++c_iter;
+ const mesh_type::label_sequence::const_iterator cellsCensoredBegin = c_iter;
+ int newNumCellsCensored = 0;
+ for (; c_iter != cellsEnd; ++c_iter)
+ newNumCellsCensored += refiner.numNewCells(*c_iter);
+
+ // Count number of normal vertices.
+ assert(!mesh->getFactory().isNull());
+ Obj<mesh_type::numbering_type> vNumbering = mesh->getFactory()->getNumbering(mesh, "censored depth", 0);
+ assert(!vNumbering.isNull());
+ const int oldNumVerticesNormal = vNumbering->size();
+
+ int counterBegin = newNumCellsNormal + oldNumVerticesNormal;
+ point_type curNewVertex = counterBegin;
+ for(mesh_type::label_sequence::iterator c_iter = cellsNormal->begin(); c_iter != cellsNormalEnd; ++c_iter) {
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ refiner.splitCell(*c_iter, cV.getPoints(), cV.getSize(), &curNewVertex);
+ } // for
+ for(mesh_type::label_sequence::iterator c_iter = cellsCensoredBegin; c_iter != cellsEnd; ++c_iter) {
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ refiner.splitCell(*c_iter, cV.getPoints(), cV.getSize(), &curNewVertex);
+ } // for
+ const int newNumVerticesNormal = curNewVertex - counterBegin + oldNumVerticesNormal;
+
+ // Count number of remaining vertices (other vertices).
+ const int oldNumVerticesCensored = vertices->size() - oldNumVerticesNormal;
+ counterBegin = newNumCellsNormal + newNumVerticesNormal + oldNumVerticesCensored;
+ curNewVertex = counterBegin;
+ for(mesh_type::label_sequence::iterator c_iter = cellsCensoredBegin; c_iter != cellsEnd; ++c_iter) {
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ refiner.splitCellUncensored(*c_iter, cV.getPoints(), cV.getSize(), &curNewVertex);
+ } // for
+ const int newNumVerticesCensored = curNewVertex - counterBegin + oldNumVerticesCensored;
+
+ _orderNewMesh->cellsNormal(0, newNumCellsNormal);
+ _orderNewMesh->verticesNormal(newNumCellsNormal, newNumCellsNormal+newNumVerticesNormal);
+ _orderNewMesh->verticesCensored(newNumCellsNormal+newNumVerticesNormal, newNumCellsNormal+newNumVerticesNormal+newNumVerticesCensored);
+ _orderNewMesh->cellsCensored(newNumCellsNormal+newNumVerticesNormal+newNumVerticesCensored,
+ newNumCellsNormal+newNumVerticesNormal+newNumVerticesCensored+newNumCellsCensored);
+
+ // Allocate chart for new sieve.
+ const Obj<mesh_type::sieve_type>& newSieve = newMesh->getSieve();
+ assert(!newSieve.isNull());
+ newSieve->setChart(mesh_type::sieve_type::chart_type(0, _orderNewMesh->cellsCensored().max()));
+
+ // Create new sieve with correct sizes for refined cells
+ point_type curNewCell = _orderNewMesh->cellsNormal().min();
+ interval_type::const_iterator oldCellsEnd = _orderOldMesh->cellsNormal().end();
+ for (interval_type::const_iterator c_iter=_orderOldMesh->cellsNormal().begin(); c_iter != oldCellsEnd; ++c_iter) {
+ // Set new cone and support sizes
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ const point_type* cone = cV.getPoints();
+ const int coneSize = cV.getSize();
+
+ const point_type* newCells;
+ int numNewCells = 0;
+ refiner.getNewCells(&newCells, &numNewCells, *c_iter, cone, coneSize, *_orderOldMesh, *_orderNewMesh);
+
+ for(int iCell=0; iCell < numNewCells; ++iCell, ++curNewCell) {
+ newSieve->setConeSize(curNewCell, coneSize);
+ for(int iVertex=0; iVertex < coneSize; ++iVertex) {
+ newSieve->addSupportSize(newCells[iCell*coneSize+iVertex], 1);
+ } // for
+ } // for
+ } // for
+ // Reset current new cell value and loop over censored cells.
+ curNewCell = _orderNewMesh->cellsCensored().min();
+ oldCellsEnd = _orderOldMesh->cellsCensored().end();
+ for (interval_type::const_iterator c_iter=_orderOldMesh->cellsCensored().begin(); c_iter != oldCellsEnd; ++c_iter) {
+ // Set new cone and support sizes
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ const point_type* cone = cV.getPoints();
+ const int coneSize = cV.getSize();
+
+ const point_type* newCells;
+ int numNewCells = 0;
+ refiner.getNewCells(&newCells, &numNewCells, *c_iter, cone, coneSize, *_orderOldMesh, *_orderNewMesh);
+
+ for(int iCell=0; iCell < numNewCells; ++iCell, ++curNewCell) {
+ newSieve->setConeSize(curNewCell, coneSize);
+ for(int iVertex=0; iVertex < coneSize; ++iVertex) {
+ newSieve->addSupportSize(newCells[iCell*coneSize+iVertex], 1);
+ } // for
+ } // for
+ } // for
+ newSieve->allocate();
+
+ // Create refined cells in new sieve.
+ curNewCell = _orderNewMesh->cellsNormal().min();
+ oldCellsEnd = _orderOldMesh->cellsNormal().end();
+ for (interval_type::const_iterator c_iter=_orderOldMesh->cellsNormal().begin(); c_iter != oldCellsEnd; ++c_iter) {
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ const point_type *cone = cV.getPoints();
+ const int coneSize = cV.getSize();
+
+ const point_type* newCells;
+ int numNewCells = 0;
+ refiner.getNewCells(&newCells, &numNewCells, *c_iter, cone, coneSize, *_orderOldMesh, *_orderNewMesh);
+
+ for(int iCell=0; iCell < numNewCells; ++iCell, ++curNewCell) {
+ newSieve->setCone(&newCells[iCell*coneSize], curNewCell);
+ } // for
+ } // for
+ curNewCell = _orderNewMesh->cellsCensored().min();
+ oldCellsEnd = _orderOldMesh->cellsCensored().end();
+ for (interval_type::const_iterator c_iter=_orderOldMesh->cellsCensored().begin(); c_iter != oldCellsEnd; ++c_iter) {
+ cV.clear();
+ sieve->cone(*c_iter, cV);
+ const point_type *cone = cV.getPoints();
+ const int coneSize = cV.getSize();
+
+ const point_type* newCells;
+ int numNewCells = 0;
+ refiner.getNewCells(&newCells, &numNewCells, *c_iter, cone, coneSize, *_orderOldMesh, *_orderNewMesh);
+
+ for(int iCell=0; iCell < numNewCells; ++iCell, ++curNewCell) {
+ newSieve->setCone(&newCells[iCell*coneSize], curNewCell);
+ } // for
+ } // for
+ newSieve->symmetrize();
+
+ // Set coordinates in refined mesh.
+ const Obj<mesh_type::real_section_type>& coordinates = mesh->getRealSection("coordinates");
+ assert(!coordinates.isNull());
+ const Obj<mesh_type::real_section_type>& newCoordinates = newMesh->getRealSection("coordinates");
+ assert(!newCoordinates.isNull());
+
+ const mesh_type::label_sequence::const_iterator verticesEnd = vertices->end();
+ assert(vertices->size() > 0);
+ const int spaceDim = coordinates->getFiberDimension(*vertices->begin());
+ assert(spaceDim > 0);
+ newCoordinates->setChart(mesh_type::sieve_type::chart_type(_orderNewMesh->verticesNormal().min(), _orderNewMesh->verticesCensored().max()));
+
+ const interval_type::const_iterator newVerticesEnd = _orderNewMesh->verticesCensored().end();
+ for (interval_type::const_iterator v_iter=_orderNewMesh->verticesNormal().begin(); v_iter != newVerticesEnd; ++v_iter) {
+ newCoordinates->setFiberDimension(*v_iter, spaceDim);
+ } // for
+ newCoordinates->allocatePoint();
+
+ interval_type::const_iterator oldVerticesEnd = _orderOldMesh->verticesNormal().end();
+ for (interval_type::const_iterator vOld_iter=_orderOldMesh->verticesNormal().begin(), vNew_iter=_orderNewMesh->verticesNormal().begin(); vOld_iter != oldVerticesEnd; ++vOld_iter, ++vNew_iter) {
+ std::cout << "Copy coordinates from old vertex " << *vOld_iter << " to new vertex " << *vNew_iter << std::endl;
+ newCoordinates->updatePoint(*vNew_iter, coordinates->restrictPoint(*vOld_iter));
+ } // for
+ oldVerticesEnd = _orderOldMesh->verticesCensored().end();
+ for (interval_type::const_iterator vOld_iter=_orderOldMesh->verticesCensored().begin(), vNew_iter=_orderNewMesh->verticesCensored().begin(); vOld_iter != oldVerticesEnd; ++vOld_iter, ++vNew_iter) {
+ std::cout << "Copy coordinates from old vertex " << *vOld_iter << " to new vertex " << *vNew_iter << std::endl;
+ newCoordinates->updatePoint(*vNew_iter, coordinates->restrictPoint(*vOld_iter));
+ } // for
+
+ refiner.setCoordsNewVertices(newCoordinates, coordinates);
+
+ _stratify(newMesh);
+ _calcNewOverlap(newMesh, mesh, refiner);
+ _createIntSections(newMesh, mesh, refiner);
+ _createLabels(newMesh, mesh, refiner);
+
+ // Create sensored depth
+ const ALE::Obj<Mesh::label_type>& censoredLabel = newMesh->createLabel("censored depth");
+ assert(!censoredLabel.isNull());
+
+ mesh_type::DepthVisitor depthVisitor(*newSieve, _orderNewMesh->verticesCensored().min(), *censoredLabel);
+
+ newSieve->roots(depthVisitor);
+ while(depthVisitor.isModified()) {
+ // FIX: Avoid the copy here somehow by fixing the traversal
+ std::vector<mesh_type::point_type> modifiedPoints(depthVisitor.getModifiedPoints().begin(), depthVisitor.getModifiedPoints().end());
+
+ depthVisitor.clear();
+ newSieve->support(modifiedPoints, depthVisitor);
+ } // while
+} // _refineCensored
+
+// ----------------------------------------------------------------------
+// Stratify mesh.
+template<typename cellrefiner_type>
+void
+ALE::MeshRefiner<cellrefiner_type>::_stratify(const Obj<mesh_type>& mesh)
+{ // _stratify
+ typedef Interval<point_type>::const_iterator interval_type;
+
+ assert(_orderNewMesh);
+ assert(_orderOldMesh);
+
+ // Fast stratification
+ const Obj<mesh_type::label_type>& height = mesh->createLabel("height");
+ const Obj<mesh_type::label_type>& depth = mesh->createLabel("depth");
+
+ // Set height/depth of cells
+ interval_type::const_iterator cellsEnd = _orderNewMesh->cellsNormal().end();
+ for (interval_type::const_iterator c_iter = _orderNewMesh->cellsNormal().begin(); c_iter != cellsEnd; ++c_iter) {
+ height->setCone(0, *c_iter);
+ depth->setCone(1, *c_iter);
+ } // for
+ cellsEnd = _orderNewMesh->cellsCensored().end();
+ for (interval_type::const_iterator c_iter = _orderNewMesh->cellsCensored().begin(); c_iter != cellsEnd; ++c_iter) {
+ height->setCone(0, *c_iter);
+ depth->setCone(1, *c_iter);
+ } // for
+
+ // Set height/depth of vertices
+ interval_type::const_iterator verticesEnd = _orderNewMesh->verticesNormal().end();
+ for (interval_type::const_iterator v_iter = _orderNewMesh->verticesNormal().begin(); v_iter != verticesEnd; ++v_iter) {
+ height->setCone(1, *v_iter);
+ depth->setCone(0, *v_iter);
+ } // for
+ verticesEnd = _orderNewMesh->verticesCensored().end();
+ for (interval_type::const_iterator v_iter = _orderNewMesh->verticesCensored().begin(); v_iter != verticesEnd; ++v_iter) {
+ height->setCone(1, *v_iter);
+ depth->setCone(0, *v_iter);
+ } // for
+
+ mesh->setHeight(1);
+ mesh->setDepth(1);
+} // _stratify
+
+// ----------------------------------------------------------------------
+// Create integer sections in new mesh.
+template<typename cellrefiner_type>
+void
+ALE::MeshRefiner<cellrefiner_type>::_createIntSections(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner)
+{ // _createIntSections
+ assert(!newMesh.isNull());
+ assert(!mesh.isNull());
+
+ const ALE::Obj<std::set<std::string> >& sectionNames =
+ mesh->getIntSections();
+ const std::set<std::string>::const_iterator namesBegin =
+ sectionNames->begin();
+ const std::set<std::string>::const_iterator namesEnd =
+ sectionNames->end();
+ for (std::set<std::string>::const_iterator name=namesBegin;
+ name != namesEnd;
+ ++name) {
+ const ALE::Obj<mesh_type::int_section_type>& group = mesh->getIntSection(*name);
+ const ALE::Obj<mesh_type::int_section_type>& newGroup = newMesh->getIntSection(*name);
+ const mesh_type::int_section_type::chart_type& chart = group->getChart();
+
+ // :WARNING: Only implemented for integer sections containing vertices.
+
+ const point_type oldVerticesStart = _orderOldMesh->verticesNormal().min();
+ const point_type oldVerticesCensoredStart = _orderOldMesh->verticesCensored().min();
+ const point_type oldVerticesEnd = _orderOldMesh->verticesCensored().max();
+
+ const point_type newVerticesStart = _orderNewMesh->verticesNormal().min();
+ const point_type newVerticesCensoredStart = _orderNewMesh->verticesCensored().min();
+ const point_type newVerticesEnd = _orderNewMesh->verticesCensored().max();
+
+ newGroup->setChart(mesh_type::int_section_type::chart_type(newVerticesStart, newVerticesEnd));
+ const mesh_type::int_section_type::chart_type& newChart = newGroup->getChart();
+
+ std::cout << "VERTICES start: " << newVerticesStart << ", end: " << newVerticesEnd << std::endl;
+
+ const point_type chartMax = chart.max();
+ for (point_type pOld=chart.min(); pOld < chartMax; ++pOld) {
+ if (group->getFiberDimension(pOld)) {
+ if (_orderOldMesh->verticesNormal().hasPoint(pOld)) {
+ const point_type pNew = newVerticesStart + pOld - oldVerticesStart;
+ newGroup->setFiberDimension(pNew, 1);
+ } else if (_orderOldMesh->verticesCensored().hasPoint(pOld)) {
+ const point_type pNew = newVerticesCensoredStart + pOld - oldVerticesCensoredStart;
+ newGroup->setFiberDimension(pNew, 1);
+ } else {
+ throw ALE::Exception("Creating integer sections during refinement containing entities other than vertices not implemented.");
+ } // if/else
+ } // if
+ } // for
+ refiner.groupAddNewVertices(newGroup, group);
+
+ newGroup->allocatePoint();
+ for (point_type pOld=chart.min(); pOld < chartMax; ++pOld) {
+ if (group->getFiberDimension(pOld)) {
+ if (_orderOldMesh->verticesNormal().hasPoint(pOld)) {
+ const point_type pNew = newVerticesStart + pOld - oldVerticesStart;
+ newGroup->updatePoint(pNew, group->restrictPoint(pOld));
+ } else if (_orderOldMesh->verticesCensored().hasPoint(pOld)) {
+ const point_type pNew = newVerticesCensoredStart + pOld - oldVerticesCensoredStart;
+ newGroup->updatePoint(pNew, group->restrictPoint(pOld));
+ } else {
+ throw ALE::Exception("Creating integer sections during refinement containing entities other than vertices not implemented.");
+ } // if/else
+ } // if
+ } // for
+ refiner.groupSetNewVertices(newGroup, group);
+ } // for
+} // _createIntSections
+
+// ----------------------------------------------------------------------
+// Create labels in new mesh.
+template<typename cellrefiner_type>
+void
+ALE::MeshRefiner<cellrefiner_type>::_createLabels(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner)
+{ // _createLabels
+ assert(!newMesh.isNull());
+ assert(!mesh.isNull());
+ assert(_orderOldMesh);
+ assert(_orderNewMesh);
+
+ typedef ALE::Interval<point_type> interval_type;
+
+ const mesh_type::labels_type labels = mesh->getLabels();
+ const mesh_type::labels_type::const_iterator labelsEnd = labels.end();
+ for (mesh_type::labels_type::const_iterator l_iter=labels.begin(); l_iter != labelsEnd; ++l_iter) {
+ // Handle censored depth separately.
+ if ("censored depth" == l_iter->first || "depth" == l_iter->first || "height" == l_iter->first) {
+ continue;
+ } // if
+
+ const Obj<mesh_type::label_type>& oldLabel = l_iter->second;
+ assert(!oldLabel.isNull());
+ const Obj<mesh_type::label_type>& newLabel = newMesh->createLabel(l_iter->first);
+ assert(!newLabel.isNull());
+
+ const int defaultValue = -999;
+
+ // Update cells
+ // Normal cells
+ interval_type::const_iterator pointsEnd = _orderOldMesh->cellsNormal().end();
+ for (interval_type::const_iterator p_iter = _orderOldMesh->cellsNormal().begin(); p_iter != pointsEnd; ++p_iter) {
+ const int value = mesh->getValue(oldLabel, *p_iter, defaultValue);
+ if (defaultValue == value)
+ continue;
+
+ const int numNewCellsPerCell = refiner.numNewCells(*p_iter);
+ mesh_type::point_type pNew = _orderNewMesh->cellsNormal().min() + (*p_iter - _orderOldMesh->cellsNormal().min())*numNewCellsPerCell;
+ for(int i=0; i < numNewCellsPerCell; ++i, ++pNew)
+ newMesh->setValue(newLabel, pNew, value);
+ } // for
+
+ // Censored cells
+ pointsEnd = _orderOldMesh->cellsCensored().end();
+ for (interval_type::const_iterator p_iter = _orderOldMesh->cellsCensored().begin(); p_iter != pointsEnd; ++p_iter) {
+ const int value = mesh->getValue(oldLabel, *p_iter, defaultValue);
+ if (defaultValue == value)
+ continue;
+
+ const int numNewCellsPerCell = refiner.numNewCells(*p_iter);
+ mesh_type::point_type pNew = _orderNewMesh->cellsCensored().min() + (*p_iter - _orderOldMesh->cellsCensored().min())*numNewCellsPerCell;
+ for(int i=0; i < numNewCellsPerCell; ++i, ++pNew)
+ newMesh->setValue(newLabel, pNew, value);
+ } // for
+
+ // Normal vertices
+ pointsEnd = _orderOldMesh->verticesNormal().end();
+ for (interval_type::const_iterator p_iter = _orderOldMesh->verticesNormal().begin(); p_iter != pointsEnd; ++p_iter) {
+ const int value = mesh->getValue(oldLabel, *p_iter, defaultValue);
+ if (defaultValue == value)
+ continue;
+
+ const mesh_type::point_type pNew = _orderNewMesh->verticesNormal().min() + (*p_iter - _orderOldMesh->verticesNormal().min());
+ newMesh->setValue(newLabel, pNew, value);
+ } // for
+
+ // Censored vertices
+ pointsEnd = _orderOldMesh->verticesCensored().end();
+ for (interval_type::const_iterator p_iter = _orderOldMesh->verticesCensored().begin(); p_iter != pointsEnd; ++p_iter) {
+ const int value = mesh->getValue(oldLabel, *p_iter, defaultValue);
+ if (defaultValue == value)
+ continue;
+
+ const mesh_type::point_type pNew = _orderNewMesh->verticesCensored().min() + (*p_iter - _orderOldMesh->verticesCensored().min());
+ newMesh->setValue(newLabel, pNew, value);
+ } // for
+
+ refiner.labelAddNewVertices(newMesh, mesh, l_iter->first.c_str());
+ } // for
+} // _createLabels
+
+// ----------------------------------------------------------------------
+// Calculate new overlap.
+template<typename cellrefiner_type>
+void
+ALE::MeshRefiner<cellrefiner_type>::_calcNewOverlap(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner)
+{ // _calcNewOverlap
+ assert(!newMesh.isNull());
+ assert(!mesh.isNull());
+
+ // Exchange new boundary vertices
+ // We can convert endpoints, and then just match to new vertex on this side
+ // 1) Create the overlap of edges which are vertex pairs (do not need for interpolated meshes)
+ // 2) Create a section of overlap edge --> new vertex (this will generalize to other split points in interpolated meshes)
+ // 3) Copy across new overlap
+ // 4) Fuse matches new vertex pairs and inserts them into the old overlap
+
+ // Create the parallel overlap
+
+ // Get offsets for points across processors and add points in overlap from original mesh to new overlap
+ int* oldVerticesStartP = (mesh->commSize() > 0) ? new int[mesh->commSize()] : 0;
+ int* newVerticesStartP = (newMesh->commSize() > 0) ? new int[newMesh->commSize()] : 0;
+ int ierr = 0;
+
+ const int oldVerticesStart = _orderOldMesh->verticesNormal().min();
+ const int newVerticesStart = _orderNewMesh->verticesNormal().min();
+
+ ierr = MPI_Allgather((void *) &oldVerticesStart, 1, MPI_INT, oldVerticesStartP, 1, MPI_INT, mesh->comm());CHKERRXX(ierr);
+ ierr = MPI_Allgather((void *) &newVerticesStart, 1, MPI_INT, newVerticesStartP, 1, MPI_INT, newMesh->comm());CHKERRXX(ierr);
+ Obj<mesh_type::send_overlap_type> newSendOverlap = newMesh->getSendOverlap();
+ Obj<mesh_type::recv_overlap_type> newRecvOverlap = newMesh->getRecvOverlap();
+ const Obj<mesh_type::send_overlap_type>& sendOverlap = mesh->getSendOverlap();
+ const Obj<mesh_type::recv_overlap_type>& recvOverlap = mesh->getRecvOverlap();
+ Obj<mesh_type::send_overlap_type::traits::capSequence> sendPoints = sendOverlap->cap();
+ const mesh_type::send_overlap_type::source_type localOffset = newVerticesStart - oldVerticesStart;
+
+ for(mesh_type::send_overlap_type::traits::capSequence::iterator p_iter = sendPoints->begin(); p_iter != sendPoints->end(); ++p_iter) {
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& ranks = sendOverlap->support(*p_iter);
+ const mesh_type::send_overlap_type::source_type& localPoint = *p_iter;
+
+ for(mesh_type::send_overlap_type::traits::supportSequence::iterator r_iter = ranks->begin(); r_iter != ranks->end(); ++r_iter) {
+ const int rank = *r_iter;
+ const mesh_type::send_overlap_type::source_type& remotePoint = r_iter.color();
+ const mesh_type::send_overlap_type::source_type remoteOffset = newVerticesStartP[rank] - oldVerticesStartP[rank];
+
+ newSendOverlap->addArrow(localPoint+localOffset, rank, remotePoint+remoteOffset);
+ } // for
+ } // for
+ Obj<mesh_type::recv_overlap_type::traits::baseSequence> recvPoints = recvOverlap->base();
+
+ for(mesh_type::recv_overlap_type::traits::baseSequence::iterator p_iter = recvPoints->begin(); p_iter != recvPoints->end(); ++p_iter) {
+ const Obj<mesh_type::recv_overlap_type::traits::coneSequence>& ranks = recvOverlap->cone(*p_iter);
+ const mesh_type::recv_overlap_type::target_type& localPoint = *p_iter;
+
+ for(mesh_type::recv_overlap_type::traits::coneSequence::iterator r_iter = ranks->begin(); r_iter != ranks->end(); ++r_iter) {
+ const int rank = *r_iter;
+ const mesh_type::recv_overlap_type::target_type& remotePoint = r_iter.color();
+ const mesh_type::recv_overlap_type::target_type remoteOffset = newVerticesStartP[rank] - oldVerticesStartP[rank];
+
+ newRecvOverlap->addArrow(rank, localPoint+localOffset, remotePoint+remoteOffset);
+ } // for
+ } // for
+ newMesh->setCalculatedOverlap(true);
+ delete [] oldVerticesStartP; oldVerticesStartP = PETSC_NULL;
+ delete [] newVerticesStartP; newVerticesStartP = PETSC_NULL;
+
+ refiner.overlapAddNewVertices(newMesh, *_orderNewMesh, mesh, *_orderOldMesh);
+} // _calcNewOverlap
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/MeshRefiner.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,143 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/MeshRefiner.hh
+ *
+ * @brief Object for refinement of cells.
+ */
+
+#if !defined(pylith_topology_meshrefiner_hh)
+#define pylith_topology_meshrefiner_hh
+
+// Include directives ---------------------------------------------------
+#include "topologyfwd.hh" // forward declarations
+
+// RefineTri3 --------------------------------------------------------
+/// Object for refinement of cells.
+template<typename cellrefiner_type>
+class ALE::MeshRefiner
+{ // MeshRefiner
+ typedef IMesh<> mesh_type;
+ typedef mesh_type::point_type point_type;
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /** Constructor
+ *
+ * @param mesh Finite-element mesh.
+ */
+ MeshRefiner(void);
+
+ /// Destructor
+ ~MeshRefiner(void);
+
+ /** Refine mesh.
+ *
+ * @param newMesh New mesh.
+ * @param mesh Current mesh.
+ * @param refiner Cell refiner.
+ */
+ void refine(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner);
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /** Refine mesh.
+ *
+ * @param newMesh New mesh.
+ * @param mesh Current mesh.
+ * @param refiner Cell refiner.
+ */
+ void _refine(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner);
+
+ /** Refine mesh with a censored depth.
+ *
+ * @param newMesh New mesh.
+ * @param mesh Current mesh.
+ * @param refiner Cell refiner.
+ */
+ void _refineCensored(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner);
+
+ /** Stratify mesh.
+ *
+ * @param mesh Mesh to stratify.
+ */
+ void _stratify(const Obj<mesh_type>& mesh);
+
+ /** Create integer sections in new mesh.
+ *
+ * :WARNING: Only implemented for integer sections containing vertices.
+ *
+ * @param newMesh New (refined) mesh.
+ * @param mesh Current (unrefined) mesh with integer sections.
+ * @param refiner Cell refiner.
+ */
+ void _createIntSections(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner);
+
+ /** Create labels in new mesh.
+ *
+ * :WARNING: Only implemented for integer sections containing vertices.
+ *
+ * @param newMesh New (refined) mesh.
+ * @param mesh Current (unrefined) mesh with integer sections.
+ * @param refiner Cell refiner.
+ */
+ void _createLabels(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner);
+
+ /** Calculate new overlap.
+ *
+ * @param newMesh New (refined) mesh.
+ * @param mesh Current (unrefined) mesh with overlap.
+ * @param refiner Cell refiner.
+ */
+ void _calcNewOverlap(const Obj<mesh_type>& newMesh,
+ const Obj<mesh_type>& mesh,
+ cellrefiner_type& refiner);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
+
+ MeshOrder* _orderOldMesh; ///< Order of entities in old mesh.
+ MeshOrder* _orderNewMesh; ///< Order of entities in new mesh.
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ MeshRefiner(const MeshRefiner&); ///< Not implemented
+ const MeshRefiner& operator=(const MeshRefiner&); ///< Not implemented
+
+}; // MeshRefiner
+
+#include "MeshRefiner.cc"
+
+#endif // pylith_topology_meshrefiner_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/RefineEdges2.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,297 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "RefineEdges2.hh" // implementation of class methods
+
+#include "MeshOrder.hh" // USES MeshOrder
+
+#include <cassert> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor
+ALE::RefineEdges2::RefineEdges2(const mesh_type& mesh) :
+ _mesh(mesh)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+ALE::RefineEdges2::~RefineEdges2(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Set coordinates of new vertices.
+void
+ALE::RefineEdges2::setCoordsNewVertices(const ALE::Obj<mesh_type::real_section_type>& newCoordsSection,
+ const ALE::Obj<mesh_type::real_section_type>& oldCoordsSection)
+{ // setCoordsNewVertices
+ assert(!newCoordsSection.isNull());
+ assert(!oldCoordsSection.isNull());
+
+ double coordinatesVertex[3];
+
+ assert(_edgeToVertex.size() > 0);
+ const int spaceDim = newCoordsSection->getFiberDimension(_edgeToVertex.begin()->second);
+ assert(spaceDim > 0 && spaceDim <= 3);
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertexA = e_iter->first.first;
+ const point_type edgeVertexB = e_iter->first.second;
+
+ assert(spaceDim == oldCoordsSection->getFiberDimension(edgeVertexA));
+ assert(spaceDim == oldCoordsSection->getFiberDimension(edgeVertexB));
+ assert(spaceDim == newCoordsSection->getFiberDimension(newVertex));
+
+ const mesh_type::real_section_type::value_type* coordsA = oldCoordsSection->restrictPoint(edgeVertexA);
+ const mesh_type::real_section_type::value_type* coordsB = oldCoordsSection->restrictPoint(edgeVertexB);
+ for (int i=0; i < spaceDim; ++i)
+ coordinatesVertex[i] = 0.5*(coordsA[i] + coordsB[i]);
+
+ newCoordsSection->updatePoint(newVertex, coordinatesVertex);
+ } // for
+} // setCoordsNewVertices
+
+// ----------------------------------------------------------------------
+// Add space for new vertices in group.
+void
+ALE::RefineEdges2::groupAddNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup)
+{ // groupAddNewVertices
+ assert(!newGroup.isNull());
+ assert(!oldGroup.isNull());
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertexA = e_iter->first.first;
+ const point_type edgeVertexB = e_iter->first.second;
+
+ if (oldGroup->getFiberDimension(edgeVertexA) && oldGroup->getFiberDimension(edgeVertexB)) {
+ if (oldGroup->restrictPoint(edgeVertexA)[0] == oldGroup->restrictPoint(edgeVertexB)[0]) {
+ newGroup->setFiberDimension(newVertex, 1);
+ } // if
+ } // if
+ } // for
+} // groupAddNewVertices
+
+// ----------------------------------------------------------------------
+// Set new vertices in group.
+void
+ALE::RefineEdges2::groupSetNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup)
+{ // groupSetNewVertices
+ assert(!newGroup.isNull());
+ assert(!oldGroup.isNull());
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertex = e_iter->first.first;
+
+ if (1 == newGroup->getFiberDimension(newVertex)) {
+ newGroup->updatePoint(newVertex, oldGroup->restrictPoint(edgeVertex));
+ std::cout << "Adding new vertex: " << newVertex << " based on edge " << e_iter->first << std::endl;
+ } // if
+ } // for
+} // groupSetNewVertices
+
+// ----------------------------------------------------------------------
+// Add new vertices to label.
+void
+ALE::RefineEdges2::labelAddNewVertices(const ALE::Obj<mesh_type>& newMesh,
+ const ALE::Obj<mesh_type>& oldMesh,
+ const char* labelName)
+{ // labelAddNewVertices
+ assert(!newMesh.isNull());
+ assert(!oldMesh.isNull());
+
+ const Obj<mesh_type::label_sequence>& oldLabelVertices = oldMesh->getLabelStratum(labelName, 0);
+ assert(!oldLabelVertices.isNull());
+
+ const Obj<mesh_type::label_type>& oldLabel = oldMesh->getLabel(labelName);
+ assert(!oldLabel.isNull());
+ const Obj<mesh_type::label_type>& newLabel = newMesh->getLabel(labelName);
+ assert(!newLabel.isNull());
+
+ const int defaultValue = -999;
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertexA = e_iter->first.first;
+ const point_type edgeVertexB = e_iter->first.second;
+
+ const int valueA = oldMesh->getValue(oldLabel, edgeVertexA, defaultValue);
+ const int valueB = oldMesh->getValue(oldLabel, edgeVertexB, defaultValue);
+
+ if (valueA != defaultValue && valueA == valueB) {
+ newMesh->setValue(newLabel, newVertex, valueA);
+ } // if
+ } // for
+} // labelAddNewVertices
+
+// ----------------------------------------------------------------------
+// Calculate new overlap.
+void
+ALE::RefineEdges2::overlapAddNewVertices(const Obj<mesh_type>& newMesh,
+ const MeshOrder& orderNewMesh,
+ const Obj<mesh_type>& oldMesh,
+ const MeshOrder& orderOldMesh)
+{ // overlapAddNewVertices
+ assert(!newMesh.isNull());
+ assert(!oldMesh.isNull());
+
+ Obj<mesh_type::send_overlap_type> newSendOverlap = newMesh->getSendOverlap();
+ assert(!newSendOverlap.isNull());
+ Obj<mesh_type::recv_overlap_type> newRecvOverlap = newMesh->getRecvOverlap();
+ assert(!newRecvOverlap.isNull());
+ const Obj<mesh_type::send_overlap_type>& oldSendOverlap = oldMesh->getSendOverlap();
+ assert(!oldSendOverlap.isNull());
+ const Obj<mesh_type::recv_overlap_type>& oldRecvOverlap = oldMesh->getRecvOverlap();
+ assert(!oldRecvOverlap.isNull());
+
+ int myrank = 0;
+ MPI_Comm_rank(oldMesh->comm(), &myrank);
+
+ // Check edges in edgeToVertex for both endpoints sent to same process
+ // Put it in section with point being the lowest numbered vertex and value (other endpoint, new vertex)
+ Obj<ALE::Section<point_type, EdgeType> > newVerticesSection = new ALE::Section<point_type, EdgeType>(oldMesh->comm());
+ assert(!newVerticesSection.isNull());
+ std::map<EdgeType, std::vector<int> > bndryEdgeToRank;
+
+ const int localNormalOffset = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+ const int localCensoredOffset = orderNewMesh.verticesCensored().min() - orderOldMesh.verticesCensored().min();
+
+ for(std::map<EdgeType, point_type>::const_iterator e_iter = _edgeToVertex.begin(); e_iter != _edgeToVertex.end(); ++e_iter) {
+ const point_type left = e_iter->first.first;
+ const point_type right = e_iter->first.second;
+
+ if (oldSendOverlap->capContains(left) && oldSendOverlap->capContains(right)) {
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanksSeq = oldSendOverlap->support(left);
+ assert(!leftRanksSeq.isNull());
+ std::list<int> leftRanks(leftRanksSeq->begin(), leftRanksSeq->end());
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks = oldSendOverlap->support(right);
+ assert(!rightRanks.isNull());
+ std::list<int> ranks;
+ std::set_intersection(leftRanks.begin(), leftRanks.end(), rightRanks->begin(), rightRanks->end(),
+ std::insert_iterator<std::list<int> >(ranks, ranks.begin()));
+
+ if(ranks.size()) {
+ const point_type edgeMin = std::min(e_iter->first.first, e_iter->first.second);
+ const int localMinOffset = (orderOldMesh.verticesNormal().hasPoint(edgeMin)) ? localNormalOffset : localCensoredOffset;
+ newVerticesSection->addFiberDimension(edgeMin+localMinOffset, 1);
+ for(std::list<int>::const_iterator r_iter = ranks.begin(); r_iter != ranks.end(); ++r_iter) {
+ bndryEdgeToRank[e_iter->first].push_back(*r_iter);
+ std::cout << "[" << myrank << "] Added edge " << e_iter->first << " with rank " << *r_iter << std::endl;
+ } // for
+ } // if
+ } // if
+ } // for
+ newVerticesSection->allocatePoint();
+ const ALE::Section<point_type, EdgeType>::chart_type& chart = newVerticesSection->getChart();
+
+ for(ALE::Section<point_type, EdgeType>::chart_type::const_iterator c_iter = chart.begin(); c_iter != chart.end(); ++c_iter) {
+ typedef ALE::Section<point_type, EdgeType>::value_type value_type;
+ const point_type p = *c_iter;
+ const int dim = newVerticesSection->getFiberDimension(p);
+ int v = 0;
+ value_type* values = (dim > 0) ? new value_type[dim] : 0;
+
+ for(std::map<EdgeType, std::vector<int> >::const_iterator e_iter = bndryEdgeToRank.begin(); e_iter != bndryEdgeToRank.end() && v < dim; ++e_iter) {
+ const point_type edgeMin = std::min(e_iter->first.first, e_iter->first.second);
+ const int localMinOffset = (orderOldMesh.verticesNormal().hasPoint(edgeMin)) ? localNormalOffset : localCensoredOffset;
+ const point_type edgeMax = std::max(e_iter->first.first, e_iter->first.second);
+ const int localMaxOffset = (orderOldMesh.verticesNormal().hasPoint(edgeMax)) ? localNormalOffset : localCensoredOffset;
+
+ if (edgeMin+localMinOffset == p) {
+ values[v++] = EdgeType(edgeMax+localMaxOffset, _edgeToVertex[e_iter->first]);
+ } // if
+ } // for
+ newVerticesSection->updatePoint(p, values);
+ delete [] values;
+ } // for
+ // Copy across overlap
+ typedef ALE::Pair<int, point_type> overlap_point_type;
+ Obj<ALE::Section<overlap_point_type, EdgeType> > overlapVertices = new ALE::Section<overlap_point_type, EdgeType>(oldMesh->comm());
+
+ ALE::Pullback::SimpleCopy::copy(newSendOverlap, newRecvOverlap, newVerticesSection, overlapVertices);
+ newVerticesSection->view("NEW VERTICES");
+ overlapVertices->view("OVERLAP VERTICES");
+
+ // Merge by translating edge to local points, finding edge in _edgeToVertex, and adding (local new vetex, remote new vertex) to overlap
+ for(std::map<EdgeType, std::vector<int> >::const_iterator e_iter = bndryEdgeToRank.begin(); e_iter != bndryEdgeToRank.end(); ++e_iter) {
+ const point_type newLocalPoint = _edgeToVertex[e_iter->first];
+
+ for(std::vector<int>::const_iterator r_iter = e_iter->second.begin(); r_iter != e_iter->second.end(); ++r_iter) {
+ point_type remoteLeft = -1, remoteRight = -1;
+ const int rank = *r_iter;
+
+ const int localFirstOffset = (orderOldMesh.verticesNormal().hasPoint(e_iter->first.first)) ? localNormalOffset : localCensoredOffset;
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localFirstOffset);
+ for(mesh_type::send_overlap_type::traits::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
+ if (rank == *lr_iter) {
+ remoteLeft = lr_iter.color();
+ break;
+ } // if
+ } // for
+ const int localSecondOffset = (orderOldMesh.verticesNormal().hasPoint(e_iter->first.second)) ? localNormalOffset : localCensoredOffset;
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localSecondOffset);
+ for(mesh_type::send_overlap_type::traits::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
+ if (rank == *rr_iter) {
+ remoteRight = rr_iter.color();
+ break;
+ } // if
+ } // for
+ const point_type remoteMin = std::min(remoteLeft, remoteRight);
+ const point_type remoteMax = std::max(remoteLeft, remoteRight);
+ const int remoteSize = overlapVertices->getFiberDimension(overlap_point_type(rank, remoteMin));
+ const EdgeType *remoteVals = overlapVertices->restrictPoint(overlap_point_type(rank, remoteMin));
+ point_type newRemotePoint = -1;
+
+ for(int d = 0; d < remoteSize; ++d) {
+ if (remoteVals[d].first == remoteMax) {
+ newRemotePoint = remoteVals[d].second;
+ break;
+ } // if
+ } // for
+ if (-1 == newRemotePoint) {
+ std::cout << "remoteLeft: " << remoteLeft
+ << ", remoteRight: " << remoteRight
+ << ", rank: " << rank
+ << ", remoteSize: " << remoteSize
+ << std::endl;
+ } // if
+ //assert(-1 != newRemotePoint);
+ newSendOverlap->addArrow(newLocalPoint, rank, newRemotePoint);
+ newRecvOverlap->addArrow(rank, newLocalPoint, newRemotePoint);
+ } // for
+ } // for
+
+ oldSendOverlap->view("OLD SEND OVERLAP");
+ oldRecvOverlap->view("OLD RECV OVERLAP");
+ newSendOverlap->view("NEW SEND OVERLAP");
+ newRecvOverlap->view("NEW RECV OVERLAP");
+} // overlapAddNewVertces
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/RefineEdges2.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineEdges2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,137 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/RefineEdges2.hh
+ *
+ * @brief Object for refinement of cells via refinement of edges
+ * comprised of two vertices.
+ */
+
+#if !defined(pylith_topology_refineedges2_hh)
+#define pylith_topology_refineedges2_hh
+
+// Include directives ---------------------------------------------------
+#include "topologyfwd.hh" // forward declarations
+
+#include <list> // USES std::pair
+
+// RefineEdges2 ------------------------------------------------------
+/// Object for tri3 refinement of cells.
+class ALE::RefineEdges2
+{ // RefineEdges2
+protected:
+
+ typedef IMesh<> mesh_type;
+ typedef mesh_type::point_type point_type;
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /** Constructor
+ *
+ * @param mesh Finite-element mesh.
+ */
+ RefineEdges2(const mesh_type& mesh);
+
+ /// Destructor
+ ~RefineEdges2(void);
+
+ /** Set coordinates of new vertices.
+ *
+ * @param newCoordsSection Coordinates of vertices in new mesh.
+ * @param oldCoordsSection Coordinates of vertices in original mesh.
+ */
+ void setCoordsNewVertices(const ALE::Obj<mesh_type::real_section_type>& newCoordsSection,
+ const ALE::Obj<mesh_type::real_section_type>& oldCoordsSection);
+
+ /** Add space for new vertices in group.
+ *
+ * @param newGroup Group in refine mesh.
+ * @param oldGroup Group in original mesh.
+ */
+ void groupAddNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup);
+
+ /** Set new vertices in group.
+ *
+ * @param newGroup Group in refine mesh.
+ * @param oldGroup Group in original mesh.
+ */
+ void groupSetNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup);
+
+ /** Add new vertices to label.
+ *
+ * @param newMesh Mesh with refined cells.
+ * @param oldMesh Original mesh.
+ * @param labelName Name of label.
+ */
+ void labelAddNewVertices(const ALE::Obj<mesh_type>& newMesh,
+ const ALE::Obj<mesh_type>& oldMesh,
+ const char* labelName);
+
+ /** Calculate new overlap.
+ *
+ * @param newMesh New (refined) mesh.
+ * @param orderNewMesh Order in new mesh.
+ * @param oldMesh Current (unrefined) mesh with overlap.
+ * @param orderOldMesh Order in old mesh.
+ */
+ void overlapAddNewVertices(const Obj<mesh_type>& newMesh,
+ const MeshOrder& orderNewMesh,
+ const Obj<mesh_type>& oldMesh,
+ const MeshOrder& orderOldMesh);
+
+// PROTECTED TYPEDEFS ///////////////////////////////////////////////////
+protected :
+
+ template<typename Point>
+ class Edge : public std::pair<Point, Point> {
+ public:
+ Edge() : std::pair<Point, Point>() {};
+ Edge(const Point l) : std::pair<Point, Point>(l, l) {};
+ Edge(const Point l, const Point r) : std::pair<Point, Point>(l, r) {};
+ ~Edge() {};
+ friend std::ostream& operator<<(std::ostream& stream, const Edge& edge) {
+ stream << "(" << edge.first << ", " << edge.second << ")";
+ return stream;
+ };
+ };
+
+ typedef Edge<point_type> EdgeType;
+ typedef std::map<EdgeType, point_type> edge_map_type;
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
+protected :
+
+ const mesh_type& _mesh;
+ edge_map_type _edgeToVertex;
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ RefineEdges2(const RefineEdges2&); ///< Not implemented
+ const RefineEdges2& operator=(const RefineEdges2&); ///< Not implemented
+
+}; // RefineEdges2
+
+#endif // pylith_topology_refineedges2_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/RefineFace4Edges2.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,343 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "RefineFace4Edges2.hh" // implementation of class methods
+
+#include "MeshOrder.hh" // USES MeshOrder
+
+#include <cassert> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor
+ALE::RefineFace4Edges2::RefineFace4Edges2(const mesh_type& mesh) :
+ _mesh(mesh)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+ALE::RefineFace4Edges2::~RefineFace4Edges2(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Set coordinates of new vertices.
+void
+ALE::RefineFace4Edges2::setCoordsNewVertices(const ALE::Obj<mesh_type::real_section_type>& newCoordsSection,
+ const ALE::Obj<mesh_type::real_section_type>& oldCoordsSection)
+{ // setCoordsNewVertices
+ assert(!newCoordsSection.isNull());
+ assert(!oldCoordsSection.isNull());
+
+ double coordinatesVertex[3];
+
+ assert(_edgeToVertex.size() > 0);
+ const int spaceDim = newCoordsSection->getFiberDimension(_edgeToVertex.begin()->second);
+ assert(spaceDim > 0 && spaceDim <= 3);
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertexA = e_iter->first.first;
+ const point_type edgeVertexB = e_iter->first.second;
+
+ assert(spaceDim == oldCoordsSection->getFiberDimension(edgeVertexA));
+ assert(spaceDim == oldCoordsSection->getFiberDimension(edgeVertexB));
+ assert(spaceDim == newCoordsSection->getFiberDimension(newVertex));
+
+ const mesh_type::real_section_type::value_type* coordsA = oldCoordsSection->restrictPoint(edgeVertexA);
+ const mesh_type::real_section_type::value_type* coordsB = oldCoordsSection->restrictPoint(edgeVertexB);
+ for (int i=0; i < spaceDim; ++i)
+ coordinatesVertex[i] = 0.5*(coordsA[i] + coordsB[i]);
+
+ newCoordsSection->updatePoint(newVertex, coordinatesVertex);
+ } // for
+
+ const face_map_type::const_iterator facesEnd = _faceToVertex.end();
+ for (face_map_type::const_iterator f_iter = _faceToVertex.begin(); f_iter != facesEnd; ++f_iter) {
+ const point_type newVertex = f_iter->second;
+
+ assert(spaceDim == newCoordsSection->getFiberDimension(newVertex));
+ for (int iDim=0; iDim < spaceDim; ++iDim)
+ coordinatesVertex[iDim] = 0.0;
+ for (int iVertex=0; iVertex < 4; ++iVertex) {
+ const point_type faceVertex = f_iter->first.points[iVertex];
+ assert(spaceDim == oldCoordsSection->getFiberDimension(faceVertex));
+
+ const mesh_type::real_section_type::value_type* coords = oldCoordsSection->restrictPoint(faceVertex);
+ for (int iDim=0; iDim < spaceDim; ++iDim)
+ coordinatesVertex[iDim] += 0.25*coords[iDim];
+ } // for
+ newCoordsSection->updatePoint(newVertex, coordinatesVertex);
+ } // for
+} // setCoordsNewVertices
+
+// ----------------------------------------------------------------------
+// Add space for new vertices in group.
+void
+ALE::RefineFace4Edges2::groupAddNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup)
+{ // groupAddNewVertices
+ assert(!newGroup.isNull());
+ assert(!oldGroup.isNull());
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertexA = e_iter->first.first;
+ const point_type edgeVertexB = e_iter->first.second;
+
+ if (oldGroup->getFiberDimension(edgeVertexA) && oldGroup->getFiberDimension(edgeVertexB)) {
+ if (oldGroup->restrictPoint(edgeVertexA)[0] == oldGroup->restrictPoint(edgeVertexB)[0]) {
+ newGroup->setFiberDimension(newVertex, 1);
+ } // if
+ } // if
+ } // for
+
+ const face_map_type::const_iterator facesEnd = _faceToVertex.end();
+ for (face_map_type::const_iterator f_iter = _faceToVertex.begin(); f_iter != facesEnd; ++f_iter) {
+ const point_type newVertex = f_iter->second;
+
+ bool hasFace = true;
+ for (int iVertex=0; iVertex < 4; ++iVertex) {
+ const point_type faceVertex = f_iter->first.points[iVertex];
+ if (!oldGroup->getFiberDimension(faceVertex)) {
+ hasFace = false;
+ break;
+ } // if
+ } // for
+ if (hasFace) {
+ newGroup->setFiberDimension(newVertex, 1);
+ } // if
+ } // for
+} // groupAddNewVertices
+
+// ----------------------------------------------------------------------
+// Set new vertices in group.
+void
+ALE::RefineFace4Edges2::groupSetNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup)
+{ // groupSetNewVertices
+ assert(!newGroup.isNull());
+ assert(!oldGroup.isNull());
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertex = e_iter->first.first;
+
+ if (1 == newGroup->getFiberDimension(newVertex)) {
+ newGroup->updatePoint(newVertex, oldGroup->restrictPoint(edgeVertex));
+ std::cout << "Adding new vertex: " << newVertex << " based on edge " << e_iter->first << std::endl;
+ } // if
+ } // for
+
+ const face_map_type::const_iterator facesEnd = _faceToVertex.end();
+ for (face_map_type::const_iterator f_iter = _faceToVertex.begin(); f_iter != facesEnd; ++f_iter) {
+ const point_type newVertex = f_iter->second;
+ const point_type faceVertex = f_iter->first.points[0];
+
+ if (1 == newGroup->getFiberDimension(newVertex)) {
+ newGroup->updatePoint(newVertex, oldGroup->restrictPoint(faceVertex));
+ std::cout << "Adding new vertex: " << newVertex << " based on face " << f_iter->first << std::endl;
+ } // if
+ } // for
+} // groupSetNewVertices
+
+// ----------------------------------------------------------------------
+// Add new vertices to label.
+void
+ALE::RefineFace4Edges2::labelAddNewVertices(const ALE::Obj<mesh_type>& newMesh,
+ const ALE::Obj<mesh_type>& oldMesh,
+ const char* labelName)
+{ // labelAddNewVertices
+ assert(!newMesh.isNull());
+ assert(!oldMesh.isNull());
+
+ const Obj<mesh_type::label_sequence>& oldLabelVertices = oldMesh->getLabelStratum(labelName, 0);
+ assert(!oldLabelVertices.isNull());
+
+ const Obj<mesh_type::label_type>& oldLabel = oldMesh->getLabel(labelName);
+ assert(!oldLabel.isNull());
+ const Obj<mesh_type::label_type>& newLabel = newMesh->getLabel(labelName);
+ assert(!newLabel.isNull());
+
+ const int defaultValue = -999;
+
+ const edge_map_type::const_iterator edgesEnd = _edgeToVertex.end();
+ for (edge_map_type::const_iterator e_iter = _edgeToVertex.begin(); e_iter != edgesEnd; ++e_iter) {
+ const point_type newVertex = e_iter->second;
+ const point_type edgeVertexA = e_iter->first.first;
+ const point_type edgeVertexB = e_iter->first.second;
+
+ const int valueA = oldMesh->getValue(oldLabel, edgeVertexA, defaultValue);
+ const int valueB = oldMesh->getValue(oldLabel, edgeVertexB, defaultValue);
+
+ if (valueA != defaultValue && valueA == valueB) {
+ newMesh->setValue(newLabel, newVertex, valueA);
+ } // if
+ } // for
+
+ const face_map_type::const_iterator facesEnd = _faceToVertex.end();
+ for (face_map_type::const_iterator f_iter = _faceToVertex.begin(); f_iter != facesEnd; ++f_iter) {
+ const point_type newVertex = f_iter->second;
+ const point_type faceVertex = f_iter->first.points[0];
+ const int value = oldMesh->getValue(oldLabel, faceVertex, defaultValue);
+
+ if (value != defaultValue) {
+ bool hasFace = true;
+ for (int iVertex=1; iVertex < 4; ++iVertex) {
+ const point_type faceVertex2 = f_iter->first.points[iVertex];
+ const int value2 = oldMesh->getValue(oldLabel, faceVertex2, defaultValue);
+ if (value2 != value) {
+ hasFace = false;
+ break;
+ } // if
+ } // for
+ if (hasFace) {
+ newMesh->setValue(newLabel, newVertex, value);
+ } // if
+ } // if
+ } // for
+} // labelAddNewVertices
+
+// ----------------------------------------------------------------------
+// Calculate new overlap.
+void
+ALE::RefineFace4Edges2::overlapAddNewVertices(const Obj<mesh_type>& newMesh,
+ const MeshOrder& orderNewMesh,
+ const Obj<mesh_type>& oldMesh,
+ const MeshOrder& orderOldMesh)
+{ // overlapAddNewVertices
+ assert(!newMesh.isNull());
+ assert(!oldMesh.isNull());
+
+ // :TODO: Add face vertices
+
+ Obj<mesh_type::send_overlap_type> newSendOverlap = newMesh->getSendOverlap();
+ assert(!newSendOverlap.isNull());
+ Obj<mesh_type::recv_overlap_type> newRecvOverlap = newMesh->getRecvOverlap();
+ assert(!newRecvOverlap.isNull());
+ const Obj<mesh_type::send_overlap_type>& oldSendOverlap = oldMesh->getSendOverlap();
+ assert(!oldSendOverlap.isNull());
+ const Obj<mesh_type::recv_overlap_type>& oldRecvOverlap = oldMesh->getRecvOverlap();
+ assert(!oldRecvOverlap.isNull());
+
+
+ // Check edges in edgeToVertex for both endpoints sent to same process
+ // Put it in section with point being the lowest numbered vertex and value (other endpoint, new vertex)
+ Obj<ALE::Section<point_type, EdgeType> > newVerticesSection = new ALE::Section<point_type, EdgeType>(oldMesh->comm());
+ assert(!newVerticesSection.isNull());
+ std::map<EdgeType, std::vector<int> > bndryEdgeToRank;
+
+ const int localOffset = orderNewMesh.verticesNormal().min() - orderOldMesh.verticesNormal().min();
+
+ for(std::map<EdgeType, point_type>::const_iterator e_iter = _edgeToVertex.begin(); e_iter != _edgeToVertex.end(); ++e_iter) {
+ const point_type left = e_iter->first.first;
+ const point_type right = e_iter->first.second;
+
+ if (oldSendOverlap->capContains(left) && oldSendOverlap->capContains(right)) {
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanksSeq = oldSendOverlap->support(left);
+ assert(!leftRanksSeq.isNull());
+ std::list<int> leftRanks(leftRanksSeq->begin(), leftRanksSeq->end());
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks = oldSendOverlap->support(right);
+ assert(!rightRanks.isNull());
+ std::list<int> ranks;
+ std::set_intersection(leftRanks.begin(), leftRanks.end(), rightRanks->begin(), rightRanks->end(),
+ std::insert_iterator<std::list<int> >(ranks, ranks.begin()));
+
+ if(ranks.size()) {
+ newVerticesSection->addFiberDimension(std::min(e_iter->first.first, e_iter->first.second)+localOffset, 1);
+ for(std::list<int>::const_iterator r_iter = ranks.begin(); r_iter != ranks.end(); ++r_iter) {
+ bndryEdgeToRank[e_iter->first].push_back(*r_iter);
+ } // for
+ } // if
+ } // if
+ } // for
+ newVerticesSection->allocatePoint();
+ const ALE::Section<point_type, EdgeType>::chart_type& chart = newVerticesSection->getChart();
+
+ for(ALE::Section<point_type, EdgeType>::chart_type::const_iterator c_iter = chart.begin(); c_iter != chart.end(); ++c_iter) {
+ typedef ALE::Section<point_type, EdgeType>::value_type value_type;
+ const point_type p = *c_iter;
+ const int dim = newVerticesSection->getFiberDimension(p);
+ int v = 0;
+ value_type* values = (dim > 0) ? new value_type[dim] : 0;
+
+ for(std::map<EdgeType, std::vector<int> >::const_iterator e_iter = bndryEdgeToRank.begin(); e_iter != bndryEdgeToRank.end() && v < dim; ++e_iter) {
+ if (std::min(e_iter->first.first, e_iter->first.second)+localOffset == p) {
+ values[v++] = EdgeType(std::max(e_iter->first.first, e_iter->first.second)+localOffset, _edgeToVertex[e_iter->first]);
+ } // if
+ } // for
+ newVerticesSection->updatePoint(p, values);
+ delete [] values;
+ } // for
+ // Copy across overlap
+ typedef ALE::Pair<int, point_type> overlap_point_type;
+ Obj<ALE::Section<overlap_point_type, EdgeType> > overlapVertices = new ALE::Section<overlap_point_type, EdgeType>(oldMesh->comm());
+
+ ALE::Pullback::SimpleCopy::copy(newSendOverlap, newRecvOverlap, newVerticesSection, overlapVertices);
+ // Merge by translating edge to local points, finding edge in _edgeToVertex, and adding (local new vetex, remote new vertex) to overlap
+ for(std::map<EdgeType, std::vector<int> >::const_iterator e_iter = bndryEdgeToRank.begin(); e_iter != bndryEdgeToRank.end(); ++e_iter) {
+ const point_type localPoint = _edgeToVertex[e_iter->first];
+
+ for(std::vector<int>::const_iterator r_iter = e_iter->second.begin(); r_iter != e_iter->second.end(); ++r_iter) {
+ point_type remoteLeft = -1, remoteRight = -1;
+ const int rank = *r_iter;
+
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& leftRanks = newSendOverlap->support(e_iter->first.first+localOffset);
+ for(mesh_type::send_overlap_type::traits::supportSequence::iterator lr_iter = leftRanks->begin(); lr_iter != leftRanks->end(); ++lr_iter) {
+ if (rank == *lr_iter) {
+ remoteLeft = lr_iter.color();
+ break;
+ } // if
+ } // for
+ const Obj<mesh_type::send_overlap_type::traits::supportSequence>& rightRanks = newSendOverlap->support(e_iter->first.second+localOffset);
+ for(mesh_type::send_overlap_type::traits::supportSequence::iterator rr_iter = rightRanks->begin(); rr_iter != rightRanks->end(); ++rr_iter) {
+ if (rank == *rr_iter) {
+ remoteRight = rr_iter.color();
+ break;
+ } // if
+ } // for
+ const point_type remoteMin = std::min(remoteLeft, remoteRight);
+ const point_type remoteMax = std::max(remoteLeft, remoteRight);
+ const int remoteSize = overlapVertices->getFiberDimension(overlap_point_type(rank, remoteMin));
+ const EdgeType *remoteVals = overlapVertices->restrictPoint(overlap_point_type(rank, remoteMin));
+ point_type remotePoint = -1;
+
+ for(int d = 0; d < remoteSize; ++d) {
+ if (remoteVals[d].first == remoteMax) {
+ remotePoint = remoteVals[d].second;
+ break;
+ } // if
+ } // for
+ newSendOverlap->addArrow(localPoint, rank, remotePoint);
+ newRecvOverlap->addArrow(rank, localPoint, remotePoint);
+ } // for
+ } // for
+
+ oldSendOverlap->view("OLD SEND OVERLAP");
+ oldRecvOverlap->view("OLD RECV OVERLAP");
+ newSendOverlap->view("NEW SEND OVERLAP");
+ newRecvOverlap->view("NEW RECV OVERLAP");
+} // overlapAddNewVertces
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/RefineFace4Edges2.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineFace4Edges2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,198 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/RefineFace4Edges2.hh
+ *
+ * @brief Object for refinement of cells via refinement of edges
+ * comprised of two vertices.
+ */
+
+#if !defined(pylith_topology_refineface4edges2_hh)
+#define pylith_topology_refineface4edges2_hh
+
+// Include directives ---------------------------------------------------
+#include "topologyfwd.hh" // forward declarations
+
+#include <list> // USES std::pair
+
+// RefineFace4Edges2 ------------------------------------------------------
+/// Object for tri3 refinement of cells.
+class ALE::RefineFace4Edges2
+{ // RefineFace4Edges2
+protected:
+
+ typedef IMesh<> mesh_type;
+ typedef mesh_type::point_type point_type;
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /** Constructor
+ *
+ * @param mesh Finite-element mesh.
+ */
+ RefineFace4Edges2(const mesh_type& mesh);
+
+ /// Destructor
+ ~RefineFace4Edges2(void);
+
+ /** Set coordinates of new vertices.
+ *
+ * @param newCoordsSection Coordinates of vertices in new mesh.
+ * @param oldCoordsSection Coordinates of vertices in original mesh.
+ */
+ void setCoordsNewVertices(const ALE::Obj<mesh_type::real_section_type>& newCoordsSection,
+ const ALE::Obj<mesh_type::real_section_type>& oldCoordsSection);
+
+ /** Add space for new vertices in group.
+ *
+ * @param newGroup Group in refine mesh.
+ * @param oldGroup Group in original mesh.
+ */
+ void groupAddNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup);
+
+ /** Set new vertices in group.
+ *
+ * @param newGroup Group in refine mesh.
+ * @param oldGroup Group in original mesh.
+ */
+ void groupSetNewVertices(const ALE::Obj<mesh_type::int_section_type>& newGroup,
+ const ALE::Obj<mesh_type::int_section_type>& oldGroup);
+
+ /** Add new vertices to label.
+ *
+ * @param newMesh Mesh with refined cells.
+ * @param oldMesh Original mesh.
+ * @param labelName Name of label.
+ */
+ void labelAddNewVertices(const ALE::Obj<mesh_type>& newMesh,
+ const ALE::Obj<mesh_type>& oldMesh,
+ const char* labelName);
+
+ /** Calculate new overlap.
+ *
+ * @param newMesh New (refined) mesh.
+ * @param orderNewMesh Order in new mesh.
+ * @param oldMesh Current (unrefined) mesh with overlap.
+ * @param orderOldMesh Order in old mesh.
+ */
+ void overlapAddNewVertices(const Obj<mesh_type>& newMesh,
+ const MeshOrder& orderNewMesh,
+ const Obj<mesh_type>& oldMesh,
+ const MeshOrder& orderOldMesh);
+
+// PROTECTED TYPEDEFS ///////////////////////////////////////////////////
+protected :
+
+ template<typename Point>
+ class Edge : public std::pair<Point, Point> {
+ public:
+ Edge(void) : std::pair<Point, Point>() {};
+ Edge(const Point l) : std::pair<Point, Point>(l, l) {};
+ Edge(const Point l, const Point r) : std::pair<Point, Point>(l, r) {};
+ ~Edge(void) {};
+ friend std::ostream& operator<<(std::ostream& stream, const Edge& edge) {
+ stream << "(" << edge.first << ", " << edge.second << ")";
+ return stream;
+ };
+ };
+ typedef Edge<point_type> EdgeType;
+ typedef std::map<EdgeType, point_type> edge_map_type;
+
+ template<typename Point>
+ class Face {
+ public:
+ Face(void) {};
+ Face(const Point p) {
+ points[0] = p;
+ points[1] = p;
+ points[2] = p;
+ points[3] = p;
+ };
+ Face(const Point p0,
+ const Point p1,
+ const Point p2,
+ const Point p3) {
+ points[0] = p0;
+ points[1] = p1;
+ points[2] = p2;
+ points[3] = p3;
+ };
+ ~Face(void) {};
+ friend bool operator==(const Face& a, const Face& b) {
+ const bool result =
+ a.points[0] == b.points[0] &&
+ a.points[1] == b.points[1] &&
+ a.points[2] == b.points[2] &&
+ a.points[3] == b.points[3];
+ return result;
+ };
+ friend bool operator<(const Face& a, const Face& b) {
+ if (a.points[0] < b.points[0]) {
+ return true;
+ } else if (a.points[0] == b.points[0]) {
+ if (a.points[1] < b.points[1]) {
+ return true;
+ } else if (a.points[1] == b.points[1]) {
+ if (a.points[2] < b.points[2]) {
+ return true;
+ } else if (a.points[2] == b.points[2]) {
+ if (a.points[3] < b.points[3]) {
+ return true;
+ } // if
+ } // if/else
+ } // if/else
+ } // if/else
+
+ return false;
+ };
+ friend std::ostream& operator<<(std::ostream& stream, const Face& face) {
+ stream << "(" << face.points[0]
+ << ", " << face.points[1]
+ << ", " << face.points[2]
+ << ", " << face.points[3]
+ << ")";
+ return stream;
+ };
+ public:
+ int points[4];
+ };
+ typedef Face<point_type> FaceType;
+ typedef std::map<FaceType, point_type> face_map_type;
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
+protected :
+
+ const mesh_type& _mesh;
+ edge_map_type _edgeToVertex;
+ face_map_type _faceToVertex;
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ RefineFace4Edges2(const RefineFace4Edges2&); ///< Not implemented
+ const RefineFace4Edges2& operator=(const RefineFace4Edges2&); ///< Not implemented
+
+}; // RefineFace4Edges2
+
+#endif // pylith_topology_refineface4edges2_hh
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -22,6 +22,11 @@
#include "Mesh.hh" // USES Mesh
+#include "CellRefinerTri3.hh" // USES CellRefinerTri3
+#include "CellRefinerTet4.hh" // USES CellRefinerTet4
+#include "CellRefinerQuad4.hh" // USES CellRefinerQuad4
+#include "MeshRefiner.hh" // USES MeshRefiner
+
#include <stdexcept> // USES std::runtime_error
#include <sstream> // USES std::ostringstream
#include <cassert> // USES assert()
@@ -30,20 +35,6 @@
typedef pylith::topology::Mesh::SieveMesh SieveMesh;
// ----------------------------------------------------------------------
-template<typename Point>
-class Edge : public std::pair<Point, Point> {
-public:
- Edge() : std::pair<Point, Point>() {};
- Edge(const Point l) : std::pair<Point, Point>(l, l) {};
- Edge(const Point l, const Point r) : std::pair<Point, Point>(l, r) {};
- ~Edge() {};
- friend std::ostream& operator<<(std::ostream& stream, const Edge& edge) {
- stream << "(" << edge.first << ", " << edge.second << ")";
- return stream;
- };
-};
-
-// ----------------------------------------------------------------------
// Constructor
pylith::topology::RefineUniform::RefineUniform(void)
{ // constructor
@@ -64,142 +55,71 @@
{ // refine
assert(0 != newMesh);
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- assert(!sieveMesh.isNull());
-
- const ALE::Obj<SieveMesh::label_sequence>& cells =
- sieveMesh->heightStratum(0);
- assert(!cells.isNull());
-
- newMesh->debug(mesh.debug());
-
- // Assume number of corners per cell is the same for the entire mesh
- assert(cells->size() > 0);
- const int cellNumCorners = sieveMesh->getNumCellCorners(*cells->begin());
-
- if (3 == mesh.dimension() && 4 == cellNumCorners)
- _refineTet4(newMesh, mesh, levels);
-
- // TODO: Add other refinement cases here
-
- else {
- std::ostringstream msg;
- msg << "Unknown case for uniform global refinement.\n"
- << "mesh dimension: " << mesh.dimension()
- << ", number of corners in cell: " << cellNumCorners;
- throw std::runtime_error(msg.str());
- } // else
-} // refine
-
-
-// ----------------------------------------------------------------------
-// Refine tet4 mesh.
-void
-pylith::topology::RefineUniform::_refineTet4(Mesh* const newMesh,
- const Mesh& mesh,
- const int levels)
-{ // _refineTet4
- assert(0 != newMesh);
-
typedef SieveMesh::point_type point_type;
- typedef Edge<point_type> edge_type;
const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
assert(!sieveMesh.isNull());
const ALE::Obj<SieveMesh>& newSieveMesh = newMesh->sieveMesh();
assert(!newSieveMesh.isNull());
-
- std::map<edge_type, point_type> edge2vertex;
-
-#if 0 // ORIGINAL VERSION
ALE::Obj<SieveMesh::sieve_type> newSieve =
new SieveMesh::sieve_type(mesh.comm(), mesh.debug());
-
newSieveMesh->setSieve(newSieve);
- ALE::MeshBuilder<Mesh>::refineTetrahedra(*mesh.sieveMesh(), * newSieveMesh,
- edge2vertex);
-#else
-#if 0 // DON'T KNOW NEW INTERFACE
- // Is arg to CellRefiner constructor the new mesh or the old mesh?
- ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type> refiner(*newSieveMesh);
+
+ const Obj<SieveMesh::label_sequence>& cells = sieveMesh->heightStratum(0);
+ assert(!cells.isNull());
+ assert(cells->size() > 0);
- ALE::MeshBuilder<SieveMesh>::refineGeneral< SieveMesh,
- ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type> >(*sieveMesh, *newSieveMesh, refiner);
-#endif
-#endif
+ const int numCorners = sieveMesh->getNumCellCorners();
+ const int dim = mesh.dimension();
- // Fix material ids
- const int numCells = sieveMesh->heightStratum(0)->size();
- const ALE::Obj<SieveMesh::label_type>& materials =
- sieveMesh->getLabel("material-id");
- const ALE::Obj<SieveMesh::label_type>& newMaterials =
- newSieveMesh->createLabel("material-id");
-
- const int numNewCellsPerCell = 8; // :KLUDGE: depends on levels
- for(int icell=0; icell < numCells; ++icell) {
- const int material = sieveMesh->getValue(materials, icell);
+ switch (dim) {
+ case 0:
+ case 1:
+ throw std::runtime_error("Uniform refinement not implemented.");
+ break;
+
+ case 2:
+ switch (numCorners) {
+ case 3: {
+ ALE::CellRefinerTri3 cellSplitter(*sieveMesh);
+ ALE::MeshRefiner<ALE::CellRefinerTri3> refinement;
+ refinement.refine(newSieveMesh, sieveMesh, cellSplitter);
+ break;
+ } // case 3
+ case 4: {
+ ALE::CellRefinerQuad4 cellSplitter(*sieveMesh);
+ ALE::MeshRefiner<ALE::CellRefinerQuad4> refinement;
+ refinement.refine(newSieveMesh, sieveMesh, cellSplitter);
+ break;
+ } // case 4
+ default :
+ throw std::runtime_error("Unknown number of corners for cells.");
+ } // switch
+ break;
- for(int i=0; i < numNewCellsPerCell; ++i)
- newSieveMesh->setValue(newMaterials, icell*8+i, material);
- } // for
-
- // Fix groups, assuming vertex groups
- const int numNewVertices = newSieveMesh->depthStratum(0)->size();
- const int numNewCells = newSieveMesh->heightStratum(0)->size();
- const ALE::Obj<std::set<std::string> >& sectionNames =
- sieveMesh->getIntSections();
-
- const std::set<std::string>::const_iterator namesBegin =
- sectionNames->begin();
- const std::set<std::string>::const_iterator namesEnd =
- sectionNames->end();
- for (std::set<std::string>::const_iterator name=namesBegin;
- name != namesEnd;
- ++name) {
- const ALE::Obj<Mesh::IntSection>& group = sieveMesh->getIntSection(*name);
- const ALE::Obj<Mesh::IntSection>& newGroup =
- newSieveMesh->getIntSection(*name);
- const Mesh::IntSection::chart_type& chart = group->getChart();
-
- newGroup->setChart(Mesh::IntSection::chart_type(numNewCells,
- numNewCells + numNewVertices));
- const Mesh::IntSection::chart_type& newChart = newGroup->getChart();
-
- const int chartMax = chart.max();
- for (int p = chart.min(), pNew = newChart.min(); p < chartMax; ++p, ++pNew) {
- if (group->getFiberDimension(p))
- newGroup->setFiberDimension(pNew, 1);
- } // for
- const std::map<edge_type, point_type>::const_iterator edge2VertexEnd =
- edge2vertex.end();
- for (std::map<edge_type, point_type>::const_iterator e_iter=edge2vertex.begin();
- e_iter != edge2VertexEnd;
- ++e_iter) {
- const point_type vertexA = e_iter->first.first;
- const point_type vertexB = e_iter->first.second;
-
- if (group->getFiberDimension(vertexA) && group->getFiberDimension(vertexB))
- if (group->restrictPoint(vertexA)[0] == group->restrictPoint(vertexB)[0])
- newGroup->setFiberDimension(e_iter->second, 1);
- } // for
+ case 3:
+ switch (numCorners) {
+ case 4: {
+ ALE::CellRefinerTet4 cellSplitter(*sieveMesh);
+ ALE::MeshRefiner<ALE::CellRefinerTet4> refinement;
+ refinement.refine(newSieveMesh, sieveMesh, cellSplitter);
+ break;
+ } // case 4
+ case 8: {
+ throw std::logic_error("Not implemented.");
+ break;
+ } // case 4
+ default :
+ throw std::runtime_error("Unknown number of corners for cells.");
+ } // switch
+ break;
- newGroup->allocatePoint();
- for (int p=chart.min(), pNew = newChart.min(); p < chartMax; ++p, ++pNew) {
- if (group->getFiberDimension(p))
- newGroup->updatePoint(pNew, group->restrictPoint(p));
- } // for
- for (std::map<edge_type, point_type>::const_iterator e_iter=edge2vertex.begin();
- e_iter != edge2VertexEnd;
- ++e_iter) {
- const point_type vertexA = e_iter->first.first;
- const point_type vertexB = e_iter->first.second;
-
- if (group->getFiberDimension(vertexA) && group->getFiberDimension(vertexB))
- if (group->restrictPoint(vertexA)[0] == group->restrictPoint(vertexB)[0])
- newGroup->updatePoint(e_iter->second, group->restrictPoint(vertexA));
- } // for
- } // for
-} // _refineTet4
+ default :
+ throw std::logic_error("Unknown dimension.");
+ } // switch
+ newMesh->view("REFINED MESH");
+} // refine
+
// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/RefineUniform.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -53,19 +53,6 @@
const Mesh& mesh,
const int levels =2);
-// PRIVATE MEMBERS //////////////////////////////////////////////////////
-private :
-
- /** Refine tet4 mesh.
- *
- * @param newMesh Refined mesh (result).
- * @param mesh Mesh to refine.
- * @param levels Number of levels to refine.
- */
- void _refineTet4(Mesh* const newMesh,
- const Mesh& mesh,
- const int levels =2);
-
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -93,8 +93,8 @@
_mesh->setRealSection("coordinates",
meshSieveMesh->getRealSection("coordinates"));
if (meshSieveMesh->hasRealSection("coordinates_dimensioned"))
- _mesh->setRealSection("coordinates_dimensioned",
- meshSieveMesh->getRealSection("coordinates_dimensioned"));
+ _mesh->setRealSection("coordinates_dimensioned",
+ meshSieveMesh->getRealSection("coordinates_dimensioned"));
// Create the parallel overlap
const ALE::Obj<SieveMesh::sieve_type>& sieve = _mesh->getSieve();
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -45,18 +45,17 @@
// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
public:
+ // Sieve mesh for higher level domain (mesh, not submesh)
+ typedef Mesh::SieveMesh DomainSieveMesh;
+
// Typedefs for basic types associated with Sieve mesh.
// SieveMesh, RealSection, and IntSection are used in templated code.
typedef Mesh::SieveSubMesh SieveMesh;
- typedef Mesh::RealSection RealSection;
+
typedef Mesh::IntSection IntSection;
- typedef Mesh::RestrictVisitor RestrictVisitor;
- typedef Mesh::UpdateAddVisitor UpdateAddVisitor;
- typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveMesh::order_type,PetscInt> IndicesVisitor;
+ typedef Mesh::RealSection RealSection;
+ typedef Mesh::RealUniformSection RealUniformSection;
- // Sieve mesh for higher level domain (mesh, not submesh)
- typedef Mesh::SieveMesh DomainSieveMesh;
-
// PUBLIC METHODS ///////////////////////////////////////////////////////
public :
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.cc (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/UniformSectionDS.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,771 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include <cassert> // USES assert()
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::IUniformSectionDS(MPI_Comm comm,
+ const int fiberDim,
+ const int debug) :
+ ParallelObject(comm, debug)
+{ // constructor
+ if (fiberDim <= 0) {
+ std::ostringstream msg;
+ msg << "Fiber dimension '" << fiberDim << "' for section must be positive.";
+ throw ALE::Exception(msg.str().c_str());
+ } // if
+ _fiberDim = fiberDim;
+
+ atlas_ptr pAtlas = atlas_alloc_type(this->_allocator).allocate(1);
+ atlas_alloc_type(this->_allocator).construct(pAtlas, atlas_type(comm, debug));
+ this->_atlas = Obj<atlas_type>(pAtlas, sizeof(atlas_type));
+ this->_array = NULL;
+ this->_emptyValue.v = new value_type[fiberDim];
+ for(int i = 0; i < fiberDim; ++i)
+ this->_emptyValue.v[i] = value_type();
+} // constructor
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::IUniformSectionDS(MPI_Comm comm,
+ const int fiberDim,
+ const point_type& min,
+ const point_type& max,
+ const int debug) :
+ ParallelObject(comm, debug)
+{ // constructor
+ if (fiberDim <= 0) {
+ std::ostringstream msg;
+ msg << "Fiber dimension '" << fiberDim << "' for section must be positive.";
+ throw ALE::Exception(msg.str().c_str());
+ } // if
+ _fiberDim = fiberDim;
+
+ atlas_ptr pAtlas = atlas_alloc_type(this->_allocator).allocate(1);
+ atlas_alloc_type(this->_allocator).construct(pAtlas,
+ atlas_type(comm, min, max, fiberDim, debug));
+ this->_atlas = Obj<atlas_type>(pAtlas, sizeof(atlas_type));
+ this->_array = NULL;
+ this->_emptyValue.v = new value_type[fiberDim];
+ for(int i = 0; i < fiberDim; ++i)
+ this->_emptyValue.v[i] = value_type();
+} // constructor
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::IUniformSectionDS(const Obj<atlas_type>& atlas,
+ const int fiberDim) :
+ ParallelObject(atlas->comm(), atlas->debug()), _atlas(atlas)
+{ // constructor
+ if (fiberDim <= 0) {
+ std::ostringstream msg;
+ msg << "Fiber dimension '" << fiberDim << "' for section must be positive.";
+ throw ALE::Exception(msg.str().c_str());
+ } // if
+ _fiberDim = fiberDim;
+
+ this->_atlas->update(*this->_atlas->getChart().begin(), &fiberDim);
+ this->_array = NULL;
+ this->_emptyValue.v = new value_type[fiberDim];
+ for(int i = 0; i < fiberDim; ++i)
+ this->_emptyValue.v[i] = value_type();
+} // constructor
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::~IUniformSectionDS(void)
+{ // destructor
+ delete[] this->_emptyValue.v; this->_emptyValue.v = NULL;
+
+ if (this->_array) {
+ const int chartEnd = this->getChart().max()*_fiberDim;
+ for(int i = this->getChart().min()*_fiberDim;
+ i < chartEnd;
+ ++i)
+ this->_allocator.destroy(this->_array+i);
+ this->_array += this->getChart().min()*_fiberDim;
+ this->_allocator.deallocate(this->_array, this->sizeWithBC());
+ this->_array = NULL;
+ this->_atlas = NULL;
+ } // if
+} // destructor
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+typename ALE::IUniformSectionDS<point_type, value_type, alloc_type>::value_type*
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getRawArray(const int size)
+{ // getRawArray
+ static value_type* array = NULL;
+ static int maxSize = 0;
+
+ if (size > maxSize) {
+ const value_type dummy(0);
+
+ if (array) {
+ for(int i = 0; i < maxSize; ++i)
+ this->_allocator.destroy(array+i);
+ this->_allocator.deallocate(array, maxSize);
+ } // if
+ maxSize = size;
+ array = this->_allocator.allocate(maxSize);
+ for (int i = 0; i < maxSize; ++i)
+ this->_allocator.construct(array+i, dummy);
+ }
+ return array;
+} // getRawArray
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+bool
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::hasPoint(const point_type& point) const
+{ // hasPoint
+ return this->_atlas->hasPoint(point);
+} // hasPoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::checkDimension(const int& dim)
+{ // checkDimension
+ if (dim != _fiberDim) {
+ ostringstream msg;
+ msg << "Invalid fiber dimension '" << dim << "' must be '" << _fiberDim
+ << "'." << std::endl;
+ throw ALE::Exception(msg.str().c_str());
+ } // if
+} // checkDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+const typename ALE::IUniformSectionDS<point_type, value_type, alloc_type>::chart_type&
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getChart(void) const
+{ // getChart
+ return this->_atlas->getChart();
+} // getChart
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setChart(const chart_type& chart)
+{ // setChart
+ this->_atlas->setChart(chart);
+ int dim = _fiberDim;
+ this->_atlas->updatePoint(*this->getChart().begin(), &dim);
+
+ const int numSpaces = this->_spaces.size();
+ for(int i=0; i < numSpaces; ++i)
+ this->_spaces[i]->setChart(chart);
+} // setChart
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+bool
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::resizeChart(const chart_type& chart)
+{ // resizeChart
+ if ((chart.min() >= this->getChart().min()) &&
+ (chart.max() <= this->getChart().max()))
+ return false;
+ this->setChart(chart);
+ return true;
+} // resizeChart
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+const ALE::Obj<typename ALE::IUniformSectionDS<point_type, value_type, alloc_type>::atlas_type>&
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getAtlas(void) const
+{ // getAtlas
+ return this->_atlas;
+} // getAtlas
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setAtlas(const Obj<atlas_type>& atlas)
+{ // setAtlas
+ this->_atlas = atlas;
+} // setAtlas
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::addPoint(const point_type& point)
+{ // addPoint
+ this->setFiberDimension(point, _fiberDim);
+} // addPoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+template<typename Points>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::addPoint(const Obj<Points>& points) {
+ const typename Points::const_iterator pointsEnd = points->end();
+ for(typename Points::iterator p_iter=points->begin();
+ p_iter != pointsEnd;
+ ++p_iter)
+ this->setFiberDimension(*p_iter, _fiberDim);
+} // addPoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::copy(const Obj<IUniformSectionDS>& section)
+{ // copy
+ this->getAtlas()->copy(section->getAtlas());
+ const chart_type& chart = section->getChart();
+
+ const typename chart_type::const_iterator chartEnd = chart.end();
+ for(typename chart_type::const_iterator c_iter=chart.begin();
+ c_iter != chartEnd;
+ ++c_iter)
+ this->updatePoint(*c_iter, section->restrictPoint(*c_iter));
+} // copy
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+const typename ALE::IUniformSectionDS<point_type, value_type, alloc_type>::value_type*
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getDefault(void) const
+{ // getDefault
+ return this->_emptyValue.v;
+} // getDefault
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setDefault(const value_type v[])
+{ // setDefault
+ for (int i = 0; i < _fiberDim; ++i)
+ this->_emptyValue.v[i] = v[i];
+} // setDefault
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::clear(void)
+{ // clear
+ this->zero();
+ this->_atlas->clear();
+} // clear
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+int
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getFiberDimension(const point_type& p) const
+{ // getFiberDimension
+ return this->_atlas->restrictPoint(p)[0];
+} // getFiberDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setFiberDimension(const point_type& p,
+ int dim)
+{ // setFiberDimension
+ this->checkDimension(dim);
+ this->_atlas->addPoint(p);
+ this->_atlas->updatePoint(p, &dim);
+} // setFiberDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+template<typename Sequence>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setFiberDimension(const Obj<Sequence>& points,
+ int dim)
+{ // setFiberDimension
+ const typename Sequence::const_iterator pointsEnd = points->end();
+ for (typename Sequence::iterator p_iter=points->begin();
+ p_iter != pointsEnd;
+ ++p_iter)
+ this->setFiberDimension(*p_iter, dim);
+} // setFiberDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setFiberDimension(const std::set<point_type>& points,
+ int dim)
+{ // setFiberDimension
+ const typename std::set<point_type>::const_iterator pointsEnd = points.end();
+ for (typename std::set<point_type>::iterator p_iter=points.begin();
+ p_iter != pointsEnd;
+ ++p_iter)
+ this->setFiberDimension(*p_iter, dim);
+} // setFiberDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::addFiberDimension(const point_type& p,
+ int dim)
+{ // addFiberDimension
+ if (this->hasPoint(p)) {
+ ostringstream msg;
+ msg << "Invalid addition to fiber dimension " << dim
+ << " cannot exceed " << _fiberDim << std::endl;
+ throw ALE::Exception(msg.str().c_str());
+ } else
+ this->setFiberDimension(p, dim);
+} // addFiberDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+int
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::size(void) const
+{ // size
+ return this->_atlas->getChart().size()*_fiberDim;
+} // size
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+int
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::sizeWithBC(void) const
+{ // sizeWithBC
+ return this->size();
+} // sizeWithBC
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::allocatePoint(void)
+{ // allocatePoint
+ this->_array = this->_allocator.allocate(this->sizeWithBC());
+ this->_array -= this->getChart().min()*_fiberDim;
+ assert(this->_array);
+ const index_type chartEnd = this->getChart().max()*_fiberDim;
+ for(index_type i=this->getChart().min()*_fiberDim;
+ i < chartEnd;
+ ++i)
+ this->_allocator.construct(this->_array+i, this->_emptyValue.v[0]);
+} // allocatePoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+bool
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::reallocatePoint(const chart_type& chart,
+ values_type* oldData)
+{ // reallocatePoint
+ const chart_type oldChart = this->getChart();
+ const int oldSize = this->sizeWithBC();
+ values_type oldArray = this->_array;
+ if (!this->resizeChart(chart))
+ return false;
+ const int size = this->sizeWithBC();
+
+ this->_array = this->_allocator.allocate(size);
+ this->_array -= this->getChart().min()*_fiberDim;
+ const index_type chartEnd = this->getChart().max()*_fiberDim;
+ for(index_type i=this->getChart().min()*_fiberDim;
+ i < chartEnd;
+ ++i)
+ this->_allocator.construct(this->_array+i, this->_emptyValue.v[0]);
+
+ const index_type oldChartEnd = oldChart.max()*_fiberDim;
+ for(index_type i=oldChart.min()*_fiberDim; i < oldChartEnd; ++i)
+ this->_array[i] = oldArray[i];
+ if (!oldData) {
+ for(index_type i=oldChart.min()*_fiberDim;
+ i < oldChartEnd;
+ ++i)
+ this->_allocator.destroy(oldArray+i);
+ oldArray += this->getChart().min()*_fiberDim;
+ this->_allocator.deallocate(oldArray, oldSize);
+ ///std::cout << "Freed IUniformSection data" << std::endl;
+ } else {
+ ///std::cout << "Did not free IUniformSection data" << std::endl;
+ *oldData = oldArray;
+ } // if/else
+ return true;
+} // reallocatePoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+template<typename Iterator, typename Extractor>
+bool
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::reallocatePoint(const Iterator& begin,
+ const Iterator& end,
+ const Extractor& extractor)
+{ // reallocatePoint
+ point_type min = this->getChart().min();
+ point_type max = this->getChart().max()-1;
+
+ for(Iterator p_iter = begin; p_iter != end; ++p_iter) {
+ min = std::min(extractor(*p_iter), min);
+ max = std::max(extractor(*p_iter), max);
+ } // for
+ return reallocatePoint(chart_type(min, max+1));
+} // reallocatePoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::zero(void)
+{ // zero
+ assert(this->_array);
+ memset(this->_array+(this->getChart().min()*_fiberDim), 0,
+ this->sizeWithBC()*sizeof(value_type));
+} // zero
+
+// ----------------------------------------------------------------------
+// Return a pointer to the entire contiguous storage array
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+const typename ALE::IUniformSectionDS<point_type, value_type, alloc_type>::values_type&
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::restrictSpace(void) const
+{ // restrictSpace
+ assert(this->_array);
+ return this->_array;
+} // restrictSpace
+
+// ----------------------------------------------------------------------
+// Return only the values associated to this point, not its closure
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+const typename ALE::IUniformSectionDS<point_type, value_type, alloc_type>::value_type*
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::restrictPoint(const point_type& p) const
+{ // restrictPoint
+ assert(this->_array);
+ if (!this->hasPoint(p))
+ return this->_emptyValue.v;
+ return &this->_array[p*_fiberDim];
+} // restrictPoint
+
+// ----------------------------------------------------------------------
+// Update only the values associated to this point, not its closure
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::updatePoint(const point_type& p,
+ const value_type v[])
+{ // updatePoint
+ assert(this->_array);
+ for(int i = 0, idx = p*_fiberDim; i < _fiberDim; ++i, ++idx)
+ this->_array[idx] = v[i];
+} // updatePoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+// Update only the values associated to this point, not its closure
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::updateAddPoint(const point_type& p,
+ const value_type v[])
+{ // updateAddPoint
+ assert(this->_array);
+ for(int i = 0, idx = p*_fiberDim; i < _fiberDim; ++i, ++idx)
+ this->_array[idx] += v[i];
+} // updateAddPoint
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::updatePointAll(const point_type& p,
+ const value_type v[])
+{ // updatePointAll
+ this->updatePoint(p, v);
+} // updatePointAll
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::view(const std::string& name,
+ MPI_Comm comm) const
+{ // view
+ ostringstream txt;
+ int rank;
+
+ if (comm == MPI_COMM_NULL) {
+ comm = this->comm();
+ rank = this->commRank();
+ } else {
+ MPI_Comm_rank(comm, &rank);
+ }
+ if (name == "") {
+ if(rank == 0) {
+ txt << "viewing an IUniformSection" << std::endl;
+ }
+ } else {
+ if(rank == 0) {
+ txt << "viewing IUniformSection '" << name << "'" << std::endl;
+ }
+ }
+ const typename atlas_type::chart_type& chart = this->_atlas->getChart();
+ values_type array = this->_array;
+
+ for(typename atlas_type::chart_type::const_iterator p_iter = chart.begin(); p_iter != chart.end(); ++p_iter) {
+ const int idx = (*p_iter)*_fiberDim;
+
+ if (_fiberDim != 0) {
+ txt << "[" << this->commRank() << "]: " << *p_iter << " dim " << _fiberDim << " ";
+ for(int i = 0; i < _fiberDim; i++) {
+ txt << " " << array[idx+i];
+ }
+ txt << std::endl;
+ }
+ }
+ if (chart.size() == 0) {
+ txt << "[" << this->commRank() << "]: empty" << std::endl;
+ }
+ PetscSynchronizedPrintf(comm, txt.str().c_str());
+ PetscSynchronizedFlush(comm);
+} // view
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+int
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getNumSpaces(void) const
+{ // getNumSpaces
+ return this->_spaces.size();
+} // getNumSpaces
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+const std::vector<ALE::Obj<typename ALE::IUniformSectionDS<point_type, value_type, alloc_type>::atlas_type> >&
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getSpaces(void)
+{ // getSpaces
+ return this->_spaces;
+} // getSpaces
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::addSpace(void)
+{ // addSpace
+ Obj<atlas_type> space = new atlas_type(this->comm(), this->debug());
+ assert(!space.isNull());
+
+ assert(!this->_atlas.isNull());
+ space->setChart(this->_atlas->getChart());
+ this->_spaces.push_back(space);
+} // addSpace
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+int
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getFiberDimension(
+ const point_type& p,
+ const int space) const
+{ // getFiberDimension
+ assert(space < this->_spaces.size());
+ assert(!this->_spaces[space].isNull());
+
+ return *this->_spaces[space]->restrictPoint(p);
+} // getFiberDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setFiberDimension(
+ const point_type& p,
+ int dim,
+ const int space)
+{ // setFiberDimension
+ assert(space < this->_spaces.size());
+ assert(!this->_spaces[space].isNull());
+
+ this->_spaces[space]->addPoint(p);
+ this->_spaces[space]->updatePoint(p, &dim);
+} // setFiberDimension
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+template<typename Sequence>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::setFiberDimension(
+ const Obj<Sequence>& points,
+ int dim,
+ const int space)
+{ // setFiberDimension
+ const typename Sequence::const_iterator pointsEnd = points->end();
+ for(typename Sequence::iterator p_iter = points->begin();
+ p_iter != pointsEnd;
+ ++p_iter)
+ this->setFiberDimension(*p_iter, dim, space);
+} // setFiberDimension
+
+// ----------------------------------------------------------------------
+// Return the total number of free dofs
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+int
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::size(const int space) const
+{ // size
+ const chart_type& points = this->getChart();
+ int size = 0;
+
+ const typename chart_type::const_iterator pointsEnd = points.end();
+ for (typename chart_type::const_iterator p_iter = points.begin();
+ p_iter != pointsEnd;
+ ++p_iter)
+ size += this->getConstrainedFiberDimension(*p_iter, space);
+
+ return size;
+} // size
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+template<typename OtherSection>
+void
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::copyFibration(const Obj<OtherSection>& section)
+{ // copyFibration
+ const std::vector<Obj<atlas_type> >& spaces = section->getSpaces();
+
+ this->_spaces.clear();
+ const typename std::vector<Obj<atlas_type> >::const_iteraor spacesEnd
+ = spaces.end();
+ for(typename std::vector<Obj<atlas_type> >::const_iterator s_iter=spaces.begin();
+ s_iter != spacesEnd;
+ ++s_iter)
+ this->_spaces.push_back(*s_iter);
+} // copyFibration
+
+// ----------------------------------------------------------------------
+template<typename point_type,
+ typename value_type,
+ typename alloc_type>
+ALE::Obj<ALE::IGeneralSection<point_type, value_type, alloc_type> >
+ALE::IUniformSectionDS<point_type, value_type, alloc_type>::getFibration(const int space) const {
+ typedef typename ALE::IGeneralSection<point_type, value_type, alloc_type>::chart_type IGeneralSection_chart_type;
+ typedef typename ALE::IGeneralSection<point_type, value_type, alloc_type>::atlas_type IGeneralSection_atlas_type;
+
+ Obj<IGeneralSection<point_type, value_type, alloc_type> > field =
+ new IGeneralSection<point_type, value_type, alloc_type>(this->comm(),
+ this->debug());
+ field->setChart(this->getChart());
+ const chart_type& chart = this->getChart();
+
+ // Copy sizes
+ const typename chart_type::const_iterator chartEnd = chart.end();
+ for(typename chart_type::const_iterator c_iter = chart.begin(); c_iter != chartEnd; ++c_iter) {
+ const int fiberDim = this->getFiberDimension(*c_iter, space);
+
+ if (fiberDim)
+ field->setFiberDimension(*c_iter, fiberDim);
+ } // for
+ field->allocateStorage();
+ Obj<IGeneralSection_atlas_type> newAtlas =
+ new IGeneralSection_atlas_type(this->comm(), this->debug());
+ const IGeneralSection_chart_type& newChart = field->getChart();
+
+
+ // Copy offsets
+ newAtlas->setChart(newChart);
+ newAtlas->allocatePoint();
+ const typename IGeneralSection_chart_type::const_iterator newChartEnd =
+ newChart.end();
+ for (typename IGeneralSection_chart_type::const_iterator c_iter=newChart.begin();
+ c_iter != newChartEnd;
+ ++c_iter) {
+ typename IGeneralSection<point_type, value_type, alloc_type>::index_type idx;
+
+ idx.prefix = field->getFiberDimension(*c_iter);
+ idx.index = this->_atlas->restrictPoint(*c_iter)[0];
+ for(int s = 0; s < space; ++s)
+ idx.index += this->getFiberDimension(*c_iter, s);
+ newAtlas->addPoint(*c_iter);
+ newAtlas->updatePoint(*c_iter, &idx);
+ } // for
+ field->replaceStorage(this->_array, true, this->sizeWithBC());
+ field->setAtlas(newAtlas);
+
+ return field;
+} // getFibration
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.hh (from rev 17287, short/3D/PyLith/trunk/libsrc/topology/UniformSectionDS.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/UniformSectionDS.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,198 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/UniformSectionDS.hh
+ *
+ * @brief Sieve section with uniform size set at runtime in contrast
+ * to ALE::IUniformSection, which has a uniform size set at compile
+ * time.
+ */
+
+#if !defined(pylith_topology_uniformsection_hh)
+#define pylith_topology_uniformsection_hh
+
+// Include directives ---------------------------------------------------
+#include "topologyfwd.hh" // forward declarations
+
+#include "IField.hh"
+
+// UniformSectionDS -----------------------------------------------------
+/// Sieve section with uniform size set at runtime.
+/// All fibers are the same dimension
+/// Note we can use a IConstantSection for this Atlas
+/// Each point may have a different vector
+/// Thus we need storage for values, and hence must implement completion
+template<typename Point_,
+ typename Value_,
+ typename Alloc_ =ALE::malloc_allocator<Value_> >
+class ALE::IUniformSectionDS : public ALE::ParallelObject {
+
+// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
+public:
+ typedef Point_ point_type;
+ typedef Value_ value_type;
+ typedef Alloc_ alloc_type;
+ typedef typename alloc_type::template rebind<point_type>::other point_alloc_type;
+ typedef IConstantSection<point_type, int, point_alloc_type> atlas_type;
+ typedef typename atlas_type::chart_type chart_type;
+ typedef point_type index_type;
+ typedef struct { value_type* v;} fiber_type;
+ typedef value_type* values_type;
+ typedef typename alloc_type::template rebind<atlas_type>::other atlas_alloc_type;
+ typedef typename atlas_alloc_type::pointer atlas_ptr;
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ IUniformSectionDS(MPI_Comm comm,
+ const int fiberDim,
+ const int debug =0);
+
+ IUniformSectionDS(MPI_Comm comm,
+ const int diberDim,
+ const point_type& min,
+ const point_type& max,
+ const int debug =0);
+
+ IUniformSectionDS(const Obj<atlas_type>& atlas,
+ const int fiberDim);
+
+ /// Destructor.
+ virtual ~IUniformSectionDS(void);
+
+ value_type* getRawArray(const int size);
+
+ bool hasPoint(const point_type& point) const;
+
+ void checkDimension(const int& dim);
+
+ const chart_type& getChart(void) const;
+
+ void setChart(const chart_type& chart);
+
+ bool resizeChart(const chart_type& chart);
+
+ const Obj<atlas_type>& getAtlas(void) const;
+
+ void setAtlas(const Obj<atlas_type>& atlas);
+ void addPoint(const point_type& point);
+
+ template<typename Points>
+ void addPoint(const Obj<Points>& points);
+
+ void copy(const Obj<IUniformSectionDS>& section);
+
+ const value_type* getDefault(void) const;
+
+ void setDefault(const value_type v[]);
+
+ void clear(void);
+
+ int getFiberDimension(const point_type& p) const;
+
+ void setFiberDimension(const point_type& p,
+ int dim);
+
+ template<typename Sequence>
+ void setFiberDimension(const Obj<Sequence>& points,
+ int dim);
+
+ void setFiberDimension(const std::set<point_type>& points,
+ int dim);
+
+ void addFiberDimension(const point_type& p,
+ int dim);
+
+ int size(void) const;
+
+ int sizeWithBC(void) const;
+
+ void allocatePoint(void);
+
+ bool reallocatePoint(const chart_type& chart,
+ values_type *oldData =NULL);
+
+ template<typename Iterator,
+ typename Extractor>
+ bool reallocatePoint(const Iterator& begin,
+ const Iterator& end,
+ const Extractor& extractor);
+
+ void zero(void);
+
+ // Return a pointer to the entire contiguous storage array
+ const values_type& restrictSpace(void) const;
+
+ // Return only the values associated to this point, not its closure
+ const value_type *restrictPoint(const point_type& p) const;
+
+ // Update only the values associated to this point, not its closure
+ void updatePoint(const point_type& p,
+ const value_type v[]);
+
+ // Update only the values associated to this point, not its closure
+ void updateAddPoint(const point_type& p,
+ const value_type v[]);
+
+ void updatePointAll(const point_type& p,
+ const value_type v[]);
+
+ void view(const std::string& name,
+ MPI_Comm comm =MPI_COMM_NULL) const;
+
+ int getNumSpaces(void) const;
+
+ const std::vector<Obj<atlas_type> >& getSpaces(void);
+ void addSpace(void);
+ int getFiberDimension(const point_type& p,
+ const int space) const;
+ void setFiberDimension(const point_type& p,
+ int dim,
+ const int space);
+
+ template<typename Sequence>
+ void setFiberDimension(const Obj<Sequence>& points,
+ int dim,
+ const int space);
+
+ // Return the total number of free dofs
+ int size(const int space) const;
+
+ template<typename OtherSection>
+ void copyFibration(const Obj<OtherSection>& section);
+
+ Obj<ALE::IGeneralSection<point_type, value_type, alloc_type> >
+ getFibration(const int space) const;
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
+protected:
+ int _fiberDim;
+ Obj<atlas_type> _atlas;
+ std::vector<Obj<atlas_type> > _spaces;
+ values_type _array;
+ fiber_type _emptyValue;
+ alloc_type _allocator;
+
+}; // class IUniformSectionDS
+
+#include "UniformSectionDS.cc" // template definitions
+
+#endif // uniformsectionds_hh
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/topologyfwd.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/topologyfwd.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/topologyfwd.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,6 +27,24 @@
#if !defined(pylith_topology_topologyfwd_hh)
#define pylith_topology_topologyfwd_hh
+#include "pylith/utils/sievetypes.hh"
+
+namespace ALE {
+ template<typename point_type,
+ typename value_type,
+ typename allocator> class IUniformSectionDS;
+
+ template<typename cellrefiner_type> class MeshRefiner;
+ class RefineEdges2;
+ class CellRefinerTri3;
+ class CellRefinerTet4;
+
+ class RefineFace4Edges2;
+ class CellRefinerQuad4;
+
+ class MeshOrder;
+} // ALE
+
namespace pylith {
namespace topology {
@@ -35,17 +53,16 @@
class MeshOps;
class FieldBase;
- template<typename mesh_type> class Field;
+ template<typename mesh_type,
+ typename section_type =ALE::IGeneralSection<pylith::Mesh::point_type, double> > class Field;
template<typename field_type> class Fields;
- typedef Fields<Field<Mesh> > FieldsMesh;
- typedef Fields<Field<SubMesh> > FieldsSubMesh;
+ template<typename mesh_type> class FieldsNew;
class SolutionFields;
class Jacobian;
class Distributor;
- class MeshRefiner;
class RefineUniform;
class ReverseCuthillMcKee;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilter.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilter.i 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilter.i 2010-10-15 23:45:21 UTC (rev 17288)
@@ -65,9 +65,9 @@
* @returns Averaged field.
*/
virtual
- const field_type& filter(const field_type& fieldIn,
- const char* label =0,
- const int labelId =0) = 0;
+ field_type& filter(const field_type& fieldIn,
+ const char* label =0,
+ const int labelId =0) = 0;
}; // CellFilter
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilterAvg.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilterAvg.i 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/CellFilterAvg.i 2010-10-15 23:45:21 UTC (rev 17288)
@@ -62,9 +62,9 @@
*
* @returns Averaged field.
*/
- const field_type& filter(const field_type& fieldIn,
- const char* label =0,
- const int labelId =0);
+ field_type& filter(const field_type& fieldIn,
+ const char* label =0,
+ const int labelId =0);
}; // CellFilterAvg
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriter.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriter.i 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriter.i 2010-10-15 23:45:21 UTC (rev 17288)
@@ -94,7 +94,7 @@
*/
virtual
void writeVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh) = 0;
/** Write field over cells to file.
@@ -107,7 +107,7 @@
*/
virtual
void writeCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0) = 0;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterHDF5.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterHDF5.i 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterHDF5.i 2010-10-15 23:45:21 UTC (rev 17288)
@@ -77,7 +77,7 @@
* @param mesh Mesh for output.
*/
void writeVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh);
/** Write field over cells to file.
@@ -89,7 +89,7 @@
* @param labelId Value of label defining which cells to include.
*/
void writeCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterVTK.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterVTK.i 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/DataWriterVTK.i 2010-10-15 23:45:21 UTC (rev 17288)
@@ -98,7 +98,7 @@
* @param mesh Mesh for output.
*/
void writeVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh);
/** Write field over cells to file.
@@ -110,7 +110,7 @@
* @param labelId Value of label defining which cells to include.
*/
void writeCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputManager.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputManager.i 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputManager.i 2010-10-15 23:45:21 UTC (rev 17288)
@@ -113,7 +113,7 @@
* @param mesh Mesh for output.
*/
void appendVertexField(const double t,
- const field_type& field,
+ field_type& field,
const mesh_type& mesh);
/** Append finite-element cell field to file.
@@ -125,7 +125,7 @@
* @param labelId Value of label defining which cells to include.
*/
void appendCellField(const double t,
- const field_type& field,
+ field_type& field,
const char* label =0,
const int labelId =0);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputSolnSubset.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputSolnSubset.i 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/meshio/OutputSolnSubset.i 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,18 +60,6 @@
*/
const pylith::topology::SubMesh& subdomainMesh(const pylith::topology::Mesh& mesh);
- /** Append finite-element vertex field to file.
- *
- * @param t Time associated with field.
- * @param field Vertex field.
- * @param mesh Mesh for output.
- */
- void appendVertexField(const double t,
- const pylith::topology::Field<pylith::topology::Mesh>& field,
- const pylith::topology::SubMesh& mesh);
-
-
-
}; // OutputSolnSubset
} // meshio
Modified: short/3D/PyLith/branches/pylith-scecdynrup/playpen/closure/TestClosure.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/playpen/closure/TestClosure.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/playpen/closure/TestClosure.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -130,22 +130,20 @@
#else
// Create fields
- pylith::topology::SolutionFields fields(mesh);
- fields.add("field AB", "field_AB");
- topology::Field<topology::Mesh>& fieldAB = fields.get("field AB");
- fieldAB.newSection(topology::FieldBase::VERTICES_FIELD, 2*spaceDim);
- fieldAB.allocate();
- fieldAB.zero();
- fields.copyLayout("field AB");
+ pylith::topology::FieldsNew fields(mesh);
+ fields.add("field A", "displacement", spaceDim, topology::FieldBase::VECTOR);
+ fields.add("field B", "velocity", spaceDim, topology::FieldBase::VECTOR);
+ fields.allocate(topology::FieldBase::VERTICES_FIELD, 2*spaceDim);
// Create field visitors
- double_array fieldABCell(coneSize*2*spaceDim);
- const ALE::Obj<RealSection>& fieldABSection = fields.get("field AB").section();
- assert(!fieldABSection.isNull());
- topology::Mesh::RestrictVisitor fieldABVisitor(*fieldABSection,
- fieldABCell.size(),
- &fieldABCell[0]);
+ double_array fieldsCell(coneSize*2*spaceDim);
+ const ALE::Obj<RealUniformSection>fieldsSection = fields.section();
+ assert(!fieldsSection.isNull());
+ topology::Mesh::RestrictVisitor fieldABVisitor(*fieldsSection,
+ fieldsCell.size(),
+ &fieldsCell[0]);
+
double_array tmpCell(coneSize*2*spaceDim);
#endif
const int dataSize = coneSize * spaceDim;
@@ -175,8 +173,8 @@
// Perform trivial operation on fields
//tmpCell = fieldACell + fieldBCell + coordsCell;
#else
- fieldABVisitor.clear();
- sieveMesh->restrictClosure(*c_iter, fieldABVisitor);
+ fieldsVisitor.clear();
+ sieveMesh->restrictClosure(*c_iter, fieldsVisitor);
// Perform trivial operation on fields
//for (int i=0; i < dataSize; ++i)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/playpen/quadratic (from rev 17287, short/3D/PyLith/trunk/playpen/quadratic)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATLagrange.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATLagrange.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATLagrange.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -103,14 +103,14 @@
quadwts = numpy.array(quadrature.get_weights())
numQuadPts = len(quadpts)
basis = numpy.array(element.function_space().tabulate(quadrature.get_points())).transpose()
- numBasisFns = len(element.function_space())
+ numBasis = len(element.function_space())
# Evaluate derivatives of basis functions at quadrature points
basisDeriv = numpy.array([element.function_space().deriv_all(d).tabulate(quadrature.get_points()) \
for d in range(1)]).transpose()
self.numQuadPts = numQuadPts**dim
- self.numCorners = numBasisFns**dim
+ self.numCorners = numBasis**dim
if dim == 1:
self.vertices = numpy.array(vertices)
@@ -120,520 +120,219 @@
self.basisDeriv = numpy.reshape(basisDeriv.flatten(), basisDeriv.shape)
else:
if dim == 2:
+ # Set order of vertices and basis functions.
+ # Corners
+ vertexOrder = [(0,0), (1,0), (1,1), (0,1)]
+ # Edges
+ # Bottom
+ p = numpy.arange(2, numBasis, dtype=numpy.int32)
+ q = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q)
+ # Right
+ p = numpy.ones(numBasis-2, dtype=numpy.int32)
+ q = numpy.arange(2, numBasis, dtype=numpy.int32)
+ vertexOrder += zip(p,q)
+ # Top
+ p = numpy.arange(numBasis-1, 1, step=-1, dtype=numpy.int32)
+ q = numpy.ones(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q)
+ # Left
+ p = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ q = numpy.arange(numBasis-1, 1, step=-1, dtype=numpy.int32)
+ vertexOrder += zip(p,q)
+ # Face
+ p = numpy.arange(2, numBasis, dtype=numpy.int32)
+ q = numpy.arange(2, numBasis, dtype=numpy.int32)
+ vertexOrder += zip(p,q)
+
self.vertices = numpy.zeros((self.numCorners, dim))
n = 0
- # Bottom
- for r in range(0, numBasisFns-1):
- self.vertices[n][0] = vertices[r]
- self.vertices[n][1] = vertices[0]
- n += 1
- # Right
- for q in range(0, numBasisFns-1):
- self.vertices[n][0] = vertices[numBasisFns-1]
+ for (p,q) in vertexOrder:
+ self.vertices[n][0] = vertices[p]
self.vertices[n][1] = vertices[q]
n += 1
- # Top
- for r in range(numBasisFns-1, 0, -1):
- self.vertices[n][0] = vertices[r]
- self.vertices[n][1] = vertices[numBasisFns-1]
- n += 1
- # Left
- for q in range(numBasisFns-1, 0, -1):
- self.vertices[n][0] = vertices[0]
- self.vertices[n][1] = vertices[q]
- n += 1
- # Interior
- for q in range(1, numBasisFns-1):
- for r in range(1, numBasisFns-1):
- self.vertices[n][0] = vertices[r]
- self.vertices[n][1] = vertices[q]
- n += 1
- if not n == self.numCorners: raise RuntimeError('Invalid 2D function tabulation')
+ if not n == self.numCorners:
+ raise RuntimeError('Invalid 2-D vertex ordering: '+str(n)+ \
+ ' should be '+str(self.numCorners))
self.quadPts = numpy.zeros((numQuadPts*numQuadPts, dim))
self.quadWts = numpy.zeros((numQuadPts*numQuadPts,))
self.basis = numpy.zeros((numQuadPts*numQuadPts,
- numBasisFns*numBasisFns))
+ numBasis*numBasis))
self.basisDeriv = numpy.zeros((numQuadPts*numQuadPts,
- numBasisFns*numBasisFns, dim))
+ numBasis*numBasis, dim))
+
+ # Order of quadrature points doesn't matter
+ # Order of basis functions should match vertices for isoparametric
n = 0
- # Bottom
- for r in range(0, numQuadPts-1):
- self.quadPts[n][0] = quadpts[r]
- self.quadPts[n][1] = quadpts[0]
- self.quadWts[n] = quadwts[r]*quadwts[0]
- m = 0
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[0][0]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[0][0]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[0][0][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][numBasisFns-1]*basis[0][f]
- self.basisDeriv[n][m][0] = basisDeriv[r][numBasisFns-1][0]*basis[0][f]
- self.basisDeriv[n][m][1] = basis[r][numBasisFns-1]*basisDeriv[0][f][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][g]*basis[0][numBasisFns-1]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[0][numBasisFns-1]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[0][numBasisFns-1][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][0]*basis[0][f]
- self.basisDeriv[n][m][0] = basisDeriv[r][0][0]*basis[0][f]
- self.basisDeriv[n][m][1] = basis[r][0]*basisDeriv[0][f][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[0][f]
- self.basisDeriv[0][r][f][g][0] = basisDeriv[r][g][0]*basis[0][f]
- self.basisDeriv[0][r][f][g][1] = basis[r][g]*basisDeriv[0][f][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 2D function tabulation')
- n += 1
- # Right
- for q in range(0, numQuadPts-1):
- self.quadPts[n][0] = quadpts[numQuadPts-1]
- self.quadPts[n][1] = quadpts[q]
- self.quadWts[n] = quadwts[numQuadPts-1]*quadwts[q]
- m = 0
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[numQuadPts-1][g]*basis[q][0]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][g][0]*basis[q][0]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][g]*basisDeriv[q][0][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[numQuadPts-1][numBasisFns-1]*basis[q][f]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][numBasisFns-1][0]*basis[q][f]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][numBasisFns-1]*basisDeriv[q][f][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[numQuadPts-1][g]*basis[q][numBasisFns-1]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][g][0]*basis[q][numBasisFns-1]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][g]*basisDeriv[q][numBasisFns-1][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[numQuadPts-1][0]*basis[q][f]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][0][0]*basis[q][f]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][0]*basisDeriv[q][f][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[numQuadPts-1][g]*basis[0][f]
- self.basisDeriv[q][numQuadPts-1][f][g][0] = basisDeriv[numQuadPts-1][g][0]*basis[q][f]
- self.basisDeriv[q][numQuadPts-1][f][g][1] = basis[numQuadPts-1][g]*basisDeriv[q][f][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 2D function tabulation')
- n += 1
- # Top
- for r in range(numQuadPts-1, 0, -1):
- self.quadPts[n][0] = quadpts[r]
- self.quadPts[n][1] = quadpts[numQuadPts-1]
- self.quadWts[n] = quadwts[r]*quadwts[numQuadPts-1]
- m = 0
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[numQuadPts-1][0]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[numQuadPts-1][0]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[numQuadPts-1][0][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][numBasisFns-1]*basis[numQuadPts-1][f]
- self.basisDeriv[n][m][0] = basisDeriv[r][numBasisFns-1][0]*basis[numQuadPts-1][f]
- self.basisDeriv[n][m][1] = basis[r][numBasisFns-1]*basisDeriv[numQuadPts-1][f][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][g]*basis[numQuadPts-1][numBasisFns-1]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[numQuadPts-1][numBasisFns-1]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[numQuadPts-1][numBasisFns-1][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][0]*basis[numQuadPts-1][f]
- self.basisDeriv[n][m][0] = basisDeriv[r][0][0]*basis[numQuadPts-1][f]
- self.basisDeriv[n][m][1] = basis[r][0]*basisDeriv[numQuadPts-1][f][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[numQuadPts-1][f]
- self.basisDeriv[numQuadPts-1][r][f][g][0] = basisDeriv[r][g][0]*basis[numQuadPts-1][f]
- self.basisDeriv[numQuadPts-1][r][f][g][1] = basis[r][g]*basisDeriv[numQuadPts-1][f][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 2D function tabulation')
- n += 1
- # Left
- for q in range(numQuadPts-1, 0, -1):
- self.quadPts[n][0] = quadpts[0]
- self.quadPts[n][1] = quadpts[q]
- self.quadWts[n] = quadwts[0]*quadwts[q]
- m = 0
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[0][g]*basis[q][0]
- self.basisDeriv[n][m][0] = basisDeriv[0][g][0]*basis[q][0]
- self.basisDeriv[n][m][1] = basis[0][g]*basisDeriv[q][0][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[0][numBasisFns-1]*basis[q][f]
- self.basisDeriv[n][m][0] = basisDeriv[0][numBasisFns-1][0]*basis[q][f]
- self.basisDeriv[n][m][1] = basis[0][numBasisFns-1]*basisDeriv[q][f][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[0][g]*basis[q][numBasisFns-1]
- self.basisDeriv[n][m][0] = basisDeriv[0][g][0]*basis[q][numBasisFns-1]
- self.basisDeriv[n][m][1] = basis[0][g]*basisDeriv[q][numBasisFns-1][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[0][0]*basis[q][f]
- self.basisDeriv[n][m][0] = basisDeriv[0][0][0]*basis[q][f]
- self.basisDeriv[n][m][1] = basis[0][0]*basisDeriv[q][f][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[0][g]*basis[0][f]
- self.basisDeriv[q][0][f][g][0] = basisDeriv[0][g][0]*basis[q][f]
- self.basisDeriv[q][0][f][g][1] = basis[0][g]*basisDeriv[q][f][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 2D function tabulation')
- n += 1
- # Interior
- for q in range(1, numQuadPts-1):
- for r in range(1, numQuadPts-1):
- self.quadPts[n][0] = quadpts[r]
+ for q in range(0, numQuadPts):
+ for p in range(0, numQuadPts):
+ self.quadPts[n][0] = quadpts[p]
self.quadPts[n][1] = quadpts[q]
- self.quadWts[n] = quadwts[r]*quadwts[q]
+ self.quadWts[n] = quadwts[p]*quadwts[q]
+
m = 0
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[q][0]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[q][0]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[q][0][0]
+ for (bp,bq) in vertexOrder:
+ self.basis[n][m] = basis[p][bp]*basis[q][bq]
+ self.basisDeriv[n][m][0] = basisDeriv[p][bp][0]*basis[q][bq]
+ self.basisDeriv[n][m][1] = basis[p][bp]*basisDeriv[q][bq][0]
m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][numBasisFns-1]*basis[q][f]
- self.basisDeriv[n][m][0] = basisDeriv[r][numBasisFns-1][0]*basis[q][f]
- self.basisDeriv[n][m][1] = basis[r][numBasisFns-1]*basisDeriv[q][f][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][g]*basis[q][numBasisFns-1]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[q][numBasisFns-1]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[q][numBasisFns-1][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][0]*basis[q][f]
- self.basisDeriv[n][m][0] = basisDeriv[r][0][0]*basis[q][f]
- self.basisDeriv[n][m][1] = basis[r][0]*basisDeriv[q][f][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[q][f]
- self.basisDeriv[q][r][f][g][0] = basisDeriv[r][g][0]*basis[q][f]
- self.basisDeriv[q][r][f][g][1] = basis[r][g]*basisDeriv[q][f][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 2D function tabulation')
+ if not m == self.numCorners:
+ raise RuntimeError('Invalid 2-D basis tabulation: '+str(m)+ \
+ ' should be '+str(self.numCorners))
n += 1
- if not n == self.numQuadPts: raise RuntimeError('Invalid 2D quadrature')
+ if not n == self.numQuadPts:
+ raise RuntimeError('Invalid 2-D quadrature: '+str(n)+ \
+ ' should be '+str(self.numQuadPts))
+
elif dim == 3:
+ # Set order of vertices and basis functions.
+ # Corners
+ vertexOrder = [(0,0,0), (1,0,0), (1,1,0), (0,1,0),
+ (0,0,1), (1,0,1), (1,1,1), (0,1,1)]
+ # Edges
+ # Bottom front
+ p = numpy.arange(2, numBasis, dtype=numpy.int32)
+ q = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ r = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Bottom right
+ p = numpy.ones(numBasis-2, dtype=numpy.int32)
+ q = numpy.arange(2, numBasis, dtype=numpy.int32)
+ r = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Bottom back
+ p = numpy.arange(numBasis-1, 1, step=-1, dtype=numpy.int32)
+ q = numpy.ones(numBasis-2, dtype=numpy.int32)
+ r = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Bottom left
+ p = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ q = numpy.arange(numBasis-1, 1, step=-1, dtype=numpy.int32)
+ r = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Top front
+ p = numpy.arange(2, numBasis, dtype=numpy.int32)
+ q = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ r = numpy.ones(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Top right
+ p = numpy.ones(numBasis-2, dtype=numpy.int32)
+ q = numpy.arange(2, numBasis, dtype=numpy.int32)
+ r = numpy.ones(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Top back
+ p = numpy.arange(numBasis-1, 1, step=-1, dtype=numpy.int32)
+ q = numpy.ones(numBasis-2, dtype=numpy.int32)
+ r = numpy.ones(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Top left
+ p = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ q = numpy.arange(numBasis-1, 1, step=-1, dtype=numpy.int32)
+ r = numpy.ones(numBasis-2, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Middle left front
+ p = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ q = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ r = numpy.arange(2, numBasis, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Middle right front
+ p = numpy.ones(numBasis-2, dtype=numpy.int32)
+ q = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ r = numpy.arange(2, numBasis, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Middle right back
+ p = numpy.ones(numBasis-2, dtype=numpy.int32)
+ q = numpy.ones(numBasis-2, dtype=numpy.int32)
+ r = numpy.arange(2, numBasis, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+ # Middle left back
+ p = numpy.zeros(numBasis-2, dtype=numpy.int32)
+ q = numpy.ones(numBasis-2, dtype=numpy.int32)
+ r = numpy.arange(2, numBasis, dtype=numpy.int32)
+ vertexOrder += zip(p,q,r)
+
+ # Face
+ # Left / Right
+ ip = numpy.arange(0, 2, dtype=numpy.int32)
+ p = numpy.tile(ip, ((numBasis-2)*(numBasis-2), 1)).transpose()
+ iq = numpy.arange(2, numBasis, dtype=numpy.int32)
+ q = numpy.tile(iq, (1, 2*(numBasis-2)))
+ ir = numpy.arange(2, numBasis, dtype=numpy.int32)
+ r = numpy.tile(ir, (2, numBasis-2)).transpose()
+ vertexOrder += zip(p.ravel(),q.ravel(),r.ravel())
+ # Front / Back
+ ip = numpy.arange(2, numBasis, dtype=numpy.int32)
+ p = numpy.tile(ip, (1, 2*(numBasis-2)))
+ iq = numpy.arange(0, 2, dtype=numpy.int32)
+ q = numpy.tile(iq, ((numBasis-2)*(numBasis-2), 1)).transpose()
+ ir = numpy.arange(2, numBasis, dtype=numpy.int32)
+ r = numpy.tile(ir, (2, numBasis-2)).transpose()
+ vertexOrder += zip(p.ravel(),q.ravel(),r.ravel())
+ # Bottom / Top
+ ip = numpy.arange(2, numBasis, dtype=numpy.int32)
+ p = numpy.tile(ip, (1, 2*(numBasis-2)))
+ iq = numpy.arange(2, numBasis, dtype=numpy.int32)
+ q = numpy.tile(iq, (2, numBasis-2)).transpose()
+ ir = numpy.arange(0, 2, dtype=numpy.int32)
+ r = numpy.tile(ir, ((numBasis-2)*(numBasis-2), 1)).transpose()
+ vertexOrder += zip(p.ravel(),q.ravel(),r.ravel())
+
+ # Interior
+ ip = numpy.arange(2, numBasis, dtype=numpy.int32)
+ p = numpy.tile(ip, (1, (numBasis-2)*(numBasis-2)))
+ iq = numpy.arange(2, numBasis, dtype=numpy.int32)
+ q = numpy.tile(iq, ((numBasis-2), numBasis-2)).transpose()
+ ir = numpy.arange(2, numBasis, dtype=numpy.int32)
+ r = numpy.tile(ir, ((numBasis-2)*(numBasis-2), 1)).transpose()
+ vertexOrder += zip(p.ravel(),q.ravel(),r.ravel())
+
self.vertices = numpy.zeros((self.numCorners, dim))
n = 0
- # Depth
- for s in range(numBasisFns):
- # Bottom
- for r in range(0, numBasisFns-1):
- self.vertices[n][0] = vertices[r]
- self.vertices[n][1] = vertices[0]
- self.vertices[n][2] = vertices[s]
- n += 1
- # Right
- for q in range(0, numBasisFns-1):
- self.vertices[n][0] = vertices[numBasisFns-1]
- self.vertices[n][1] = vertices[q]
- self.vertices[n][2] = vertices[s]
- n += 1
- # Top
- for r in range(numBasisFns-1, 0, -1):
- self.vertices[n][0] = vertices[r]
- self.vertices[n][1] = vertices[numBasisFns-1]
- self.vertices[n][2] = vertices[s]
- n += 1
- # Left
- for q in range(numBasisFns-1, 0, -1):
- self.vertices[n][0] = vertices[0]
- self.vertices[n][1] = vertices[q]
- self.vertices[n][2] = vertices[s]
- n += 1
- # Interior
- for q in range(1, numBasisFns-1):
- for r in range(1, numBasisFns-1):
- self.vertices[n][0] = vertices[r]
- self.vertices[n][1] = vertices[q]
- self.vertices[n][2] = vertices[s]
- n += 1
- if not n == self.numCorners: raise RuntimeError('Invalid 3D function tabulation: '+str(n)+' should be '+str(self.numCorners))
+ for (p,q,r) in vertexOrder:
+ self.vertices[n][0] = vertices[p]
+ self.vertices[n][1] = vertices[q]
+ self.vertices[n][2] = vertices[r]
+ n += 1
+ if not n == self.numCorners:
+ raise RuntimeError('Invalid 3-D vertex ordering: '+str(n)+ \
+ ' should be '+str(self.numCorners))
self.quadPts = numpy.zeros((numQuadPts*numQuadPts*numQuadPts, dim))
self.quadWts = numpy.zeros((numQuadPts*numQuadPts*numQuadPts,))
self.basis = numpy.zeros((numQuadPts*numQuadPts*numQuadPts,
- numBasisFns*numBasisFns*numBasisFns))
+ numBasis*numBasis*numBasis))
self.basisDeriv = numpy.zeros((numQuadPts*numQuadPts*numQuadPts,
- numBasisFns*numBasisFns*numBasisFns,
+ numBasis*numBasis*numBasis,
dim))
+
+ # Order of quadrature points doesn't matter
+ # Order of basis functions should match vertices for isoparametric
n = 0
- # Depth
- for s in range(numQuadPts):
- # Bottom
- for r in range(0, numQuadPts-1):
- self.quadPts[n][0] = quadpts[r]
- self.quadPts[n][1] = quadpts[0]
- self.quadPts[n][2] = quadpts[s]
- self.quadWts[n] = quadwts[r]*quadwts[0]*quadwts[s]
- m = 0
- for h in range(numBasisFns):
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[0][0]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[0][0]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[0][0][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[0][0]*basisDeriv[s][h][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][numBasisFns-1]*basis[0][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][numBasisFns-1][0]*basis[0][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][numBasisFns-1]*basisDeriv[0][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][numBasisFns-1]*basis[0][f]*basisDeriv[s][h][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][g]*basis[0][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[0][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[0][numBasisFns-1][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[0][numBasisFns-1]*basisDeriv[s][h][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][0]*basis[0][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][0][0]*basis[0][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][0]*basisDeriv[0][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][0]*basis[0][f]*basisDeriv[s][h][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[0][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[0][f]*basis[s][h]
- self.basisDeriv[m][m][1] = basis[r][g]*basisDeriv[0][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[0][f]*basisDeriv[s][h][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 3D function tabulation')
- n += 1
- # Right
- for q in range(0, numQuadPts-1):
- self.quadPts[n][0] = quadpts[numQuadPts-1]
- self.quadPts[n][1] = quadpts[q]
- self.quadPts[n][2] = quadpts[s]
- self.quadWts[n] = quadwts[numQuadPts-1]*quadwts[q]*quadwts[s]
- m = 0
- for h in range(numBasisFns):
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[numQuadPts-1][g]*basis[q][0]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][g][0]*basis[q][0]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][g]*basisDeriv[q][0][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[numQuadPts-1][g]*basis[q][0]*basisDeriv[s][h][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[numQuadPts-1][numBasisFns-1]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][numBasisFns-1][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][numBasisFns-1]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[numQuadPts-1][numBasisFns-1]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[numQuadPts-1][g]*basis[q][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][g][0]*basis[q][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][g]*basisDeriv[q][numBasisFns-1][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[numQuadPts-1][g]*basis[q][numBasisFns-1]*basisDeriv[s][h][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[numQuadPts-1][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][0][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[numQuadPts-1][0]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[numQuadPts-1][0]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[numQuadPts-1][g]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[numQuadPts-1][g][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[m][m][1] = basis[numQuadPts-1][g]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[numQuadPts-1][g]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 3D function tabulation')
- n += 1
- # Top
- for r in range(numQuadPts-1, 0, -1):
- self.quadPts[n][0] = quadpts[r]
- self.quadPts[n][1] = quadpts[numQuadPts-1]
- self.quadPts[n][2] = quadpts[s]
- self.quadWts[n] = quadwts[r]*quadwts[numQuadPts-1]*quadwts[s]
- m = 0
- for h in range(numBasisFns):
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[numQuadPts-1][0]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[numQuadPts-1][0]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[numQuadPts-1][0][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[numQuadPts-1][0]*basisDeriv[s][h][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][numBasisFns-1]*basis[numQuadPts-1][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][numBasisFns-1][0]*basis[numQuadPts-1][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][numBasisFns-1]*basisDeriv[numQuadPts-1][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][numBasisFns-1]*basis[numQuadPts-1][f]*basisDeriv[s][h][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][g]*basis[numQuadPts-1][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[numQuadPts-1][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[numQuadPts-1][numBasisFns-1][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[numQuadPts-1][numBasisFns-1]*basisDeriv[s][h][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][0]*basis[numQuadPts-1][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][0][0]*basis[numQuadPts-1][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][0]*basisDeriv[numQuadPts-1][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][0]*basis[numQuadPts-1][f]*basisDeriv[s][h][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[numQuadPts-1][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[numQuadPts-1][f]*basis[s][h]
- self.basisDeriv[m][m][1] = basis[r][g]*basisDeriv[numQuadPts-1][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[numQuadPts-1][f]*basisDeriv[s][h][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 3D function tabulation')
- n += 1
- # Left
- for q in range(numQuadPts-1, 0, -1):
- self.quadPts[n][0] = quadpts[0]
- self.quadPts[n][1] = quadpts[q]
- self.quadPts[n][2] = quadpts[s]
- self.quadWts[n] = quadwts[0]*quadwts[q]*quadwts[s]
- m = 0
- for h in range(numBasisFns):
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[0][g]*basis[q][0]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[0][g][0]*basis[q][0]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[0][g]*basisDeriv[q][0][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[0][g]*basis[q][0]*basisDeriv[s][h][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[0][numBasisFns-1]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[0][numBasisFns-1][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[0][numBasisFns-1]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[0][numBasisFns-1]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[0][g]*basis[q][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[0][g][0]*basis[q][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[0][g]*basisDeriv[q][numBasisFns-1][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[0][g]*basis[q][numBasisFns-1]*basisDeriv[s][h][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[0][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[0][0][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[0][0]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[0][0]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[0][g]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[0][g][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[m][m][1] = basis[0][g]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[0][g]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 3D function tabulation')
- n += 1
- # Interior
- for q in range(1, numQuadPts-1):
- for r in range(1, numQuadPts-1):
- self.quadPts[n][0] = quadpts[r]
+ for r in range(0, numQuadPts):
+ for q in range(0, numQuadPts):
+ for p in range(0, numQuadPts):
+ self.quadPts[n][0] = quadpts[p]
self.quadPts[n][1] = quadpts[q]
- self.quadPts[n][2] = quadpts[s]
- self.quadWts[n] = quadwts[r]*quadwts[q]*quadwts[s]
+ self.quadPts[n][2] = quadpts[r]
+ self.quadWts[n] = quadwts[p]*quadwts[q]*quadwts[r]
+
m = 0
- for h in range(numBasisFns):
- # Bottom
- for g in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[q][0]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[q][0]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[q][0][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[q][0]*basisDeriv[s][h][0]
- m += 1
- # Right
- for f in range(0, numBasisFns-1):
- self.basis[n][m] = basis[r][numBasisFns-1]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][numBasisFns-1][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][numBasisFns-1]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][numBasisFns-1]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- # Top
- for g in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][g]*basis[q][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[q][numBasisFns-1]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][g]*basisDeriv[q][numBasisFns-1][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[q][numBasisFns-1]*basisDeriv[s][h][0]
- m += 1
- # Left
- for f in range(numBasisFns-1, 0, -1):
- self.basis[n][m] = basis[r][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][0][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][1] = basis[r][0]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][0]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- # Interior
- for f in range(1, numBasisFns-1):
- for g in range(1, numBasisFns-1):
- self.basis[n][m] = basis[r][g]*basis[q][f]*basis[s][h]
- self.basisDeriv[n][m][0] = basisDeriv[r][g][0]*basis[q][f]*basis[s][h]
- self.basisDeriv[m][m][1] = basis[r][g]*basisDeriv[q][f][0]*basis[s][h]
- self.basisDeriv[n][m][2] = basis[r][g]*basis[q][f]*basisDeriv[s][h][0]
- m += 1
- if not m == self.numCorners: raise RuntimeError('Invalid 3D function tabulation')
+ for (bp,bq,br) in vertexOrder:
+ self.basis[n][m] = basis[p][bp]*basis[q][bq]*basis[r][br]
+ self.basisDeriv[n][m][0] = basisDeriv[p][bp][0]*basis[q][bq]*basis[r][br]
+ self.basisDeriv[n][m][1] = basis[p][bp]*basisDeriv[q][bq][0]*basis[r][br]
+ self.basisDeriv[n][m][2] = basis[p][bp]*basis[q][bq]*basisDeriv[r][br][0]
+ m += 1
+
+ if not m == self.numCorners:
+ raise RuntimeError('Invalid 3-D basis tabulation: '+str(m)+ \
+ ' should be '+str(self.numCorners))
n += 1
- if not n == self.numQuadPts: raise RuntimeError('Invalid 3D quadrature')
+ if not n == self.numQuadPts:
+ raise RuntimeError('Invalid 3-D quadrature: '+str(n)+ \
+ ' should be '+str(self.numQuadPts))
+
self.vertices = numpy.reshape(self.vertices, (self.numCorners, dim))
self.quadPts = numpy.reshape(self.quadPts, (self.numQuadPts, dim))
self.quadWts = numpy.reshape(self.quadWts, (self.numQuadPts))
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATSimplex.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATSimplex.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/feassemble/FIATSimplex.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -93,42 +93,49 @@
"""
self._setupGeometry(spaceDim)
- if "point" != self.shape.lower():
+ if "point" == self.shape.lower():
+ # Need 0-D quadrature for boundary conditions of 1-D meshes
+ self.cellDim = 0
+ self.numCorners = 1
+ self.numQuadPts = 1
+ self.basis = numpy.array([[1.0]])
+ self.basisDeriv = numpy.array([[[1.0]]])
+ self.quadPts = numpy.array([[0.0]])
+ self.quadWts = numpy.array([1.0])
+ self.vertices = numpy.array([[0.0]])
+ else:
quadrature = self._setupQuadrature()
basisFns = self._setupBasisFns()
# Get coordinates of vertices (dual basis)
- self.vertices = numpy.array(self._setupVertices(), dtype=numpy.float64)
+ vertices = numpy.array(self._setupVertices(), dtype=numpy.float64)
# Evaluate basis functions at quadrature points
quadpts = quadrature.get_points()
basis = numpy.array(basisFns.tabulate(quadpts)).transpose()
- self.basis = numpy.reshape(basis.flatten(), basis.shape)
# Evaluate derivatives of basis functions at quadrature points
import FIAT.shapes
dim = FIAT.shapes.dimension(basisFns.base.shape)
basisDeriv = numpy.array([basisFns.deriv_all(d).tabulate(quadpts) \
for d in range(dim)]).transpose()
- self.basisDeriv = numpy.reshape(basisDeriv.flatten(), basisDeriv.shape)
- self.quadPts = numpy.array(quadrature.get_points())
- self.quadWts = numpy.array(quadrature.get_weights())
-
self.cellDim = dim
self.numCorners = len(basisFns)
self.numQuadPts = len(quadrature.get_weights())
- else:
- # Need 0-D quadrature for boundary conditions of 1-D meshes
- self.cellDim = 0
- self.numCorners = 1
- self.numQuadPts = 1
- self.basis = numpy.array([[1.0]])
- self.basisDeriv = numpy.array([[[1.0]]])
- self.quadPts = numpy.array([[0.0]])
- self.quadWts = numpy.array([1.0])
- self.vertices = numpy.array([[0.0]])
+ # Permute from FIAT order to Sieve order
+ p = self._permutationFIATToSieve()
+ self.vertices = vertices[p,:]
+ self.basis = numpy.reshape(basis[:,p].flatten(), basis.shape)
+ self.basisDeriv = numpy.reshape(basisDeriv[:,p,:].flatten(),
+ basisDeriv.shape)
+
+ # No permutation in order of quadrature points
+ self.quadPts = numpy.array(quadrature.get_points())
+ self.quadWts = numpy.array(quadrature.get_weights())
+
+
self._info.line("Cell geometry: ")
self._info.line(self.geometry)
self._info.line("Vertices: ")
@@ -159,7 +166,50 @@
self.order = self.degree
return
+
+ def _permutationFIATToSieve(self):
+ """
+ Permute from FIAT basis order to Sieve basis order.
+ FIAT: corners, edges, faces
+
+ Sieve: breadth search first (faces, edges, corners)
+ """
+ import FIAT.shapes
+
+ basis = self.cell.function_space()
+ dim = FIAT.shapes.dimension(self._getShape())
+ ids = self.cell.Udual.entity_ids
+ permutation = []
+ if dim == 1:
+ for edge in ids[1]:
+ permutation.extend(ids[1][edge])
+ for vertex in ids[0]:
+ permutation.extend(ids[0][vertex])
+ elif dim == 2:
+ for face in ids[2]:
+ permutation.extend(ids[2][face])
+ for edge in ids[1]:
+ permutation.extend(ids[1][(edge+2)%3])
+ for vertex in ids[0]:
+ permutation.extend(ids[0][vertex])
+ elif dim == 3:
+ for volume in ids[3]:
+ permutation.extend(ids[3][volume])
+ for face in [3, 2, 0, 1]:
+ permutation.extend(ids[2][face])
+ for edge in [2, 0, 1, 3]:
+ permutation.extend(ids[1][edge])
+ for edge in [4, 5]:
+ if len(ids[1][edge]) > 0:
+ permutation.extend(ids[1][edge][::-1])
+ for vertex in ids[0]:
+ permutation.extend(ids[0][vertex])
+ else:
+ raise ValueError("Unknown dimension '%d'." % dim)
+ return permutation
+
+
def _setupGeometry(self, spaceDim):
"""
Setup reference cell geometry object.
@@ -193,6 +243,7 @@
if None == self.geometry:
raise ValueError("Could not set shape '%s' of cell for '%s' in spatial " \
"dimension '%s'." % (name, self.name, spaceDim))
+
return
@@ -211,15 +262,15 @@
Setup basis functions for reference cell.
"""
from FIAT.Lagrange import Lagrange
- return Lagrange(self._getShape(), self.degree).function_space()
+ self.cell = Lagrange(self._getShape(), self.degree)
+ return self.cell.function_space()
def _setupVertices(self):
"""
Setup evaluation functional points for reference cell.
"""
- from FIAT.Lagrange import Lagrange
- return Lagrange(self._getShape(), self.degree).Udual.pts
+ return self.cell.Udual.pts
def _getShape(self):
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5Mesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5Mesh.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5Mesh.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -56,7 +56,7 @@
# FACTORIES ////////////////////////////////////////////////////////////
-def output_data_writer():
+def data_writer():
"""
Factory associated with DataWriter.
"""
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubMesh.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubMesh.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,7 +59,7 @@
# FACTORIES ////////////////////////////////////////////////////////////
-def output_data_writer():
+def data_writer():
"""
Factory associated with DataWriter.
"""
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubSubMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubSubMesh.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterHDF5SubSubMesh.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -56,7 +56,7 @@
# FACTORIES ////////////////////////////////////////////////////////////
-def output_data_writer():
+def data_writer():
"""
Factory associated with DataWriter.
"""
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKMesh.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKMesh.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,7 +59,7 @@
# FACTORIES ////////////////////////////////////////////////////////////
-def output_data_writer():
+def data_writer():
"""
Factory associated with DataWriter.
"""
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubMesh.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubMesh.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,7 +59,7 @@
# FACTORIES ////////////////////////////////////////////////////////////
-def output_data_writer():
+def data_writer():
"""
Factory associated with DataWriter.
"""
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubSubMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubSubMesh.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/meshio/DataWriterVTKSubSubMesh.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,7 +59,7 @@
# FACTORIES ////////////////////////////////////////////////////////////
-def output_data_writer():
+def data_writer():
"""
Factory associated with DataWriter.
"""
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -26,9 +26,13 @@
cellTypes = {(1,2): 'line2',
(1,3): 'line3',
(2,3): 'tri3',
+ (2,6): 'tri6',
(2,4): 'quad4',
+ (2,9): 'quad9',
(3,4): 'tet4',
- (3,8): 'hex8'
+ (3,8): 'hex8',
+ (3,10): 'tet10',
+ (3,27): 'hex27'
}
"""
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/utils/VTKDataReader.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/utils/VTKDataReader.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/utils/VTKDataReader.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -81,14 +81,28 @@
cellId = cellTypes[0]
if numpy.sum(cellTypes-cellId) != 0:
raise ValueError("Expecting cells to all be the same type.")
- if cellId == 5: # tri3
- ncorners = 3
- elif cellId == 12: # tri3
- ncorners = 8
+ if cellId == 1: # vertex
+ ncorners = 1
elif cellId == 3: # line2
ncorners = 2
+ elif cellId == 5: # tri3
+ ncorners = 3
elif cellId == 9: # quad4
ncorners = 4
+ elif cellId == 10: # tet4
+ ncorners = 4
+ elif cellId == 12: # hex8
+ ncorners = 8
+ elif cellId == 21: # line3
+ ncorners = 3
+ elif cellId == 22: # tri6
+ ncorners = 6
+ elif cellId == 22: # quad9
+ ncorners = 9
+ elif cellId == 24: # tet10
+ ncorners = 10
+ elif cellId == 29: # hex27
+ ncorners = 27
elif cellId == 255: # unknown?
ncorners = 1
else:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/tests/3d/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests/3d/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests/3d/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -18,6 +18,7 @@
SUBDIRS = \
matprops \
+ plasticity \
slipdir
# End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests/3d/plasticity (from rev 17287, short/3D/PyLith/trunk/tests/3d/plasticity)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/quad9 (from rev 17287, short/3D/PyLith/trunk/tests_auto/2d/quad9)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/tri3/sheardisp_refine.cfg (from rev 17287, short/3D/PyLith/trunk/tests_auto/2d/tri3/sheardisp_refine.cfg)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/tri3/sheardisp_refine.cfg (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/tri3/sheardisp_refine.cfg 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,118 @@
+# -*- Python -*-
+[pylithapp]
+
+[pylithapp.launcher] # WARNING: THIS IS NOT PORTABLE
+#command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+[pylithapp.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solverlinear = 1
+#meshiocubit = 1
+#implicitelasticity = 1
+#quadrature2d = 1
+#fiatsimplex = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+[pylithapp.mesh_generator]
+#debug = 1
+reader = pylith.meshio.MeshIOCubit
+
+refiner = pylith.topology.RefineUniform
+
+[pylithapp.mesh_generator.reader]
+filename = mesh.exo
+use_nodeset_names = False
+coordsys.space_dim = 2
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+dimension = 2
+bc = [x_neg,x_pos,y_neg,y_pos]
+
+[pylithapp.timedependent.formulation.time_step]
+total_time = 0.0*s
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+materials = [elastic]
+materials.elastic = pylith.materials.ElasticPlaneStrain
+
+[pylithapp.timedependent.materials.elastic]
+label = Elastic material
+id = 1
+db_properties.iohandler.filename = matprops.spatialdb
+quadrature.cell = pylith.feassemble.FIATSimplex
+quadrature.cell.shape = triangle
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.bc.x_pos]
+bc_dof = [1]
+label = 20
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC +x edge
+db_initial.iohandler.filename = shear_disp.spatialdb
+
+[pylithapp.timedependent.bc.x_neg]
+bc_dof = [1]
+label = 21
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -x edge
+db_initial.iohandler.filename = shear_disp.spatialdb
+
+[pylithapp.timedependent.bc.y_pos]
+bc_dof = [0]
+label = 22
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC +y edge
+db_initial.iohandler.filename = shear_disp.spatialdb
+
+[pylithapp.timedependent.bc.y_neg]
+bc_dof = [0]
+label = 23
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -y edge
+db_initial.iohandler.filename = shear_disp.spatialdb
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[pylithapp.petsc]
+pc_type = asm
+
+# Change the preconditioner settings.
+sub_pc_factor_shift_type = none
+
+ksp_rtol = 1.0e-8
+ksp_max_it = 100
+ksp_gmres_restart = 50
+
+#ksp_monitor = true
+#ksp_view = true
+#ksp_converged_reason = true
+
+#log_summary = true
+# start_in_debugger = true
+
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+[pylithapp.problem.formulation.output.output.writer]
+filename = sheardisp.vtk
+
+[pylithapp.timedependent.materials.elastic.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = sheardisp-elastic.vtk
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/2d/tri6 (from rev 17287, short/3D/PyLith/trunk/tests_auto/2d/tri6)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex27 (from rev 17287, short/3D/PyLith/trunk/tests_auto/3dnew/hex27)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axial_disp.spatialdb (from rev 17287, short/3D/PyLith/trunk/tests_auto/3dnew/hex8/axial_disp.spatialdb)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axial_disp.spatialdb (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axial_disp.spatialdb 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,113 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 3
+ value-names = displacement-x displacement-y displacement-z
+ value-units = m m m
+ num-locs = 100
+ data-dim = 3
+ space-dim = 3
+ cs-data = cartesian {
+ to-meters = 1
+ space-dim = 3
+}
+}
+ -4.000000e+03 -4.000000e+03 -6.000000e+03 -7.037037e-01 1.851852e-01 2.777778e-01
+ -2.000000e+03 -4.000000e+03 -6.000000e+03 -3.518519e-01 1.851852e-01 2.777778e-01
+ 0.000000e+00 -4.000000e+03 -6.000000e+03 0.000000e+00 1.851852e-01 2.777778e-01
+ 2.000000e+03 -4.000000e+03 -6.000000e+03 3.518519e-01 1.851852e-01 2.777778e-01
+ 4.000000e+03 -4.000000e+03 -6.000000e+03 7.037037e-01 1.851852e-01 2.777778e-01
+ -4.000000e+03 -2.000000e+03 -6.000000e+03 -7.037037e-01 9.259259e-02 2.777778e-01
+ -2.000000e+03 -2.000000e+03 -6.000000e+03 -3.518519e-01 9.259259e-02 2.777778e-01
+ 0.000000e+00 -2.000000e+03 -6.000000e+03 0.000000e+00 9.259259e-02 2.777778e-01
+ 2.000000e+03 -2.000000e+03 -6.000000e+03 3.518519e-01 9.259259e-02 2.777778e-01
+ 4.000000e+03 -2.000000e+03 -6.000000e+03 7.037037e-01 9.259259e-02 2.777778e-01
+ -4.000000e+03 0.000000e+00 -6.000000e+03 -7.037037e-01 -0.000000e+00 2.777778e-01
+ -2.000000e+03 0.000000e+00 -6.000000e+03 -3.518519e-01 -0.000000e+00 2.777778e-01
+ 0.000000e+00 0.000000e+00 -6.000000e+03 0.000000e+00 0.000000e+00 2.777778e-01
+ 2.000000e+03 0.000000e+00 -6.000000e+03 3.518519e-01 0.000000e+00 2.777778e-01
+ 4.000000e+03 0.000000e+00 -6.000000e+03 7.037037e-01 0.000000e+00 2.777778e-01
+ -4.000000e+03 2.000000e+03 -6.000000e+03 -7.037037e-01 -9.259259e-02 2.777778e-01
+ -2.000000e+03 2.000000e+03 -6.000000e+03 -3.518519e-01 -9.259259e-02 2.777778e-01
+ 0.000000e+00 2.000000e+03 -6.000000e+03 0.000000e+00 -9.259259e-02 2.777778e-01
+ 2.000000e+03 2.000000e+03 -6.000000e+03 3.518519e-01 -9.259259e-02 2.777778e-01
+ 4.000000e+03 2.000000e+03 -6.000000e+03 7.037037e-01 -9.259259e-02 2.777778e-01
+ -4.000000e+03 4.000000e+03 -6.000000e+03 -7.037037e-01 -1.851852e-01 2.777778e-01
+ -2.000000e+03 4.000000e+03 -6.000000e+03 -3.518519e-01 -1.851852e-01 2.777778e-01
+ 0.000000e+00 4.000000e+03 -6.000000e+03 0.000000e+00 -1.851852e-01 2.777778e-01
+ 2.000000e+03 4.000000e+03 -6.000000e+03 3.518519e-01 -1.851852e-01 2.777778e-01
+ 4.000000e+03 4.000000e+03 -6.000000e+03 7.037037e-01 -1.851852e-01 2.777778e-01
+ -4.000000e+03 -4.000000e+03 -4.000000e+03 -7.037037e-01 1.851852e-01 1.851852e-01
+ -2.000000e+03 -4.000000e+03 -4.000000e+03 -3.518519e-01 1.851852e-01 1.851852e-01
+ 0.000000e+00 -4.000000e+03 -4.000000e+03 0.000000e+00 1.851852e-01 1.851852e-01
+ 2.000000e+03 -4.000000e+03 -4.000000e+03 3.518519e-01 1.851852e-01 1.851852e-01
+ 4.000000e+03 -4.000000e+03 -4.000000e+03 7.037037e-01 1.851852e-01 1.851852e-01
+ -4.000000e+03 -2.000000e+03 -4.000000e+03 -7.037037e-01 9.259259e-02 1.851852e-01
+ -2.000000e+03 -2.000000e+03 -4.000000e+03 -3.518519e-01 9.259259e-02 1.851852e-01
+ 0.000000e+00 -2.000000e+03 -4.000000e+03 0.000000e+00 9.259259e-02 1.851852e-01
+ 2.000000e+03 -2.000000e+03 -4.000000e+03 3.518519e-01 9.259259e-02 1.851852e-01
+ 4.000000e+03 -2.000000e+03 -4.000000e+03 7.037037e-01 9.259259e-02 1.851852e-01
+ -4.000000e+03 0.000000e+00 -4.000000e+03 -7.037037e-01 -0.000000e+00 1.851852e-01
+ -2.000000e+03 0.000000e+00 -4.000000e+03 -3.518519e-01 -0.000000e+00 1.851852e-01
+ 0.000000e+00 0.000000e+00 -4.000000e+03 0.000000e+00 0.000000e+00 1.851852e-01
+ 2.000000e+03 0.000000e+00 -4.000000e+03 3.518519e-01 0.000000e+00 1.851852e-01
+ 4.000000e+03 0.000000e+00 -4.000000e+03 7.037037e-01 0.000000e+00 1.851852e-01
+ -4.000000e+03 2.000000e+03 -4.000000e+03 -7.037037e-01 -9.259259e-02 1.851852e-01
+ -2.000000e+03 2.000000e+03 -4.000000e+03 -3.518519e-01 -9.259259e-02 1.851852e-01
+ 0.000000e+00 2.000000e+03 -4.000000e+03 0.000000e+00 -9.259259e-02 1.851852e-01
+ 2.000000e+03 2.000000e+03 -4.000000e+03 3.518519e-01 -9.259259e-02 1.851852e-01
+ 4.000000e+03 2.000000e+03 -4.000000e+03 7.037037e-01 -9.259259e-02 1.851852e-01
+ -4.000000e+03 4.000000e+03 -4.000000e+03 -7.037037e-01 -1.851852e-01 1.851852e-01
+ -2.000000e+03 4.000000e+03 -4.000000e+03 -3.518519e-01 -1.851852e-01 1.851852e-01
+ 0.000000e+00 4.000000e+03 -4.000000e+03 0.000000e+00 -1.851852e-01 1.851852e-01
+ 2.000000e+03 4.000000e+03 -4.000000e+03 3.518519e-01 -1.851852e-01 1.851852e-01
+ 4.000000e+03 4.000000e+03 -4.000000e+03 7.037037e-01 -1.851852e-01 1.851852e-01
+ -4.000000e+03 -4.000000e+03 -2.000000e+03 -7.037037e-01 1.851852e-01 9.259259e-02
+ -2.000000e+03 -4.000000e+03 -2.000000e+03 -3.518519e-01 1.851852e-01 9.259259e-02
+ 0.000000e+00 -4.000000e+03 -2.000000e+03 0.000000e+00 1.851852e-01 9.259259e-02
+ 2.000000e+03 -4.000000e+03 -2.000000e+03 3.518519e-01 1.851852e-01 9.259259e-02
+ 4.000000e+03 -4.000000e+03 -2.000000e+03 7.037037e-01 1.851852e-01 9.259259e-02
+ -4.000000e+03 -2.000000e+03 -2.000000e+03 -7.037037e-01 9.259259e-02 9.259259e-02
+ -2.000000e+03 -2.000000e+03 -2.000000e+03 -3.518519e-01 9.259259e-02 9.259259e-02
+ 0.000000e+00 -2.000000e+03 -2.000000e+03 0.000000e+00 9.259259e-02 9.259259e-02
+ 2.000000e+03 -2.000000e+03 -2.000000e+03 3.518519e-01 9.259259e-02 9.259259e-02
+ 4.000000e+03 -2.000000e+03 -2.000000e+03 7.037037e-01 9.259259e-02 9.259259e-02
+ -4.000000e+03 0.000000e+00 -2.000000e+03 -7.037037e-01 -0.000000e+00 9.259259e-02
+ -2.000000e+03 0.000000e+00 -2.000000e+03 -3.518519e-01 -0.000000e+00 9.259259e-02
+ 0.000000e+00 0.000000e+00 -2.000000e+03 0.000000e+00 0.000000e+00 9.259259e-02
+ 2.000000e+03 0.000000e+00 -2.000000e+03 3.518519e-01 0.000000e+00 9.259259e-02
+ 4.000000e+03 0.000000e+00 -2.000000e+03 7.037037e-01 0.000000e+00 9.259259e-02
+ -4.000000e+03 2.000000e+03 -2.000000e+03 -7.037037e-01 -9.259259e-02 9.259259e-02
+ -2.000000e+03 2.000000e+03 -2.000000e+03 -3.518519e-01 -9.259259e-02 9.259259e-02
+ 0.000000e+00 2.000000e+03 -2.000000e+03 0.000000e+00 -9.259259e-02 9.259259e-02
+ 2.000000e+03 2.000000e+03 -2.000000e+03 3.518519e-01 -9.259259e-02 9.259259e-02
+ 4.000000e+03 2.000000e+03 -2.000000e+03 7.037037e-01 -9.259259e-02 9.259259e-02
+ -4.000000e+03 4.000000e+03 -2.000000e+03 -7.037037e-01 -1.851852e-01 9.259259e-02
+ -2.000000e+03 4.000000e+03 -2.000000e+03 -3.518519e-01 -1.851852e-01 9.259259e-02
+ 0.000000e+00 4.000000e+03 -2.000000e+03 0.000000e+00 -1.851852e-01 9.259259e-02
+ 2.000000e+03 4.000000e+03 -2.000000e+03 3.518519e-01 -1.851852e-01 9.259259e-02
+ 4.000000e+03 4.000000e+03 -2.000000e+03 7.037037e-01 -1.851852e-01 9.259259e-02
+ -4.000000e+03 -4.000000e+03 0.000000e+00 -7.037037e-01 1.851852e-01 -0.000000e+00
+ -2.000000e+03 -4.000000e+03 0.000000e+00 -3.518519e-01 1.851852e-01 -0.000000e+00
+ 0.000000e+00 -4.000000e+03 0.000000e+00 0.000000e+00 1.851852e-01 0.000000e+00
+ 2.000000e+03 -4.000000e+03 0.000000e+00 3.518519e-01 1.851852e-01 0.000000e+00
+ 4.000000e+03 -4.000000e+03 0.000000e+00 7.037037e-01 1.851852e-01 0.000000e+00
+ -4.000000e+03 -2.000000e+03 0.000000e+00 -7.037037e-01 9.259259e-02 -0.000000e+00
+ -2.000000e+03 -2.000000e+03 0.000000e+00 -3.518519e-01 9.259259e-02 -0.000000e+00
+ 0.000000e+00 -2.000000e+03 0.000000e+00 0.000000e+00 9.259259e-02 0.000000e+00
+ 2.000000e+03 -2.000000e+03 0.000000e+00 3.518519e-01 9.259259e-02 0.000000e+00
+ 4.000000e+03 -2.000000e+03 0.000000e+00 7.037037e-01 9.259259e-02 0.000000e+00
+ -4.000000e+03 0.000000e+00 0.000000e+00 -7.037037e-01 0.000000e+00 0.000000e+00
+ -2.000000e+03 0.000000e+00 0.000000e+00 -3.518519e-01 0.000000e+00 0.000000e+00
+ 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+ 2.000000e+03 0.000000e+00 0.000000e+00 3.518519e-01 0.000000e+00 0.000000e+00
+ 4.000000e+03 0.000000e+00 0.000000e+00 7.037037e-01 0.000000e+00 0.000000e+00
+ -4.000000e+03 2.000000e+03 0.000000e+00 -7.037037e-01 -9.259259e-02 0.000000e+00
+ -2.000000e+03 2.000000e+03 0.000000e+00 -3.518519e-01 -9.259259e-02 0.000000e+00
+ 0.000000e+00 2.000000e+03 0.000000e+00 0.000000e+00 -9.259259e-02 0.000000e+00
+ 2.000000e+03 2.000000e+03 0.000000e+00 3.518519e-01 -9.259259e-02 0.000000e+00
+ 4.000000e+03 2.000000e+03 0.000000e+00 7.037037e-01 -9.259259e-02 0.000000e+00
+ -4.000000e+03 4.000000e+03 0.000000e+00 -7.037037e-01 -1.851852e-01 0.000000e+00
+ -2.000000e+03 4.000000e+03 0.000000e+00 -3.518519e-01 -1.851852e-01 0.000000e+00
+ 0.000000e+00 4.000000e+03 0.000000e+00 0.000000e+00 -1.851852e-01 0.000000e+00
+ 2.000000e+03 4.000000e+03 0.000000e+00 3.518519e-01 -1.851852e-01 0.000000e+00
+ 4.000000e+03 4.000000e+03 0.000000e+00 7.037037e-01 -1.851852e-01 0.000000e+00
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp.cfg (from rev 17287, short/3D/PyLith/trunk/tests_auto/3dnew/hex8/axialdisp.cfg)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp.cfg (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp.cfg 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,134 @@
+# -*- Python -*-
+[pylithapp]
+
+[pylithapp.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+[pylithapp.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solverlinear = 1
+#meshiocubit = 1
+#implicitelasticity = 1
+#quadrature3d = 1
+#fiatlagrange = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+[pylithapp.mesh_generator]
+#debug = 1
+reader = pylith.meshio.MeshIOCubit
+
+[pylithapp.mesh_generator.reader]
+filename = mesh.exo
+use_nodeset_names = True
+coordsys.space_dim = 3
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+dimension = 3
+bc = [x_neg,x_pos,y_neg,z_neg]
+
+[pylithapp.timedependent.formulation]
+output = [domain,subdomain]
+output.subdomain = pylith.meshio.OutputSolnSubset
+
+[pylithapp.timedependent.formulation.time_step]
+total_time = 0.0*s
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+materials = [elastic,viscoelastic]
+materials.elastic = pylith.materials.ElasticIsotropic3D
+materials.viscoelastic = pylith.materials.ElasticIsotropic3D
+
+[pylithapp.timedependent.materials.elastic]
+label = Elastic material
+id = 1
+db_properties.iohandler.filename = matprops.spatialdb
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 3
+
+[pylithapp.timedependent.materials.viscoelastic]
+label = Elastic material 2
+id = 2
+db_properties.iohandler.filename = matprops.spatialdb
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 3
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.bc.x_pos]
+bc_dof = [0]
+label = face_xpos
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC +x eface
+db_initial.iohandler.filename = axial_disp.spatialdb
+
+[pylithapp.timedependent.bc.x_neg]
+bc_dof = [0]
+label = face_xneg
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -x face
+db_initial.iohandler.filename = axial_disp.spatialdb
+
+[pylithapp.timedependent.bc.y_neg]
+bc_dof = [1]
+label = face_yneg
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -y face
+db_initial.iohandler.filename = axial_disp.spatialdb
+
+[pylithapp.timedependent.bc.z_neg]
+bc_dof = [2]
+label = face_zneg
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -z edge
+db_initial.iohandler.filename = axial_disp.spatialdb
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[pylithapp.petsc]
+pc_type = asm
+
+# Change the preconditioner settings.
+sub_pc_factor_shift_type = none
+
+ksp_rtol = 1.0e-8
+ksp_max_it = 100
+ksp_gmres_restart = 50
+ksp_monitor = true
+ksp_view = true
+ksp_converged_reason = true
+#log_summary = true
+# start_in_debugger = true
+
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+[pylithapp.problem.formulation.output.domain.writer]
+filename = axialdisp.vtk
+
+[pylithapp.problem.formulation.output.subdomain]
+label = face_zpos
+writer.filename = axialdisp-groundsurf.vtk
+
+[pylithapp.timedependent.materials.elastic.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = axialdisp-elastic.vtk
+
+[pylithapp.timedependent.materials.viscoelastic.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = axialdisp-viscoelastic.vtk
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_gendb.py (from rev 17287, short/3D/PyLith/trunk/tests_auto/3dnew/hex8/axialdisp_gendb.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_gendb.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_gendb.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# 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 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/3d/hex8/axialdisp_gendb.py
+##
+## @brief Python script to generate spatial database with displacement
+## boundary conditions for the axial displacement test.
+
+import numpy
+
+class GenerateDB(object):
+ """
+ Python object to generate spatial database with displacement
+ boundary conditions for the axial displacement test.
+ """
+
+ def __init__(self):
+ """
+ Constructor.
+ """
+ return
+
+
+ def run(self):
+ """
+ Generate the database.
+ """
+ # Domain
+ x = numpy.arange(-4000.0, 4000.1, 1000.0)
+ y = numpy.arange(-4000.0, 4000.1, 1000.0)
+ z = numpy.arange(-6000.0, 0.1, 1000.0)
+ nxpts = x.shape[0]
+ nypts = y.shape[0]
+ nzpts = z.shape[0]
+
+ xx = numpy.tile(x, (1,nypts*nzpts))
+ yy = numpy.tile(y, (nxpts,nzpts)).transpose()
+ zz = numpy.tile(z, (nxpts*nypts,1)).transpose()
+
+ xyz = numpy.zeros( (nxpts*nypts*nzpts, 3), dtype=numpy.float64)
+ xyz[:,0] = numpy.ravel(xx)
+ xyz[:,1] = numpy.ravel(yy)
+ xyz[:,2] = numpy.ravel(zz)
+
+ from axialdisp_soln import AnalyticalSoln
+ soln = AnalyticalSoln()
+ disp = soln.displacement(xyz)
+
+ from spatialdata.geocoords.CSCart import CSCart
+ cs = CSCart()
+ cs.inventory.spaceDim = 3
+ cs._configure()
+ data = {'points': xyz,
+ 'coordsys': cs,
+ 'data_dim': 3,
+ 'values': [{'name': "displacement-x",
+ 'units': "m",
+ 'data': numpy.ravel(disp[:,0])},
+ {'name': "displacement-y",
+ 'units': "m",
+ 'data': numpy.ravel(disp[:,1])},
+ {'name': "displacement-z",
+ 'units': "m",
+ 'data': numpy.ravel(disp[:,2])}]}
+
+ from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
+ io = SimpleIOAscii()
+ io.inventory.filename = "axial_disp.spatialdb"
+ io._configure()
+ io.write(data)
+ return
+
+
+# ======================================================================
+if __name__ == "__main__":
+ app = GenerateDB()
+ app.run()
+
+
+# End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_soln.py (from rev 17287, short/3D/PyLith/trunk/tests_auto/3dnew/hex8/axialdisp_soln.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_soln.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/axialdisp_soln.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# 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 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/axialdisp_soln.py
+##
+## @brief Analytical solution to axial displacement problem.
+
+## 3-D axial extension test with linear hexahedral cells.
+
+import numpy
+
+# Physical properties
+p_density = 2500.0
+p_vs = 3000.0
+p_vp = 5291.502622129181
+
+p_mu = p_density*p_vs**2
+p_lambda = p_density*p_vp**2 - 2*p_mu
+
+# Uniform stress field (plane strain)
+sxx = 1.0e+7
+syy = 0.0
+szz = 0.0
+sxy = 0.0
+syz = 0.0
+sxz = 0.0
+
+# Uniform strain field
+exx = 1.0/(2*p_mu) * (sxx - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+eyy = 1.0/(2*p_mu) * (syy - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+ezz = 1.0/(2*p_mu) * (szz - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+
+exy = 1.0/(2*p_mu) * (sxy)
+eyz = 1.0/(2*p_mu) * (syz)
+exz = 1.0/(2*p_mu) * (sxz)
+
+#print exx,eyy,exy,ezz
+#print -exx*p_lambda/(p_lambda+2*p_mu)
+
+# ----------------------------------------------------------------------
+class AnalyticalSoln(object):
+ """
+ Analytical solution to axial/shear displacement problem.
+ """
+
+ def __init__(self):
+ return
+
+
+ def displacement(self, locs):
+ """
+ Compute displacement field at locations.
+ """
+ (npts, dim) = locs.shape
+ disp = numpy.zeros( (npts, 3), dtype=numpy.float64)
+ disp[:,0] = exx*locs[:,0] + exy*locs[:,1] + exz*locs[:,2]
+ disp[:,1] = eyy*locs[:,1] + exy*locs[:,0] + eyz*locs[:,2]
+ disp[:,2] = ezz*locs[:,2] + exz*locs[:,0] + eyz*locs[:,1]
+ return disp
+
+
+ def strain(self, locs):
+ """
+ Compute strain field at locations.
+ """
+ (npts, dim) = locs.shape
+ strain = numpy.zeros( (npts, 6), dtype=numpy.float64)
+ strain[:,0] = exx
+ strain[:,1] = eyy
+ strain[:,2] = ezz
+ strain[:,3] = exy
+ strain[:,4] = eyz
+ strain[:,5] = exz
+ return strain
+
+
+ def stress(self, locs):
+ """
+ Compute stress field at locations.
+ """
+ (npts, dim) = locs.shape
+ stress = numpy.zeros( (npts, 6), dtype=numpy.float64)
+ stress[:,0] = sxx
+ stress[:,1] = syy
+ stress[:,2] = szz
+ stress[:,3] = sxy
+ stress[:,4] = syz
+ stress[:,5] = sxz
+ return stress
+
+
+# End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/mesh.exo
===================================================================
(Binary files differ)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/mesh.jou
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/mesh.jou 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/hex8/mesh.jou 2010-10-15 23:45:21 UTC (rev 17288)
@@ -41,7 +41,7 @@
group "face_xpos" add node in surface 31
group "face_xpos" add node in surface 39
nodeset 20 group face_xpos
-nodeset 20 name "face xpos"
+nodeset 20 name "face_xpos"
# ----------------------------------------------------------------------
# Create nodeset for -x face
@@ -49,7 +49,7 @@
group "face_xneg" add node in surface 41
group "face_xneg" add node in surface 49
nodeset 21 group face_xneg
-nodeset 21 name "face xneg"
+nodeset 21 name "face_xneg"
# ----------------------------------------------------------------------
# Create nodeset for +y face
@@ -61,7 +61,7 @@
group "face_ypos" add node in surface 46
group "face_ypos" add node in surface 56
nodeset 22 group face_ypos
-nodeset 22 name "face ypos"
+nodeset 22 name "face_ypos"
# ----------------------------------------------------------------------
# Create nodeset for -y face
@@ -73,7 +73,7 @@
group "face_yneg" add node in surface 48
group "face_yneg" add node in surface 58
nodeset 23 group face_yneg
-nodeset 23 name "face yneg"
+nodeset 23 name "face_yneg"
# ----------------------------------------------------------------------
# Create nodeset for +z face
@@ -82,7 +82,7 @@
group "face_zpos" add node in surface 27
group "face_zpos" add node in surface 23
nodeset 24 group face_zpos
-nodeset 24 name "face zpos"
+nodeset 24 name "face_zpos"
# ----------------------------------------------------------------------
# Create nodeset for -z face
@@ -91,7 +91,7 @@
group "face_zneg" add node in surface 28
group "face_zneg" add node in surface 21
nodeset 25 group face_zneg
-nodeset 25 name "face zneg"
+nodeset 25 name "face_zneg"
# ----------------------------------------------------------------------
# Create nodeset for -z face
@@ -99,7 +99,7 @@
group "face_zneg_nofault" add node in face_zneg
group "face_zneg_nofault" remove node in fault
nodeset 26 group face_zneg_nofault
-nodeset 26 name "face zneg nofault"
+nodeset 26 name "face_zneg_nofault"
# ----------------------------------------------------------------------
# Export exodus file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/tet10 (from rev 17287, short/3D/PyLith/trunk/tests_auto/3dnew/tet10)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests_auto/3dnew/tet4 (from rev 17287, short/3D/PyLith/trunk/tests_auto/3dnew/tet4)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestAbsorbingDampers.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestAbsorbingDampers.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -45,7 +45,6 @@
typedef pylith::topology::SubMesh::RealSection RealSection;
typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
typedef pylith::topology::SubMesh::RealSection SubRealSection;
-typedef pylith::topology::SubMesh::RestrictVisitor RestrictVisitor;
// ----------------------------------------------------------------------
// Setup testing data.
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestNeumann.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestNeumann.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestNeumann.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -48,8 +48,9 @@
typedef pylith::topology::SubMesh::RealSection RealSection;
typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
typedef pylith::topology::SubMesh::RealSection SubRealSection;
-typedef pylith::topology::SubMesh::RestrictVisitor RestrictVisitor;
+typedef pylith::topology::Field<pylith::topology::SubMesh>::RestrictVisitor RestrictVisitor;
+
// ----------------------------------------------------------------------
namespace pylith {
namespace bc {
@@ -166,52 +167,29 @@
const int numCorners = _data->numCorners;
const int spaceDim = _data->spaceDim;
const ALE::Obj<SieveSubMesh::label_sequence>& cells = submesh->heightStratum(1);
- const int numBoundaryVertices = submesh->depthStratum(0)->size();
- const int numBoundaryCells = cells->size();
+ const int numVertices = submesh->depthStratum(0)->size();
+ const int numCells = cells->size();
+ const int boundaryDepth = submesh->depth()-1; // depth of boundary cells
CPPUNIT_ASSERT_EQUAL(_data->cellDim, cellDim);
- CPPUNIT_ASSERT_EQUAL(_data->numBoundaryVertices, numBoundaryVertices);
- CPPUNIT_ASSERT_EQUAL(_data->numBoundaryCells, numBoundaryCells);
+ CPPUNIT_ASSERT_EQUAL(_data->numVertices, numVertices);
+ CPPUNIT_ASSERT_EQUAL(_data->numCells, numCells);
- const int boundaryDepth = submesh->depth()-1; // depth of boundary cells
- const ALE::Obj<SubRealSection>& coordinates =
- submesh->getRealSection("coordinates");
- RestrictVisitor coordsVisitor(*coordinates, numCorners*spaceDim);
- // coordinates->view("Mesh coordinates from TestNeumann::testInitialize");
-
- const int numBasis = bc._quadrature->numBasis();
- const int cellVertSize = _data->numCorners * spaceDim;
- double_array cellVertices(cellVertSize);
-
- const double tolerance = 1.0e-06;
-
- // check cell vertices
- int iCell = 0;
+ const ALE::Obj<SieveMesh::sieve_type>& sieve = submesh->getSieve();
+ ALE::ISieveVisitor::PointRetriever<SieveSubMesh::sieve_type> pV(sieve->getMaxConeSize());
+ int dp = 0;
for(SieveSubMesh::label_sequence::iterator c_iter = cells->begin();
c_iter != cells->end();
++c_iter) {
const int numCorners = submesh->getNumCellCorners(*c_iter, boundaryDepth);
CPPUNIT_ASSERT_EQUAL(_data->numCorners, numCorners);
- coordsVisitor.clear();
- submesh->restrictClosure(*c_iter, coordsVisitor);
- double vert =0.0;
- double vertE =0.0;
- const double* cellVertices = coordsVisitor.getValues();
- // std::cout << "c_iter " << *c_iter << " vertex coords:" << std::endl;
- for(int iVert = 0; iVert < numCorners; ++iVert) {
- for(int iDim = 0; iDim < spaceDim; ++iDim) {
- vertE = _data->cellVertices[iDim+spaceDim*iVert+iCell*cellVertSize];
- vert = cellVertices[iDim+spaceDim*iVert];
- // std::cout << " " << cellVertices[iDim+spaceDim*iVert];
- if (fabs(vertE) > 1.0)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vert/vertE, tolerance);
- else
- CPPUNIT_ASSERT_DOUBLES_EQUAL(vert, vertE, tolerance);
- } // for
- // std::cout << std::endl;
- } // for
- iCell++;
+ sieve->cone(*c_iter, pV);
+ const SieveSubMesh::point_type *cone = pV.getPoints();
+ for(int p = 0; p < pV.getSize(); ++p, ++dp) {
+ CPPUNIT_ASSERT_EQUAL(_data->cells[dp], cone[p]);
+ }
+ pV.clear();
} // for
// Check traction values
@@ -223,6 +201,7 @@
const ALE::Obj<SubRealSection>& tractionSection =
bc._parameters->get("initial").section();
+ const double tolerance = 1.0e-06;
for(SieveSubMesh::label_sequence::iterator c_iter = cells->begin();
c_iter != cells->end();
++c_iter) {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestTimeDependent.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestTimeDependent.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/TestTimeDependent.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -125,13 +125,8 @@
PointForce bc;
bc.dbTimeHistory(&th);
- bool caught = false;
- try {
- bc.TimeDependent::verifyConfiguration(mesh);
- } catch ( const std::exception& err) {
- caught = true;
- } // catch
- CPPUNIT_ASSERT(caught);
+ CPPUNIT_ASSERT_THROW(bc.TimeDependent::verifyConfiguration(mesh),
+ std::runtime_error);
} // change (missing change)
} // testVerifyConfiguration
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -112,8 +112,8 @@
const int pylith::bc::AbsorbingDampersDataHex8::_numCells = 2;
const int pylith::bc::AbsorbingDampersDataHex8::_numCorners = 4;
const int pylith::bc::AbsorbingDampersDataHex8::_cells[] = {
- 4, 10, 8, 2,
- 6, 12, 10, 4,
+ 2, 4, 10, 8,
+ 4, 6, 12, 10,
};
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/AbsorbingDampersDataTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -35,9 +35,9 @@
0.3333333333333333,
};
const double pylith::bc::AbsorbingDampersDataTet4::_basisDerivRef[] = {
- -1.0, -1.0,
- 1.0, 0.0,
- 0.0, 1.0,
+ -0.5, -0.5,
+ 0.5, 0.0,
+ 0.0, 0.5,
};
const char* pylith::bc::AbsorbingDampersDataTet4::_spatialDBFilename =
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -33,8 +33,8 @@
2, 4, 6, 8, 10, 12
};
const int pylith::bc::BoundaryMeshDataHex8::_cellsNoFault[] = {
- 4, 10, 8, 2,
- 6, 12, 10, 4
+ 2, 4, 10, 8,
+ 4, 6, 12, 10,
};
const int pylith::bc::BoundaryMeshDataHex8::_numVerticesFault = 8;
@@ -42,8 +42,8 @@
2, 4, 6, 8, 10, 12, 14, 16
};
const int pylith::bc::BoundaryMeshDataHex8::_cellsFault[] = {
- 14, 16, 8, 2,
- 6, 12, 10, 4,
+ 2, 14, 16, 8,
+ 4, 6, 12, 10,
};
pylith::bc::BoundaryMeshDataHex8::BoundaryMeshDataHex8(void)
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -33,10 +33,10 @@
label(""),
spaceDim(0),
cellDim(0),
- numBoundaryVertices(0),
- numBoundaryCells(0),
+ numVertices(0),
+ numCells(0),
numCorners(0),
- cellVertices(0),
+ cells(0),
tractionsCell(0),
valsResidual(0)
{ // constructor
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannData.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -61,12 +61,12 @@
/// @name Boundary mesh information
//@{
- int spaceDim; ///< Number of dimensions of vertex coordinates
- int cellDim; ///< Dimension of surface cells.
- int numBoundaryVertices; ///< Number of boundary vertices in the mesh.
- int numBoundaryCells; ///< Number of cells on Neumann boundary.
- int numCorners; ///< Number of vertices for each boundary cell.
- double* cellVertices; ///< Vertex coordinates for boundary cells.
+ int spaceDim; ///< Number of dimensions in vertex coordinates
+ int cellDim; ///< Number of dimensions associated with cell
+ int numVertices; ///< Number of vertices
+ int numCells; ///< Number of cells
+ int numCorners; ///< Number of vertices in cell
+ int* cells; ///< Indices of vertices in cells
//@}
/// @name Calculated values.
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -78,18 +78,14 @@
const int pylith::bc::NeumannDataHex8::_spaceDim = 3;
const int pylith::bc::NeumannDataHex8::_cellDim = 2;
-
-const int pylith::bc::NeumannDataHex8::_numBoundaryVertices = 6;
-const int pylith::bc::NeumannDataHex8::_numBoundaryCells = 2;
+const int pylith::bc::NeumannDataHex8::_numVertices = 6;
+const int pylith::bc::NeumannDataHex8::_numCells = 2;
const int pylith::bc::NeumannDataHex8::_numCorners = 4;
-const double pylith::bc::NeumannDataHex8::_cellVertices[] = { 0.0,-1.0,-1.0,
- 0.0,-1.0, 1.0,
- -2.0,-1.0, 1.0,
- -2.0,-1.0,-1.0,
- 2.0,-1.0,-1.0,
- 2.0,-1.0, 1.0,
- 0.0,-1.0, 1.0,
- 0.0,-1.0,-1.0};
+const int pylith::bc::NeumannDataHex8::_cells[] = {
+ 4, 2, 6, 8,
+ 8, 6, 10, 12,
+};
+
const double pylith::bc::NeumannDataHex8::_tractionsCell[] = { 4.0, 0.0, 0.0,
4.0, 0.0, 0.0,
4.0, 0.0, 0.0,
@@ -129,11 +125,11 @@
spaceDim = _spaceDim;
cellDim = _cellDim;
- numBoundaryVertices = _numBoundaryVertices;
- numBoundaryCells = _numBoundaryCells;
+ numVertices = _numVertices;
+ numCells = _numCells;
numCorners = _numCorners;
+ cells = const_cast<int*>(_cells);
- cellVertices = const_cast<double*>(_cellVertices);
tractionsCell = const_cast<double*>(_tractionsCell);
valsResidual = const_cast<double*>(_valsResidual);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,10 +60,10 @@
// Mesh information
static const int _spaceDim;
static const int _cellDim;
- static const int _numBoundaryVertices;
- static const int _numBoundaryCells;
+ static const int _numVertices;
+ static const int _numCells;
static const int _numCorners;
- static const double _cellVertices[];
+ static const int _cells[];
// Calculated values.
static const double _tractionsCell[];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -52,11 +52,13 @@
const int pylith::bc::NeumannDataLine2::_spaceDim = 1;
const int pylith::bc::NeumannDataLine2::_cellDim = 0;
+const int pylith::bc::NeumannDataLine2::_numVertices = 1;
+const int pylith::bc::NeumannDataLine2::_numCells = 1;
+const int pylith::bc::NeumannDataLine2::_numCorners = 1;
+const int pylith::bc::NeumannDataLine2::_cells[] = {
+ 2,
+};
-const int pylith::bc::NeumannDataLine2::_numBoundaryVertices = 1;
-const int pylith::bc::NeumannDataLine2::_numBoundaryCells = 1;
-const int pylith::bc::NeumannDataLine2::_numCorners = 1;
-const double pylith::bc::NeumannDataLine2::_cellVertices[] = { -1.0};
const double pylith::bc::NeumannDataLine2::_tractionsCell[] = {
1.0,
};
@@ -84,11 +86,11 @@
spaceDim = _spaceDim;
cellDim = _cellDim;
- numBoundaryVertices = _numBoundaryVertices;
- numBoundaryCells = _numBoundaryCells;
+ numVertices = _numVertices;
+ numCells = _numCells;
numCorners = _numCorners;
+ cells = const_cast<int*>(_cells);
- cellVertices = const_cast<double*>(_cellVertices);
tractionsCell = const_cast<double*>(_tractionsCell);
valsResidual = const_cast<double*>(_valsResidual);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataLine2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,10 +60,10 @@
// Mesh information
static const int _spaceDim;
static const int _cellDim;
- static const int _numBoundaryVertices;
- static const int _numBoundaryCells;
+ static const int _numVertices;
+ static const int _numCells;
static const int _numCorners;
- static const double _cellVertices[];
+ static const int _cells[];
// Calculated values.
static const double _tractionsCell[];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -70,14 +70,14 @@
const int pylith::bc::NeumannDataQuad4::_spaceDim = 2;
const int pylith::bc::NeumannDataQuad4::_cellDim = 1;
+const int pylith::bc::NeumannDataQuad4::_numVertices = 3;
+const int pylith::bc::NeumannDataQuad4::_numCells = 2;
+const int pylith::bc::NeumannDataQuad4::_numCorners = 2;
+const int pylith::bc::NeumannDataQuad4::_cells[] = {
+ 2, 4,
+ 4, 6,
+};
-const int pylith::bc::NeumannDataQuad4::_numBoundaryVertices = 3;
-const int pylith::bc::NeumannDataQuad4::_numBoundaryCells = 2;
-const int pylith::bc::NeumannDataQuad4::_numCorners = 2;
-const double pylith::bc::NeumannDataQuad4::_cellVertices[] = {-1.0,-1.0,
- 0.0,-1.0,
- 0.0,-1.0,
- 1.0,-1.0};
const double pylith::bc::NeumannDataQuad4::_tractionsCell[] = {
0.0, -0.1056624327,
0.0, -0.3943375673,
@@ -111,11 +111,11 @@
spaceDim = _spaceDim;
cellDim = _cellDim;
- numBoundaryVertices = _numBoundaryVertices;
- numBoundaryCells = _numBoundaryCells;
+ numVertices = _numVertices;
+ numCells = _numCells;
numCorners = _numCorners;
+ cells = const_cast<int*>(_cells);
- cellVertices = const_cast<double*>(_cellVertices);
tractionsCell = const_cast<double*>(_tractionsCell);
valsResidual = const_cast<double*>(_valsResidual);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataQuad4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,10 +60,10 @@
// Mesh information
static const int _spaceDim;
static const int _cellDim;
- static const int _numBoundaryVertices;
- static const int _numBoundaryCells;
+ static const int _numVertices;
+ static const int _numCells;
static const int _numCorners;
- static const double _cellVertices[];
+ static const int _cells[];
// Calculated values.
static const double _tractionsCell[];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -53,9 +53,9 @@
0.3333333333333333,
};
const double pylith::bc::NeumannDataTet4::_basisDerivRef[] = {
- -1.0, -1.0,
- 1.0, 0.0,
- 0.0, 1.0,
+ -0.5, -0.5,
+ 0.5, 0.0,
+ 0.0, 0.5,
};
const char* pylith::bc::NeumannDataTet4::_spatialDBFilename =
@@ -65,13 +65,13 @@
const int pylith::bc::NeumannDataTet4::_spaceDim = 3;
const int pylith::bc::NeumannDataTet4::_cellDim = 2;
+const int pylith::bc::NeumannDataTet4::_numVertices = 3;
+const int pylith::bc::NeumannDataTet4::_numCells = 1;
+const int pylith::bc::NeumannDataTet4::_numCorners = 3;
+const int pylith::bc::NeumannDataTet4::_cells[] = {
+ 3, 4, 5,
+};
-const int pylith::bc::NeumannDataTet4::_numBoundaryVertices = 3;
-const int pylith::bc::NeumannDataTet4::_numBoundaryCells = 1;
-const int pylith::bc::NeumannDataTet4::_numCorners = 3;
-const double pylith::bc::NeumannDataTet4::_cellVertices[] = { 1.0, 0.0, 0.0,
- 0.0, 1.0, 0.0,
- 0.0, 0.0, 1.0};
const double pylith::bc::NeumannDataTet4::_tractionsCell[] = {
-0.5380048025, 0.87620875991, 1.3938468501
};
@@ -101,11 +101,11 @@
spaceDim = _spaceDim;
cellDim = _cellDim;
- numBoundaryVertices = _numBoundaryVertices;
- numBoundaryCells = _numBoundaryCells;
+ numVertices = _numVertices;
+ numCells = _numCells;
numCorners = _numCorners;
+ cells = const_cast<int*>(_cells);
- cellVertices = const_cast<double*>(_cellVertices);
tractionsCell = const_cast<double*>(_tractionsCell);
valsResidual = const_cast<double*>(_valsResidual);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTet4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,10 +60,10 @@
// Mesh information
static const int _spaceDim;
static const int _cellDim;
- static const int _numBoundaryVertices;
- static const int _numBoundaryCells;
+ static const int _numVertices;
+ static const int _numCells;
static const int _numCorners;
- static const double _cellVertices[];
+ static const int _cells[];
// Calculated values.
static const double _tractionsCell[];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,12 +60,13 @@
const int pylith::bc::NeumannDataTri3::_spaceDim = 2;
const int pylith::bc::NeumannDataTri3::_cellDim = 1;
+const int pylith::bc::NeumannDataTri3::_numVertices = 2;
+const int pylith::bc::NeumannDataTri3::_numCells = 1;
+const int pylith::bc::NeumannDataTri3::_numCorners = 2;
+const int pylith::bc::NeumannDataTri3::_cells[] = {
+ 3, 5,
+};
-const int pylith::bc::NeumannDataTri3::_numBoundaryVertices = 2;
-const int pylith::bc::NeumannDataTri3::_numBoundaryCells = 1;
-const int pylith::bc::NeumannDataTri3::_numCorners = 2;
-const double pylith::bc::NeumannDataTri3::_cellVertices[] = { 0.0,-1.0,
- 1.0, 0.0};
const double pylith::bc::NeumannDataTri3::_tractionsCell[] = {
1.4142135624, 0.0,
};
@@ -94,11 +95,11 @@
spaceDim = _spaceDim;
cellDim = _cellDim;
- numBoundaryVertices = _numBoundaryVertices;
- numBoundaryCells = _numBoundaryCells;
+ numVertices = _numVertices;
+ numCells = _numCells;
numCorners = _numCorners;
+ cells = const_cast<int*>(_cells);
- cellVertices = const_cast<double*>(_cellVertices);
tractionsCell = const_cast<double*>(_tractionsCell);
valsResidual = const_cast<double*>(_valsResidual);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/data/NeumannDataTri3.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,10 +60,10 @@
// Mesh information
static const int _spaceDim;
static const int _cellDim;
- static const int _numBoundaryVertices;
- static const int _numBoundaryCells;
+ static const int _numVertices;
+ static const int _numCells;
static const int _numCorners;
- static const double _cellVertices[];
+ static const int _cells[];
// Calculated values.
static const double _tractionsCell[];
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/TestFaultCohesive.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/TestFaultCohesive.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/TestFaultCohesive.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -418,7 +418,7 @@
{ // testAdjustTopologyHex8h
CohesiveDataHex8h data;
FaultCohesiveTract fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyHex8h
// ----------------------------------------------------------------------
@@ -551,6 +551,8 @@
tolerance);
} // for
+ mesh.view("MESH");
+
// check cells
const ALE::Obj<SieveMesh::sieve_type>& sieve = sieveMesh->getSieve();
CPPUNIT_ASSERT(!sieve.isNull());
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8b.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8b.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8b.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -72,7 +72,7 @@
const int pylith::faults::CohesiveDataHex8b::_cells[] = {
2, 14, 15, 3, 4, 16, 17, 5,
6, 10, 11, 7, 8, 12, 13, 9,
- 8, 9, 7, 6, 16, 17, 15, 14,
+ 7, 6, 8, 9, 15, 14, 16, 17,
};
const int pylith::faults::CohesiveDataHex8b::_materialIds[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8d.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8d.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8d.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -72,7 +72,7 @@
const int pylith::faults::CohesiveDataHex8d::_cells[] = {
4, 8, 6, 2, 5, 9, 7, 3,
16, 12, 10, 14, 17, 13, 11, 15,
- 6, 7, 9, 8, 14, 15, 17, 16,
+ 8, 6, 7, 9, 16, 14, 15, 17,
};
const int pylith::faults::CohesiveDataHex8d::_materialIds[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8e.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8e.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8e.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -72,7 +72,7 @@
const int pylith::faults::CohesiveDataHex8e::_cells[] = {
5, 9, 8, 4, 3, 7, 6, 2,
17, 13, 12, 16, 15, 11, 10, 14,
- 8, 6, 7, 9, 16, 14, 15, 17,
+ 9, 8, 6, 7, 17, 16, 14, 15,
};
const int pylith::faults::CohesiveDataHex8e::_materialIds[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8f.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8f.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8f.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -72,7 +72,7 @@
const int pylith::faults::CohesiveDataHex8f::_cells[] = {
3, 15, 17, 5, 2, 14, 16, 4,
7, 11, 13, 9, 6, 10, 12, 8,
- 6, 8, 9, 7, 14, 16, 17, 15,
+ 9, 7, 6, 8, 17, 15, 14, 16,
};
const int pylith::faults::CohesiveDataHex8f::_materialIds[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8g.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8g.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8g.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -98,8 +98,8 @@
6, 24, 25, 7, 8, 26, 27, 9,
10, 16, 17, 11, 12, 18, 19, 13,
12, 18, 19, 13, 14, 20, 21, 15,
- 12, 13, 11, 10, 24, 25, 23, 22,
- 14, 15, 13, 12, 26, 27, 25, 24,
+ 11, 10, 12, 13, 23, 22, 24, 25,
+ 13, 12, 14, 15, 25, 24, 26, 27,
};
const int pylith::faults::CohesiveDataHex8g::_materialIds[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8h.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8h.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8h.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -97,8 +97,8 @@
19, 18, 20, 21, 13, 12, 14, 15,
11, 17, 19, 13, 10, 16, 18, 12,
27, 26, 8, 9, 25, 24, 6, 7,
- 11, 10, 12, 13, 23, 22, 24, 25,
- 12, 14, 15, 13, 24, 26, 27, 25,
+ 13, 11, 10, 12, 25, 23, 22, 24,
+ 15, 13, 12, 14, 27, 25, 24, 26,
};
const int pylith::faults::CohesiveDataHex8h::_materialIds[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8i.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8i.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDataHex8i.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -90,8 +90,8 @@
41, 35, 30, 38, 42, 36, 31, 39,
27, 28, 38, 37, 32, 33, 41, 40,
15, 14, 13, 24, 19, 18, 17, 26,
- 24, 23, 20, 21, 41, 40, 37, 38,
- 21, 22, 25, 24, 38, 39, 42, 41,
+ 20, 21, 24, 23, 37, 38, 41, 40,
+ 24, 21, 22, 25, 41, 38, 39, 42,
};
const int pylith::faults::CohesiveDataHex8i::_materialIds[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDynDataTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDynDataTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveDynDataTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -60,9 +60,9 @@
3.33333333e-01,};
const double pylith::faults::CohesiveDynDataTet4::_basisDeriv[] = {
- -1.00000000e+00, -1.00000000e+00,
- 1.00000000e+00, 0.00000000e+00,
- 0.00000000e+00, 1.00000000e+00,
+ -0.50000000e+00, -0.50000000e+00,
+ 0.50000000e+00, 0.00000000e+00,
+ 0.00000000e+00, 0.50000000e+00,
};
const double pylith::faults::CohesiveDynDataTet4::_verticesRef[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,9 +59,9 @@
3.33333333e-01,};
const double pylith::faults::CohesiveKinDataTet4::_basisDeriv[] = {
- -1.00000000e+00, -1.00000000e+00,
- 1.00000000e+00, 0.00000000e+00,
- 0.00000000e+00, 1.00000000e+00,
+ -0.50000000e+00, -0.50000000e+00,
+ 0.50000000e+00, 0.00000000e+00,
+ 0.00000000e+00, 0.50000000e+00,
};
const double pylith::faults::CohesiveKinDataTet4::_verticesRef[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4e.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4e.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4e.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,9 +59,9 @@
3.33333333e-01,};
const double pylith::faults::CohesiveKinDataTet4e::_basisDeriv[] = {
- -1.00000000e+00, -1.00000000e+00,
- 1.00000000e+00, 0.00000000e+00,
- 0.00000000e+00, 1.00000000e+00,
+ -0.50000000e+00, -0.50000000e+00,
+ 0.50000000e+00, 0.00000000e+00,
+ 0.00000000e+00, 0.50000000e+00,
};
const double pylith::faults::CohesiveKinDataTet4e::_verticesRef[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4f.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4f.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinDataTet4f.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,9 +59,9 @@
3.33333333e-01,};
const double pylith::faults::CohesiveKinDataTet4f::_basisDeriv[] = {
- -1.00000000e+00, -1.00000000e+00,
- 1.00000000e+00, 0.00000000e+00,
- 0.00000000e+00, 1.00000000e+00,
+ -0.50000000e+00, -0.50000000e+00,
+ 0.50000000e+00, 0.00000000e+00,
+ 0.00000000e+00, 0.50000000e+00,
};
const double pylith::faults::CohesiveKinDataTet4f::_verticesRef[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinSrcsDataTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinSrcsDataTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/data/CohesiveKinSrcsDataTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -59,9 +59,9 @@
3.33333333e-01,};
const double pylith::faults::CohesiveKinSrcsDataTet4::_basisDeriv[] = {
- -1.00000000e+00, -1.00000000e+00,
- 1.00000000e+00, 0.00000000e+00,
- 0.00000000e+00, 1.00000000e+00,
+ -0.50000000e+00, -0.50000000e+00,
+ 0.50000000e+00, 0.00000000e+00,
+ 0.00000000e+00, 0.50000000e+00,
};
const double pylith::faults::CohesiveKinSrcsDataTet4::_verticesRef[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/TestQuadrature.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/TestQuadrature.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/TestQuadrature.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -33,6 +33,8 @@
// ----------------------------------------------------------------------
CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestQuadrature );
+typedef pylith::topology::Field<pylith::topology::Mesh>::RestrictVisitor RestrictVisitor;
+
// ----------------------------------------------------------------------
// Test copy constuctor.
void
@@ -238,9 +240,8 @@
const ALE::Obj<topology::Mesh::RealSection>& coordinates =
sieveMesh->getRealSection("coordinates");
assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
+ RestrictVisitor coordsVisitor(*coordinates,
+ coordinatesCell.size(), &coordinatesCell[0]);
#endif
size_t size = 0;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -32,6 +32,10 @@
TestMeshIOLagrit.cc \
TestCellFilterAvg.cc \
TestVertexFilterVecNorm.cc \
+ TestDataWriterMesh.cc \
+ TestDataWriterSubMesh.cc \
+ TestDataWriterBCMesh.cc \
+ TestDataWriterFaultMesh.cc \
TestDataWriterVTK.cc \
TestDataWriterVTKMesh.cc \
TestDataWriterVTKMeshLine2.cc \
@@ -67,7 +71,11 @@
noinst_HEADERS = \
TestCellFilterAvg.hh \
+ TestDataWriterMesh.hh \
TestDataWriterVTK.hh \
+ TestDataWriterSubMesh.hh \
+ TestDataWriterBCMesh.hh \
+ TestDataWriterFaultMesh.hh \
TestDataWriterVTKMesh.hh \
TestDataWriterVTKMeshLine2.hh \
TestDataWriterVTKMeshTri3.hh \
@@ -105,7 +113,7 @@
# Source files associated with testing data
testmeshio_SOURCES += \
- data/DataWriterVTKData.cc \
+ data/DataWriterData.cc \
data/DataWriterVTKDataMeshLine2.cc \
data/DataWriterVTKDataMeshTri3.cc \
data/DataWriterVTKDataMeshQuad4.cc \
@@ -129,6 +137,7 @@
data/DataWriterVTKDataBCMeshQuad4.cc \
data/DataWriterVTKDataBCMeshTet4.cc \
data/DataWriterVTKDataBCMeshHex8.cc \
+ data/DataWriterHDF5DataMeshHex8.cc \
data/MeshData.cc \
data/MeshData1D.cc \
data/MeshData1Din3D.cc \
@@ -145,7 +154,7 @@
noinst_HEADERS += \
- data/DataWriterVTKData.hh \
+ data/DataWriterData.hh \
data/DataWriterVTKDataMeshLine2.hh \
data/DataWriterVTKDataMeshTri3.hh \
data/DataWriterVTKDataMeshQuad4.hh \
@@ -169,6 +178,7 @@
data/DataWriterVTKDataBCMeshQuad4.hh \
data/DataWriterVTKDataBCMeshTet4.hh \
data/DataWriterVTKDataBCMeshHex8.hh \
+ data/DataWriterHDF5DataMeshHex8.hh \
data/MeshData.hh \
data/MeshData1D.hh \
data/MeshData1Din2D.hh \
@@ -203,7 +213,21 @@
testmeshio_LDADD += -lnetcdf_c++ -lnetcdf
endif
+if ENABLE_HDF5
+ testmeshio_SOURCES += \
+ TestDataWriterHDF5.cc \
+ TestDataWriterHDF5Mesh.cc \
+ TestDataWriterHDF5MeshHex8.cc
+ noinst_HEADERS += \
+ TestDataWriterHDF5.hh \
+ TestDataWriterHDF5Mesh.hh \
+ TestDataWriterHDF5MeshHex8.hh
+
+ testmeshio_LDADD += -lhdf5
+endif
+
+
noinst_tmp = \
mesh1D.txt \
mesh1Din2D.txt \
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterBCMesh.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,193 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterBCMesh.hh" // Implementation of class methods
+
+#include "data/DataWriterData.hh" // USES DataWriterData
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+#include "pylith/meshio/DataWriter.hh" // USES DataWriter
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Field<pylith::topology::SubMesh> SubMeshField;
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterBCMesh::setUp(void)
+{ // setUp
+ _data = 0;
+ _mesh = 0;
+ _submesh = 0;
+ _flipFault = false;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::meshio::TestDataWriterBCMesh::tearDown(void)
+{ // tearDown
+ delete _data; _data = 0;
+ delete _mesh; _mesh = 0;
+ delete _submesh; _submesh = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Initialize mesh.
+void
+pylith::meshio::TestDataWriterBCMesh::_initialize(void)
+{ // _initialize
+ CPPUNIT_ASSERT(0 != _data);
+
+ delete _mesh; _mesh = new topology::Mesh;
+ MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(_mesh);
+
+ if (0 != _data->faultLabel) {
+ faults::FaultCohesiveKin fault;
+ int firstFaultVertex = 0;
+ int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ if (fault.useLagrangeConstraints()) {
+ firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ }
+ fault.label(_data->faultLabel);
+ fault.id(_data->faultId);
+ fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
+ } // if
+
+ delete _submesh; _submesh = new topology::SubMesh(*_mesh, _data->bcLabel);
+ const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
+ assert(!sieveMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
+ _submesh->sieveMesh();
+ assert(!sieveSubMesh.isNull());
+ sieveSubMesh->setRealSection("coordinates",
+ sieveMesh->getRealSection("coordinates"));
+ //_mesh->view("BC mesh");
+} // _initialize
+
+// ----------------------------------------------------------------------
+// Create vertex fields.
+void
+pylith::meshio::TestDataWriterBCMesh::_createVertexFields(
+ topology::Fields<SubMeshField>* fields) const
+{ // _createVertexFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numVertexFields;
+
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
+ _submesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveSubMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& vertices =
+ sieveSubMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+ const topology::SubMesh::SieveMesh::label_sequence::iterator verticesEnd =
+ vertices->end();
+
+ // Set vertex fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->vertexFieldsInfo[i].name;
+ const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ SubMeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
+ field.allocate();
+ field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int ipt = 0;
+ for (topology::SubMesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+ v_iter != verticesEnd;
+ ++v_iter, ++ipt) {
+ const double* values = &_data->vertexFields[i][ipt*fiberDim];
+ section->updatePoint(*v_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } // catch
+} // _createVertexFields
+
+// ----------------------------------------------------------------------
+// Create cell fields.
+void
+pylith::meshio::TestDataWriterBCMesh::_createCellFields(
+ topology::Fields<SubMeshField>* fields) const
+{ // _createCellFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numCellFields;
+
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
+ _submesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveSubMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& cells =
+ sieveSubMesh->heightStratum(1);
+ assert(!cells.isNull());
+ const topology::SubMesh::SieveMesh::label_sequence::iterator cellsBegin =
+ cells->begin();
+ const topology::SubMesh::SieveMesh::label_sequence::iterator cellsEnd =
+ cells->end();
+
+ // Set cell fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->cellFieldsInfo[i].name;
+ const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ SubMeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim, 1);
+ field.allocate();
+ field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int icell = 0;
+ for (topology::SubMesh::SieveMesh::label_sequence::iterator c_iter=cellsBegin;
+ c_iter != cellsEnd;
+ ++c_iter, ++icell) {
+ const double* values = &_data->cellFields[i][icell*fiberDim];
+ section->updatePoint(*c_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } // catch
+} // _createCellFields
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterBCMesh.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterBCMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,84 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterBCMesh.hh
+ *
+ * @brief C++ TestDataWriterBCMesh object
+ *
+ * C++ unit testing for DataWriter<BCMesh>.
+ */
+
+#if !defined(pylith_meshio_testdatawriterbcmesh_hh)
+#define pylith_meshio_testdatawriterbcmesh_hh
+
+#include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh, Field
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterBCMesh;
+
+ class DataWriterData;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriter<BCMesh>
+class pylith::meshio::TestDataWriterBCMesh
+{ // class TestDataWriterBCMesh
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Initialize mesh.
+ void _initialize(void);
+
+ /** Create vertex fields.
+ *
+ * @param fields Vertex fields.
+ */
+ void
+ _createVertexFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
+
+ /** Create cell fields.
+ *
+ * @param fields Cell fields.
+ */
+ void
+ _createCellFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DataWriterData* _data; ///< Data for testing
+ topology::Mesh* _mesh; ///< Mesh for domain
+ topology::SubMesh* _submesh; ///< Mesh for subdomain.
+ bool _flipFault; ///< If true, flip fault orientation.
+
+}; // class TestDataWriterBCMesh
+
+#endif // pylith_meshio_testdatawriterbcmesh_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterFaultMesh.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,188 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterFaultMesh.hh" // Implementation of class methods
+
+#include "data/DataWriterData.hh" // USES DataWriterData
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+#include "pylith/meshio/DataWriter.hh" // USES DataWriter
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+#include "pylith/faults/CohesiveTopology.hh" // USES CohesiveTopology
+
+#include <map> // USES std::map
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Field<pylith::topology::SubMesh> MeshField;
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterFaultMesh::setUp(void)
+{ // setUp
+ _data = 0;
+ _mesh = new topology::Mesh();
+ _faultMesh = new topology::SubMesh();
+ _flipFault = false;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::meshio::TestDataWriterFaultMesh::tearDown(void)
+{ // tearDown
+ delete _data; _data = 0;
+ delete _mesh; _mesh = 0;
+ delete _faultMesh; _faultMesh = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Initialize mesh.
+void
+pylith::meshio::TestDataWriterFaultMesh::_initialize(void)
+{ // _initialize
+ CPPUNIT_ASSERT(0 != _data);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _faultMesh);
+
+ MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(_mesh);
+
+ faults::FaultCohesiveKin fault;
+ int firstFaultVertex = 0;
+ int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ const bool constraintCell = true;
+ if (constraintCell) {
+ firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ }
+ fault.label(_data->faultLabel);
+ fault.id(_data->faultId);
+ fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
+ faults::CohesiveTopology::createFaultParallel(_faultMesh, *_mesh, _data->faultId,
+ constraintCell);
+} // _initialize
+
+// ----------------------------------------------------------------------
+// Create vertex fields.
+void
+pylith::meshio::TestDataWriterFaultMesh::_createVertexFields(
+ topology::Fields<MeshField>* fields) const
+{ // _createVertexFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _faultMesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numVertexFields;
+
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveFaultMesh =
+ _faultMesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveFaultMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& vertices =
+ sieveFaultMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+ const topology::SubMesh::SieveMesh::label_sequence::iterator verticesEnd =
+ vertices->end();
+
+ // Set vertex fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->vertexFieldsInfo[i].name;
+ const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ MeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
+ field.allocate();
+ field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int ipt = 0;
+ for (topology::SubMesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+ v_iter != verticesEnd;
+ ++v_iter, ++ipt) {
+ const double* values = &_data->vertexFields[i][ipt*fiberDim];
+ section->updatePoint(*v_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } // catch
+} // _createVertexFields
+
+// ----------------------------------------------------------------------
+// Create cell fields.
+void
+pylith::meshio::TestDataWriterFaultMesh::_createCellFields(
+ topology::Fields<MeshField>* fields) const
+{ // _createCellFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numCellFields;
+
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveFaultMesh =
+ _faultMesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveFaultMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& cells =
+ sieveFaultMesh->heightStratum(0);
+ assert(!cells.isNull());
+ const topology::SubMesh::SieveMesh::label_sequence::iterator cellsBegin =
+ cells->begin();
+ const topology::SubMesh::SieveMesh::label_sequence::iterator cellsEnd =
+ cells->end();
+
+ // Set cell fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->cellFieldsInfo[i].name;
+ const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ MeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim);
+ field.allocate();
+ field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int icell = 0;
+ for (topology::SubMesh::SieveMesh::label_sequence::iterator c_iter=cellsBegin;
+ c_iter != cellsEnd;
+ ++c_iter, ++icell) {
+ const double* values = &_data->cellFields[i][icell*fiberDim];
+ section->updatePoint(*c_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } // catch
+} // _createCellFields
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterFaultMesh.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterFaultMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,84 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterFaultMesh.hh
+ *
+ * @brief C++ TestDataWriterFaultMesh object
+ *
+ * C++ unit testing for DataWriter<FaultMesh>.
+ */
+
+#if !defined(pylith_meshio_testdatawriterfaultmesh_hh)
+#define pylith_meshio_testdatawriterfaultmesh_hh
+
+#include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh, Field
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterFaultMesh;
+
+ class DataWriterData;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriter<FaultMesh>.
+class pylith::meshio::TestDataWriterFaultMesh
+{ // class TestDataWriterFaultMesh
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Initialize mesh.
+ void _initialize(void);
+
+ /** Create vertex fields.
+ *
+ * @param fields Vertex fields.
+ */
+ void
+ _createVertexFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
+
+ /** Create cell fields.
+ *
+ * @param fields Cell fields.
+ */
+ void
+ _createCellFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DataWriterData* _data; ///< Data for testing
+ topology::Mesh* _mesh; ///< Mesh for domain
+ topology::SubMesh* _faultMesh; ///< Fault mesh.
+ bool _flipFault; ///< If true, flip fault orientation.
+
+}; // class TestDataWriterFaultMesh
+
+#endif // pylith_meshio_testdatawriterfaultmesh_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,38 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterHDF5.hh" // Implementation of class methods
+
+#include <string.h> // USES strcmp()
+#include <iostream> // USES std::cerr
+#include <fstream> // USES std::ifstream
+
+// ----------------------------------------------------------------------
+// Check HDF5 file against archived file.
+void
+pylith::meshio::TestDataWriterHDF5::checkFile(const char* filename)
+{ // checkFile
+
+ const std::string filenameE = "data/" + std::string(filename);
+
+} // checkFile
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,58 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterHDF5.hh
+ *
+ * @brief C++ TestDataWriterHDF5 object
+ *
+ * C++ unit testing for DataWriterHDF5.
+ */
+
+#if !defined(pylith_meshio_testdatawriterhdf5_hh)
+#define pylith_meshio_testdatawriterhdf5_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterHDF5;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriterHDF5
+class pylith::meshio::TestDataWriterHDF5
+{ // class TestDataWriterHDF5
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /** Check HDF5 file against archived file.
+ *
+ * @param filename Name of file to check.
+ */
+ static
+ void checkFile(const char* filename);
+
+}; // class TestDataWriterHDF5
+
+#endif // pylith_meshio_testdatawriterhdf5_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,209 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterHDF5Mesh.hh" // Implementation of class methods
+
+#include "data/DataWriterData.hh" // USES DataWriterData
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+#include "pylith/meshio/DataWriterHDF5.hh" // USES DataWriterHDF5
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5Mesh );
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Field<pylith::topology::Mesh> MeshField;
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterHDF5Mesh::setUp(void)
+{ // setUp
+ TestDataWriterMesh::setUp();
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::meshio::TestDataWriterHDF5Mesh::tearDown(void)
+{ // tearDown
+ TestDataWriterMesh::tearDown();
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Test constructor
+void
+pylith::meshio::TestDataWriterHDF5Mesh::testConstructor(void)
+{ // testConstructor
+ DataWriterHDF5<topology::Mesh, MeshField> writer;
+
+ CPPUNIT_ASSERT(0 == writer._viewer);
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test filename()
+void
+pylith::meshio::TestDataWriterHDF5Mesh::testFilename(void)
+{ // testDebug
+ DataWriterHDF5<topology::Mesh, MeshField> writer;
+
+ const char* filename = "data.h5";
+ writer.filename(filename);
+ CPPUNIT_ASSERT_EQUAL(std::string(filename), writer._filename);
+} // testFilename
+
+// ----------------------------------------------------------------------
+// Test openTimeStep() and closeTimeStep()
+void
+pylith::meshio::TestDataWriterHDF5Mesh::testTimeStep(void)
+{ // testTimeStep
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ DataWriterHDF5<topology::Mesh, MeshField> writer;
+
+ writer.filename(_data->timestepFilename);
+
+ const double t = _data->time;
+ const int numTimeSteps = 1;
+ if (0 == _data->cellsLabel) {
+ writer.open(*_mesh, numTimeSteps);
+ writer.openTimeStep(t, *_mesh);
+ } else {
+ const char* label = _data->cellsLabel;
+ const int id = _data->labelId;
+ writer.open(*_mesh, numTimeSteps, label, id);
+ writer.openTimeStep(t, *_mesh, label, id);
+ } // else
+
+ writer.closeTimeStep();
+ writer.close();
+
+ checkFile(_data->timestepFilename);
+} // testTimeStep
+
+// ----------------------------------------------------------------------
+// Test writeVertexField.
+void
+pylith::meshio::TestDataWriterHDF5Mesh::testWriteVertexField(void)
+{ // testWriteVertexField
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ DataWriterHDF5<topology::Mesh, MeshField> writer;
+
+ topology::Fields<MeshField> vertexFields(*_mesh);
+ _createVertexFields(&vertexFields);
+
+ writer.filename(_data->vertexFilename);
+
+ const int nfields = _data->numVertexFields;
+
+ const double t = _data->time;
+ const int numTimeSteps = 1;
+ if (0 == _data->cellsLabel) {
+ writer.open(*_mesh, numTimeSteps);
+ writer.openTimeStep(t, *_mesh);
+ } else {
+ const char* label = _data->cellsLabel;
+ const int id = _data->labelId;
+ writer.open(*_mesh, numTimeSteps, label, id);
+ writer.openTimeStep(t, *_mesh, label, id);
+ } // else
+ for (int i=0; i < nfields; ++i) {
+ MeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
+ writer.writeVertexField(t, field, *_mesh);
+ } // for
+ writer.closeTimeStep();
+ writer.close();
+
+ checkFile(_data->vertexFilename);
+} // testWriteVertexField
+
+// ----------------------------------------------------------------------
+// Test writeCellField.
+void
+pylith::meshio::TestDataWriterHDF5Mesh::testWriteCellField(void)
+{ // testWriteCellField
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ DataWriterHDF5<topology::Mesh, MeshField> writer;
+
+ topology::Fields<MeshField> cellFields(*_mesh);
+ _createCellFields(&cellFields);
+
+ writer.filename(_data->cellFilename);
+
+ const int nfields = _data->numCellFields;
+
+ const double t = _data->time;
+ const int numTimeSteps = 1;
+ if (0 == _data->cellsLabel) {
+ writer.open(*_mesh, numTimeSteps);
+ writer.openTimeStep(t, *_mesh);
+ for (int i=0; i < nfields; ++i) {
+ MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ writer.writeCellField(t, field);
+ } // for
+ } else {
+ const char* label = _data->cellsLabel;
+ const int id = _data->labelId;
+ writer.open(*_mesh, numTimeSteps, label, id);
+ writer.openTimeStep(t, *_mesh, label, id);
+ for (int i=0; i < nfields; ++i) {
+ MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ writer.writeCellField(t, field, label, id);
+ } // for
+ } // else
+ writer.closeTimeStep();
+ writer.close();
+
+ checkFile(_data->cellFilename);
+} // testWriteCellField
+
+// ----------------------------------------------------------------------
+// Test _hdf5Filename.
+void pylith::meshio::TestDataWriterHDF5Mesh::testHdf5Filename(void)
+{ // testHdf5Filename
+ DataWriterHDF5<topology::Mesh, MeshField> writer;
+
+ // Append info to filename if number of time steps is 0.
+ writer._numTimeSteps = 0;
+ writer._filename = "output.h5";
+ CPPUNIT_ASSERT_EQUAL(std::string("output_info.h5"), writer._hdf5Filename());
+
+ writer._numTimeSteps = 5;
+ writer._filename = "output_abc.h5";
+ CPPUNIT_ASSERT_EQUAL(std::string("output_abc.h5"),
+ writer._hdf5Filename());
+
+ writer._numTimeSteps = 10;
+ writer._filename = "output_abcd.h5";
+ CPPUNIT_ASSERT_EQUAL(std::string("output_abcd.h5"),
+ writer._hdf5Filename());
+} // testHdf5Filename
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5Mesh.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5Mesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,89 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterHDF5Mesh.hh
+ *
+ * @brief C++ TestDataWriterHDF5Mesh object
+ *
+ * C++ unit testing for DataWriterHDF5Mesh.
+ */
+
+#if !defined(pylith_meshio_testdatawriterhdf5mesh_hh)
+#define pylith_meshio_testdatawriterhdf5mesh_hh
+
+#include "TestDataWriterHDF5.hh" // ISA TestDataWriterHDF5
+#include "TestDataWriterMesh.hh" // ISA TestDataWriterMesh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterHDF5Mesh;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriterHDF5
+class pylith::meshio::TestDataWriterHDF5Mesh : public TestDataWriterHDF5,
+ public TestDataWriterMesh,
+ public CppUnit::TestFixture
+{ // class TestDataWriterHDF5Mesh
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDataWriterHDF5Mesh );
+
+ CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testFilename );
+ CPPUNIT_TEST( testHdf5Filename );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Test constructor
+ void testConstructor(void);
+
+ /// Test filename()
+ void testFilename(void);
+
+ /// Test openTimeStep() and closeTimeStep()
+ void testTimeStep(void);
+
+ /// Test writeVertexField.
+ void testWriteVertexField(void);
+
+ /// Test writeCellField.
+ void testWriteCellField(void);
+
+ /// Test hdf5Filename.
+ void testHdf5Filename(void);
+
+}; // class TestDataWriterHDF5Mesh
+
+#endif // pylith_meshio_testdatawriterhdf5mesh_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,41 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterHDF5MeshHex8.hh" // Implementation of class methods
+
+#include "data/DataWriterHDF5DataMeshHex8.hh" // USES DataWriterHDF5DataMeshHex8
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5MeshHex8 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterHDF5MeshHex8::setUp(void)
+{ // setUp
+ TestDataWriterHDF5Mesh::setUp();
+ _data = new DataWriterHDF5DataMeshHex8;
+ _flipFault = true;
+
+ _initialize();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,63 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterHDF5MeshHex8.hh
+ *
+ * @brief C++ TestDataWriterHDF5MeshHex8 object
+ *
+ * C++ unit testing for DataWriterHDF5MeshHex8.
+ */
+
+#if !defined(pylith_meshio_testdatawriterhdf5meshhex8_hh)
+#define pylith_meshio_testdatawriterhdf5meshhex8_hh
+
+#include "TestDataWriterHDF5Mesh.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterHDF5MeshHex8;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriterHDF5
+class pylith::meshio::TestDataWriterHDF5MeshHex8 : public TestDataWriterHDF5Mesh
+{ // class TestDataWriterHDF5MeshHex8
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDataWriterHDF5MeshHex8 );
+
+ CPPUNIT_TEST( testTimeStep );
+ CPPUNIT_TEST( testWriteVertexField );
+ CPPUNIT_TEST( testWriteCellField );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDataWriterHDF5MeshHex8
+
+#endif // pylith_meshio_testdatawriterhdf5meshhex8_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterMesh.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,182 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterMesh.hh" // Implementation of class methods
+
+#include "data/DataWriterData.hh" // USES DataWriterData
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+#include "pylith/meshio/DataWriter.hh" // USES DataWriter
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Field<pylith::topology::Mesh> MeshField;
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterMesh::setUp(void)
+{ // setUp
+ _data = 0;
+ _mesh = 0;
+ _flipFault = false;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::meshio::TestDataWriterMesh::tearDown(void)
+{ // tearDown
+ delete _data; _data = 0;
+ delete _mesh; _mesh = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Initialize mesh.
+void
+pylith::meshio::TestDataWriterMesh::_initialize(void)
+{ // _initialize
+ CPPUNIT_ASSERT(0 != _data);
+
+ delete _mesh; _mesh = new topology::Mesh;
+ MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(_mesh);
+
+ if (0 != _data->faultLabel) {
+ faults::FaultCohesiveKin fault;
+ int firstFaultVertex = 0;
+ int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ if (fault.useLagrangeConstraints()) {
+ firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ }
+ fault.label(_data->faultLabel);
+ fault.id(_data->faultId);
+ fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
+ } // if
+} // _initialize
+
+// ----------------------------------------------------------------------
+// Create vertex fields.
+void
+pylith::meshio::TestDataWriterMesh::_createVertexFields(
+ topology::Fields<MeshField>* fields) const
+{ // _createVertexFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numVertexFields;
+
+ const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<topology::Mesh::SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+ const topology::Mesh::SieveMesh::label_sequence::iterator verticesEnd =
+ vertices->end();
+
+ // Set vertex fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->vertexFieldsInfo[i].name;
+ const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ MeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
+ field.allocate();
+ field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::Mesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int ipt = 0;
+ for (topology::Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+ v_iter != verticesEnd;
+ ++v_iter, ++ipt) {
+ const double* values = &_data->vertexFields[i][ipt*fiberDim];
+ section->updatePoint(*v_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } catch (...) {
+ throw;
+ } // catch
+} // _createVertexFields
+
+// ----------------------------------------------------------------------
+// Create cell fields.
+void
+pylith::meshio::TestDataWriterMesh::_createCellFields(
+ topology::Fields<MeshField>* fields) const
+{ // _createCellFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numCellFields;
+
+ const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<topology::Mesh::SieveMesh::label_sequence>& cells =
+ (0 == _data->cellsLabel) ?
+ sieveMesh->depthStratum(1) :
+ sieveMesh->getLabelStratum(_data->cellsLabel, _data->labelId);
+ const topology::Mesh::SieveMesh::label_sequence::iterator cellsEnd =
+ cells->end();
+
+ // Set cell fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->cellFieldsInfo[i].name;
+ const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ MeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim);
+ field.allocate();
+ field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::Mesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int icell = 0;
+ for (topology::Mesh::SieveMesh::label_sequence::iterator c_iter=cells->begin();
+ c_iter != cellsEnd;
+ ++c_iter, ++icell) {
+ const double* values = &_data->cellFields[i][icell*fiberDim];
+ section->updatePoint(*c_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } catch (...) {
+ throw;
+ } // catch
+} // _createCellFields
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterMesh.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,83 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterMesh.hh
+ *
+ * @brief C++ TestDataWriterMesh object
+ *
+ * C++ unit testing for DataWriter<Mesh>.
+ */
+
+#if !defined(pylith_meshio_testdatawritermesh_hh)
+#define pylith_meshio_testdatawritermesh_hh
+
+#include "pylith/topology/topologyfwd.hh" // USES Mesh, Field
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterMesh;
+
+ class DataWriterData;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriter<Mesh>.
+class pylith::meshio::TestDataWriterMesh
+{ // class TestDataWriterMesh
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Initialize mesh.
+ void _initialize(void);
+
+ /** Create vertex fields.
+ *
+ * @param fields Vertex fields.
+ */
+ void
+ _createVertexFields(topology::Fields<topology::Field<topology::Mesh> >* fields) const;
+
+ /** Create cell fields.
+ *
+ * @param fields Cell fields.
+ */
+ void
+ _createCellFields(topology::Fields<topology::Field<topology::Mesh> >* fields) const;
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DataWriterData* _data; ///< Data for testing
+ topology::Mesh* _mesh; ///< Mesh for data
+ bool _flipFault; ///< If true, flip fault orientation.
+
+}; // class TestDataWriterMesh
+
+#endif // pylith_meshio_testdatawritermesh_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterSubMesh.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,199 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterSubMesh.hh" // Implementation of class methods
+
+#include "data/DataWriterData.hh" // USES DataWriterData
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+#include "pylith/meshio/DataWriter.hh" // USES DataWriter
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Field<pylith::topology::Mesh> MeshField;
+typedef pylith::topology::Field<pylith::topology::SubMesh> SubMeshField;
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterSubMesh::setUp(void)
+{ // setUp
+ _data = 0;
+ _mesh = 0;
+ _submesh = 0;
+ _flipFault = false;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::meshio::TestDataWriterSubMesh::tearDown(void)
+{ // tearDown
+ delete _data; _data = 0;
+ delete _mesh; _mesh = 0;
+ delete _submesh; _submesh = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Initialize mesh.
+void
+pylith::meshio::TestDataWriterSubMesh::_initialize(void)
+{ // _initialize
+ CPPUNIT_ASSERT(0 != _data);
+
+ delete _mesh; _mesh = new topology::Mesh;
+ MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(_mesh);
+
+ if (0 != _data->faultLabel) {
+ faults::FaultCohesiveKin fault;
+ int firstFaultVertex = 0;
+ int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ if (fault.useLagrangeConstraints()) {
+ firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
+ }
+ fault.label(_data->faultLabel);
+ fault.id(_data->faultId);
+ fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
+ } // if
+
+ CPPUNIT_ASSERT(0 != _data->bcLabel);
+ delete _submesh; _submesh = new topology::SubMesh(*_mesh, _data->bcLabel);
+ const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
+ assert(!sieveMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
+ _submesh->sieveMesh();
+ assert(!sieveSubMesh.isNull());
+ sieveSubMesh->setRealSection("coordinates",
+ sieveMesh->getRealSection("coordinates"));
+ //_mesh->view("BC mesh");
+} // _initialize
+
+// ----------------------------------------------------------------------
+// Create vertex fields.
+void
+pylith::meshio::TestDataWriterSubMesh::_createVertexFields(
+ topology::Fields<MeshField>* fields) const
+{ // _createVertexFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numVertexFields;
+
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveMesh =
+ _mesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+ const topology::SubMesh::SieveMesh::label_sequence::iterator verticesEnd =
+ vertices->end();
+
+ // Set vertex fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->vertexFieldsInfo[i].name;
+ const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ MeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
+ field.allocate();
+ field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int ipt = 0;
+ for (topology::SubMesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+ v_iter != verticesEnd;
+ ++v_iter, ++ipt) {
+ const double* values = &_data->vertexFields[i][ipt*fiberDim];
+ section->updatePoint(*v_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } catch (...) {
+ throw;
+ } // catch
+} // _createVertexFields
+
+// ----------------------------------------------------------------------
+// Create cell fields.
+void
+pylith::meshio::TestDataWriterSubMesh::_createCellFields(
+ topology::Fields<SubMeshField>* fields) const
+{ // _createCellFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numCellFields;
+
+ const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
+ _submesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveSubMesh.isNull());
+ const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& cells =
+ sieveSubMesh->heightStratum(1);
+ assert(!cells.isNull());
+ const topology::SubMesh::SieveMesh::label_sequence::iterator cellsBegin =
+ cells->begin();
+ const topology::SubMesh::SieveMesh::label_sequence::iterator cellsEnd =
+ cells->end();
+
+ // Set cell fields
+ for (int i=0; i < nfields; ++i) {
+ const char* name = _data->cellFieldsInfo[i].name;
+ const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
+ fields->add(name, name);
+ SubMeshField& field = fields->get(name);
+ field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim, 1);
+ field.allocate();
+ field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
+
+ const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ int icell = 0;
+ for (topology::SubMesh::SieveMesh::label_sequence::iterator c_iter=cellsBegin;
+ c_iter != cellsEnd;
+ ++c_iter, ++icell) {
+ const double* values = &_data->cellFields[i][icell*fiberDim];
+ section->updatePoint(*c_iter, values);
+ } // for
+ CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } catch (...) {
+ throw;
+ } // catch
+} // _createCellFields
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterSubMesh.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterSubMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,84 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterSubMesh.hh
+ *
+ * @brief C++ TestDataWriterSubMesh object
+ *
+ * C++ unit testing for DataWriter<SubMesh>.
+ */
+
+#if !defined(pylith_meshio_testdatawritersubmesh_hh)
+#define pylith_meshio_testdatawritersubmesh_hh
+
+#include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh, Field
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterSubMesh;
+
+ class DataWriterData;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriter<SubMesh>.
+class pylith::meshio::TestDataWriterSubMesh
+{ // class TestDataWriterSubMesh
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Initialize mesh.
+ void _initialize(void);
+
+ /** Create vertex fields.
+ *
+ * @param fields Vertex fields.
+ */
+ void
+ _createVertexFields(topology::Fields<topology::Field<topology::Mesh> >* fields) const;
+
+ /** Create cell fields.
+ *
+ * @param fields Cell fields.
+ */
+ void
+ _createCellFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DataWriterData* _data; ///< Data for testing
+ topology::Mesh* _mesh; ///< Mesh for domain
+ topology::SubMesh* _submesh; ///< Mesh for subdomain.
+ bool _flipFault; ///< If true, flip fault orientation.
+
+}; // class TestDataWriterSubMesh
+
+#endif // pylith_meshio_testdatawritersubmesh_hh
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -20,29 +20,14 @@
#include "TestDataWriterVTK.hh" // Implementation of class methods
-#include "data/DataWriterVTKData.hh" // USES DataWriterVTKData
+#include <cppunit/extensions/HelperMacros.h>
#include <string.h> // USES strcmp()
#include <iostream> // USES std::cerr
+#include <sstream> // USES std::ostringstream
#include <fstream> // USES std::ifstream
// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::meshio::TestDataWriterVTK::setUp(void)
-{ // setUp
- _data = 0;
-} // setUp
-
-// ----------------------------------------------------------------------
-// Tear down testing data.
-void
-pylith::meshio::TestDataWriterVTK::tearDown(void)
-{ // tearDown
- delete _data; _data = 0;
-} // tearDown
-
-// ----------------------------------------------------------------------
// Check VTK file against archived file.
void
pylith::meshio::TestDataWriterVTK::checkFile(const char* filenameRoot,
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTK.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -27,33 +27,20 @@
#if !defined(pylith_meshio_testdatawritervtk_hh)
#define pylith_meshio_testdatawritervtk_hh
-#include <cppunit/extensions/HelperMacros.h>
-
/// Namespace for pylith package
namespace pylith {
namespace meshio {
class TestDataWriterVTK;
-
- class DataWriterVTKData;
} // meshio
} // pylith
/// C++ unit testing for DataWriterVTK
-class pylith::meshio::TestDataWriterVTK : public CppUnit::TestFixture
+class pylith::meshio::TestDataWriterVTK
{ // class TestDataWriterVTK
// PUBLIC METHODS /////////////////////////////////////////////////////
public :
- /// Setup testing data.
- void setUp(void);
-
- /// Tear down testing data.
- void tearDown(void);
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
/** Check VTK file against archived file.
*
* @param filename Name of file to check.
@@ -65,11 +52,6 @@
const double t,
const char* timeFormat);
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- DataWriterVTKData* _data; ///< Data for testing
-
}; // class TestDataWriterVTK
#endif // pylith_meshio_testdatawritervtk_hh
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -20,7 +20,7 @@
#include "TestDataWriterVTKBCMesh.hh" // Implementation of class methods
-#include "data/DataWriterVTKData.hh" // USES DataWriterVTKData
+#include "data/DataWriterData.hh" // USES DataWriterData
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/Field.hh" // USES Field
@@ -40,10 +40,7 @@
void
pylith::meshio::TestDataWriterVTKBCMesh::setUp(void)
{ // setUp
- TestDataWriterVTK::setUp();
- _mesh = 0;
- _submesh = 0;
- _flipFault = false;
+ TestDataWriterBCMesh::setUp();
} // setUp
// ----------------------------------------------------------------------
@@ -51,9 +48,7 @@
void
pylith::meshio::TestDataWriterVTKBCMesh::tearDown(void)
{ // tearDown
- TestDataWriterVTK::tearDown();
- delete _mesh; _mesh = 0;
- delete _submesh; _submesh = 0;
+ TestDataWriterBCMesh::tearDown();
} // tearDown
// ----------------------------------------------------------------------
@@ -138,7 +133,7 @@
writer.openTimeStep(t, *_submesh, label, id);
} // else
for (int i=0; i < nfields; ++i) {
- const SubMeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
+ SubMeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
writer.writeVertexField(t, field, *_submesh);
CPPUNIT_ASSERT(writer._wroteVertexHeader);
CPPUNIT_ASSERT(false == writer._wroteCellHeader);
@@ -175,7 +170,7 @@
writer.open(*_submesh, numTimeSteps);
writer.openTimeStep(t, *_submesh);
for (int i=0; i < nfields; ++i) {
- const SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -186,7 +181,7 @@
writer.open(*_submesh, numTimeSteps, label, id);
writer.openTimeStep(t, *_submesh, label, id);
for (int i=0; i < nfields; ++i) {
- const SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field, label, id);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -200,139 +195,5 @@
checkFile(_data->cellFilename, t, _data->timeFormat);
} // testWriteCellField
-// ----------------------------------------------------------------------
-// Initialize mesh.
-void
-pylith::meshio::TestDataWriterVTKBCMesh::_initialize(void)
-{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- delete _mesh; _mesh = new topology::Mesh;
- MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(_mesh);
-
- if (0 != _data->faultLabel) {
- faults::FaultCohesiveKin fault;
- int firstFaultVertex = 0;
- int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- if (fault.useLagrangeConstraints()) {
- firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- }
- fault.label(_data->faultLabel);
- fault.id(_data->faultId);
- fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
- } // if
-
- delete _submesh; _submesh = new topology::SubMesh(*_mesh, _data->bcLabel);
- const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
- _submesh->sieveMesh();
- assert(!sieveSubMesh.isNull());
- sieveSubMesh->setRealSection("coordinates",
- sieveMesh->getRealSection("coordinates"));
- //_mesh->view("BC mesh");
-} // _initialize
-
-// ----------------------------------------------------------------------
-// Create vertex fields.
-void
-pylith::meshio::TestDataWriterVTKBCMesh::_createVertexFields(
- topology::Fields<SubMeshField>* fields) const
-{ // _createVertexFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numVertexFields;
-
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
- _submesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveSubMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& vertices =
- sieveSubMesh->depthStratum(0);
- CPPUNIT_ASSERT(!vertices.isNull());
- const topology::SubMesh::SieveMesh::label_sequence::iterator verticesEnd =
- vertices->end();
-
- // Set vertex fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->vertexFieldsInfo[i].name;
- const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- SubMeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
- field.allocate();
- field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int ipt = 0;
- for (topology::SubMesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter, ++ipt) {
- const double* values = &_data->vertexFields[i][ipt*fiberDim];
- section->updatePoint(*v_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createVertexFields
-
-// ----------------------------------------------------------------------
-// Create cell fields.
-void
-pylith::meshio::TestDataWriterVTKBCMesh::_createCellFields(
- topology::Fields<SubMeshField>* fields) const
-{ // _createCellFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numCellFields;
-
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
- _submesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveSubMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& cells =
- sieveSubMesh->heightStratum(1);
- assert(!cells.isNull());
- const topology::SubMesh::SieveMesh::label_sequence::iterator cellsBegin =
- cells->begin();
- const topology::SubMesh::SieveMesh::label_sequence::iterator cellsEnd =
- cells->end();
-
- // Set cell fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->cellFieldsInfo[i].name;
- const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- SubMeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim, 1);
- field.allocate();
- field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int icell = 0;
- for (topology::SubMesh::SieveMesh::label_sequence::iterator c_iter=cellsBegin;
- c_iter != cellsEnd;
- ++c_iter, ++icell) {
- const double* values = &_data->cellFields[i][icell*fiberDim];
- section->updatePoint(*c_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createCellFields
-
-
// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKBCMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -28,9 +28,12 @@
#define pylith_meshio_testdatawritervtkbcmesh_hh
#include "TestDataWriterVTK.hh"
+#include "TestDataWriterBCMesh.hh"
#include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh, Field
+#include <cppunit/extensions/HelperMacros.h>
+
/// Namespace for pylith package
namespace pylith {
namespace meshio {
@@ -39,7 +42,9 @@
} // pylith
/// C++ unit testing for DataWriterVTK
-class pylith::meshio::TestDataWriterVTKBCMesh : public TestDataWriterVTK
+class pylith::meshio::TestDataWriterVTKBCMesh : public TestDataWriterVTK,
+ public TestDataWriterBCMesh,
+ public CppUnit::TestFixture
{ // class TestDataWriterVTKBCMesh
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
@@ -70,36 +75,6 @@
/// Test writeCellField.
void testWriteCellField(void);
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- /// Initialize mesh.
- void _initialize(void);
-
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- topology::Mesh* _mesh; ///< Mesh for domain
- topology::SubMesh* _submesh; ///< Mesh for subdomain.
- bool _flipFault; ///< If true, flip fault orientation.
-
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- /** Create vertex fields.
- *
- * @param fields Vertex fields.
- */
- void
- _createVertexFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
-
- /** Create cell fields.
- *
- * @param fields Cell fields.
- */
- void
- _createCellFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
-
}; // class TestDataWriterVTKBCMesh
#endif // pylith_meshio_testdatawritervtkbcmesh_hh
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -20,7 +20,7 @@
#include "TestDataWriterVTKFaultMesh.hh" // Implementation of class methods
-#include "data/DataWriterVTKData.hh" // USES DataWriterVTKData
+#include "data/DataWriterData.hh" // USES DataWriterData
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/Field.hh" // USES Field
@@ -43,10 +43,7 @@
void
pylith::meshio::TestDataWriterVTKFaultMesh::setUp(void)
{ // setUp
- TestDataWriterVTK::setUp();
- _mesh = new topology::Mesh();
- _faultMesh = new topology::SubMesh();
- _flipFault = false;
+ TestDataWriterFaultMesh::setUp();
} // setUp
// ----------------------------------------------------------------------
@@ -54,9 +51,7 @@
void
pylith::meshio::TestDataWriterVTKFaultMesh::tearDown(void)
{ // tearDown
- TestDataWriterVTK::tearDown();
- delete _mesh; _mesh = 0;
- delete _faultMesh; _faultMesh = 0;
+ TestDataWriterFaultMesh::tearDown();
} // tearDown
// ----------------------------------------------------------------------
@@ -141,7 +136,7 @@
writer.openTimeStep(t, *_faultMesh, label, id);
} // else
for (int i=0; i < nfields; ++i) {
- const MeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
+ MeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
writer.writeVertexField(t, field, *_faultMesh);
CPPUNIT_ASSERT(writer._wroteVertexHeader);
CPPUNIT_ASSERT(false == writer._wroteCellHeader);
@@ -178,7 +173,7 @@
writer.open(*_faultMesh, numTimeSteps);
writer.openTimeStep(t, *_faultMesh);
for (int i=0; i < nfields; ++i) {
- const MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -189,7 +184,7 @@
writer.open(*_faultMesh, numTimeSteps, label, id);
writer.openTimeStep(t, *_faultMesh, label, id);
for (int i=0; i < nfields; ++i) {
- const MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field, label, id);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -203,131 +198,5 @@
checkFile(_data->cellFilename, t, _data->timeFormat);
} // testWriteCellField
-// ----------------------------------------------------------------------
-// Initialize mesh.
-void
-pylith::meshio::TestDataWriterVTKFaultMesh::_initialize(void)
-{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _faultMesh);
- MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(_mesh);
-
- faults::FaultCohesiveKin fault;
- int firstFaultVertex = 0;
- int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- const bool constraintCell = true;
- if (constraintCell) {
- firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- }
- fault.label(_data->faultLabel);
- fault.id(_data->faultId);
- fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
- faults::CohesiveTopology::createFaultParallel(_faultMesh, *_mesh, _data->faultId,
- constraintCell);
-} // _initialize
-
-// ----------------------------------------------------------------------
-// Create vertex fields.
-void
-pylith::meshio::TestDataWriterVTKFaultMesh::_createVertexFields(
- topology::Fields<MeshField>* fields) const
-{ // _createVertexFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _faultMesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numVertexFields;
-
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveFaultMesh =
- _faultMesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveFaultMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& vertices =
- sieveFaultMesh->depthStratum(0);
- CPPUNIT_ASSERT(!vertices.isNull());
- const topology::SubMesh::SieveMesh::label_sequence::iterator verticesEnd =
- vertices->end();
-
- // Set vertex fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->vertexFieldsInfo[i].name;
- const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- MeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
- field.allocate();
- field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int ipt = 0;
- for (topology::SubMesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter, ++ipt) {
- const double* values = &_data->vertexFields[i][ipt*fiberDim];
- section->updatePoint(*v_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createVertexFields
-
-// ----------------------------------------------------------------------
-// Create cell fields.
-void
-pylith::meshio::TestDataWriterVTKFaultMesh::_createCellFields(
- topology::Fields<MeshField>* fields) const
-{ // _createCellFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numCellFields;
-
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveFaultMesh =
- _faultMesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveFaultMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& cells =
- sieveFaultMesh->heightStratum(0);
- assert(!cells.isNull());
- const topology::SubMesh::SieveMesh::label_sequence::iterator cellsBegin =
- cells->begin();
- const topology::SubMesh::SieveMesh::label_sequence::iterator cellsEnd =
- cells->end();
-
- // Set cell fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->cellFieldsInfo[i].name;
- const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- MeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim);
- field.allocate();
- field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int icell = 0;
- for (topology::SubMesh::SieveMesh::label_sequence::iterator c_iter=cellsBegin;
- c_iter != cellsEnd;
- ++c_iter, ++icell) {
- const double* values = &_data->cellFields[i][icell*fiberDim];
- section->updatePoint(*c_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createCellFields
-
-
// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKFaultMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -28,9 +28,12 @@
#define pylith_meshio_testdatawritervtkfaultmesh_hh
#include "TestDataWriterVTK.hh"
+#include "TestDataWriterFaultMesh.hh"
#include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh, Field
+#include <cppunit/extensions/HelperMacros.h>
+
/// Namespace for pylith package
namespace pylith {
namespace meshio {
@@ -39,7 +42,9 @@
} // pylith
/// C++ unit testing for DataWriterVTK
-class pylith::meshio::TestDataWriterVTKFaultMesh : public TestDataWriterVTK
+class pylith::meshio::TestDataWriterVTKFaultMesh : public TestDataWriterVTK,
+ public TestDataWriterFaultMesh,
+ public CppUnit::TestFixture
{ // class TestDataWriterVTKFaultMesh
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
@@ -70,36 +75,6 @@
/// Test writeCellField.
void testWriteCellField(void);
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- /// Initialize mesh.
- void _initialize(void);
-
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- topology::Mesh* _mesh; ///< Mesh for domain
- topology::SubMesh* _faultMesh; ///< Fault mesh.
- bool _flipFault; ///< If true, flip fault orientation.
-
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- /** Create vertex fields.
- *
- * @param fields Vertex fields.
- */
- void
- _createVertexFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
-
- /** Create cell fields.
- *
- * @param fields Cell fields.
- */
- void
- _createCellFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
-
}; // class TestDataWriterVTKFaultMesh
#endif // pylith_meshio_testdatawritervtkfaultmesh_hh
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -20,7 +20,7 @@
#include "TestDataWriterVTKMesh.hh" // Implementation of class methods
-#include "data/DataWriterVTKData.hh" // USES DataWriterVTKData
+#include "data/DataWriterData.hh" // USES DataWriterData
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/Field.hh" // USES Field
@@ -40,9 +40,7 @@
void
pylith::meshio::TestDataWriterVTKMesh::setUp(void)
{ // setUp
- TestDataWriterVTK::setUp();
- _mesh = 0;
- _flipFault = false;
+ TestDataWriterMesh::setUp();
} // setUp
// ----------------------------------------------------------------------
@@ -50,8 +48,7 @@
void
pylith::meshio::TestDataWriterVTKMesh::tearDown(void)
{ // tearDown
- TestDataWriterVTK::tearDown();
- delete _mesh; _mesh = 0;
+ TestDataWriterMesh::tearDown();
} // tearDown
// ----------------------------------------------------------------------
@@ -184,7 +181,7 @@
writer.openTimeStep(t, *_mesh, label, id);
} // else
for (int i=0; i < nfields; ++i) {
- const MeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
+ MeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
writer.writeVertexField(t, field, *_mesh);
CPPUNIT_ASSERT(writer._wroteVertexHeader);
CPPUNIT_ASSERT(false == writer._wroteCellHeader);
@@ -221,7 +218,7 @@
writer.open(*_mesh, numTimeSteps);
writer.openTimeStep(t, *_mesh);
for (int i=0; i < nfields; ++i) {
- const MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -232,7 +229,7 @@
writer.open(*_mesh, numTimeSteps, label, id);
writer.openTimeStep(t, *_mesh, label, id);
for (int i=0; i < nfields; ++i) {
- const MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ MeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field, label, id);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -273,126 +270,5 @@
writer._vtkFilename(50.0));
} // testVtkFilename
-// ----------------------------------------------------------------------
-// Initialize mesh.
-void
-pylith::meshio::TestDataWriterVTKMesh::_initialize(void)
-{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- delete _mesh; _mesh = new topology::Mesh;
- MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(_mesh);
-
- if (0 != _data->faultLabel) {
- faults::FaultCohesiveKin fault;
- int firstFaultVertex = 0;
- int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- if (fault.useLagrangeConstraints()) {
- firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- }
- fault.label(_data->faultLabel);
- fault.id(_data->faultId);
- fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
- } // if
-} // _initialize
-
-// ----------------------------------------------------------------------
-// Create vertex fields.
-void
-pylith::meshio::TestDataWriterVTKMesh::_createVertexFields(
- topology::Fields<MeshField>* fields) const
-{ // _createVertexFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numVertexFields;
-
- const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
- const ALE::Obj<topology::Mesh::SieveMesh::label_sequence>& vertices =
- sieveMesh->depthStratum(0);
- CPPUNIT_ASSERT(!vertices.isNull());
- const topology::Mesh::SieveMesh::label_sequence::iterator verticesEnd =
- vertices->end();
-
- // Set vertex fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->vertexFieldsInfo[i].name;
- const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- MeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
- field.allocate();
- field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::Mesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int ipt = 0;
- for (topology::Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter, ++ipt) {
- const double* values = &_data->vertexFields[i][ipt*fiberDim];
- section->updatePoint(*v_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createVertexFields
-
-// ----------------------------------------------------------------------
-// Create cell fields.
-void
-pylith::meshio::TestDataWriterVTKMesh::_createCellFields(
- topology::Fields<MeshField>* fields) const
-{ // _createCellFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numCellFields;
-
- const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
- const ALE::Obj<topology::Mesh::SieveMesh::label_sequence>& cells =
- (0 == _data->cellsLabel) ?
- sieveMesh->depthStratum(1) :
- sieveMesh->getLabelStratum(_data->cellsLabel, _data->labelId);
- const topology::Mesh::SieveMesh::label_sequence::iterator cellsEnd =
- cells->end();
-
- // Set cell fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->cellFieldsInfo[i].name;
- const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- MeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim);
- field.allocate();
- field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::Mesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int icell = 0;
- for (topology::Mesh::SieveMesh::label_sequence::iterator c_iter=cells->begin();
- c_iter != cellsEnd;
- ++c_iter, ++icell) {
- const double* values = &_data->cellFields[i][icell*fiberDim];
- section->updatePoint(*c_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createCellFields
-
-
// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -28,9 +28,12 @@
#define pylith_meshio_testdatawritervtkmesh_hh
#include "TestDataWriterVTK.hh" // ISA TestDataWriterVTK
+#include "TestDataWriterMesh.hh" // ISA TestDataWriterMesh
#include "pylith/topology/topologyfwd.hh" // USES Mesh, Field
+#include <cppunit/extensions/HelperMacros.h>
+
/// Namespace for pylith package
namespace pylith {
namespace meshio {
@@ -39,7 +42,9 @@
} // pylith
/// C++ unit testing for DataWriterVTK
-class pylith::meshio::TestDataWriterVTKMesh : public TestDataWriterVTK
+class pylith::meshio::TestDataWriterVTKMesh : public TestDataWriterVTK,
+ public TestDataWriterMesh,
+ public CppUnit::TestFixture
{ // class TestDataWriterVTKMesh
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
@@ -90,35 +95,6 @@
/// Test vtkFilename.
void testVtkFilename(void);
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- /// Initialize mesh.
- void _initialize(void);
-
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- topology::Mesh* _mesh; ///< Mesh for data
- bool _flipFault; ///< If true, flip fault orientation.
-
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- /** Create vertex fields.
- *
- * @param fields Vertex fields.
- */
- void
- _createVertexFields(topology::Fields<topology::Field<topology::Mesh> >* fields) const;
-
- /** Create cell fields.
- *
- * @param fields Cell fields.
- */
- void
- _createCellFields(topology::Fields<topology::Field<topology::Mesh> >* fields) const;
-
}; // class TestDataWriterVTKMesh
#endif // pylith_meshio_testdatawritervtkmesh_hh
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -20,7 +20,7 @@
#include "TestDataWriterVTKSubMesh.hh" // Implementation of class methods
-#include "data/DataWriterVTKData.hh" // USES DataWriterVTKData
+#include "data/DataWriterData.hh" // USES DataWriterData
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/Field.hh" // USES Field
@@ -41,10 +41,7 @@
void
pylith::meshio::TestDataWriterVTKSubMesh::setUp(void)
{ // setUp
- TestDataWriterVTK::setUp();
- _mesh = 0;
- _submesh = 0;
- _flipFault = false;
+ TestDataWriterSubMesh::setUp();
} // setUp
// ----------------------------------------------------------------------
@@ -52,9 +49,7 @@
void
pylith::meshio::TestDataWriterVTKSubMesh::tearDown(void)
{ // tearDown
- TestDataWriterVTK::tearDown();
- delete _mesh; _mesh = 0;
- delete _submesh; _submesh = 0;
+ TestDataWriterSubMesh::tearDown();
} // tearDown
// ----------------------------------------------------------------------
@@ -139,7 +134,7 @@
writer.openTimeStep(t, *_submesh, label, id);
} // else
for (int i=0; i < nfields; ++i) {
- const MeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
+ MeshField& field = vertexFields.get(_data->vertexFieldsInfo[i].name);
writer.writeVertexField(t, field, *_submesh);
CPPUNIT_ASSERT(writer._wroteVertexHeader);
CPPUNIT_ASSERT(false == writer._wroteCellHeader);
@@ -176,7 +171,7 @@
writer.open(*_submesh, numTimeSteps);
writer.openTimeStep(t, *_submesh);
for (int i=0; i < nfields; ++i) {
- const SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -187,7 +182,7 @@
writer.open(*_submesh, numTimeSteps, label, id);
writer.openTimeStep(t, *_submesh, label, id);
for (int i=0; i < nfields; ++i) {
- const SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
+ SubMeshField& field = cellFields.get(_data->cellFieldsInfo[i].name);
writer.writeCellField(t, field, label, id);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
@@ -201,140 +196,5 @@
checkFile(_data->cellFilename, t, _data->timeFormat);
} // testWriteCellField
-// ----------------------------------------------------------------------
-// Initialize mesh.
-void
-pylith::meshio::TestDataWriterVTKSubMesh::_initialize(void)
-{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- delete _mesh; _mesh = new topology::Mesh;
- MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(_mesh);
-
- if (0 != _data->faultLabel) {
- faults::FaultCohesiveKin fault;
- int firstFaultVertex = 0;
- int firstLagrangeVertex = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- int firstFaultCell = _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- if (fault.useLagrangeConstraints()) {
- firstFaultCell += _mesh->sieveMesh()->getIntSection(_data->faultLabel)->size();
- }
- fault.label(_data->faultLabel);
- fault.id(_data->faultId);
- fault.adjustTopology(_mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
- } // if
-
- CPPUNIT_ASSERT(0 != _data->bcLabel);
- delete _submesh; _submesh = new topology::SubMesh(*_mesh, _data->bcLabel);
- const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = _mesh->sieveMesh();
- assert(!sieveMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
- _submesh->sieveMesh();
- assert(!sieveSubMesh.isNull());
- sieveSubMesh->setRealSection("coordinates",
- sieveMesh->getRealSection("coordinates"));
- //_mesh->view("BC mesh");
-} // _initialize
-
-// ----------------------------------------------------------------------
-// Create vertex fields.
-void
-pylith::meshio::TestDataWriterVTKSubMesh::_createVertexFields(
- topology::Fields<MeshField>* fields) const
-{ // _createVertexFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numVertexFields;
-
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveMesh =
- _mesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& vertices =
- sieveMesh->depthStratum(0);
- CPPUNIT_ASSERT(!vertices.isNull());
- const topology::SubMesh::SieveMesh::label_sequence::iterator verticesEnd =
- vertices->end();
-
- // Set vertex fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->vertexFieldsInfo[i].name;
- const int fiberDim = _data->vertexFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- MeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
- field.allocate();
- field.vectorFieldType(_data->vertexFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int ipt = 0;
- for (topology::SubMesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter, ++ipt) {
- const double* values = &_data->vertexFields[i][ipt*fiberDim];
- section->updatePoint(*v_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numVertices, ipt);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createVertexFields
-
-// ----------------------------------------------------------------------
-// Create cell fields.
-void
-pylith::meshio::TestDataWriterVTKSubMesh::_createCellFields(
- topology::Fields<SubMeshField>* fields) const
-{ // _createCellFields
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _mesh);
- CPPUNIT_ASSERT(0 != _data);
-
- try {
- const int nfields = _data->numCellFields;
-
- const ALE::Obj<topology::SubMesh::SieveMesh>& sieveSubMesh =
- _submesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveSubMesh.isNull());
- const ALE::Obj<topology::SubMesh::SieveMesh::label_sequence>& cells =
- sieveSubMesh->heightStratum(1);
- assert(!cells.isNull());
- const topology::SubMesh::SieveMesh::label_sequence::iterator cellsBegin =
- cells->begin();
- const topology::SubMesh::SieveMesh::label_sequence::iterator cellsEnd =
- cells->end();
-
- // Set cell fields
- for (int i=0; i < nfields; ++i) {
- const char* name = _data->cellFieldsInfo[i].name;
- const int fiberDim = _data->cellFieldsInfo[i].fiber_dim;
- fields->add(name, name);
- SubMeshField& field = fields->get(name);
- field.newSection(topology::FieldBase::CELLS_FIELD, fiberDim, 1);
- field.allocate();
- field.vectorFieldType(_data->cellFieldsInfo[i].field_type);
-
- const ALE::Obj<topology::SubMesh::RealSection>& section = field.section();
- CPPUNIT_ASSERT(!section.isNull());
- int icell = 0;
- for (topology::SubMesh::SieveMesh::label_sequence::iterator c_iter=cellsBegin;
- c_iter != cellsEnd;
- ++c_iter, ++icell) {
- const double* values = &_data->cellFields[i][icell*fiberDim];
- section->updatePoint(*c_iter, values);
- } // for
- CPPUNIT_ASSERT_EQUAL(_data->numCells, icell);
- } // for
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _createCellFields
-
-
// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/TestDataWriterVTKSubMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -28,9 +28,12 @@
#define pylith_meshio_testdatawritervtksubmesh_hh
#include "TestDataWriterVTK.hh"
+#include "TestDataWriterSubMesh.hh"
#include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh, Field
+#include <cppunit/extensions/HelperMacros.h>
+
/// Namespace for pylith package
namespace pylith {
namespace meshio {
@@ -39,7 +42,9 @@
} // pylith
/// C++ unit testing for DataWriterVTK
-class pylith::meshio::TestDataWriterVTKSubMesh : public TestDataWriterVTK
+class pylith::meshio::TestDataWriterVTKSubMesh : public TestDataWriterVTK,
+ public TestDataWriterSubMesh,
+ public CppUnit::TestFixture
{ // class TestDataWriterVTKSubMesh
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
@@ -70,36 +75,6 @@
/// Test writeCellField.
void testWriteCellField(void);
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- /// Initialize mesh.
- void _initialize(void);
-
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- topology::Mesh* _mesh; ///< Mesh for domain
- topology::SubMesh* _submesh; ///< Mesh for subdomain.
- bool _flipFault; ///< If true, flip fault orientation.
-
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- /** Create vertex fields.
- *
- * @param fields Vertex fields.
- */
- void
- _createVertexFields(topology::Fields<topology::Field<topology::Mesh> >* fields) const;
-
- /** Create cell fields.
- *
- * @param fields Cell fields.
- */
- void
- _createCellFields(topology::Fields<topology::Field<topology::SubMesh> >* fields) const;
-
}; // class TestDataWriterVTKSubMesh
#endif // pylith_meshio_testdatawritervtksubmesh_hh
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterData.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,51 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "DataWriterData.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::meshio::DataWriterData::DataWriterData(void) :
+ meshFilename(0),
+ faultLabel(0),
+ faultId(0),
+ bcLabel(0),
+ timestepFilename(0),
+ vertexFilename(0),
+ cellFilename(0),
+ time(0),
+ timeFormat(0),
+ cellsLabel(0),
+ labelId(0),
+ numVertexFields(0),
+ numVertices(0),
+ vertexFieldsInfo(0),
+ numCellFields(0),
+ numCells(0),
+ cellFieldsInfo(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::meshio::DataWriterData::~DataWriterData(void)
+{ // destructor
+} // destructor
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterData.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterData.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,91 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawriterdata_hh)
+#define pylith_meshio_datawriterdata_hh
+
+#include "pylith/topology/FieldBase.hh" // USES VectorFieldEnum
+
+namespace pylith {
+ namespace meshio {
+ class DataWriterData;
+ } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterData
+{ // DataWriterData
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ DataWriterData(void);
+
+ /// Destructor
+ virtual
+ ~DataWriterData(void);
+
+// PUBLIC STRUCTS ///////////////////////////////////////////////////////
+public:
+
+ struct FieldStruct {
+ char* name; ///< Name of field
+ topology::FieldBase::VectorFieldEnum field_type; ///< Type of field.
+ int fiber_dim; ///< Fiber dimension for field.
+ }; // FieldStruct
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+ char* meshFilename; ///< Name of mesh file.
+ char* faultLabel; ///< Name of group of vertices for fault.
+ int faultId; ///< Material identifier for fault.
+ char* bcLabel; ///< Name of group of vertices for bc.
+
+ char* timestepFilename; ///< Name of file without fields.
+ char* vertexFilename; ///< Name of file for vertex fields.
+ char* cellFilename; ///< Name of file for cell fields.
+
+ double time; ///< Time for fields.
+ char* timeFormat; ///< Format for time stamp.
+
+ char* cellsLabel; ///< Name of label for mesh cells (if using subset or boundary).
+ int labelId; ///< Id for label associated with cells (if cellsLabel != 0)
+
+ /// @name Vertex field information.
+ //@{
+ int numVertexFields; ///< Number of vertex fields.
+ int numVertices; ///< Number of vertices.
+ FieldStruct* vertexFieldsInfo; ///< Array of vertex field information.
+ double* vertexFields[3]; ///< Array of vertex field values.
+ //@}
+
+ /// @name Cell field information.
+ //@{
+ int numCellFields; ///< Number of cell fields.
+ int numCells; ///< Number of vertices.
+ FieldStruct* cellFieldsInfo; ///< Array of cell fields information.
+ double* cellFields[3]; /// Array of cell field values.
+ //@}
+
+}; // DataWriterData
+
+#endif // pylith_meshio_datawriterdata_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,160 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "DataWriterHDF5DataMeshHex8.hh"
+
+#include <assert.h> // USES assert()
+
+const char* pylith::meshio::DataWriterHDF5DataMeshHex8::_meshFilename =
+ "data/hex8.mesh";
+
+const char* pylith::meshio::DataWriterHDF5DataMeshHex8::_faultLabel =
+ "fault";
+const int pylith::meshio::DataWriterHDF5DataMeshHex8::_faultId = 100;
+
+const char* pylith::meshio::DataWriterHDF5DataMeshHex8::_timestepFilename =
+ "hex8.h5";
+
+const char* pylith::meshio::DataWriterHDF5DataMeshHex8::_vertexFilename =
+ "hex8_vertex.h5";
+
+const char* pylith::meshio::DataWriterHDF5DataMeshHex8::_cellFilename =
+ "hex8_cell.h5";
+
+const double pylith::meshio::DataWriterHDF5DataMeshHex8::_time = 1.0;
+
+const char* pylith::meshio::DataWriterHDF5DataMeshHex8::_timeFormat =
+ "%3.1f";
+
+const int pylith::meshio::DataWriterHDF5DataMeshHex8::_numVertexFields = 3;
+const int pylith::meshio::DataWriterHDF5DataMeshHex8::_numVertices = 20;
+
+const pylith::meshio::DataWriterData::FieldStruct
+pylith::meshio::DataWriterHDF5DataMeshHex8::_vertexFields[] = {
+ { "displacements", topology::FieldBase::VECTOR, 3 },
+ { "pressure", topology::FieldBase::SCALAR, 1 },
+ { "other", topology::FieldBase::OTHER, 2 },
+};
+const double pylith::meshio::DataWriterHDF5DataMeshHex8::_vertexField0[] = {
+ 1.1, 2.2, 3.3,
+ 4.4, 5.5, 6.6,
+ 7.7, 8.8, 9.9,
+ 10.1, 11.2, 12.3,
+ 1.2, 2.3, 3.4,
+ 4.5, 5.6, 6.7,
+ 7.8, 8.9, 9.0,
+ 10.2, 11.3, 12.4,
+ 1.3, 2.4, 3.5,
+ 4.6, 5.7, 6.8,
+ 7.9, 8.0, 9.1,
+ 10.2, 11.3, 12.4,
+ 13.5, 14.6, 15.7,
+ 16.8, 17.9, 18.1,
+ 19.2, 20.3, 21.4,
+ 22.5, 23.6, 24.7,
+ 25.8, 26.9, 27.1,
+ 28.8, 29.9, 30.1,
+ 31.8, 32.9, 33.1,
+ 34.8, 35.9, 36.1,
+};
+const double pylith::meshio::DataWriterHDF5DataMeshHex8::_vertexField1[] = {
+ 2.1, 3.2, 4.3, 5.4, 6.5, 7.6, 8.7, 9.8,
+ 10.0, 12.1, 11.1, 13.1, 14.1, 15.1, 16.1, 17.1,
+ 18.1, 19.1, 20.1, 21.2
+};
+const double pylith::meshio::DataWriterHDF5DataMeshHex8::_vertexField2[] = {
+ 1.2, 2.3,
+ 3.4, 4.5,
+ 5.6, 6.7,
+ 7.8, 8.9,
+ 1.3, 2.4,
+ 3.5, 4.6,
+ 5.7, 6.8,
+ 7.9, 8.0,
+ 1.3, 2.4,
+ 3.5, 4.6,
+ 5.7, 6.8,
+ 8.0, 1.4,
+ 2.5, 3.6,
+ 4.8, 1.5,
+ 2.6, 3.7,
+ 4.8, 5.9,
+ 6.1, 7.2,
+ 7.1, 8.2,
+ 8.1, 9.2,
+ 9.1, 10.1
+};
+
+const int pylith::meshio::DataWriterHDF5DataMeshHex8::_numCellFields = 3;
+const int pylith::meshio::DataWriterHDF5DataMeshHex8::_numCells = 3;
+
+const pylith::meshio::DataWriterData::FieldStruct
+pylith::meshio::DataWriterHDF5DataMeshHex8::_cellFields[] = {
+ { "traction", topology::FieldBase::VECTOR, 3 },
+ { "pressure", topology::FieldBase::SCALAR, 1 },
+ { "other", topology::FieldBase::TENSOR, 6 },
+};
+const double pylith::meshio::DataWriterHDF5DataMeshHex8::_cellField0[] = {
+ 1.1, 2.2, 3.3,
+ 4.4, 5.5, 6.6,
+ 7.7, 8.8, 9.9
+};
+const double pylith::meshio::DataWriterHDF5DataMeshHex8::_cellField1[] = {
+ 2.1, 3.2, 4.3
+};
+const double pylith::meshio::DataWriterHDF5DataMeshHex8::_cellField2[] = {
+ 1.2, 2.3, 3.4, 4.5, 5.6, 6.7,
+ 1.1, 2.2, 3.3, 4.4, 5.5, 6.6,
+ 1.3, 2.4, 3.5, 4.6, 5.7, 6.8
+};
+
+pylith::meshio::DataWriterHDF5DataMeshHex8::DataWriterHDF5DataMeshHex8(void)
+{ // constructor
+ meshFilename = const_cast<char*>(_meshFilename);
+ faultLabel = const_cast<char*>(_faultLabel);
+ faultId = _faultId;
+
+ timestepFilename = const_cast<char*>(_timestepFilename);
+ vertexFilename = const_cast<char*>(_vertexFilename);
+ cellFilename = const_cast<char*>(_cellFilename);
+
+ time = _time;
+ timeFormat = const_cast<char*>(_timeFormat);
+
+ numVertexFields = _numVertexFields;
+ numVertices = _numVertices;
+ assert(3 == numVertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
+ vertexFields[0] = const_cast<double*>(_vertexField0);
+ vertexFields[1] = const_cast<double*>(_vertexField1);
+ vertexFields[2] = const_cast<double*>(_vertexField2);
+
+ numCellFields = _numCellFields;
+ numCells = _numCells;
+ assert(3 == numCellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
+ cellFields[0] = const_cast<double*>(_cellField0);
+ cellFields[1] = const_cast<double*>(_cellField1);
+ cellFields[2] = const_cast<double*>(_cellField2);
+} // constructor
+
+pylith::meshio::DataWriterHDF5DataMeshHex8::~DataWriterHDF5DataMeshHex8(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterHDF5DataMeshHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,80 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawriterhdf5datameshhex8_hh)
+#define pylith_meshio_datawriterhdf5datameshhex8_hh
+
+#include "DataWriterData.hh" // ISA DataWriterData
+
+namespace pylith {
+ namespace meshio {
+ class DataWriterHDF5DataMeshHex8;
+ } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterHDF5DataMeshHex8 : public DataWriterData
+{ // DataWriterHDF5DataMeshHex8
+
+public:
+
+ /// Constructor
+ DataWriterHDF5DataMeshHex8(void);
+
+ /// Destructor
+ ~DataWriterHDF5DataMeshHex8(void);
+
+private:
+
+ static const char* _meshFilename; ///< Name of mesh file.
+ static const char* _faultLabel; ///< Name of group of vertices for fault.
+ static const int _faultId; ///< Material identifier for fault.
+
+ static const char* _timestepFilename; ///< Name of HDF5 file without fields.
+ static const char* _vertexFilename; ///< Name of HDF5 file for vertex fields.
+ static const char* _cellFilename; ///< Name of HDF5 file for cell fields.
+
+ static const double _time; ///< Time for fields.
+ static const char* _timeFormat; ///< Format for time stamp.
+
+ /// @name Vertex field information.
+ //@{
+ static const int _numVertexFields; ///< Number of vertex fields.
+ static const int _numVertices; ///< Number of vertices.
+ static const FieldStruct _vertexFields[]; ///< Array of vertex fields.
+
+ static const double _vertexField0[]; ///< Values for vertex field 0.
+ static const double _vertexField1[]; ///< Values for vertex field 1.
+ static const double _vertexField2[]; ///< Values for vertex field 2.
+ //@}
+
+ /// @name Cell field information.
+ //@{
+ static const int _numCellFields; ///< Number of cell fields.
+ static const int _numCells; ///< Number of cells.
+ static const FieldStruct _cellFields[]; ///< Array of cell fields.
+
+ static const double _cellField0[]; ///< Values for cell field 0.
+ static const double _cellField1[]; ///< Values for cell field 1.
+ static const double _cellField2[]; ///< Values for cell field 2.
+ //@}
+
+}; // DataWriterHDF5DataMeshHex8
+
+#endif // pylith_meshio_datawriterhdf5datameshhex8_hh
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -47,7 +47,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshHex8::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshHex8::_numVertices = 8;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshHex8::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -80,7 +80,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshHex8::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshHex8::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshHex8::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -115,7 +115,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -123,7 +123,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatabcmeshhex8_hh)
#define pylith_meshio_datawritervtkdatabcmeshhex8_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataBCMeshHex8 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataBCMeshHex8 : public DataWriterData
{ // DataWriterVTKDataBCMeshHex8
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -43,7 +43,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshQuad4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshQuad4::_numVertices = 3;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshQuad4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -66,7 +66,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshQuad4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshQuad4::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshQuad4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -99,7 +99,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -107,7 +107,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshQuad4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatabcmeshquad4_hh)
#define pylith_meshio_datawritervtkdatabcmeshquad4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataBCMeshQuad4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataBCMeshQuad4 : public DataWriterData
{ // DataWriterVTKDataBCMeshQuad4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -47,7 +47,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshTet4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshTet4::_numVertices = 6;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshTet4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -76,7 +76,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshTet4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshTet4::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshTet4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -111,7 +111,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -119,7 +119,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTet4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatabcmeshtet4_hh)
#define pylith_meshio_datawritervtkdatabcmeshtet4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataBCMeshTet4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataBCMeshTet4 : public DataWriterData
{ // DataWriterVTKDataBCMeshTet4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -47,7 +47,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshTri3::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshTri3::_numVertices = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshTri3::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -68,7 +68,7 @@
const int pylith::meshio::DataWriterVTKDataBCMeshTri3::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataBCMeshTri3::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataBCMeshTri3::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -101,7 +101,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -109,7 +109,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataBCMeshTri3.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatabcmeshtri3_hh)
#define pylith_meshio_datawritervtkdatabcmeshtri3_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataBCMeshTri3 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataBCMeshTri3 : public DataWriterData
{ // DataWriterVTKDataBCMeshTri3
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshHex8::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshHex8::_numVertices = 4;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshHex8::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -69,7 +69,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshHex8::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshHex8::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshHex8::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -101,7 +101,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -109,7 +109,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatafaultmeshhex8_hh)
#define pylith_meshio_datawritervtkdatafaultmeshhex8_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataFaultMeshHex8 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataFaultMeshHex8 : public DataWriterData
{ // DataWriterVTKDataFaultMeshHex8
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshQuad4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshQuad4::_numVertices = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshQuad4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -65,7 +65,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshQuad4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshQuad4::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshQuad4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -97,7 +97,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -105,7 +105,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshQuad4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatafaultmeshquad4_hh)
#define pylith_meshio_datawritervtkdatafaultmeshquad4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataFaultMeshQuad4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataFaultMeshQuad4 : public DataWriterData
{ // DataWriterVTKDataFaultMeshQuad4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshTet4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshTet4::_numVertices = 3;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshTet4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -67,7 +67,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshTet4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshTet4::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshTet4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -99,7 +99,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -107,7 +107,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTet4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatafaultmeshtet4_hh)
#define pylith_meshio_datawritervtkdatafaultmeshtet4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataFaultMeshTet4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataFaultMeshTet4 : public DataWriterData
{ // DataWriterVTKDataFaultMeshTet4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshTri3::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshTri3::_numVertices = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshTri3::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -65,7 +65,7 @@
const int pylith::meshio::DataWriterVTKDataFaultMeshTri3::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataFaultMeshTri3::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataFaultMeshTri3::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -97,7 +97,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -105,7 +105,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataFaultMeshTri3.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatafaultmeshtri3_hh)
#define pylith_meshio_datawritervtkdatafaultmeshtri3_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataFaultMeshTri3 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataFaultMeshTri3 : public DataWriterData
{ // DataWriterVTKDataFaultMeshTri3
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -48,7 +48,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshHex8::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshHex8::_numVertices = 20;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshHex8::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -107,7 +107,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshHex8::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshHex8::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshHex8::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -141,7 +141,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -149,7 +149,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatamatmeshhex8_hh)
#define pylith_meshio_datawritervtkdatamatmeshhex8_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMatMeshHex8 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMatMeshHex8 : public DataWriterData
{ // DataWriterVTKDataMatMeshHex8
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -48,7 +48,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshLine2::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshLine2::_numVertices = 5;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshLine2::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 1 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -71,7 +71,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshLine2::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshLine2::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshLine2::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 1 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -105,7 +105,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -113,7 +113,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshLine2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatamatmeshline2_hh)
#define pylith_meshio_datawritervtkdatamatmeshline2_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMatMeshLine2 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMatMeshLine2 : public DataWriterData
{ // DataWriterVTKDataMatMeshLine2
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshQuad4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshQuad4::_numVertices = 6;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshQuad4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -73,7 +73,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshQuad4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshQuad4::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshQuad4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -105,7 +105,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -113,7 +113,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshQuad4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatamatmeshquad4_hh)
#define pylith_meshio_datawritervtkdatamatmeshquad4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMatMeshQuad4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMatMeshQuad4 : public DataWriterData
{ // DataWriterVTKDataMatMeshQuad4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -48,7 +48,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshTet4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshTet4::_numVertices = 11;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshTet4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -87,7 +87,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshTet4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshTet4::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshTet4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -123,7 +123,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -131,7 +131,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTet4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatamatmeshtet4_hh)
#define pylith_meshio_datawritervtkdatamatmeshtet4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMatMeshTet4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMatMeshTet4 : public DataWriterData
{ // DataWriterVTKDataMatMeshTet4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -48,7 +48,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshTri3::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshTri3::_numVertices = 8;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshTri3::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -81,7 +81,7 @@
const int pylith::meshio::DataWriterVTKDataMatMeshTri3::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMatMeshTri3::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMatMeshTri3::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -115,7 +115,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -123,7 +123,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMatMeshTri3.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatamatmeshtri3_hh)
#define pylith_meshio_datawritervtkdatamatmeshtri3_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMatMeshTri3 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMatMeshTri3 : public DataWriterData
{ // DataWriterVTKDataMatMeshTri3
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataMeshHex8::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshHex8::_numVertices = 20;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshHex8::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -103,7 +103,7 @@
const int pylith::meshio::DataWriterVTKDataMeshHex8::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshHex8::_numCells = 3;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshHex8::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -139,7 +139,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -147,7 +147,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatameshhex8_hh)
#define pylith_meshio_datawritervtkdatameshhex8_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMeshHex8 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMeshHex8 : public DataWriterData
{ // DataWriterVTKDataMeshHex8
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataMeshLine2::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshLine2::_numVertices = 5;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshLine2::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 1 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -67,7 +67,7 @@
const int pylith::meshio::DataWriterVTKDataMeshLine2::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshLine2::_numCells = 3;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshLine2::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 1 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -99,7 +99,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -107,7 +107,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatameshline2_hh)
#define pylith_meshio_datawritervtkdatameshline2_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMeshLine2 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMeshLine2 : public DataWriterData
{ // DataWriterVTKDataMeshLine2
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -40,7 +40,7 @@
const int pylith::meshio::DataWriterVTKDataMeshQuad4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshQuad4::_numVertices = 6;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshQuad4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -69,7 +69,7 @@
const int pylith::meshio::DataWriterVTKDataMeshQuad4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshQuad4::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshQuad4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -101,7 +101,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -109,7 +109,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshQuad4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatameshquad4_hh)
#define pylith_meshio_datawritervtkdatameshquad4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMeshQuad4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMeshQuad4 : public DataWriterData
{ // DataWriterVTKDataMeshQuad4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataMeshTet4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshTet4::_numVertices = 11;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshTet4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -83,7 +83,7 @@
const int pylith::meshio::DataWriterVTKDataMeshTet4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshTet4::_numCells = 3;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshTet4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -119,7 +119,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -127,7 +127,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTet4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatameshtet4_hh)
#define pylith_meshio_datawritervtkdatameshtet4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMeshTet4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMeshTet4 : public DataWriterData
{ // DataWriterVTKDataMeshTet4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -44,7 +44,7 @@
const int pylith::meshio::DataWriterVTKDataMeshTri3::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshTri3::_numVertices = 8;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshTri3::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -75,7 +75,7 @@
const int pylith::meshio::DataWriterVTKDataMeshTri3::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataMeshTri3::_numCells = 3;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataMeshTri3::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -111,7 +111,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -119,7 +119,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataMeshTri3.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatameshtri3_hh)
#define pylith_meshio_datawritervtkdatameshtri3_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataMeshTri3 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataMeshTri3 : public DataWriterData
{ // DataWriterVTKDataMeshTri3
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -46,7 +46,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshHex8::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshHex8::_numVertices = 12;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshHex8::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -87,7 +87,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshHex8::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshHex8::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshHex8::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -122,7 +122,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -130,7 +130,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshHex8.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatasubmeshhex8_hh)
#define pylith_meshio_datawritervtkdatasubmeshhex8_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataSubMeshHex8 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataSubMeshHex8 : public DataWriterData
{ // DataWriterVTKDataSubMeshHex8
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -47,7 +47,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshLine2::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshLine2::_numVertices = 5;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshLine2::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -74,7 +74,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshLine2::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshLine2::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshLine2::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -107,7 +107,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -115,7 +115,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshLine2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatasubmeshline2_hh)
#define pylith_meshio_datawritervtkdatasubmeshline2_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataSubMeshLine2 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataSubMeshLine2 : public DataWriterData
{ // DataWriterVTKDataSubMeshLine2
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -43,7 +43,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshQuad4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshQuad4::_numVertices = 6;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshQuad4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -72,7 +72,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshQuad4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshQuad4::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshQuad4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -105,7 +105,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -113,7 +113,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshQuad4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatasubmeshquad4_hh)
#define pylith_meshio_datawritervtkdatasubmeshquad4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataSubMeshQuad4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataSubMeshQuad4 : public DataWriterData
{ // DataWriterVTKDataSubMeshQuad4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -46,7 +46,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshTet4::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshTet4::_numVertices = 5;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshTet4::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -73,7 +73,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshTet4::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshTet4::_numCells = 2;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshTet4::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 3 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -108,7 +108,7 @@
numVertexFields = _numVertexFields;
assert(3 == numVertexFields);
numVertices = _numVertices;
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -116,7 +116,7 @@
numCellFields = _numCellFields;
assert(3 == numCellFields);
numCells = _numCells;
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTet4.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatasubmeshtet4_hh)
#define pylith_meshio_datawritervtkdatasubmeshtet4_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataSubMeshTet4 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataSubMeshTet4 : public DataWriterData
{ // DataWriterVTKDataSubMeshTet4
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -47,7 +47,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numVertexFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numVertices = 8;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshTri3::_vertexFields[] = {
{ "displacements", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -80,7 +80,7 @@
const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numCellFields = 3;
const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numCells = 1;
-const pylith::meshio::DataWriterVTKData::FieldStruct
+const pylith::meshio::DataWriterData::FieldStruct
pylith::meshio::DataWriterVTKDataSubMeshTri3::_cellFields[] = {
{ "traction", topology::FieldBase::VECTOR, 2 },
{ "pressure", topology::FieldBase::SCALAR, 1 },
@@ -113,7 +113,7 @@
numVertexFields = _numVertexFields;
numVertices = _numVertices;
assert(3 == numVertexFields);
- vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
vertexFields[0] = const_cast<double*>(_vertexField0);
vertexFields[1] = const_cast<double*>(_vertexField1);
vertexFields[2] = const_cast<double*>(_vertexField2);
@@ -121,7 +121,7 @@
numCellFields = _numCellFields;
numCells = _numCells;
assert(3 == numCellFields);
- cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_cellFields);
cellFields[0] = const_cast<double*>(_cellField0);
cellFields[1] = const_cast<double*>(_cellField1);
cellFields[2] = const_cast<double*>(_cellField2);
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -19,7 +19,7 @@
#if !defined(pylith_meshio_datawritervtkdatasubmeshtri3_hh)
#define pylith_meshio_datawritervtkdatasubmeshtri3_hh
-#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterData.hh" // ISA DataWriterData
namespace pylith {
namespace meshio {
@@ -27,7 +27,7 @@
} // meshio
} // pylith
-class pylith::meshio::DataWriterVTKDataSubMeshTri3 : public DataWriterVTKData
+class pylith::meshio::DataWriterVTKDataSubMeshTri3 : public DataWriterData
{ // DataWriterVTKDataSubMeshTri3
public:
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_cell_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_cell_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_cell_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -12,8 +12,8 @@
0.000000e+00 -1.000000e+00 1.000000e+00
0.000000e+00 1.000000e+00 1.000000e+00
CELLS 2 10
-4 6 7 1 0
-4 4 5 3 2
+4 0 6 7 1
+4 2 4 5 3
CELL_TYPES 2
9
9
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -12,8 +12,8 @@
0.000000e+00 -1.000000e+00 1.000000e+00
0.000000e+00 1.000000e+00 1.000000e+00
CELLS 2 10
-4 6 7 1 0
-4 4 5 3 2
+4 0 6 7 1
+4 2 4 5 3
CELL_TYPES 2
9
9
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_vertex_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_bc_vertex_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -12,8 +12,8 @@
0.000000e+00 -1.000000e+00 1.000000e+00
0.000000e+00 1.000000e+00 1.000000e+00
CELLS 2 10
-4 6 7 1 0
-4 4 5 3 2
+4 0 6 7 1
+4 2 4 5 3
CELL_TYPES 2
9
9
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_cell_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_cell_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_cell_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -8,7 +8,7 @@
0.000000e+00 -1.000000e+00 1.000000e+00
0.000000e+00 1.000000e+00 1.000000e+00
CELLS 1 5
-4 2 3 1 0
+4 1 0 2 3
CELL_TYPES 1
9
CELL_DATA 1
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -8,6 +8,6 @@
0.000000e+00 -1.000000e+00 1.000000e+00
0.000000e+00 1.000000e+00 1.000000e+00
CELLS 1 5
-4 2 3 1 0
+4 1 0 2 3
CELL_TYPES 1
9
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_vertex_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_fault_vertex_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -8,7 +8,7 @@
0.000000e+00 -1.000000e+00 1.000000e+00
0.000000e+00 1.000000e+00 1.000000e+00
CELLS 1 5
-4 2 3 1 0
+4 1 0 2 3
CELL_TYPES 1
9
POINT_DATA 4
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_cell_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_cell_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_cell_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -10,8 +10,8 @@
1.000000e+00 -1.000000e+00 1.000000e+00
1.000000e+00 1.000000e+00 1.000000e+00
CELLS 2 10
-4 2 3 1 0
-4 4 5 3 2
+4 0 2 3 1
+4 2 4 5 3
CELL_TYPES 2
9
9
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -10,8 +10,8 @@
1.000000e+00 -1.000000e+00 1.000000e+00
1.000000e+00 1.000000e+00 1.000000e+00
CELLS 2 10
-4 2 3 1 0
-4 4 5 3 2
+4 0 2 3 1
+4 2 4 5 3
CELL_TYPES 2
9
9
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_vertex_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/hex8_surf_vertex_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -10,8 +10,8 @@
1.000000e+00 -1.000000e+00 1.000000e+00
1.000000e+00 1.000000e+00 1.000000e+00
CELLS 2 10
-4 2 3 1 0
-4 4 5 3 2
+4 0 2 3 1
+4 2 4 5 3
CELL_TYPES 2
9
9
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_cell_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_cell_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_cell_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -7,7 +7,7 @@
CELLS 1 2
1 0
CELL_TYPES 1
--1
+1
CELL_DATA 1
VECTORS traction double
1.100000e+00 2.200000e+00 0.0
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -7,4 +7,4 @@
CELLS 1 2
1 0
CELL_TYPES 1
--1
+1
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_vertex_t10.vtk 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/data/line2_surf_vertex_t10.vtk 2010-10-15 23:45:21 UTC (rev 17288)
@@ -7,7 +7,7 @@
CELLS 1 2
1 0
CELL_TYPES 1
--1
+1
POINT_DATA 1
VECTORS displacements double
1.100000e+00 2.200000e+00 0.0
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -34,8 +34,10 @@
TestFieldSubMesh.cc \
TestFieldsMesh.cc \
TestFieldsSubMesh.cc \
+ TestFieldsNewMesh.cc \
TestSolutionFields.cc \
TestJacobian.cc \
+ TestRefineUniform.cc \
test_topology.cc
@@ -47,14 +49,30 @@
TestFieldSubMesh.hh \
TestFieldsMesh.hh \
TestFieldsSubMesh.hh \
+ TestFieldsNewMesh.hh \
TestSolutionFields.hh \
- TestJacobian.hh
+ TestJacobian.hh \
+ TestRefineUniform.hh
# Source files associated with testing data
-testtopology_SOURCES +=
+testtopology_SOURCES += \
+ data/MeshDataCohesive.cc \
+ data/MeshDataCohesiveTri3Level2.cc \
+ data/MeshDataCohesiveTri3Level2Fault1.cc \
+ data/MeshDataCohesiveTet4Level2.cc \
+ data/MeshDataCohesiveTet4Level2Fault1.cc \
+ data/MeshDataCohesiveQuad4Level2.cc \
+ data/MeshDataCohesiveQuad4Level2Fault1.cc
-noinst_HEADERS +=
+noinst_HEADERS += \
+ data/MeshDataCohesive.hh \
+ data/MeshDataCohesiveTri3Level2.hh \
+ data/MeshDataCohesiveTri3Level2Fault1.hh \
+ data/MeshDataCohesiveTet4Level2.hh \
+ data/MeshDataCohesiveTet4Level2Fault1.hh \
+ data/MeshDataCohesiveQuad4Level2.hh \
+ data/MeshDataCohesiveQuad4Level2Fault1.hh
AM_CPPFLAGS = \
$(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE) \
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldMesh.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -141,9 +141,14 @@
_buildMesh(&mesh);
Field<Mesh> field(mesh);
+ const std::string& label = "field A";
+ field.label(label.c_str());
+
field.newSection();
const ALE::Obj<Mesh::RealSection>& section = field.section();
CPPUNIT_ASSERT(!section.isNull());
+
+ CPPUNIT_ASSERT_EQUAL(label, std::string(section->getName()));
} // testNewSection
// ----------------------------------------------------------------------
@@ -159,6 +164,9 @@
CPPUNIT_ASSERT(!sieveMesh.isNull());
Field<Mesh> field(mesh);
+ const std::string& label = "field A";
+ field.label(label.c_str());
+
const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices =
sieveMesh->depthStratum(0);
CPPUNIT_ASSERT(!vertices.isNull());
@@ -171,6 +179,8 @@
v_iter != vertices->end();
++v_iter)
CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+
+ CPPUNIT_ASSERT_EQUAL(label, std::string(section->getName()));
} // testNewSectionPoints
// ----------------------------------------------------------------------
@@ -186,6 +196,9 @@
CPPUNIT_ASSERT(!sieveMesh.isNull());
Field<Mesh> field(mesh);
+ const std::string& label = "field A";
+ field.label(label.c_str());
+
const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices =
sieveMesh->depthStratum(0);
CPPUNIT_ASSERT(!vertices.isNull());
@@ -219,6 +232,8 @@
// Points not int array should have a fiber dimension of zero.
for (int i=0; i < pointsOut.size(); ++i)
CPPUNIT_ASSERT_EQUAL(0, section->getFiberDimension(pointsOut[i]));
+
+ CPPUNIT_ASSERT_EQUAL(label, std::string(section->getName()));
} // testNewSectionPointsArray
// ----------------------------------------------------------------------
@@ -234,6 +249,8 @@
CPPUNIT_ASSERT(!sieveMesh.isNull());
Field<Mesh> field(mesh);
+ const std::string& label = "field A";
+ field.label(label.c_str());
field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
const ALE::Obj<Mesh::RealSection>& section = field.section();
@@ -245,6 +262,8 @@
v_iter != vertices->end();
++v_iter)
CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+
+ CPPUNIT_ASSERT_EQUAL(label, std::string(section->getName()));
} // testNewSectionDomain
// ----------------------------------------------------------------------
@@ -268,6 +287,8 @@
const int fiberDim2 = 5;
Field<Mesh> field(mesh);
+ const std::string& label = "field A";
+ field.label(label.c_str());
field.newSection(fieldSrc, fiberDim2);
const ALE::Obj<Mesh::RealSection>& section = field.section();
CPPUNIT_ASSERT(!section.isNull());
@@ -278,6 +299,8 @@
v_iter != vertices->end();
++v_iter)
CPPUNIT_ASSERT_EQUAL(fiberDim2, section->getFiberDimension(*v_iter));
+
+ CPPUNIT_ASSERT_EQUAL(label, std::string(section->getName()));
} // testNewSectionField
// ----------------------------------------------------------------------
@@ -327,6 +350,8 @@
} // Setup source field
Field<Mesh> field(mesh);
+ const std::string& label = "field A";
+ field.label(label.c_str());
field.cloneSection(fieldSrc);
const ALE::Obj<Mesh::RealSection>& section = field.section();
CPPUNIT_ASSERT(!section.isNull());
@@ -341,6 +366,8 @@
// Verify vector scatter was also copied.
CPPUNIT_ASSERT_EQUAL(fieldSrc._scatter, field._scatter);
+
+ CPPUNIT_ASSERT_EQUAL(label, std::string(section->getName()));
} // testCloneSection
// ----------------------------------------------------------------------
@@ -357,9 +384,9 @@
field.clear();
- CPPUNIT_ASSERT_EQUAL(1.0, field._scale);
- CPPUNIT_ASSERT_EQUAL(Field<Mesh>::OTHER, field._vecFieldType);
- CPPUNIT_ASSERT_EQUAL(false, field._dimensionsOkay);
+ CPPUNIT_ASSERT_EQUAL(1.0, field._metadata.scale);
+ CPPUNIT_ASSERT_EQUAL(Field<Mesh>::OTHER, field._metadata.vectorFieldType);
+ CPPUNIT_ASSERT_EQUAL(false, field._metadata.dimsOkay);
} // testClear
// ----------------------------------------------------------------------
@@ -834,6 +861,8 @@
Mesh mesh;
_buildMesh(&mesh);
Field<Mesh> field(mesh);
+ const std::string& label = "field A";
+ field.label(label.c_str());
field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
field.allocate();
@@ -854,6 +883,10 @@
// Make sure we can do multiple calls to createVector().
field.createVector();
CPPUNIT_ASSERT(0 != field._vector);
+
+ const char* vecname = 0;
+ PetscObjectGetName((PetscObject)field._vector, &vecname);
+ CPPUNIT_ASSERT_EQUAL(label, std::string(vecname));
} // testCreateVector
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldSubMesh.cc 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldSubMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -296,9 +296,9 @@
field.clear();
- CPPUNIT_ASSERT_EQUAL(1.0, field._scale);
- CPPUNIT_ASSERT_EQUAL(Field<SubMesh>::OTHER, field._vecFieldType);
- CPPUNIT_ASSERT_EQUAL(false, field._dimensionsOkay);
+ CPPUNIT_ASSERT_EQUAL(1.0, field._metadata.scale);
+ CPPUNIT_ASSERT_EQUAL(Field<SubMesh>::OTHER, field._metadata.vectorFieldType);
+ CPPUNIT_ASSERT_EQUAL(false, field._metadata.dimsOkay);
} // testClear
// ----------------------------------------------------------------------
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldsNewMesh.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,321 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestFieldsNewMesh.hh" // Implementation of class methods
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/FieldsNew.hh" // USES FieldsNew
+
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestFieldsNewMesh );
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::FieldsNew<pylith::topology::Mesh> FieldsNewMesh;
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+
+#if defined(USE_UNIFORMSECTION)
+typedef pylith::topology::Mesh::RealUniformSection section_type;
+#else
+typedef pylith::topology::Mesh::RealSection section_type;
+#endif
+
+// ----------------------------------------------------------------------
+void
+pylith::topology::TestFieldsNewMesh::setUp(void)
+{ // setUp
+ _mesh = new Mesh;
+ meshio::MeshIOAscii importer;
+ importer.filename("data/tri3.mesh");
+ importer.read(_mesh);
+} // setUp
+
+// ----------------------------------------------------------------------
+void
+pylith::topology::TestFieldsNewMesh::tearDown(void)
+{ // tearDown
+ delete _mesh; _mesh = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::topology::TestFieldsNewMesh::testConstructor(void)
+{ // testConstructor
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test hasField().
+void
+pylith::topology::TestFieldsNewMesh::testHasField(void)
+{ // testHasField
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+
+ CPPUNIT_ASSERT_EQUAL(true, fields.hasField("field A"));
+ CPPUNIT_ASSERT_EQUAL(false, fields.hasField("field B"));
+ CPPUNIT_ASSERT_EQUAL(false, fields.hasField("field C"));
+
+ fields.add("field B", "displacement", 3, FieldBase::VECTOR);
+
+ CPPUNIT_ASSERT_EQUAL(true, fields.hasField("field A"));
+ CPPUNIT_ASSERT_EQUAL(true, fields.hasField("field B"));
+ CPPUNIT_ASSERT_EQUAL(false, fields.hasField("field C"));
+
+} // testHasField
+
+// ----------------------------------------------------------------------
+// Test add().
+void
+pylith::topology::TestFieldsNewMesh::testAdd(void)
+{ // testAdd
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "displacement", 4, FieldBase::OTHER, 2.0, true);
+
+ const size_t size = 2;
+ CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
+} // testAdd
+
+// ----------------------------------------------------------------------
+// Test allocate(sequence).
+void
+pylith::topology::TestFieldsNewMesh::testAllocateSequence(void)
+{ // testAllocateSequence
+ const int fiberDim = 7;
+
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "other", 4, FieldBase::OTHER);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+
+ fields.allocate(vertices);
+
+ const size_t size = 2;
+ CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
+
+ const ALE::Obj<section_type>& section = fields.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter)
+ CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testAllocateSequence
+
+// ----------------------------------------------------------------------
+// Test allocate(array).
+void
+pylith::topology::TestFieldsNewMesh::testAllocateArray(void)
+{ // testAllocateSequence
+ const int fiberDim = 7;
+ const int nptsIn = 3;
+ const int ptsIn[nptsIn] = {
+ 1, 3, 4,
+ };
+ const int nptsOut = 1;
+ const int ptsOut[nptsOut] = {
+ 2,
+ };
+
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "other", 4, FieldBase::OTHER);
+
+ int_array verticesIn(nptsIn);
+ for (int i=0; i < nptsIn; ++i)
+ verticesIn = ptsIn[i];
+
+ int_array verticesOut(nptsOut);
+ for (int i=0; i < nptsOut; ++i)
+ verticesOut = ptsOut[i];
+
+ fields.allocate(verticesIn);
+
+ const size_t size = 2;
+ CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
+
+ const ALE::Obj<section_type>& section = fields.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ for (int i=0; i < nptsIn; ++i)
+ CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(verticesIn[i]));
+ for (int i=0; i < nptsOut; ++i)
+ CPPUNIT_ASSERT_EQUAL(0, section->getFiberDimension(verticesOut[i]));
+} // testAllocateArray
+
+// ----------------------------------------------------------------------
+// Test allocate(domain).
+void
+pylith::topology::TestFieldsNewMesh::testAllocateDomain(void)
+{ // testAllocateDomain
+ const int fiberDim = 7;
+
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "other", 4, FieldBase::OTHER);
+ fields.allocate(Field<Mesh>::VERTICES_FIELD);
+
+ const size_t size = 2;
+ CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
+
+ const ALE::Obj<section_type>& section = fields.section();
+ CPPUNIT_ASSERT(!section.isNull());
+ const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+ for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter)
+ CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testAllocateDomain
+
+// ----------------------------------------------------------------------
+// Test get().
+void
+pylith::topology::TestFieldsNewMesh::testGet(void)
+{ // testGet
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "displacement", 4, FieldBase::OTHER, 2.0, true);
+ fields.allocate(FieldBase::VERTICES_FIELD);
+
+ Field<Mesh>& fieldA = fields.get("field A");
+ CPPUNIT_ASSERT_EQUAL(std::string("velocity"), std::string(fieldA.label()));
+ CPPUNIT_ASSERT_EQUAL(FieldBase::VECTOR,
+ fieldA.vectorFieldType());
+ CPPUNIT_ASSERT_EQUAL(1.0, fieldA.scale());
+ CPPUNIT_ASSERT_EQUAL(false, fieldA.addDimensionOkay());
+
+ Field<Mesh>& fieldB = fields.get("field B");
+ CPPUNIT_ASSERT_EQUAL(std::string("displacement"),
+ std::string(fieldB.label()));
+ CPPUNIT_ASSERT_EQUAL(FieldBase::OTHER,
+ fieldB.vectorFieldType());
+ CPPUNIT_ASSERT_EQUAL(2.0, fieldB.scale());
+ CPPUNIT_ASSERT_EQUAL(true, fieldB.addDimensionOkay());
+} // testGet
+
+// ----------------------------------------------------------------------
+// Test get() const.
+void
+pylith::topology::TestFieldsNewMesh::testGetConst(void)
+{ // testGetConst
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "displacement", 4, FieldBase::OTHER, 2.0, true);
+ fields.allocate(FieldBase::VERTICES_FIELD);
+
+ const Field<Mesh>& fieldA = fields.get("field A");
+ CPPUNIT_ASSERT_EQUAL(std::string("velocity"), std::string(fieldA.label()));
+ CPPUNIT_ASSERT_EQUAL(FieldBase::VECTOR,
+ fieldA.vectorFieldType());
+ CPPUNIT_ASSERT_EQUAL(1.0, fieldA.scale());
+ CPPUNIT_ASSERT_EQUAL(false, fieldA.addDimensionOkay());
+
+ const Field<Mesh>& fieldB = fields.get("field B");
+ CPPUNIT_ASSERT_EQUAL(std::string("displacement"),
+ std::string(fieldB.label()));
+ CPPUNIT_ASSERT_EQUAL(FieldBase::OTHER,
+ fieldB.vectorFieldType());
+ CPPUNIT_ASSERT_EQUAL(2.0, fieldB.scale());
+ CPPUNIT_ASSERT_EQUAL(true, fieldB.addDimensionOkay());
+} // testGetConst
+
+// ----------------------------------------------------------------------
+// Test mesh().
+void
+pylith::topology::TestFieldsNewMesh::testMesh(void)
+{ // testMesh
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ const Mesh& mesh = fields.mesh();
+} // testMesh
+
+// ----------------------------------------------------------------------
+// Test sectionIndex().
+void
+pylith::topology::TestFieldsNewMesh::testSectionIndex(void)
+{ // testSectionIndex
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "displacement", 4, FieldBase::OTHER, 2.0, true);
+
+ CPPUNIT_ASSERT_EQUAL(0, fields.sectionIndex("field A"));
+ CPPUNIT_ASSERT_EQUAL(3, fields.sectionIndex("field B"));
+} // testSectionIndex
+
+// ----------------------------------------------------------------------
+// Test fieldNames() const.
+void
+pylith::topology::TestFieldsNewMesh::testFieldNames(void)
+{ // testFieldNames
+ const int numFieldsE = 2;
+ const char* namesE[2] = {
+ "field A",
+ "field B"
+ };
+
+ CPPUNIT_ASSERT(0 != _mesh);
+ FieldsNewMesh fields(*_mesh);
+
+ fields.add("field A", "velocity", 3, FieldBase::VECTOR);
+ fields.add("field B", "displacement", 4, FieldBase::OTHER, 2.0, true);
+
+ int numFields = 0;
+ std::string* names = 0;
+ fields.fieldNames(&numFields, &names);
+
+ CPPUNIT_ASSERT_EQUAL(numFieldsE, numFields);
+
+ for (int i=0; i < numFields; ++i)
+ CPPUNIT_ASSERT_EQUAL(std::string(namesE[i]), names[i]);
+
+ delete[] names; names = 0;
+} // testFieldNames
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldsNewMesh.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestFieldsNewMesh.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,115 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/topology/TestFieldsNewMesh.hh
+ *
+ * @brief C++ unit testing for FieldsNew<Mesh>.
+ */
+
+#if !defined(pylith_topology_testfieldsnewmesh_hh)
+#define pylith_topology_testfieldsnewmesh_hh
+
+// Include directives ---------------------------------------------------
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/topologyfwd.hh" // forward declarations
+
+// Forward declarations -------------------------------------------------
+/// Namespace for pylith package
+namespace pylith {
+ namespace topology {
+ class TestFieldsNewMesh;
+ } // topology
+} // pylith
+
+// TestField -------------------------------------------------------------
+/// C++ unit testing for Field.
+class pylith::topology::TestFieldsNewMesh : public CppUnit::TestFixture
+{ // class TestField
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestFieldsNewMesh );
+
+ CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testHasField );
+ CPPUNIT_TEST( testAdd );
+ CPPUNIT_TEST( testAllocateSequence );
+ CPPUNIT_TEST( testAllocateArray );
+ CPPUNIT_TEST( testAllocateDomain );
+ CPPUNIT_TEST( testGet );
+ CPPUNIT_TEST( testGetConst );
+ CPPUNIT_TEST( testMesh );
+ CPPUNIT_TEST( testSectionIndex );
+ CPPUNIT_TEST( testFieldNames );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup test case.
+ void setUp(void);
+
+ /// Tear down test case.
+ void tearDown(void);
+
+ /// Test constructor.
+ void testConstructor(void);
+
+ /// Test hasField().
+ void testHasField(void);
+
+ /// Test add().
+ void testAdd(void);
+
+ /// Test allocate(label_sequence).
+ void testAllocateSequence(void);
+
+ /// Test allocate(int_array).
+ void testAllocateArray(void);
+
+ /// Test allocate(domain).
+ void testAllocateDomain(void);
+
+ /// Test getField().
+ void testGet(void);
+
+ /// Test getField() for const FieldsNew.
+ void testGetConst(void);
+
+ /// Test mesh().
+ void testMesh(void);
+
+ /// Test sectionIndex().
+ void testSectionIndex(void);
+
+ /// Test fieldNames().
+ void testFieldNames(void);
+
+// PRIVATE MEMBERS /////////////////////////////////////////////////////
+private :
+
+ Mesh* _mesh;
+
+}; // class TestFieldsNewMesh
+
+#endif // pylith_topology_testfieldsnewmesh_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,294 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestRefineUniform.hh" // Implementation of class methods
+
+#include "pylith/topology/RefineUniform.hh" // USES RefineUniform
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+#include "pylith/utils/array.hh" // USES int_array
+
+#include "data/MeshDataCohesiveTri3Level2.hh"
+#include "data/MeshDataCohesiveTri3Level2Fault1.hh"
+#include "data/MeshDataCohesiveTet4Level2.hh"
+#include "data/MeshDataCohesiveTet4Level2Fault1.hh"
+#include "data/MeshDataCohesiveQuad4Level2.hh"
+#include "data/MeshDataCohesiveQuad4Level2Fault1.hh"
+
+#include <strings.h> // USES strcasecmp()
+#include <stdexcept> // USES std::logic_error
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+typedef pylith::topology::Mesh::RealSection RealSection;
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestRefineUniform );
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::topology::TestRefineUniform::testConstructor(void)
+{ // testConstructor
+ RefineUniform refiner;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, tri3 cells, and no fault.
+void
+pylith::topology::TestRefineUniform::testRefineTri3Level2(void)
+{ // testRefineTri3Level2
+ MeshDataCohesiveTri3Level2 data;
+ _testRefine(data);
+} // testRefineTri3Level2
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, tri3 cells, and one fault.
+void
+pylith::topology::TestRefineUniform::testRefineTri3Level2Fault1(void)
+{ // testRefineTri3Level2Fault1
+ MeshDataCohesiveTri3Level2Fault1 data;
+ _testRefine(data);
+} // testRefineTri3Level2Fault1
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, tet4 cells, and no fault.
+void
+pylith::topology::TestRefineUniform::testRefineTet4Level2(void)
+{ // testRefineTet4Level2
+ MeshDataCohesiveTet4Level2 data;
+ _testRefine(data);
+} // testRefineTet4Level2
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, tet4 cells, and one fault.
+void
+pylith::topology::TestRefineUniform::testRefineTet4Level2Fault1(void)
+{ // testRefineTet4Level2Fault1
+ MeshDataCohesiveTet4Level2Fault1 data;
+ _testRefine(data);
+} // testRefineTet4Level2Fault1
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, quad4 cells, and no fault.
+void
+pylith::topology::TestRefineUniform::testRefineQuad4Level2(void)
+{ // testRefineQuad4Level2
+ MeshDataCohesiveQuad4Level2 data;
+ _testRefine(data);
+} // testRefineQuad4Level2
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, quad4 cells, and one fault.
+void
+pylith::topology::TestRefineUniform::testRefineQuad4Level2Fault1(void)
+{ // testRefineQuad4Level2Fault1
+ MeshDataCohesiveQuad4Level2Fault1 data;
+ _testRefine(data);
+} // testRefineQuad4Level2Fault1
+
+// ----------------------------------------------------------------------
+void
+pylith::topology::TestRefineUniform::_setupMesh(Mesh* const mesh,
+ const MeshDataCohesive& data)
+{ // _setupMesh
+ assert(0 != mesh);
+
+ meshio::MeshIOAscii iohandler;
+ iohandler.filename(data.filename);
+
+ iohandler.read(mesh);
+
+ // Adjust topology if necessary.
+ if (0 != data.faultA || 0 != data.faultB) {
+ int firstLagrangeVertex = 0;
+ int firstFaultCell = 0;
+
+ faults::FaultCohesiveKin faultA;
+ faultA.id(100);
+ if (0 != data.faultA) {
+ faultA.label(data.faultA);
+ const int nvertices = faultA.numVertices(*mesh);
+ firstLagrangeVertex += nvertices;
+ firstFaultCell += 2*nvertices; // shadow + Lagrange vertices
+ } // if
+
+ faults::FaultCohesiveKin faultB;
+ faultB.id(101);
+ if (0 != data.faultB) {
+ faultA.label(data.faultB);
+ const int nvertices = faultB.numVertices(*mesh);
+ firstLagrangeVertex += nvertices;
+ firstFaultCell += 2*nvertices; // shadow + Lagrange vertices
+ } // if
+
+ int firstFaultVertex = 0;
+ if (0 != data.faultA)
+ faultA.adjustTopology(mesh, &firstFaultVertex,
+ &firstLagrangeVertex, &firstFaultCell);
+ if (0 != data.faultB)
+ faultB.adjustTopology(mesh, &firstFaultVertex,
+ &firstLagrangeVertex, &firstFaultCell);
+ } // if
+} // _setupMesh
+
+// ----------------------------------------------------------------------
+// Test refine().
+void
+pylith::topology::TestRefineUniform::_testRefine(const MeshDataCohesive& data)
+{ // _testRefine
+ typedef SieveMesh::int_section_type::chart_type chart_type;
+
+ Mesh mesh(data.cellDim);
+ _setupMesh(&mesh, data);
+
+ RefineUniform refiner;
+ Mesh newMesh(data.cellDim);
+ refiner.refine(&newMesh, mesh, data.refineLevel);
+
+ // Check mesh dimension
+ CPPUNIT_ASSERT_EQUAL(data.cellDim, newMesh.dimension());
+
+ const ALE::Obj<SieveMesh>& sieveMesh = newMesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+
+ // Check vertices
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ const ALE::Obj<RealSection>& coordinates =
+ sieveMesh->getRealSection("coordinates");
+ const int numVertices = vertices->size();
+ CPPUNIT_ASSERT(!vertices.isNull());
+ CPPUNIT_ASSERT(!coordinates.isNull());
+ CPPUNIT_ASSERT_EQUAL(data.numVertices, numVertices);
+ CPPUNIT_ASSERT_EQUAL(data.spaceDim,
+ coordinates->getFiberDimension(*vertices->begin()));
+ int i = 0;
+ const int spaceDim = data.spaceDim;
+ for(SieveMesh::label_sequence::iterator v_iter =
+ vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const double* vertexCoords = coordinates->restrictPoint(*v_iter);
+ CPPUNIT_ASSERT(0 != vertexCoords);
+ const double tolerance = 1.0e-06;
+ for (int iDim=0; iDim < spaceDim; ++iDim)
+ if (data.vertices[i] < 1.0) {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(data.vertices[i++], vertexCoords[iDim],
+ tolerance);
+ } else {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vertexCoords[iDim]/data.vertices[i++],
+ tolerance);
+ }
+ } // for
+
+ // check cells
+ const ALE::Obj<SieveMesh::sieve_type>& sieve = sieveMesh->getSieve();
+ const ALE::Obj<SieveMesh::label_sequence>& cells =
+ sieveMesh->heightStratum(0);
+
+ const int numCells = cells->size();
+ CPPUNIT_ASSERT_EQUAL(data.numCells+data.numCellsCohesive, numCells);
+
+ // Normal cells
+ ALE::ISieveVisitor::PointRetriever<SieveMesh::sieve_type> pV(sieve->getMaxConeSize());
+ SieveMesh::label_sequence::iterator c_iter = cells->begin();
+ for(int iCell=0, i=0; iCell < data.numCells; ++iCell, ++c_iter) {
+ pV.clear();
+ sieve->cone(*c_iter, pV);
+ const SieveMesh::point_type *cone = pV.getPoints();
+ const int coneSize = pV.getSize();
+ CPPUNIT_ASSERT_EQUAL(data.numCorners, coneSize);
+ for(int p = 0; p < coneSize; ++p, ++i)
+ CPPUNIT_ASSERT_EQUAL(data.cells[i], cone[p]);
+ } // for
+ // Cohesive cells
+ for (int iCell=0, i=0; iCell < data.numCellsCohesive; ++iCell, ++c_iter) {
+ pV.clear();
+ sieve->cone(*c_iter, pV);
+ const SieveMesh::point_type *cone = pV.getPoints();
+ const int coneSize = pV.getSize();
+ CPPUNIT_ASSERT_EQUAL(data.numCornersCohesive, coneSize);
+ for(int p = 0; p < coneSize; ++p, ++i)
+ CPPUNIT_ASSERT_EQUAL(data.cellsCohesive[i], cone[p]);
+ } // for
+
+ // check materials
+ const ALE::Obj<SieveMesh::label_type>& labelMaterials =
+ sieveMesh->getLabel("material-id");
+ const int idDefault = -999;
+ const int size = numCells;
+ i = 0;
+ for(SieveMesh::label_sequence::iterator c_iter = cells->begin();
+ c_iter != cells->end();
+ ++c_iter) {
+ const int id = sieveMesh->getValue(labelMaterials, *c_iter, idDefault);
+ CPPUNIT_ASSERT_EQUAL(data.materialIds[i++], id);
+ } // for
+
+ // Check groups
+ const ALE::Obj<std::set<std::string> >& groupNames =
+ sieveMesh->getIntSections();
+ if (data.numGroups > 0) {
+ CPPUNIT_ASSERT(!groupNames.isNull());
+ CPPUNIT_ASSERT_EQUAL(data.numGroups, int(groupNames->size()));
+ } // if
+ int iGroup = 0;
+ int index = 0;
+ for (std::set<std::string>::const_iterator name=groupNames->begin();
+ name != groupNames->end();
+ ++name, ++iGroup) {
+ const ALE::Obj<SieveMesh::int_section_type>& groupField =
+ sieveMesh->getIntSection(*name);
+ CPPUNIT_ASSERT(!groupField.isNull());
+ const chart_type& chart = groupField->getChart();
+ SieveMesh::point_type firstPoint;
+ for(chart_type::const_iterator c_iter = chart.begin();
+ c_iter != chart.end();
+ ++c_iter) {
+ if (groupField->getFiberDimension(*c_iter)) {
+ firstPoint = *c_iter;
+ break;
+ } // if
+ } // for
+ std::string groupType =
+ (sieveMesh->height(firstPoint) == 0) ? "cell" : "vertex";
+ const int numPoints = groupField->size();
+ int_array points(numPoints);
+ int i = 0;
+ for(chart_type::const_iterator c_iter = chart.begin();
+ c_iter != chart.end();
+ ++c_iter)
+ if (groupField->getFiberDimension(*c_iter))
+ points[i++] = *c_iter;
+
+ CPPUNIT_ASSERT_EQUAL(std::string(data.groupNames[iGroup]), *name);
+ CPPUNIT_ASSERT_EQUAL(std::string(data.groupTypes[iGroup]), groupType);
+ CPPUNIT_ASSERT_EQUAL(data.groupSizes[iGroup], numPoints);
+ for (int i=0; i < numPoints; ++i)
+ CPPUNIT_ASSERT_EQUAL(data.groups[index++], points[i]);
+ } // for
+} // _testRefine
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/TestRefineUniform.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,111 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/topology/TestRefineUniform.hh
+ *
+ * @brief C++ TestRefineUniform object
+ *
+ * C++ unit testing for RefineUniform.
+ */
+
+#if !defined(pylith_topology_testrefineuniform_hh)
+#define pylith_topology_testrefineuniform_hh
+
+// Include directives ---------------------------------------------------
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/topologyfwd.hh" // USES Mesh
+
+// Forward declarations -------------------------------------------------
+/// Namespace for pylith package
+namespace pylith {
+ namespace topology {
+ class TestRefineUniform;
+
+ class MeshDataCohesive; // test data
+ } // topology
+} // pylith
+
+// RefineUniform ---------------------------------------------------------------
+class pylith::topology::TestRefineUniform : public CppUnit::TestFixture
+{ // class TestRefineUniform
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestRefineUniform );
+
+ CPPUNIT_TEST( testConstructor );
+
+ CPPUNIT_TEST( testRefineTri3Level2 );
+ CPPUNIT_TEST( testRefineTri3Level2Fault1 );
+
+ CPPUNIT_TEST( testRefineTet4Level2 );
+ CPPUNIT_TEST( testRefineTet4Level2Fault1 );
+
+ CPPUNIT_TEST( testRefineQuad4Level2 );
+ CPPUNIT_TEST( testRefineQuad4Level2Fault1 );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test constructor.
+ void testConstructor(void);
+
+ /// Test refine() with level 2, tri3 cells, and no fault.
+ void testRefineTri3Level2(void);
+
+ /// Test refine() with level 2, tri3 cells, and one fault.
+ void testRefineTri3Level2Fault1(void);
+
+ /// Test refine() with level 2, tet4 cells, and no fault.
+ void testRefineTet4Level2(void);
+
+ /// Test refine() with level 2, tet4 cells, and one fault.
+ void testRefineTet4Level2Fault1(void);
+
+ /// Test refine() with level 2, quad4 cells, and no fault.
+ void testRefineQuad4Level2(void);
+
+ /// Test refine() with level 2, quad4 cells, and one fault.
+ void testRefineQuad4Level2Fault1(void);
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /** Setup mesh.
+ *
+ * @mesh Mesh to setup.
+ * @param data Test data.
+ */
+ void _setupMesh(Mesh* const mesh,
+ const MeshDataCohesive& data);
+
+ /** Test refine().
+ *
+ * @param data Test data.
+ */
+ void _testRefine(const MeshDataCohesive& data);
+
+}; // class TestRefineUniform
+
+#endif // pylith_topology_testrefineuniform_hh
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -17,7 +17,10 @@
#
dist_noinst_DATA = \
- tri3.mesh
+ tri3.mesh \
+ fourtri3.mesh \
+ fourquad4.mesh \
+ twotet4.mesh
noinst_TMP =
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,54 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesive.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::topology::MeshDataCohesive::MeshDataCohesive(void) :
+ filename(0),
+ refineLevel(0),
+ faultA(0),
+ faultB(0),
+ numVertices(0),
+ spaceDim(0),
+ cellDim(0),
+ numCells(0),
+ numCorners(0),
+ numCellsCohesive(0),
+ numCornersCohesive(0),
+ vertices(0),
+ cells(0),
+ cellsCohesive(0),
+ materialIds(0),
+ groups(0),
+ groupSizes(0),
+ groupNames(0),
+ groupTypes(0),
+ numGroups(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::topology::MeshDataCohesive::~MeshDataCohesive(void)
+{ // destructor
+} // destructor
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesive.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,73 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesive_hh)
+#define pylith_topology_meshdatacohesive_hh
+
+namespace pylith {
+ namespace topology {
+ class MeshDataCohesive;
+ } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesive
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ MeshDataCohesive(void);
+
+ /// Destructor
+ ~MeshDataCohesive(void);
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+ // Input information
+ char* filename; ///< Filename of mesh file.
+ int refineLevel; ///< Refinement level.
+ char* faultA; ///< Vertex group associated with fault A (0 if no fault).
+ char* faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+ // Output information
+ int numVertices; ///< Number of vertices
+ int spaceDim; ///< Number of dimensions in vertex coordinates
+ int cellDim; ///< Number of dimensions associated with cell.
+ int numCells; ///< Number of cells
+ int numCorners; ///< Number of vertices in cell.
+ int numCellsCohesive; ///< Number of cohesive cells.
+ int numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+ double* vertices; ///< Pointer to coordinates of vertices
+ int* cells; ///< Pointer to indices of vertices in cells
+ int* cellsCohesive; ///< Pointer to indices of vertices in cells
+ int* materialIds; ///< Pointer to cell material identifiers
+
+ int* groups; ///< Array of pointers to indices of points in groups
+ int* groupSizes; ///< Array of sizes of each group
+ char** groupNames; ///< Array of group names
+ char** groupTypes; ///< Array of group types
+ int numGroups; ///< Number of groups
+
+};
+
+#endif // pylith_topology_meshdatacohesive_hh
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,148 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveQuad4Level2.hh"
+
+const char* pylith::topology::MeshDataCohesiveQuad4Level2::_filename =
+ "data/fourquad4.mesh";
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveQuad4Level2::_faultA = 0;
+const char* pylith::topology::MeshDataCohesiveQuad4Level2::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_numVertices = 25;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_spaceDim = 2;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_numCellsCohesive = 0;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_cellDim = 2;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_numCorners = 4;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_numCornersCohesive = 6;
+
+const double pylith::topology::MeshDataCohesiveQuad4Level2::_vertices[] = {
+ -1.0, -1.0,
+ -1.0, 0.0,
+ -1.0, 1.0,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, -1.0,
+ 1.0, 0.0,
+ 1.0, 1.0,
+ -0.5, -1.0,
+ 0.0, -0.5,
+ -0.5, 0.0,
+ -1.0, -0.5,
+ -0.5, -0.5,
+ 1.0, -0.5,
+ 0.5, 0.0,
+ 0.5, -1.0,
+ 0.5, -0.5,
+ -1.0, 0.5,
+ 0.0, 0.5,
+ -0.5, 1.0,
+ -0.5, 0.5,
+ 0.5, 1.0,
+ 1.0, 0.5,
+ 0.5, 0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_cells[] = {
+ 16, 25, 29, 28,
+ 19, 26, 29, 25,
+ 17, 28, 29, 27,
+ 20, 27, 29, 26,
+ 22, 30, 33, 32,
+ 23, 31, 33, 30,
+ 19, 32, 33, 26,
+ 20, 26, 33, 31,
+ 18, 34, 37, 36,
+ 17, 27, 37, 34,
+ 21, 36, 37, 35,
+ 20, 35, 37, 27,
+ 24, 38, 40, 39,
+ 21, 35, 40, 38,
+ 23, 39, 40, 31,
+ 20, 31, 40, 35,
+};
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_cellsCohesive[] = {
+};
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_materialIds[] = {
+ 1, 1, 1, 1, 2, 2, 2, 2,
+ 1, 1, 1, 1, 2, 2, 2, 2,
+};
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_numGroups = 3;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_groupSizes[] = {
+ 5, 5, 5,
+};
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2::_groups[] = {
+ 16, 19, 22, 25, 32,
+ 16, 17, 18, 28, 34,
+ 19, 20, 21, 26, 35,
+};
+
+const char* pylith::topology::MeshDataCohesiveQuad4Level2::_groupNames[] = {
+ "edge 1",
+ "end points",
+ "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveQuad4Level2::_groupTypes[] = {
+ "vertex",
+ "vertex",
+ "vertex",
+};
+
+pylith::topology::MeshDataCohesiveQuad4Level2::MeshDataCohesiveQuad4Level2(void)
+{ // constructor
+ filename = const_cast<char*>(_filename);
+ refineLevel = _refineLevel;
+ faultA = const_cast<char*>(_faultA);
+ faultB = const_cast<char*>(_faultB);
+
+ numVertices = _numVertices;
+ spaceDim = _spaceDim;
+ cellDim = _cellDim;
+ numCells = _numCells;
+ numCorners = _numCorners;
+ numCellsCohesive = _numCellsCohesive;
+ numCornersCohesive = _numCornersCohesive;
+ vertices = const_cast<double*>(_vertices);
+ cells = const_cast<int*>(_cells);
+ cellsCohesive = const_cast<int*>(_cellsCohesive);
+ materialIds = const_cast<int*>(_materialIds);
+ groups = const_cast<int*>(_groups);
+ groupSizes = const_cast<int*>(_groupSizes);
+ groupNames = const_cast<char**>(_groupNames);
+ groupTypes = const_cast<char**>(_groupTypes);
+ numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveQuad4Level2::~MeshDataCohesiveQuad4Level2(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,73 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivequad4level2_hh)
+#define pylith_topology_meshdatacohesivequad4level2_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+ namespace topology {
+ class MeshDataCohesiveQuad4Level2;
+ } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveQuad4Level2 : public MeshDataCohesive
+{ // MeshDataCohesiveQuad4Level2
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ MeshDataCohesiveQuad4Level2(void);
+
+ /// Destructor
+ ~MeshDataCohesiveQuad4Level2(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+ static const char* _filename; ///< Filename of mesh file.
+ static const int _refineLevel; ///< Refinement level.
+ static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+ static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+ static const int _numVertices; ///< Number of vertices
+ static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+ static const int _cellDim; ///< Number of dimensions associated with cell
+ static const int _numCells; ///< Number of cells
+ static const int _numCorners; ///< Number of vertices in cell
+ static const int _numCellsCohesive; ///< Number of cohesive cells.
+ static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+ static const double _vertices[]; ///< Pointer to coordinates of vertices
+ static const int _cells[]; ///< Pointer to indices of vertices in cells
+ static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+ static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+ static const int _groups[]; ///< Groups of points
+ static const int _groupSizes[]; ///< Sizes of groups
+ static const char* _groupNames[]; ///< Array of group names
+ static const char* _groupTypes[]; ///< Array of group types
+ static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveQuad4Level2
+
+#endif // pylith_topology_meshdatacohesivequad4level2_hh
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,163 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveQuad4Level2Fault1.hh"
+
+const char* pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_filename =
+ "data/fourquad4.mesh";
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_faultA = "fault";
+const char* pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_numVertices = 35;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_spaceDim = 2;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_numCellsCohesive = 4;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_cellDim = 2;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_numCorners = 4;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_numCornersCohesive = 6;
+
+const double pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_vertices[] = {
+ -1.0, -1.0,
+ -1.0, 0.0,
+ -1.0, 1.0,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, -1.0,
+ 1.0, 0.0,
+ 1.0, 1.0,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ -0.5, -1.0,
+ 0.0, -0.5,
+ -0.5, 0.0,
+ -1.0, -0.5,
+ -0.5, -0.5,
+ 1.0, -0.5,
+ 0.5, 0.0,
+ 0.0, -0.5,
+ 0.5, -1.0,
+ 0.5, -0.5,
+ -1.0, 0.5,
+ 0.0, 0.5,
+ -0.5, 1.0,
+ -0.5, 0.5,
+ 0.5, 1.0,
+ 0.0, 0.5,
+ 1.0, 0.5,
+ 0.5, 0.5,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 0.0, -0.5,
+ 0.0, 0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_cells[] = {
+ 16, 28, 32, 31,
+ 19, 29, 32, 28,
+ 17, 31, 32, 30,
+ 20, 30, 32, 29,
+ 22, 33, 37, 36,
+ 23, 34, 37, 33,
+ 25, 36, 37, 35,
+ 26, 35, 37, 34,
+ 18, 38, 41, 40,
+ 17, 30, 41, 38,
+ 21, 40, 41, 39,
+ 20, 39, 41, 30,
+ 24, 42, 45, 44,
+ 27, 43, 45, 42,
+ 23, 44, 45, 34,
+ 26, 34, 45, 43,
+};
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_cellsCohesive[] = {
+ 19, 29, 25, 35, 46, 49,
+ 29, 20, 35, 26, 49, 47,
+ 20, 39, 26, 43, 47, 50,
+ 39, 21, 43, 27, 50, 48,
+};
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_materialIds[] = {
+ 1, 1, 1, 1, 2, 2, 2, 2,
+ 1, 1, 1, 1, 2, 2, 2, 2,
+ 100, 100, 100, 100,
+};
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_numGroups = 3;
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_groupSizes[] = {
+ 6, 5, 15,
+};
+
+const int pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_groups[] = {
+ 16, 19, 22, 25, 28, 36,
+ 16, 17, 18, 31, 38,
+ 19, 20, 21, 25, 26, 27, 29, 35, 39, 43, 46, 47, 48, 49, 50,
+};
+
+const char* pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_groupNames[] = {
+ "edge 1",
+ "end points",
+ "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveQuad4Level2Fault1::_groupTypes[] = {
+ "vertex",
+ "vertex",
+ "vertex",
+};
+
+pylith::topology::MeshDataCohesiveQuad4Level2Fault1::MeshDataCohesiveQuad4Level2Fault1(void)
+{ // constructor
+ filename = const_cast<char*>(_filename);
+ refineLevel = _refineLevel;
+ faultA = const_cast<char*>(_faultA);
+ faultB = const_cast<char*>(_faultB);
+
+ numVertices = _numVertices;
+ spaceDim = _spaceDim;
+ cellDim = _cellDim;
+ numCells = _numCells;
+ numCorners = _numCorners;
+ numCellsCohesive = _numCellsCohesive;
+ numCornersCohesive = _numCornersCohesive;
+ vertices = const_cast<double*>(_vertices);
+ cells = const_cast<int*>(_cells);
+ cellsCohesive = const_cast<int*>(_cellsCohesive);
+ materialIds = const_cast<int*>(_materialIds);
+ groups = const_cast<int*>(_groups);
+ groupSizes = const_cast<int*>(_groupSizes);
+ groupNames = const_cast<char**>(_groupNames);
+ groupTypes = const_cast<char**>(_groupTypes);
+ numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveQuad4Level2Fault1::~MeshDataCohesiveQuad4Level2Fault1(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level2Fault1.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,73 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivequad4level2fault1_hh)
+#define pylith_topology_meshdatacohesivequad4level2fault1_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+ namespace topology {
+ class MeshDataCohesiveQuad4Level2Fault1;
+ } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveQuad4Level2Fault1 : public MeshDataCohesive
+{ // MeshDataCohesiveQuad4Level2Fault1
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ MeshDataCohesiveQuad4Level2Fault1(void);
+
+ /// Destructor
+ ~MeshDataCohesiveQuad4Level2Fault1(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+ static const char* _filename; ///< Filename of mesh file.
+ static const int _refineLevel; ///< Refinement level.
+ static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+ static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+ static const int _numVertices; ///< Number of vertices
+ static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+ static const int _cellDim; ///< Number of dimensions associated with cell
+ static const int _numCells; ///< Number of cells
+ static const int _numCorners; ///< Number of vertices in cell
+ static const int _numCellsCohesive; ///< Number of cohesive cells.
+ static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+ static const double _vertices[]; ///< Pointer to coordinates of vertices
+ static const int _cells[]; ///< Pointer to indices of vertices in cells
+ static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+ static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+ static const int _groups[]; ///< Groups of points
+ static const int _groupSizes[]; ///< Sizes of groups
+ static const char* _groupNames[]; ///< Array of group names
+ static const char* _groupTypes[]; ///< Array of group types
+ static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveQuad4Level2Fault1
+
+#endif // pylith_topology_meshdatacohesivequad4level2fault1_hh
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,140 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveTet4Level2.hh"
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_filename =
+ "data/twotet4.mesh";
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_faultA = 0;
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numVertices = 14;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_spaceDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCellsCohesive = 0;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_cellDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCorners = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCornersCohesive = 9;
+
+const double pylith::topology::MeshDataCohesiveTet4Level2::_vertices[] = {
+ -1.000000e+00, 0.000000e+00, 0.000000e+00,
+ 0.000000e+00, -1.000000e+00, 0.000000e+00,
+ 0.000000e+00, 0.000000e+00, 1.000000e+00,
+ 0.000000e+00, 1.000000e+00, 0.000000e+00,
+ 1.000000e+00, 0.000000e+00, 0.000000e+00,
+ 0.000000e+00, -5.000000e-01, 5.000000e-01,
+ 0.000000e+00, 5.000000e-01, 5.000000e-01,
+ 0.000000e+00, 0.000000e+00, 0.000000e+00,
+ -5.000000e-01, -5.000000e-01, 0.000000e+00,
+ -5.000000e-01, 0.000000e+00, 5.000000e-01,
+ -5.000000e-01, 5.000000e-01, 0.000000e+00,
+ 5.000000e-01, -5.000000e-01, 0.000000e+00,
+ 5.000000e-01, 5.000000e-01, 0.000000e+00,
+ 5.000000e-01, 0.000000e+00, 5.000000e-01,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_cells[] = {
+ 17, 24, 21, 23,
+ 21, 22, 23, 24,
+ 21, 24, 25, 22,
+ 18, 25, 22, 21,
+ 23, 26, 24, 22,
+ 19, 26, 23, 22,
+ 22, 25, 26, 24,
+ 16, 24, 26, 25,
+ 17, 27, 23, 21,
+ 23, 22, 21, 27,
+ 23, 27, 28, 22,
+ 19, 28, 22, 23,
+ 21, 29, 27, 22,
+ 18, 29, 21, 22,
+ 22, 28, 29, 27,
+ 20, 27, 29, 28,
+};
+const int pylith::topology::MeshDataCohesiveTet4Level2::_cellsCohesive[] = {
+};
+const int pylith::topology::MeshDataCohesiveTet4Level2::_materialIds[] = {
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_groupSizes[] = {
+ 3, 3, 2, 6,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_groups[] = {
+ 16, 17, 24,
+ 18, 20, 29,
+ 16, 20,
+ 17, 18, 19, 21, 22, 23,
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_groupNames[] = {
+ "edge 1",
+ "edge 2",
+ "end points",
+ "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_groupTypes[] = {
+ "vertex",
+ "vertex",
+ "vertex",
+ "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTet4Level2::MeshDataCohesiveTet4Level2(void)
+{ // constructor
+ filename = const_cast<char*>(_filename);
+ refineLevel = _refineLevel;
+ faultA = const_cast<char*>(_faultA);
+ faultB = const_cast<char*>(_faultB);
+
+ numVertices = _numVertices;
+ spaceDim = _spaceDim;
+ cellDim = _cellDim;
+ numCells = _numCells;
+ numCorners = _numCorners;
+ numCellsCohesive = _numCellsCohesive;
+ numCornersCohesive = _numCornersCohesive;
+ vertices = const_cast<double*>(_vertices);
+ cells = const_cast<int*>(_cells);
+ cellsCohesive = const_cast<int*>(_cellsCohesive);
+ materialIds = const_cast<int*>(_materialIds);
+ groups = const_cast<int*>(_groups);
+ groupSizes = const_cast<int*>(_groupSizes);
+ groupNames = const_cast<char**>(_groupNames);
+ groupTypes = const_cast<char**>(_groupTypes);
+ numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveTet4Level2::~MeshDataCohesiveTet4Level2(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,73 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivetet4level2_hh)
+#define pylith_topology_meshdatacohesivetet4level2_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+ namespace topology {
+ class MeshDataCohesiveTet4Level2;
+ } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTet4Level2 : public MeshDataCohesive
+{ // MeshDataCohesiveTet4Level2
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ MeshDataCohesiveTet4Level2(void);
+
+ /// Destructor
+ ~MeshDataCohesiveTet4Level2(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+ static const char* _filename; ///< Filename of mesh file.
+ static const int _refineLevel; ///< Refinement level.
+ static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+ static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+ static const int _numVertices; ///< Number of vertices
+ static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+ static const int _cellDim; ///< Number of dimensions associated with cell
+ static const int _numCells; ///< Number of cells
+ static const int _numCorners; ///< Number of vertices in cell
+ static const int _numCellsCohesive; ///< Number of cohesive cells.
+ static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+ static const double _vertices[]; ///< Pointer to coordinates of vertices
+ static const int _cells[]; ///< Pointer to indices of vertices in cells
+ static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+ static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+ static const int _groups[]; ///< Groups of points
+ static const int _groupSizes[]; ///< Sizes of groups
+ static const char* _groupNames[]; ///< Array of group names
+ static const char* _groupTypes[]; ///< Array of group types
+ static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveTet4Level2
+
+#endif // pylith_topology_meshdatacohesivetet4level2_hh
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,158 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveTet4Level2Fault1.hh"
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_filename =
+ "data/twotet4.mesh";
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_faultA =
+ "fault";
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numVertices = 26;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_spaceDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCellsCohesive = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_cellDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCorners = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCornersCohesive = 9;
+
+const double pylith::topology::MeshDataCohesiveTet4Level2Fault1::_vertices[] = {
+ -1.0, 0.0, 0.0,
+ 0.0, -1.0, 0.0,
+ 0.0, 0.0, 1.0,
+ 0.0, 1.0, 0.0,
+ 1.0, 0.0, 0.0,
+ 0.0, -1.0, 0.0,
+ 0.0, 0.0, 1.0,
+ 0.0, 1.0, 0.0,
+ 0.0, -0.5, 0.5,
+ 0.0, 0.5, 0.5,
+ 0.0, 0.0, 0.0,
+ -0.5, -0.5, 0.0,
+ -0.5, 0.0, 0.5,
+ -0.5, 0.5, 0.0,
+ 0.0, 0.0, 0.0,
+ 0.0, 0.5, 0.5,
+ 0.0, -0.5, 0.5,
+ 0.5, -0.5, 0.0,
+ 0.5, 0.5, 0.0,
+ 0.5, 0.0, 0.5,
+ 0.0, -1.0, 0.0,
+ 0.0, 0.0, 1.0,
+ 0.0, 1.0, 0.0,
+ 0.0, -0.5, 0.5,
+ 0.0, 0.0, 0.0,
+ 0.0, 0.5, 0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_cells[] = {
+ 17, 27, 24, 26,
+ 24, 25, 26, 27,
+ 24, 27, 28, 25,
+ 18, 28, 25, 24,
+ 26, 29, 27, 25,
+ 19, 29, 26, 25,
+ 25, 28, 29, 27,
+ 16, 27, 29, 28,
+ 21, 33, 30, 32,
+ 30, 31, 32, 33,
+ 30, 33, 34, 31,
+ 23, 34, 31, 30,
+ 32, 35, 33, 31,
+ 22, 35, 32, 31,
+ 31, 34, 35, 33,
+ 20, 33, 35, 34,
+};
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_cellsCohesive[] = {
+ 18, 24, 25, 22, 32, 31, 37, 39, 41,
+ 24, 26, 25, 32, 30, 31, 39, 40, 41,
+ 17, 26, 24, 21, 30, 32, 36, 40, 39,
+ 19, 25, 26, 23, 31, 30, 38, 41, 40,
+};
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_materialIds[] = {
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 100, 100, 100, 100,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groupSizes[] = {
+ 4, 4, 2, 18,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groups[] = {
+ 16, 17, 21, 27,
+ 18, 20, 22, 35,
+ 16, 20,
+ 17, 18, 19, 21, 22, 23, 24, 25, 26, 30, 31, 32, 36, 37, 38, 39, 40, 41,
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groupNames[] = {
+ "edge 1",
+ "edge 2",
+ "end points",
+ "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groupTypes[] = {
+ "vertex",
+ "vertex",
+ "vertex",
+ "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTet4Level2Fault1::MeshDataCohesiveTet4Level2Fault1(void)
+{ // constructor
+ filename = const_cast<char*>(_filename);
+ refineLevel = _refineLevel;
+ faultA = const_cast<char*>(_faultA);
+ faultB = const_cast<char*>(_faultB);
+
+ numVertices = _numVertices;
+ spaceDim = _spaceDim;
+ cellDim = _cellDim;
+ numCells = _numCells;
+ numCorners = _numCorners;
+ numCellsCohesive = _numCellsCohesive;
+ numCornersCohesive = _numCornersCohesive;
+ vertices = const_cast<double*>(_vertices);
+ cells = const_cast<int*>(_cells);
+ cellsCohesive = const_cast<int*>(_cellsCohesive);
+ materialIds = const_cast<int*>(_materialIds);
+ groups = const_cast<int*>(_groups);
+ groupSizes = const_cast<int*>(_groupSizes);
+ groupNames = const_cast<char**>(_groupNames);
+ groupTypes = const_cast<char**>(_groupTypes);
+ numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveTet4Level2Fault1::~MeshDataCohesiveTet4Level2Fault1(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,73 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivetet4level2fault1_hh)
+#define pylith_topology_meshdatacohesivetet4level2fault1_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+ namespace topology {
+ class MeshDataCohesiveTet4Level2Fault1;
+ } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTet4Level2Fault1 : public MeshDataCohesive
+{ // MeshDataCohesiveTet4Level2Fault1
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ MeshDataCohesiveTet4Level2Fault1(void);
+
+ /// Destructor
+ ~MeshDataCohesiveTet4Level2Fault1(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+ static const char* _filename; ///< Filename of mesh file.
+ static const int _refineLevel; ///< Refinement level.
+ static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+ static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+ static const int _numVertices; ///< Number of vertices
+ static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+ static const int _cellDim; ///< Number of dimensions associated with cell
+ static const int _numCells; ///< Number of cells
+ static const int _numCorners; ///< Number of vertices in cell
+ static const int _numCellsCohesive; ///< Number of cohesive cells.
+ static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+ static const double _vertices[]; ///< Pointer to coordinates of vertices
+ static const int _cells[]; ///< Pointer to indices of vertices in cells
+ static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+ static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+ static const int _groups[]; ///< Groups of points
+ static const int _groupSizes[]; ///< Sizes of groups
+ static const char* _groupNames[]; ///< Array of group names
+ static const char* _groupTypes[]; ///< Array of group types
+ static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveTet4Level2Fault1
+
+#endif // pylith_topology_meshdatacohesivetet4level2fault1_hh
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,139 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveTri3Level2.hh"
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_filename =
+ "data/fourtri3.mesh";
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_faultA = 0;
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numVertices = 13;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_spaceDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCellsCohesive = 0;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_cellDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCorners = 3;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCornersCohesive = 6;
+
+const double pylith::topology::MeshDataCohesiveTri3Level2::_vertices[] = {
+ -1.0, 0.0,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 0.0,
+ -0.5, -0.5,
+ 0.0, -0.5,
+ -0.5, 0.0,
+ 0.0, 0.5,
+ -0.5, 0.5,
+ 0.5, -0.5,
+ 0.5, 0.0,
+ 0.5, 0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_cells[] = {
+ 16, 21, 23,
+ 21, 22, 23,
+ 17, 22, 21,
+ 18, 23, 22,
+ 18, 24, 23,
+ 24, 25, 23,
+ 19, 25, 24,
+ 16, 23, 25,
+ 18, 22, 27,
+ 22, 26, 27,
+ 17, 26, 22,
+ 20, 27, 26,
+ 18, 27, 24,
+ 27, 28, 24,
+ 20, 28, 27,
+ 19, 24, 28,
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2::_cellsCohesive[] = {
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2::_materialIds[] = {
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_groupSizes[] = {
+ 5, 3, 2, 5,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_groups[] = {
+ 16, 17, 19, 21, 25,
+ 17, 20, 26,
+ 16, 20,
+ 17, 18, 19, 22, 24,
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_groupNames[] = {
+ "edge 1",
+ "edge 2",
+ "end points",
+ "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_groupTypes[] = {
+ "vertex",
+ "vertex",
+ "vertex",
+ "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTri3Level2::MeshDataCohesiveTri3Level2(void)
+{ // constructor
+ filename = const_cast<char*>(_filename);
+ refineLevel = _refineLevel;
+ faultA = const_cast<char*>(_faultA);
+ faultB = const_cast<char*>(_faultB);
+
+ numVertices = _numVertices;
+ spaceDim = _spaceDim;
+ cellDim = _cellDim;
+ numCells = _numCells;
+ numCorners = _numCorners;
+ numCellsCohesive = _numCellsCohesive;
+ numCornersCohesive = _numCornersCohesive;
+ vertices = const_cast<double*>(_vertices);
+ cells = const_cast<int*>(_cells);
+ cellsCohesive = const_cast<int*>(_cellsCohesive);
+ materialIds = const_cast<int*>(_materialIds);
+ groups = const_cast<int*>(_groups);
+ groupSizes = const_cast<int*>(_groupSizes);
+ groupNames = const_cast<char**>(_groupNames);
+ groupTypes = const_cast<char**>(_groupTypes);
+ numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveTri3Level2::~MeshDataCohesiveTri3Level2(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,73 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivetri3level2_hh)
+#define pylith_topology_meshdatacohesivetri3level2_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+ namespace topology {
+ class MeshDataCohesiveTri3Level2;
+ } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTri3Level2 : public MeshDataCohesive
+{ // MeshDataCohesiveTri3Level2
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ MeshDataCohesiveTri3Level2(void);
+
+ /// Destructor
+ ~MeshDataCohesiveTri3Level2(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+ static const char* _filename; ///< Filename of mesh file.
+ static const int _refineLevel; ///< Refinement level.
+ static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+ static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+ static const int _numVertices; ///< Number of vertices
+ static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+ static const int _cellDim; ///< Number of dimensions associated with cell
+ static const int _numCells; ///< Number of cells
+ static const int _numCorners; ///< Number of vertices in cell
+ static const int _numCellsCohesive; ///< Number of cohesive cells.
+ static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+ static const double _vertices[]; ///< Pointer to coordinates of vertices
+ static const int _cells[]; ///< Pointer to indices of vertices in cells
+ static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+ static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+ static const int _groups[]; ///< Groups of points
+ static const int _groupSizes[]; ///< Sizes of groups
+ static const char* _groupNames[]; ///< Array of group names
+ static const char* _groupTypes[]; ///< Array of group types
+ static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveTri3Level2
+
+#endif // pylith_topology_meshdatacohesivetri3level2_hh
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,155 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveTri3Level2Fault1.hh"
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_filename =
+ "data/fourtri3.mesh";
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_faultA =
+ "fault";
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numVertices = 23;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_spaceDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCellsCohesive = 4;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_cellDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCorners = 3;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCornersCohesive = 6;
+
+const double pylith::topology::MeshDataCohesiveTri3Level2Fault1::_vertices[] = {
+ -1.0, 0.0,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 0.0,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ -0.5, -0.5,
+ 0.0, -0.5,
+ -0.5, 0.0,
+ 0.0, 0.5,
+ -0.5, 0.5,
+ 0.0, -0.5,
+ 0.5, -0.5,
+ 0.5, 0.0,
+ 0.5, 0.5,
+ 0.0, 0.5,
+ 0.0, -1.0,
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 0.0, -0.5,
+ 0.0, 0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_cells[] = {
+ 16, 24, 26,
+ 24, 25, 26,
+ 17, 25, 24,
+ 18, 26, 25,
+ 18, 27, 26,
+ 27, 28, 26,
+ 19, 28, 27,
+ 16, 26, 28,
+ 22, 29, 31,
+ 29, 30, 31,
+ 21, 30, 29,
+ 20, 31, 30,
+ 22, 31, 33,
+ 31, 32, 33,
+ 20, 32, 31,
+ 23, 33, 32,
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_cellsCohesive[] = {
+ 17, 25, 21, 29, 34, 37,
+ 25, 18, 29, 22, 37, 35,
+ 18, 27, 22, 33, 35, 38,
+ 27, 19, 33, 23, 38, 36,
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_materialIds[] = {
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 100, 100, 100, 100,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groupSizes[] = {
+ 7, 4, 2, 15,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groups[] = {
+ 16, 17, 19, 21, 23, 24, 28,
+ 17, 20, 21, 30,
+ 16, 20,
+ 17, 18, 19, 21, 22, 23, 25, 27, 29, 33, 34, 35, 36, 37, 38,
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groupNames[] = {
+ "edge 1",
+ "edge 2",
+ "end points",
+ "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groupTypes[] = {
+ "vertex",
+ "vertex",
+ "vertex",
+ "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTri3Level2Fault1::MeshDataCohesiveTri3Level2Fault1(void)
+{ // constructor
+ filename = const_cast<char*>(_filename);
+ refineLevel = _refineLevel;
+ faultA = const_cast<char*>(_faultA);
+ faultB = const_cast<char*>(_faultB);
+
+ numVertices = _numVertices;
+ spaceDim = _spaceDim;
+ cellDim = _cellDim;
+ numCells = _numCells;
+ numCorners = _numCorners;
+ numCellsCohesive = _numCellsCohesive;
+ numCornersCohesive = _numCornersCohesive;
+ vertices = const_cast<double*>(_vertices);
+ cells = const_cast<int*>(_cells);
+ cellsCohesive = const_cast<int*>(_cellsCohesive);
+ materialIds = const_cast<int*>(_materialIds);
+ groups = const_cast<int*>(_groups);
+ groupSizes = const_cast<int*>(_groupSizes);
+ groupNames = const_cast<char**>(_groupNames);
+ groupTypes = const_cast<char**>(_groupTypes);
+ numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveTri3Level2Fault1::~MeshDataCohesiveTri3Level2Fault1(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,73 @@
+// -*- 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 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivetri3level2fault1_hh)
+#define pylith_topology_meshdatacohesivetri3level2fault1_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+ namespace topology {
+ class MeshDataCohesiveTri3Level2Fault1;
+ } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTri3Level2Fault1 : public MeshDataCohesive
+{ // MeshDataCohesiveTri3Level2Fault1
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ MeshDataCohesiveTri3Level2Fault1(void);
+
+ /// Destructor
+ ~MeshDataCohesiveTri3Level2Fault1(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+ static const char* _filename; ///< Filename of mesh file.
+ static const int _refineLevel; ///< Refinement level.
+ static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+ static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+ static const int _numVertices; ///< Number of vertices
+ static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+ static const int _cellDim; ///< Number of dimensions associated with cell
+ static const int _numCells; ///< Number of cells
+ static const int _numCorners; ///< Number of vertices in cell
+ static const int _numCellsCohesive; ///< Number of cohesive cells.
+ static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+ static const double _vertices[]; ///< Pointer to coordinates of vertices
+ static const int _cells[]; ///< Pointer to indices of vertices in cells
+ static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+ static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+ static const int _groups[]; ///< Groups of points
+ static const int _groupSizes[]; ///< Sizes of groups
+ static const char* _groupNames[]; ///< Array of group names
+ static const char* _groupTypes[]; ///< Array of group types
+ static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveTri3Level2Fault1
+
+#endif // pylith_topology_meshdatacohesivetri3level2fault1_hh
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourquad4.mesh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/fourquad4.mesh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourquad4.mesh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourquad4.mesh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,71 @@
+mesh = {
+ dimension = 2
+ use-index-zero = true
+ vertices = {
+ dimension = 2
+ count = 9
+ coordinates = {
+ 0 -1.0 -1.0
+ 1 -1.0 0.0
+ 2 -1.0 1.0
+ 3 0.0 -1.0
+ 4 0.0 0.0
+ 5 0.0 1.0
+ 6 1.0 -1.0
+ 7 1.0 0.0
+ 8 1.0 1.0
+ }
+ }
+
+ cells = {
+ count = 4
+ num-corners = 4
+ simplices = {
+ 0 0 3 4 1
+ 1 6 7 4 3
+ 2 2 1 4 5
+ 3 8 5 4 7
+ }
+
+ material-ids = {
+ 0 1
+ 1 2
+ 2 1
+ 3 2
+ }
+ }
+
+ group = {
+ name = fault
+ type = vertices
+ count = 3
+ indices = {
+ 3
+ 4
+ 5
+ }
+ }
+
+ group = {
+ name = end points
+ type = vertices
+ count = 3
+ indices = {
+ 0
+ 1
+ 2
+ }
+ }
+
+ group = {
+ name = edge 1
+ type = vertices
+ count = 3
+ indices = {
+ 0
+ 3
+ 6
+ }
+ }
+
+}
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourtri3.mesh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/fourtri3.mesh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourtri3.mesh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/fourtri3.mesh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,75 @@
+mesh = {
+ dimension = 2
+ use-index-zero = true
+ vertices = {
+ dimension = 2
+ count = 5
+ coordinates = {
+ 0 -1.0 0.0
+ 1 0.0 -1.0
+ 2 0.0 0.0
+ 3 0.0 1.0
+ 4 1.0 0.0
+ }
+ }
+
+ cells = {
+ count = 4
+ num-corners = 3
+ simplices = {
+ 0 0 1 2
+ 1 2 3 0
+ 2 2 1 4
+ 3 2 4 3
+ }
+
+ material-ids = {
+ 0 1
+ 1 1
+ 2 2
+ 3 2
+ }
+ }
+
+ group = {
+ name = fault
+ type = vertices
+ count = 3
+ indices = {
+ 1
+ 2
+ 3
+ }
+ }
+
+ group = {
+ name = end points
+ type = vertices
+ count = 2
+ indices = {
+ 0
+ 4
+ }
+ }
+
+ group = {
+ name = edge 1
+ type = vertices
+ count = 3
+ indices = {
+ 0
+ 1
+ 3
+ }
+ }
+
+ group = {
+ name = edge 2
+ type = vertices
+ count = 2
+ indices = {
+ 1
+ 4
+ }
+ }
+}
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/twotet4.mesh (from rev 17287, short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/twotet4.mesh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/data/twotet4.mesh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,69 @@
+mesh = {
+ dimension = 3
+ use-index-zero = true
+ vertices = {
+ dimension = 3
+ count = 5
+ coordinates = {
+ 0 -1.0 0.0 0.0
+ 1 0.0 -1.0 0.0
+ 2 0.0 0.0 1.0
+ 3 0.0 1.0 0.0
+ 4 1.0 0.0 0.0
+ }
+ }
+
+ cells = {
+ count = 2
+ num-corners = 4
+ simplices = {
+ 0 1 2 3 0
+ 1 1 3 2 4
+ }
+ material-ids = {
+ 0 1
+ 1 2
+ }
+ }
+
+ group = {
+ name = fault
+ type = vertices
+ count = 3
+ indices = {
+ 1
+ 2
+ 3
+ }
+ }
+
+ group = {
+ name = end points
+ type = vertices
+ count = 2
+ indices = {
+ 0
+ 4
+ }
+ }
+
+ group = {
+ name = edge 1
+ type = vertices
+ count = 2
+ indices = {
+ 0
+ 1
+ }
+ }
+
+ group = {
+ name = edge 2
+ type = vertices
+ count = 2
+ indices = {
+ 2
+ 4
+ }
+ }
+}
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATLagrange.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATLagrange.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATLagrange.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -72,6 +72,7 @@
def N1p(self, p):
return 0.5
+
# ----------------------------------------------------------------------
class Line3(object):
@@ -124,6 +125,7 @@
def N2p(self, p):
return -2.0*p
+
# ----------------------------------------------------------------------
class Quad4(object):
@@ -137,8 +139,8 @@
[-1.0, +1.0]])
quadPts = numpy.array([ [-1.0/3**0.5, -1.0/3**0.5],
[+1.0/3**0.5, -1.0/3**0.5],
- [+1.0/3**0.5, +1.0/3**0.5],
- [-1.0/3**0.5, +1.0/3**0.5] ])
+ [-1.0/3**0.5, +1.0/3**0.5],
+ [+1.0/3**0.5, +1.0/3**0.5] ])
quadWts = numpy.array( [1.0, 1.0, 1.0, 1.0])
# Compute basis fns and derivatives at quadrature points
@@ -203,7 +205,152 @@
def N3q(self, p):
return (1-p[0])/4.0
+
# ----------------------------------------------------------------------
+class Quad9(object):
+
+ def __init__(self):
+ """
+ Setup quad9 cell.
+ """
+ vertices = numpy.array([[-1.0, -1.0], # corners
+ [+1.0, -1.0],
+ [+1.0, +1.0],
+ [-1.0, +1.0],
+ [ 0.0, -1.0], # edges
+ [+1.0, 0.0],
+ [ 0.0, +1.0],
+ [-1.0, 0.0],
+ [ 0.0, 0.0], # face
+ ])
+ quadPts = numpy.array([ [-(3.0/5)**0.5, -(3.0/5)**0.5],
+ [ 0.0, -(3.0/5)**0.5],
+ [+(3.0/5)**0.5, -(3.0/5)**0.5],
+ [-(3.0/5)**0.5, 0.0],
+ [ 0.0, 0.0],
+ [+(3.0/5)**0.5, 0.0],
+ [-(3.0/5)**0.5, +(3.0/5)**0.5],
+ [ 0.0, +(3.0/5)**0.5],
+ [+(3.0/5)**0.5, +(3.0/5)**0.5] ])
+ quadWts = numpy.array( [25.0/81, 40.0/81, 25.0/81,
+ 40.0/81, 64.0/81, 40.0/81,
+ 25.0/81, 40.0/81, 25.0/81])
+
+ # Compute basis fns and derivatives at quadrature points
+ basis = numpy.zeros( (9, 9), dtype=numpy.float64)
+ basisDeriv = numpy.zeros( (9, 9, 2), dtype=numpy.float64)
+ iQuad = 0
+ for q in quadPts:
+ basis[iQuad] = numpy.array([self.N0(q), self.N1(q), self.N2(q),
+ self.N3(q), self.N4(q), self.N5(q),
+ self.N6(q), self.N7(q), self.N8(q)],
+ dtype=numpy.float64).reshape( (9,) )
+ deriv = numpy.array([[self.N0p(q), self.N0q(q)],
+ [self.N1p(q), self.N1q(q)],
+ [self.N2p(q), self.N2q(q)],
+ [self.N3p(q), self.N3q(q)],
+ [self.N4p(q), self.N4q(q)],
+ [self.N5p(q), self.N5q(q)],
+ [self.N6p(q), self.N6q(q)],
+ [self.N7p(q), self.N7q(q)],
+ [self.N8p(q), self.N8q(q)]])
+ basisDeriv[iQuad] = deriv.reshape((9, 2))
+ iQuad += 1
+
+ self.cellDim = 2
+ self.numCorners = len(vertices)
+ self.numQuadPts = len(quadPts)
+ self.vertices = vertices
+ self.quadPts = quadPts
+ self.quadWts = quadWts
+ self.basis = basis
+ self.basisDeriv = basisDeriv
+ return
+
+
+ def N0(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-0.5*p[1])*(1.0-p[1])
+
+ def N0p(self, p):
+ return (p[0]-0.5)*(-0.5*p[1])*(1.0-p[1])
+
+ def N0q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]-0.5)
+
+ def N1(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-0.5*p[1])*(1.0-p[1])
+
+ def N1p(self, p):
+ return (p[0]+0.5)*(-0.5*p[1])*(1.0-p[1])
+
+ def N1q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]-0.5)
+
+ def N2(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(+0.5*p[1])*(1.0+p[1])
+
+ def N2p(self, p):
+ return (p[0]+0.5)*(+0.5*p[1])*(1.0+p[1])
+
+ def N2q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]+0.5)
+
+ def N3(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(+0.5*p[1])*(1.0+p[1])
+
+ def N3p(self, p):
+ return (p[0]-0.5)*(+0.5*p[1])*(1.0+p[1])
+
+ def N3q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]+0.5)
+
+ def N4(self, p):
+ return (1.0-p[0]**2)*(-0.5*p[1])*(1.0-p[1])
+
+ def N4p(self, p):
+ return (-2.0*p[0])*(-0.5*p[1])*(1.0-p[1])
+
+ def N4q(self, p):
+ return (1.0-p[0]**2)*(p[1]-0.5)
+
+ def N5(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(1.0-p[1]**2)
+
+ def N5p(self, p):
+ return (p[0]+0.5)*(1.0-p[1]**2)
+
+ def N5q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-2.0*p[1])
+
+ def N6(self, p):
+ return (1.0-p[0]**2)*(+0.5*p[1])*(1.0+p[1])
+
+ def N6p(self, p):
+ return (-2.0*p[0])*(+0.5*p[1])*(1.0+p[1])
+
+ def N6q(self, p):
+ return (1.0-p[0]**2)*(p[1]+0.5)
+
+ def N7(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(1.0-p[1]**2)
+
+ def N7p(self, p):
+ return (p[0]-0.5)*(1.0-p[1]**2)
+
+ def N7q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-2.0*p[1])
+
+ def N8(self, p):
+ return (1.0-p[0]**2)*(1.0-p[1]**2)
+
+ def N8p(self, p):
+ return (-2.0*p[0])*(1.0-p[1]**2)
+
+ def N8q(self, p):
+ return (1.0-p[0]**2)*(-2.0*p[1])
+
+
+# ----------------------------------------------------------------------
class Hex8(object):
def __init__(self):
@@ -220,12 +367,12 @@
[-1.0, +1.0, +1.0]])
quadPts = numpy.array([ [-1.0/3**0.5, -1.0/3**0.5, -1.0/3**0.5],
[+1.0/3**0.5, -1.0/3**0.5, -1.0/3**0.5],
+ [-1.0/3**0.5, +1.0/3**0.5, -1.0/3**0.5],
[+1.0/3**0.5, +1.0/3**0.5, -1.0/3**0.5],
- [-1.0/3**0.5, +1.0/3**0.5, -1.0/3**0.5],
[-1.0/3**0.5, -1.0/3**0.5, +1.0/3**0.5],
[+1.0/3**0.5, -1.0/3**0.5, +1.0/3**0.5],
- [+1.0/3**0.5, +1.0/3**0.5, +1.0/3**0.5],
- [-1.0/3**0.5, +1.0/3**0.5, +1.0/3**0.5]])
+ [-1.0/3**0.5, +1.0/3**0.5, +1.0/3**0.5],
+ [+1.0/3**0.5, +1.0/3**0.5, +1.0/3**0.5]])
quadWts = numpy.array( [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
# Compute basis fns and derivatives at quadrature points
@@ -356,7 +503,494 @@
def N7r(self, p):
return (1-p[0])*(1+p[1])/8.0
+
# ----------------------------------------------------------------------
+class Hex27(object):
+
+ def __init__(self):
+ """
+ Setup hex8 cell.
+ """
+ vertices = numpy.array([[-1.0, -1.0, -1.0], # Corners
+ [+1.0, -1.0, -1.0],
+ [+1.0, +1.0, -1.0],
+ [-1.0, +1.0, -1.0],
+ [-1.0, -1.0, +1.0],
+ [+1.0, -1.0, +1.0],
+ [+1.0, +1.0, +1.0],
+ [-1.0, +1.0, +1.0],
+ [ 0.0, -1.0, -1.0], # Bottom edges
+ [+1.0, 0.0, -1.0],
+ [ 0.0, +1.0, -1.0],
+ [-1.0, 0.0, -1.0],
+ [ 0.0, -1.0, +1.0], # Top edges
+ [+1.0, 0.0, +1.0],
+ [ 0.0, +1.0, +1.0],
+ [-1.0, 0.0, +1.0],
+ [-1.0, -1.0, 0.0], # Middle edges
+ [+1.0, -1.0, 0.0],
+ [+1.0, +1.0, 0.0],
+ [-1.0, +1.0, 0.0],
+ [-1.0, 0.0, 0.0], # Faces
+ [+1.0, 0.0, 0.0],
+ [ 0.0, -1.0, 0.0],
+ [ 0.0, +1.0, 0.0],
+ [ 0.0, 0.0, -1.0],
+ [ 0.0, 0.0, +1.0],
+ [ 0.0, 0.0, 0.0]]) # Interior
+ quadPts = numpy.array([ [-(3.0/5)**0.5, -(3.0/5)**0.5, -(3.0/5)**0.5],
+ [ 0.0, -(3.0/5)**0.5, -(3.0/5)**0.5],
+ [+(3.0/5)**0.5, -(3.0/5)**0.5, -(3.0/5)**0.5],
+ [-(3.0/5)**0.5, 0.0, -(3.0/5)**0.5],
+ [ 0.0, 0.0, -(3.0/5)**0.5],
+ [+(3.0/5)**0.5, 0.0, -(3.0/5)**0.5],
+ [-(3.0/5)**0.5, +(3.0/5)**0.5, -(3.0/5)**0.5],
+ [ 0.0, +(3.0/5)**0.5, -(3.0/5)**0.5],
+ [+(3.0/5)**0.5, +(3.0/5)**0.5, -(3.0/5)**0.5],
+ [-(3.0/5)**0.5, -(3.0/5)**0.5, 0.0],
+ [ 0.0, -(3.0/5)**0.5, 0.0],
+ [+(3.0/5)**0.5, -(3.0/5)**0.5, 0.0],
+ [-(3.0/5)**0.5, 0.0, 0.0],
+ [ 0.0, 0.0, 0.0],
+ [+(3.0/5)**0.5, 0.0, 0.0],
+ [-(3.0/5)**0.5, +(3.0/5)**0.5, 0.0],
+ [ 0.0, +(3.0/5)**0.5, 0.0],
+ [+(3.0/5)**0.5, +(3.0/5)**0.5, 0.0],
+ [-(3.0/5)**0.5, -(3.0/5)**0.5, +(3.0/5)**0.5],
+ [ 0.0, -(3.0/5)**0.5, +(3.0/5)**0.5],
+ [+(3.0/5)**0.5, -(3.0/5)**0.5, +(3.0/5)**0.5],
+ [-(3.0/5)**0.5, 0.0, +(3.0/5)**0.5],
+ [ 0.0, 0.0, +(3.0/5)**0.5],
+ [+(3.0/5)**0.5, 0.0, +(3.0/5)**0.5],
+ [-(3.0/5)**0.5, +(3.0/5)**0.5, +(3.0/5)**0.5],
+ [ 0.0, +(3.0/5)**0.5, +(3.0/5)**0.5],
+ [+(3.0/5)**0.5, +(3.0/5)**0.5, +(3.0/5)**0.5] ])
+ quadWts = numpy.array( [125.0/729, 200.0/729, 125.0/729,
+ 200.0/729, 320.0/729, 200.0/729,
+ 125.0/729, 200.0/729, 125.0/729,
+ 200.0/729, 320.0/729, 200.0/729,
+ 320.0/729, 512.0/729, 320.0/729,
+ 200.0/729, 320.0/729, 200.0/729,
+ 125.0/729, 200.0/729, 125.0/729,
+ 200.0/729, 320.0/729, 200.0/729,
+ 125.0/729, 200.0/729, 125.0/729])
+
+ # Compute basis fns and derivatives at quadrature points
+ basis = numpy.zeros( (27, 27), dtype=numpy.float64)
+ basisDeriv = numpy.zeros( (27, 27, 3), dtype=numpy.float64)
+ iQuad = 0
+ for q in quadPts:
+ basis[iQuad] = numpy.array([self.N0(q), self.N1(q), self.N2(q), self.N3(q), # Corners
+ self.N4(q), self.N5(q), self.N6(q), self.N7(q),
+ self.N8(q), self.N9(q), self.N10(q), self.N11(q), # Edges
+ self.N12(q), self.N13(q), self.N14(q), self.N15(q),
+ self.N16(q), self.N17(q), self.N18(q), self.N19(q),
+ self.N20(q), # Interior
+ self.N21(q), self.N22(q), # Faces
+ self.N23(q), self.N24(q),
+ self.N25(q), self.N26(q)],
+ dtype=numpy.float64).reshape( (27,) )
+ deriv = numpy.array([[self.N0p(q), self.N0q(q), self.N0r(q)],
+ [self.N1p(q), self.N1q(q), self.N1r(q)],
+ [self.N2p(q), self.N2q(q), self.N2r(q)],
+ [self.N3p(q), self.N3q(q), self.N3r(q)],
+ [self.N4p(q), self.N4q(q), self.N4r(q)],
+ [self.N5p(q), self.N5q(q), self.N5r(q)],
+ [self.N6p(q), self.N6q(q), self.N6r(q)],
+ [self.N7p(q), self.N7q(q), self.N7r(q)],
+ [self.N8p(q), self.N8q(q), self.N8r(q)],
+ [self.N9p(q), self.N9q(q), self.N9r(q)],
+ [self.N10p(q), self.N10q(q), self.N10r(q)],
+ [self.N11p(q), self.N11q(q), self.N11r(q)],
+ [self.N12p(q), self.N12q(q), self.N12r(q)],
+ [self.N13p(q), self.N13q(q), self.N13r(q)],
+ [self.N14p(q), self.N14q(q), self.N14r(q)],
+ [self.N15p(q), self.N15q(q), self.N15r(q)],
+ [self.N16p(q), self.N16q(q), self.N16r(q)],
+ [self.N17p(q), self.N17q(q), self.N17r(q)],
+ [self.N18p(q), self.N18q(q), self.N18r(q)],
+ [self.N19p(q), self.N19q(q), self.N19r(q)],
+ [self.N20p(q), self.N20q(q), self.N20r(q)],
+ [self.N21p(q), self.N21q(q), self.N21r(q)],
+ [self.N22p(q), self.N22q(q), self.N22r(q)],
+ [self.N23p(q), self.N23q(q), self.N23r(q)],
+ [self.N24p(q), self.N24q(q), self.N24r(q)],
+ [self.N25p(q), self.N25q(q), self.N25r(q)],
+ [self.N26p(q), self.N26q(q), self.N26r(q)]])
+ basisDeriv[iQuad] = deriv.reshape((27, 3))
+ iQuad += 1
+
+ self.cellDim = 3
+ self.numCorners = len(vertices)
+ self.numQuadPts = len(quadPts)
+ self.vertices = vertices
+ self.quadPts = quadPts
+ self.quadWts = quadWts
+ self.basis = basis
+ self.basisDeriv = basisDeriv
+ return
+
+
+ # Corners
+ def N0(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-0.5*p[1])*(1.0-p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N0p(self, p):
+ return (p[0]-0.5)*(-0.5*p[1])*(1.0-p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N0q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]-0.5)*(-0.5*p[2])*(1.0-p[2])
+
+ def N0r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-0.5*p[1])*(1.0-p[1])*(p[2]-0.5)
+
+
+ def N1(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-0.5*p[1])*(1.0-p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N1p(self, p):
+ return (p[0]+0.5)*(-0.5*p[1])*(1.0-p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N1q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]-0.5)*(-0.5*p[2])*(1.0-p[2])
+
+ def N1r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-0.5*p[1])*(1.0-p[1])*(p[2]-0.5)
+
+
+ def N2(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(+0.5*p[1])*(1.0+p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N2p(self, p):
+ return (p[0]+0.5)*(+0.5*p[1])*(1.0+p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N2q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]+0.5)*(-0.5*p[2])*(1.0-p[2])
+
+ def N2r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(+0.5*p[1])*(1.0+p[1])*(p[2]-0.5)
+
+
+ def N3(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(+0.5*p[1])*(1.0+p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N3p(self, p):
+ return (p[0]-0.5)*(+0.5*p[1])*(1.0+p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N3q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]+0.5)*(-0.5*p[2])*(1.0-p[2])
+
+ def N3r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(+0.5*p[1])*(1.0+p[1])*(p[2]-0.5)
+
+
+ def N4(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-0.5*p[1])*(1.0-p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N4p(self, p):
+ return (p[0]-0.5)*(-0.5*p[1])*(1.0-p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N4q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]-0.5)*(+0.5*p[2])*(1.0+p[2])
+
+ def N4r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-0.5*p[1])*(1.0-p[1])*(p[2]+0.5)
+
+
+ def N5(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-0.5*p[1])*(1.0-p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N5p(self, p):
+ return (p[0]+0.5)*(-0.5*p[1])*(1.0-p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N5q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]-0.5)*(+0.5*p[2])*(1.0+p[2])
+
+ def N5r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-0.5*p[1])*(1.0-p[1])*(p[2]+0.5)
+
+
+ def N6(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(+0.5*p[1])*(1.0+p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N6p(self, p):
+ return (p[0]+0.5)*(+0.5*p[1])*(1.0+p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N6q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]+0.5)*(+0.5*p[2])*(1.0+p[2])
+
+ def N6r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(+0.5*p[1])*(1.0+p[1])*(p[2]+0.5)
+
+
+ def N7(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(+0.5*p[1])*(1.0+p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N7p(self, p):
+ return (p[0]-0.5)*(+0.5*p[1])*(1.0+p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N7q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]+0.5)*(+0.5*p[2])*(1.0+p[2])
+
+ def N7r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(+0.5*p[1])*(1.0+p[1])*(p[2]+0.5)
+
+
+ # Bottom edges
+ def N8(self, p):
+ return (1.0-p[0]**2)*(-0.5*p[1])*(1.0-p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N8p(self, p):
+ return (-2.0*p[0])*(-0.5*p[1])*(1.0-p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N8q(self, p):
+ return (1.0-p[0]**2)*(p[1]-0.5)*(-0.5*p[2])*(1.0-p[2])
+
+ def N8r(self, p):
+ return (1.0-p[0]**2)*(-0.5*p[1])*(1.0-p[1])*(p[2]-0.5)
+
+
+ def N9(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(1.0-p[1]**2)*(-0.5*p[2])*(1.0-p[2])
+
+ def N9p(self, p):
+ return (p[0]+0.5)*(1.0-p[1]**2)*(-0.5*p[2])*(1.0-p[2])
+
+ def N9q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-2.0*p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N9r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(1.0-p[1]**2)*(p[2]-0.5)
+
+
+ def N10(self, p):
+ return (1.0-p[0]**2)*(+0.5*p[1])*(1.0+p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N10p(self, p):
+ return (-2.0*p[0])*(+0.5*p[1])*(1.0+p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N10q(self, p):
+ return (1.0-p[0]**2)*(p[1]+0.5)*(-0.5*p[2])*(1.0-p[2])
+
+ def N10r(self, p):
+ return (1.0-p[0]**2)*(+0.5*p[1])*(1.0+p[1])*(p[2]-0.5)
+
+
+ def N11(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(1.0-p[1]**2)*(-0.5*p[2])*(1.0-p[2])
+
+ def N11p(self, p):
+ return (p[0]-0.5)*(1.0-p[1]**2)*(-0.5*p[2])*(1.0-p[2])
+
+ def N11q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-2.0*p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N11r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(1.0-p[1]**2)*(p[2]-0.5)
+
+
+ # Top edges
+ def N12(self, p):
+ return (1.0-p[0]**2)*(-0.5*p[1])*(1.0-p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N12p(self, p):
+ return (-2.0*p[0])*(-0.5*p[1])*(1.0-p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N12q(self, p):
+ return (1.0-p[0]**2)*(p[1]-0.5)*(+0.5*p[2])*(1.0+p[2])
+
+ def N12r(self, p):
+ return (1.0-p[0]**2)*(-0.5*p[1])*(1.0-p[1])*(p[2]+0.5)
+
+
+ def N13(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(1.0-p[1]**2)*(+0.5*p[2])*(1.0+p[2])
+
+ def N13p(self, p):
+ return (p[0]+0.5)*(1.0-p[1]**2)*(+0.5*p[2])*(1.0+p[2])
+
+ def N13q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-2.0*p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N13r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(1.0-p[1]**2)*(p[2]+0.5)
+
+
+ def N14(self, p):
+ return (1.0-p[0]**2)*(+0.5*p[1])*(1.0+p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N14p(self, p):
+ return (-2.0*p[0])*(+0.5*p[1])*(1.0+p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N14q(self, p):
+ return (1.0-p[0]**2)*(p[1]+0.5)*(+0.5*p[2])*(1.0+p[2])
+
+ def N14r(self, p):
+ return (1.0-p[0]**2)*(+0.5*p[1])*(1.0+p[1])*(p[2]+0.5)
+
+
+ def N15(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(1.0-p[1]**2)*(+0.5*p[2])*(1.0+p[2])
+
+ def N15p(self, p):
+ return (p[0]-0.5)*(1.0-p[1]**2)*(+0.5*p[2])*(1.0+p[2])
+
+ def N15q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-2.0*p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N15r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(1.0-p[1]**2)*(p[2]+0.5)
+
+
+ # Middle edges
+ def N16(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-0.5*p[1])*(1.0-p[1])*(1.0-p[2]**2)
+
+ def N16p(self, p):
+ return (p[0]-0.5)*(-0.5*p[1])*(1.0-p[1])*(1.0-p[2]**2)
+
+ def N16q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]-0.5)*(1.0-p[2]**2)
+
+ def N16r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-0.5*p[1])*(1.0-p[1])*(-2.0*p[2])
+
+
+ def N17(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-0.5*p[1])*(1.0-p[1])*(1.0-p[2]**2)
+
+ def N17p(self, p):
+ return (p[0]+0.5)*(-0.5*p[1])*(1.0-p[1])*(1.0-p[2]**2)
+
+ def N17q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]-0.5)*(1.0-p[2]**2)
+
+ def N17r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-0.5*p[1])*(1.0-p[1])*(-2.0*p[2])
+
+
+ def N18(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(+0.5*p[1])*(1.0+p[1])*(1.0-p[2]**2)
+
+ def N18p(self, p):
+ return (p[0]+0.5)*(+0.5*p[1])*(1.0+p[1])*(1.0-p[2]**2)
+
+ def N18q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(p[1]+0.5)*(1.0-p[2]**2)
+
+ def N18r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(+0.5*p[1])*(1.0+p[1])*(-2.0*p[2])
+
+
+ def N19(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(+0.5*p[1])*(1.0+p[1])*(1.0-p[2]**2)
+
+ def N19p(self, p):
+ return (p[0]-0.5)*(+0.5*p[1])*(1.0+p[1])*(1.0-p[2]**2)
+
+ def N19q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(p[1]+0.5)*(1.0-p[2]**2)
+
+ def N19r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(+0.5*p[1])*(1.0+p[1])*(-2.0*p[2])
+
+
+ # Left/right
+ def N20(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(1.0-p[1]**2)*(1.0-p[2]**2)
+
+ def N20p(self, p):
+ return (p[0]-0.5)*(1.0-p[1]**2)*(1.0-p[2]**2)
+
+ def N20q(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(-2.0*p[1])*(1.0-p[2]**2)
+
+ def N20r(self, p):
+ return (-0.5*p[0])*(1.0-p[0])*(1.0-p[1]**2)*(-2.0*p[2])
+
+
+ def N21(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(1.0-p[1]**2)*(1.0-p[2]**2)
+
+ def N21p(self, p):
+ return (p[0]+0.5)*(1.0-p[1]**2)*(1.0-p[2]**2)
+
+ def N21q(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(-2.0*p[1])*(1.0-p[2]**2)
+
+ def N21r(self, p):
+ return (+0.5*p[0])*(1.0+p[0])*(1.0-p[1]**2)*(-2.0*p[2])
+
+
+ # Front/back
+ def N22(self, p):
+ return (1.0-p[0]**2)*(-0.5*p[1])*(1.0-p[1])*(1.0-p[2]**2)
+
+ def N22p(self, p):
+ return (-2.0*p[0])*(-0.5*p[1])*(1.0-p[1])*(1.0-p[2]**2)
+
+ def N22q(self, p):
+ return (1.0-p[0]**2)*(p[1]-0.5)*(1.0-p[2]**2)
+
+ def N22r(self, p):
+ return (1.0-p[0]**2)*(-0.5*p[1])*(1.0-p[1])*(-2.0*p[2])
+
+
+ def N23(self, p):
+ return (1.0-p[0]**2)*(+0.5*p[1])*(1.0+p[1])*(1.0-p[2]**2)
+
+ def N23p(self, p):
+ return (-2.0*p[0])*(+0.5*p[1])*(1.0+p[1])*(1.0-p[2]**2)
+
+ def N23q(self, p):
+ return (1.0-p[0]**2)*(p[1]+0.5)*(1.0-p[2]**2)
+
+ def N23r(self, p):
+ return (1.0-p[0]**2)*(+0.5*p[1])*(1.0+p[1])*(-2.0*p[2])
+
+
+ # Bottom/top
+ def N24(self, p):
+ return (1.0-p[0]**2)*(1.0-p[1]**2)*(-0.5*p[2])*(1.0-p[2])
+
+ def N24p(self, p):
+ return (-2.0*p[0])*(1.0-p[1]**2)*(-0.5*p[2])*(1.0-p[2])
+
+ def N24q(self, p):
+ return (1.0-p[0]**2)*(-2.0*p[1])*(-0.5*p[2])*(1.0-p[2])
+
+ def N24r(self, p):
+ return (1.0-p[0]**2)*(1.0-p[1]**2)*(p[2]-0.5)
+
+
+ def N25(self, p):
+ return (1.0-p[0]**2)*(1.0-p[1]**2)*(+0.5*p[2])*(1.0+p[2])
+
+ def N25p(self, p):
+ return (-2.0*p[0])*(1.0-p[1]**2)*(+0.5*p[2])*(1.0+p[2])
+
+ def N25q(self, p):
+ return (1.0-p[0]**2)*(-2.0*p[1])*(+0.5*p[2])*(1.0+p[2])
+
+ def N25r(self, p):
+ return (1.0-p[0]**2)*(1.0-p[1]**2)*(p[2]+0.5)
+
+
+ # Interior
+ def N26(self, p):
+ return (1.0-p[0]**2)*(1.0-p[1]**2)*(1.0-p[2]**2)
+
+ def N26p(self, p):
+ return (-2.0*p[0])*(1.0-p[1]**2)*(1.0-p[2]**2)
+
+ def N26q(self, p):
+ return (1.0-p[0]**2)*(-2.0*p[1])*(1.0-p[2]**2)
+
+ def N26r(self, p):
+ return (1.0-p[0]**2)*(1.0-p[1]**2)*(-2.0*p[2])
+
+
+# ----------------------------------------------------------------------
class TestFIATLagrange(unittest.TestCase):
"""
Unit testing of FIATLagrange object.
@@ -366,11 +1000,11 @@
"""
Test initialize() with line2 cell.
"""
- from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATLagrange()
- cell.cellDim = 1
- cell.degree = 1
- cell.order = 1
+ cell.inventory.dimension = 1
+ cell.inventory.degree = 1
+ cell.inventory.order = 1
+ cell._configure()
cell.initialize(spaceDim=1)
cellE = Line2()
@@ -384,11 +1018,11 @@
"""
Test initialize() with line3 cell.
"""
- from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATLagrange()
- cell.cellDim = 1
- cell.degree = 2
- cell.order = 2
+ cell.inventory.dimension = 1
+ cell.inventory.degree = 2
+ cell.inventory.order = 2
+ cell._configure()
cell.initialize(spaceDim=2)
cellE = Line3()
@@ -402,11 +1036,11 @@
"""
Test initialize() with quad4 cell.
"""
- from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATLagrange()
- cell.cellDim = 2
- cell.degree = 1
- cell.order = 2
+ cell.inventory.dimension = 2
+ cell.inventory.degree = 1
+ cell.inventory.order = 2
+ cell._configure()
cell.initialize(spaceDim=2)
cellE = Quad4()
@@ -416,15 +1050,33 @@
return
+ def test_initialize_quad9(self):
+ """
+ Test initialize() with quad9 cell.
+ """
+ cell = FIATLagrange()
+ cell.inventory.dimension = 2
+ cell.inventory.degree = 2
+ cell.inventory.order = 5
+ cell._configure()
+ cell.initialize(spaceDim=2)
+
+ cellE = Quad9()
+ self._checkVals(cellE, cell)
+ from pylith.feassemble.CellGeometry import GeometryQuad2D
+ self.failUnless(isinstance(cell.geometry, GeometryQuad2D))
+ return
+
+
def test_initialize_hex8(self):
"""
Test initialize() with hex8 cell.
"""
- from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATLagrange()
- cell.cellDim = 3
- cell.degree = 1
- cell.order = 2
+ cell.inventory.dimension = 3
+ cell.inventory.degree = 1
+ cell.inventory.order = 2
+ cell._configure()
cell.initialize(spaceDim=3)
cellE = Hex8()
@@ -434,6 +1086,24 @@
return
+ def test_initialize_hex27(self):
+ """
+ Test initialize() with hex27 cell.
+ """
+ cell = FIATLagrange()
+ cell.inventory.dimension = 3
+ cell.inventory.degree = 2
+ cell.inventory.order = 5
+ cell._configure()
+ cell.initialize(spaceDim=3)
+
+ cellE = Hex27()
+ self._checkVals(cellE, cell)
+ from pylith.feassemble.CellGeometry import GeometryHex3D
+ self.failUnless(isinstance(cell.geometry, GeometryHex3D))
+ return
+
+
def test_factory(self):
"""
Test factory method.
@@ -445,7 +1115,7 @@
def _checkVals(self, cellE, cell):
"""
- Check known values against those generated by FIATSimplex.
+ Check known values against those generated by FIATLagrange.
"""
# Check basic attributes
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATSimplex.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATSimplex.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestFIATSimplex.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -79,7 +79,7 @@
"""
Setup line3 cell.
"""
- vertices = numpy.array([[-1.0], [1.0], [0.0]])
+ vertices = numpy.array([[0.0], [-1.0], [1.0]])
quadPts = numpy.array([ [-1.0/3**0.5],
[+1.0/3**0.5] ])
quadWts = numpy.array( [1.0, 1.0])
@@ -91,7 +91,9 @@
for q in quadPts:
basis[iQuad] = numpy.array([self.N0(q), self.N1(q), self.N2(q)],
dtype=numpy.float64).reshape( (3,) )
- deriv = numpy.array([[self.N0p(q)], [self.N1p(q)], [self.N2p(q)]])
+ deriv = numpy.array([[self.N0p(q)],
+ [self.N1p(q)],
+ [self.N2p(q)]])
basisDeriv[iQuad] = deriv.reshape((3, 1))
iQuad += 1
@@ -107,23 +109,26 @@
def N0(self, p):
- return -0.5*p*(1.0-p)
+ return (1.0-p*p)
def N0p(self, p):
- return 1.0*p - 0.5
+ return -2.0*p
+
def N1(self, p):
- return 0.5*p*(1.0+p)
+ return -0.5*p*(1.0-p)
def N1p(self, p):
- return 1.0*p + 0.5
+ return 1.0*p - 0.5
+
def N2(self, p):
- return (1.0-p*p)
+ return 0.5*p*(1.0+p)
def N2p(self, p):
- return -2.0*p
+ return 1.0*p + 0.5
+
# ----------------------------------------------------------------------
class Tri3(object):
@@ -170,6 +175,7 @@
def N0q(self, p):
return -0.5
+
def N1(self, p):
return 0.5*(1.0+p[0])
@@ -179,6 +185,7 @@
def N1q(self, p):
return 0.0
+
def N2(self, p):
return 0.5*(1.0+p[1])
@@ -188,7 +195,116 @@
def N2q(self, p):
return 0.5
+
# ----------------------------------------------------------------------
+class Tri6(object):
+
+ def __init__(self):
+ """
+ Setup tri33 cell.
+ """
+ vertices = numpy.array([[ 0.0, -1.0],
+ [ 0.0, 0.0],
+ [-1.0, 0.0],
+ [-1.0, -1.0],
+ [+1.0, -1.0],
+ [-1.0, +1.0]])
+ quadPts = numpy.array([ [-0.64288254, -0.68989795],
+ [-0.84993778, 0.28989795],
+ [ 0.33278049, -0.68989795],
+ [-0.43996017, 0.28989795]])
+ quadWts = numpy.array( [0.63608276, 0.36391724, 0.63608276, 0.36391724])
+
+ # Compute basis fns and derivatives at quadrature points
+ basis = numpy.zeros( (4, 6), dtype=numpy.float64)
+ basisDeriv = numpy.zeros( (4, 6, 2), dtype=numpy.float64)
+ iQuad = 0
+ for q in quadPts:
+ basis[iQuad] = numpy.array([self.N0(q), self.N1(q), self.N2(q),
+ self.N3(q), self.N4(q), self.N5(q)],
+ dtype=numpy.float64).reshape( (6,) )
+ deriv = numpy.array([[self.N0p(q), self.N0q(q)],
+ [self.N1p(q), self.N1q(q)],
+ [self.N2p(q), self.N2q(q)],
+ [self.N3p(q), self.N3q(q)],
+ [self.N4p(q), self.N4q(q)],
+ [self.N5p(q), self.N5q(q)]])
+ print deriv
+ basisDeriv[iQuad] = deriv.reshape((6, 2))
+ iQuad += 1
+
+ self.cellDim = 2
+ self.numCorners = len(vertices)
+ self.numQuadPts = len(quadPts)
+ self.vertices = vertices
+ self.quadPts = quadPts
+ self.quadWts = quadWts
+ self.basis = basis
+ self.basisDeriv = basisDeriv
+ return
+
+
+ def N0(self, p):
+ return (-p[0]-p[1])*(1+p[0])
+
+ def N0p(self, p):
+ return -1.0-2*p[0]-p[1]
+
+ def N0q(self, p):
+ return -(1+p[0])
+
+
+ def N1(self, p):
+ return (1.0+p[0])*(1+p[1])
+
+ def N1p(self, p):
+ return (1+p[1])
+
+ def N1q(self, p):
+ return (1.0+p[0])
+
+
+ def N2(self, p):
+ return (-p[0]-p[1])*(1+p[1])
+
+ def N2p(self, p):
+ return -(1+p[1])
+
+ def N2q(self, p):
+ return -1.0-p[0]-2*p[1]
+
+
+ def N3(self, p):
+ return 0.5*(-p[0]-p[1])*(-1.0-p[0]-p[1])
+
+ def N3p(self, p):
+ return 0.5+p[0]+p[1]
+
+ def N3q(self, p):
+ return 0.5+p[0]+p[1]
+
+
+ def N4(self, p):
+ return 0.5*(1.0+p[0])*(p[0])
+
+ def N4p(self, p):
+ return 0.5+p[0]
+
+ def N4q(self, p):
+ return 0
+
+
+ def N5(self, p):
+ return 0.5*(1.0+p[1])*(p[1])
+
+ def N5p(self, p):
+ return 0
+
+ def N5q(self, p):
+ return 0.5+p[1]
+
+
+# ----------------------------------------------------------------------
class Tet4(object):
def __init__(self):
@@ -276,6 +392,7 @@
def N3r(self, p):
return 0.5
+
# ----------------------------------------------------------------------
class TestFIATSimplex(unittest.TestCase):
"""
@@ -344,9 +461,9 @@
Test initialize() with tri3 cell.
"""
cell = FIATSimplex()
- cell.shape = "triangle"
- cell.degree = 1
- cell.order = 1
+ cell.inventory.shape = "triangle"
+ cell.inventory.degree = 1
+ cell._configure()
cell.initialize(spaceDim=2)
cellE = Tri3()
@@ -356,14 +473,31 @@
return
+ def test_initialize_tri6(self):
+ """
+ Test initialize() with tri6 cell.
+ """
+ cell = FIATSimplex()
+ cell.inventory.shape = "triangle"
+ cell.inventory.degree = 2
+ cell._configure()
+ cell.initialize(spaceDim=2)
+
+ cellE = Tri6()
+ self._checkVals(cellE, cell)
+ from pylith.feassemble.CellGeometry import GeometryTri2D
+ self.failUnless(isinstance(cell.geometry, GeometryTri2D))
+ return
+
+
def test_initialize_tet4(self):
"""
Test initialize() with tet4 cell.
"""
cell = FIATSimplex()
- cell.shape = "tetrahedron"
- cell.degree = 1
- cell.order = 1
+ cell.inventory.shape = "tetrahedron"
+ cell.inventory.degree = 1
+ cell._configure()
cell.initialize(spaceDim=3)
cellE = Tet4()
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestMeshQuadrature.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestMeshQuadrature.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestMeshQuadrature.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -29,22 +29,22 @@
# ----------------------------------------------------------------------
def N0(p):
- return -0.5*p*(1.0-p)
+ return (1.0-p**2)
def N0p(p):
- return -0.5*(1.0-p) + 0.5*p
+ return -2.0*p
def N1(p):
- return 0.5*p*(1.0+p)
+ return -0.5*p*(1.0-p)
def N1p(p):
- return +0.5*(1.0+p) + 0.5*p
+ return -0.5*(1.0-p) + 0.5*p
def N2(p):
- return (1.0-p**2)
+ return 0.5*p*(1.0+p)
def N2p(p):
- return -2.0*p
+ return +0.5*(1.0+p) + 0.5*p
# ----------------------------------------------------------------------
class TestMeshQuadrature(unittest.TestCase):
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestSubMeshQuadrature.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestSubMeshQuadrature.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/feassemble/TestSubMeshQuadrature.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -29,22 +29,22 @@
# ----------------------------------------------------------------------
def N0(p):
- return -0.5*p*(1.0-p)
+ return (1.0-p**2)
def N0p(p):
- return -0.5*(1.0-p) + 0.5*p
+ return -2.0*p
def N1(p):
- return 0.5*p*(1.0+p)
+ return -0.5*p*(1.0-p)
def N1p(p):
- return +0.5*(1.0+p) + 0.5*p
+ return -0.5*(1.0-p) + 0.5*p
def N2(p):
- return (1.0-p**2)
+ return 0.5*p*(1.0+p)
def N2p(p):
- return -2.0*p
+ return +0.5*(1.0+p) + 0.5*p
# ----------------------------------------------------------------------
class TestSubMeshQuadrature(unittest.TestCase):
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterHDF5.py (from rev 17287, short/3D/PyLith/trunk/unittests/pytests/meshio/TestDataWriterHDF5.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterHDF5.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterHDF5.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# 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 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/meshio/TestDataWriterHDF5.py
+
+## @brief Unit testing of Python DataWriterHDF5 object.
+
+import unittest
+
+from pylith.meshio.DataWriterHDF5Mesh import DataWriterHDF5Mesh
+from pylith.meshio.DataWriterHDF5SubMesh import DataWriterHDF5SubMesh
+from pylith.meshio.DataWriterHDF5SubSubMesh import DataWriterHDF5SubSubMesh
+
+# ----------------------------------------------------------------------
+class TestDataWriterHDF5Mesh(unittest.TestCase):
+ """
+ Unit testing of Python DataWriterHDF5Mesh object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ filter = DataWriterHDF5Mesh()
+ filter._configure()
+ return
+
+
+ def test_initialize(self):
+ """
+ Test constructor.
+ """
+ filter = DataWriterHDF5Mesh()
+ filter._configure()
+
+ from spatialdata.units.Nondimensional import Nondimensional
+ normalizer = Nondimensional()
+ filter.initialize(normalizer)
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.meshio.DataWriterHDF5Mesh import data_writer
+ filter = data_writer()
+ return
+
+
+# ----------------------------------------------------------------------
+class TestDataWriterHDF5SubMesh(unittest.TestCase):
+ """
+ Unit testing of Python DataWriterHDF5 object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ filter = DataWriterHDF5SubMesh()
+ filter._configure()
+ return
+
+
+ def test_initialize(self):
+ """
+ Test constructor.
+ """
+ filter = DataWriterHDF5SubMesh()
+ filter._configure()
+
+ from spatialdata.units.Nondimensional import Nondimensional
+ normalizer = Nondimensional()
+ filter.initialize(normalizer)
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.meshio.DataWriterHDF5SubMesh import data_writer
+ filter = data_writer()
+ return
+
+
+# ----------------------------------------------------------------------
+class TestDataWriterHDF5SubSubMesh(unittest.TestCase):
+ """
+ Unit testing of Python DataWriterHDF5 object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ filter = DataWriterHDF5SubSubMesh()
+ filter._configure()
+ return
+
+
+ def test_initialize(self):
+ """
+ Test constructor.
+ """
+ filter = DataWriterHDF5SubSubMesh()
+ filter._configure()
+
+ from spatialdata.units.Nondimensional import Nondimensional
+ normalizer = Nondimensional()
+ filter.initialize(normalizer)
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.meshio.DataWriterHDF5SubSubMesh import data_writer
+ filter = data_writer()
+ return
+
+
+# End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterVTK.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterVTK.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/TestDataWriterVTK.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -58,8 +58,8 @@
"""
Test factory method.
"""
- from pylith.meshio.DataWriterVTKMesh import output_data_writer
- filter = output_data_writer()
+ from pylith.meshio.DataWriterVTKMesh import data_writer
+ filter = data_writer()
return
@@ -95,8 +95,8 @@
"""
Test factory method.
"""
- from pylith.meshio.DataWriterVTKSubMesh import output_data_writer
- filter = output_data_writer()
+ from pylith.meshio.DataWriterVTKSubMesh import data_writer
+ filter = data_writer()
return
@@ -132,8 +132,8 @@
"""
Test factory method.
"""
- from pylith.meshio.DataWriterVTKSubSubMesh import output_data_writer
- filter = output_data_writer()
+ from pylith.meshio.DataWriterVTKSubSubMesh import data_writer
+ filter = data_writer()
return
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/testmeshio.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/testmeshio.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/meshio/testmeshio.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -89,6 +89,15 @@
from TestDataWriterVTK import TestDataWriterVTKSubSubMesh
suite.addTest(unittest.makeSuite(TestDataWriterVTKSubSubMesh))
+ from TestDataWriterHDF5 import TestDataWriterHDF5Mesh
+ suite.addTest(unittest.makeSuite(TestDataWriterHDF5Mesh))
+
+ from TestDataWriterHDF5 import TestDataWriterHDF5SubMesh
+ suite.addTest(unittest.makeSuite(TestDataWriterHDF5SubMesh))
+
+ from TestDataWriterHDF5 import TestDataWriterHDF5SubSubMesh
+ suite.addTest(unittest.makeSuite(TestDataWriterHDF5SubSubMesh))
+
from TestOutputManagerMesh import TestOutputManagerMesh
suite.addTest(unittest.makeSuite(TestOutputManagerMesh))
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -42,7 +42,8 @@
TestJacobian.py \
TestMeshGenerator.py \
TestMeshGenSimple.py \
- TestMeshImporter.py
+ TestMeshImporter.py \
+ TestRefineUniform.py
noinst_tmp = \
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/TestRefineUniform.py (from rev 17287, short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/TestRefineUniform.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/TestRefineUniform.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# 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 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/topology/TestRefineUniform.py
+
+## @brief Unit testing of Python RefineUniform object.
+
+import unittest
+
+from pylith.topology.RefineUniform import RefineUniform
+
+from pylith.topology.RefineUniform import RefineUniform
+
+# ----------------------------------------------------------------------
+class TestRefineUniform(unittest.TestCase):
+ """
+ Unit testing of Python RefineUniform object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ io = RefineUniform()
+ return
+
+
+ def test_refineTet4NoFault(self):
+ """
+ Test refine().
+ """
+ filenameIn = "data/twotet4.mesh"
+ filenameOut = "data/twotet4_test.mesh"
+ filenameOutE = "data/twotet4_nofault_refined2.mesh"
+
+ self._runTest(filenameIn, filenameOut, filenameOutE)
+ return
+
+
+ def test_refineTet4Fault(self):
+ """
+ Test refine().
+ """
+ filenameIn = "data/twotet4.mesh"
+ filenameOut = "data/twotet4_test.mesh"
+ filenameOutE = "data/twotet4_fault_refined2.mesh"
+
+ self._runTest(filenameIn, filenameOut, filenameOutE, "fault")
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.topology.RefineUniform import mesh_refiner
+ refiner = mesh_refiner()
+ return
+
+
+ def _runTest(self, filenameIn, filenameOut, filenameOutE, faultGroup=None):
+
+ from spatialdata.geocoords.CSCart import CSCart
+ cs = CSCart()
+ cs._configure()
+
+ from pylith.meshio.MeshIOAscii import MeshIOAscii
+ io = MeshIOAscii()
+ io.inventory.filename = filenameIn
+ io.inventory.coordsys = cs
+ io._configure()
+
+ mesh = io.read(debug=True, interpolate=False)
+
+ if not faultGroup is None:
+ from pylith.faults.FaultCohesiveKin import FaultCohesiveKin
+ fault = FaultCohesiveKin()
+ fault.inventory.matId = 10
+ fault.inventory.faultLabel = faultGroup
+ fault._configure()
+
+ nvertices = fault.numVertices(mesh)
+ firstFaultVertex = 0
+ firstLagrangeVertex = nvertices
+ firstFaultCell = 2*nvertices
+ fault.adjustTopology(mesh,
+ firstFaultVertex,
+ firstLagrangeVertex,
+ firstFaultCell)
+
+ from pylith.topology.RefineUniform import RefineUniform
+ refiner = RefineUniform()
+ meshRefined = refiner.refine(mesh)
+
+ meshRefined.view("MESH")
+
+ return
+
+
+
+# End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/Makefile.am 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/Makefile.am 2010-10-15 23:45:21 UTC (rev 17288)
@@ -17,7 +17,8 @@
#
dist_noinst_DATA = \
- tri3.mesh
+ tri3.mesh \
+ twotet4.mesh
noinst_TMP =
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/twotet4.mesh (from rev 17287, short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4.mesh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/twotet4.mesh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/data/twotet4.mesh 2010-10-15 23:45:21 UTC (rev 17288)
@@ -0,0 +1,110 @@
+// Global mesh object.
+// This defines a mesh composed of two tetrahedral elements.
+mesh = {
+
+ // This is a 3D mesh.
+ dimension = 3
+
+ // We are using zero-indexing (default) rather than one-indexing.
+ use-index-zero = true
+
+ // Describe the vertices (nodes) defining the mesh.
+ vertices = {
+
+ // The vertices are defined in a 3D coordinate system.
+ dimension = 3
+
+ // There are 5 vertices.
+ count = 5
+
+ // List the coordinates as:
+ // Vertex number (starting from zero), x-coord, y-coord, z-coord
+ // Use coordinate units that are consistent with the other units used.
+ coordinates = {
+ 0 -1.0 0.0 0.0
+ 1 0.0 -1.0 0.0
+ 2 0.0 0.0 1.0
+ 3 0.0 1.0 0.0
+ 4 1.0 0.0 0.0
+ }
+ }
+
+ // Describe the cells (elements) composing the mesh.
+ cells = {
+
+ // There are 2 cells.
+ count = 2
+
+ // These are linear tetrahedral cells, so there are 4 corners per cell.
+ num-corners = 4
+
+ // List the vertices composing each cell (see manual for ordering).
+ // List the information as:
+ // Cell number (starting from zero), vertex 0, vertex 1, vertex 2, vertex 3
+ simplices = {
+ 0 1 2 3 0
+ 1 1 3 2 4
+ }
+
+ // List the material ID's associated with each cell.
+ // Different ID's may be used to specify a different material type, or
+ // to use a different spatial database for each material ID.
+ // In this example, cells 0 and 1 both are associated with material ID 1.
+ material-ids = {
+ 0 1
+ 1 2
+ }
+ }
+
+ // Here we list different groups (cells or vertices) that we want to associate
+ // with a particular name (ID).
+
+ // This group of vertices may be used to define a fault.
+ // There are 3 vertices corresponding to indices 1, 2 and 3.
+ group = {
+ name = fault
+ type = vertices
+ count = 3
+ indices = {
+ 1
+ 2
+ 3
+ }
+ }
+
+ // This group of vertices may be used to specify boundary conditions.
+ // There are 2 vertices corresponding to indices 0 and 4.
+ group = {
+ name = end points
+ type = vertices
+ count = 2
+ indices = {
+ 0
+ 4
+ }
+ }
+
+ // This group of vertices may be used to specify boundary conditions.
+ // There are 2 vertices corresponding to indices 0, 1.
+ group = {
+ name = edge 1
+ type = vertices
+ count = 2
+ indices = {
+ 0
+ 1
+ }
+ }
+
+ // This group of vertices may be used to specify boundary conditions.
+ // There are 2 vertices corresponding to indices 2, 4.
+ group = {
+ name = edge 2
+ type = vertices
+ count = 2
+ indices = {
+ 2
+ 4
+ }
+ }
+}
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/testtopology.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/testtopology.py 2010-10-15 23:14:27 UTC (rev 17287)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/topology/testtopology.py 2010-10-15 23:45:21 UTC (rev 17288)
@@ -87,6 +87,9 @@
from TestMeshImporter import TestMeshImporter
suite.addTest(unittest.makeSuite(TestMeshImporter))
+ from TestRefineUniform import TestRefineUniform
+ suite.addTest(unittest.makeSuite(TestRefineUniform))
+
return suite
More information about the CIG-COMMITS
mailing list