[cig-commits] [commit] baagaard/remove-1d: Remove 1-D stuff from modules, python, and Python unit tests. (10bcfba)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Thu Nov 7 11:12:37 PST 2013
Repository : ssh://geoshell/pylith
On branch : baagaard/remove-1d
Link : https://github.com/geodynamics/pylith/compare/dc231f802ca59232e7b593c07305f68a70c2cfe3...10bcfba6a95bb40194bae7f5118dcec6ecec37ea
>---------------------------------------------------------------
commit 10bcfba6a95bb40194bae7f5118dcec6ecec37ea
Author: Brad Aagaard <baagaard at usgs.gov>
Date: Thu Nov 7 11:15:01 2013 -0800
Remove 1-D stuff from modules, python, and Python unit tests.
>---------------------------------------------------------------
10bcfba6a95bb40194bae7f5118dcec6ecec37ea
modulesrc/feassemble/CellGeometry.i | 1 -
modulesrc/feassemble/GeometryLine1D.i | 106 -----------
modulesrc/feassemble/GeometryPoint1D.i | 106 -----------
modulesrc/feassemble/GeometryPoint2D.i | 106 -----------
modulesrc/feassemble/GeometryPoint3D.i | 106 -----------
modulesrc/feassemble/Makefile.am | 4 -
modulesrc/feassemble/feassemble.i | 8 -
pylith/feassemble/CellGeometry.py | 68 --------
pylith/feassemble/FIATLagrange.py | 11 +-
pylith/feassemble/FIATSimplex.py | 11 +-
unittests/pytests/feassemble/TestCellGeometry.py | 8 +-
unittests/pytests/feassemble/TestFIATLagrange.py | 191 --------------------
unittests/pytests/feassemble/TestFIATSimplex.py | 193 ---------------------
unittests/pytests/feassemble/TestMeshQuadrature.py | 42 -----
unittests/pytests/materials/Makefile.am | 2 -
unittests/pytests/materials/TestElasticMaterial.py | 4 +-
unittests/pytests/materials/TestElasticStrain1D.py | 101 -----------
unittests/pytests/materials/TestElasticStress1D.py | 101 -----------
unittests/pytests/materials/TestMaterial.py | 8 +-
unittests/pytests/materials/testmaterials.py | 6 -
20 files changed, 12 insertions(+), 1171 deletions(-)
diff --git a/modulesrc/feassemble/CellGeometry.i b/modulesrc/feassemble/CellGeometry.i
index 94135b3..18eb6ec 100644
--- a/modulesrc/feassemble/CellGeometry.i
+++ b/modulesrc/feassemble/CellGeometry.i
@@ -31,7 +31,6 @@ namespace pylith {
public :
enum ShapeEnum {
- POINT=0, // 0-D point cell
LINE=2, // 1-D line cell (2 points)
TRIANGLE=4, // 2-D triangular cell (3 edges)
QUADRILATERAL=5, // 2-D quadrilateral cell (4 edges)
diff --git a/modulesrc/feassemble/GeometryLine1D.i b/modulesrc/feassemble/GeometryLine1D.i
deleted file mode 100644
index a9fdd56..0000000
--- a/modulesrc/feassemble/GeometryLine1D.i
+++ /dev/null
@@ -1,106 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard, U.S. Geological Survey
-// Charles A. Williams, GNS Science
-// Matthew G. Knepley, University of Chicago
-//
-// This code was developed as part of the Computational Infrastructure
-// for Geodynamics (http://geodynamics.org).
-//
-// Copyright (c) 2010-2013 University of California, Davis
-//
-// See COPYING for license information.
-//
-// ======================================================================
-//
-
-/** @file modulesrc/feassemble/GeometryLine1D.i
- *
- * @brief Python interface to C++ GeometryLine1D object.
- */
-
-namespace pylith {
- namespace feassemble {
-
- class GeometryLine1D : public CellGeometry
- { // GeometryLine1D
-
- // PUBLIC METHODS /////////////////////////////////////////////////
- public :
-
- /// Default constructor.
- GeometryLine1D(void);
-
- /// Default destructor.
- ~GeometryLine1D(void);
-
- /** Create a copy of geometry.
- *
- * @returns Copy of geometry.
- */
- CellGeometry* clone(void) const;
-
- /** Get cell geometry for lower dimension cell.
- *
- * @returns Pointer to cell geometry object corresponding to next
- * lower dimension, NULL if there is no lower dimension object.
- */
- CellGeometry* geometryLowerDim(void) const;
-
- /** Transform coordinates in reference cell to global coordinates.
- *
- * @param ptsGlobal Array of points in global coordinate system.
- * @param ptsRef Array of points in reference cell.
- * @param vertices Array of cell vertices in global coordinates.
- * @param dim Dimension of global coordinate system.
- * @param npts Number of points to transform.
- */
- void ptsRefToGlobal(PylithScalar* ptsGlobal,
- const PylithScalar* ptsRef,
- const PylithScalar* vertices,
- const int dim,
- const int npts =1) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param numVertices Number of vertices in cell.
- * @param spaceDim Spatial dimension of coordinates.
- * @param location Location in reference cell at which to compute Jacobian.
- * @param cellDim Dimension of reference cell.
- */
- void jacobian(pylith::scalar_array* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const int numVertices,
- const int spaceDim,
- const PylithScalar* location,
- const int cellDim) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param ptsRef Points in reference cell at which to compute Jacobian.
- * @param dim Dimension of coordinate system.
- * @param npts Number of points to transform.
- */
- void jacobian(PylithScalar* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const PylithScalar* ptsRef,
- const int dim,
- const int npts =1) const;
-
- }; // GeometryLine1D
-
- } // feassemble
-} // pylith
-
-
-// End of file
diff --git a/modulesrc/feassemble/GeometryPoint1D.i b/modulesrc/feassemble/GeometryPoint1D.i
deleted file mode 100644
index a5402bb..0000000
--- a/modulesrc/feassemble/GeometryPoint1D.i
+++ /dev/null
@@ -1,106 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard, U.S. Geological Survey
-// Charles A. Williams, GNS Science
-// Matthew G. Knepley, University of Chicago
-//
-// This code was developed as part of the Computational Infrastructure
-// for Geodynamics (http://geodynamics.org).
-//
-// Copyright (c) 2010-2013 University of California, Davis
-//
-// See COPYING for license information.
-//
-// ======================================================================
-//
-
-/** @file modulesrc/feassemble/GeometryPoint1D.i
- *
- * @brief Python interface to C++ GeometryPoint1D object.
- */
-
-namespace pylith {
- namespace feassemble {
-
- class GeometryPoint1D : public CellGeometry
- { // GeometryPoint1D
-
- // PUBLIC METHODS /////////////////////////////////////////////////
- public :
-
- /// Default constructor.
- GeometryPoint1D(void);
-
- /// Default destructor.
- ~GeometryPoint1D(void);
-
- /** Create a copy of geometry.
- *
- * @returns Copy of geometry.
- */
- CellGeometry* clone(void) const;
-
- /** Get cell geometry for lower dimension cell.
- *
- * @returns Pointer to cell geometry object corresponding to next
- * lower dimension, NULL if there is no lower dimension object.
- */
- CellGeometry* geometryLowerDim(void) const;
-
- /** Transform coordinates in reference cell to global coordinates.
- *
- * @param ptsGlobal Array of points in global coordinate system.
- * @param ptsRef Array of points in reference cell.
- * @param vertices Array of cell vertices in global coordinates.
- * @param dim Dimension of global coordinate system.
- * @param npts Number of points to transform.
- */
- void ptsRefToGlobal(PylithScalar* ptsGlobal,
- const PylithScalar* ptsRef,
- const PylithScalar* vertices,
- const int dim,
- const int npts =1) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param numVertices Number of vertices in cell.
- * @param spaceDim Spatial dimension of coordinates.
- * @param location Location in reference cell at which to compute Jacobian.
- * @param cellDim Dimension of reference cell.
- */
- void jacobian(pylith::scalar_array* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const int numVertices,
- const int spaceDim,
- const PylithScalar* location,
- const int cellDim) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param ptsRef Points in reference cell at which to compute Jacobian.
- * @param dim Dimension of coordinate system.
- * @param npts Number of points to transform.
- */
- void jacobian(PylithScalar* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const PylithScalar* ptsRef,
- const int dim,
- const int npts =1) const;
-
- }; // GeometryPoint1D
-
- } // feassemble
-} // pylith
-
-
-// End of file
diff --git a/modulesrc/feassemble/GeometryPoint2D.i b/modulesrc/feassemble/GeometryPoint2D.i
deleted file mode 100644
index 35cc8ac..0000000
--- a/modulesrc/feassemble/GeometryPoint2D.i
+++ /dev/null
@@ -1,106 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard, U.S. Geological Survey
-// Charles A. Williams, GNS Science
-// Matthew G. Knepley, University of Chicago
-//
-// This code was developed as part of the Computational Infrastructure
-// for Geodynamics (http://geodynamics.org).
-//
-// Copyright (c) 2010-2013 University of California, Davis
-//
-// See COPYING for license information.
-//
-// ======================================================================
-//
-
-/** @file modulesrc/feassemble/GeometryPoint2D.i
- *
- * @brief Python interface to C++ GeometryPoint2D object.
- */
-
-namespace pylith {
- namespace feassemble {
-
- class GeometryPoint2D : public CellGeometry
- { // GeometryPoint2D
-
- // PUBLIC METHODS /////////////////////////////////////////////////
- public :
-
- /// Default constructor.
- GeometryPoint2D(void);
-
- /// Default destructor.
- ~GeometryPoint2D(void);
-
- /** Create a copy of geometry.
- *
- * @returns Copy of geometry.
- */
- CellGeometry* clone(void) const;
-
- /** Get cell geometry for lower dimension cell.
- *
- * @returns Pointer to cell geometry object corresponding to next
- * lower dimension, NULL if there is no lower dimension object.
- */
- CellGeometry* geometryLowerDim(void) const;
-
- /** Transform coordinates in reference cell to global coordinates.
- *
- * @param ptsGlobal Array of points in global coordinate system.
- * @param ptsRef Array of points in reference cell.
- * @param vertices Array of cell vertices in global coordinates.
- * @param dim Dimension of global coordinate system.
- * @param npts Number of points to transform.
- */
- void ptsRefToGlobal(PylithScalar* ptsGlobal,
- const PylithScalar* ptsRef,
- const PylithScalar* vertices,
- const int dim,
- const int npts =1) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param numVertices Number of vertices in cell.
- * @param spaceDim Spatial dimension of coordinates.
- * @param location Location in reference cell at which to compute Jacobian.
- * @param cellDim Dimension of reference cell.
- */
- void jacobian(pylith::scalar_array* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const int numVertices,
- const int spaceDim,
- const PylithScalar* location,
- const int cellDim) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param ptsRef Points in reference cell at which to compute Jacobian.
- * @param dim Dimension of coordinate system.
- * @param npts Number of points to transform.
- */
- void jacobian(PylithScalar* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const PylithScalar* ptsRef,
- const int dim,
- const int npts =1) const;
-
- }; // GeometryPoint2D
-
- } // feassemble
-} // pylith
-
-
-// End of file
diff --git a/modulesrc/feassemble/GeometryPoint3D.i b/modulesrc/feassemble/GeometryPoint3D.i
deleted file mode 100644
index a83bb5d..0000000
--- a/modulesrc/feassemble/GeometryPoint3D.i
+++ /dev/null
@@ -1,106 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard, U.S. Geological Survey
-// Charles A. Williams, GNS Science
-// Matthew G. Knepley, University of Chicago
-//
-// This code was developed as part of the Computational Infrastructure
-// for Geodynamics (http://geodynamics.org).
-//
-// Copyright (c) 2010-2013 University of California, Davis
-//
-// See COPYING for license information.
-//
-// ======================================================================
-//
-
-/** @file modulesrc/feassemble/GeometryPoint3D.i
- *
- * @brief Python interface to C++ GeometryPoint3D object.
- */
-
-namespace pylith {
- namespace feassemble {
-
- class GeometryPoint3D : public CellGeometry
- { // GeometryPoint3D
-
- // PUBLIC METHODS /////////////////////////////////////////////////
- public :
-
- /// Default constructor.
- GeometryPoint3D(void);
-
- /// Default destructor.
- ~GeometryPoint3D(void);
-
- /** Create a copy of geometry.
- *
- * @returns Copy of geometry.
- */
- CellGeometry* clone(void) const;
-
- /** Get cell geometry for lower dimension cell.
- *
- * @returns Pointer to cell geometry object corresponding to next
- * lower dimension, NULL if there is no lower dimension object.
- */
- CellGeometry* geometryLowerDim(void) const;
-
- /** Transform coordinates in reference cell to global coordinates.
- *
- * @param ptsGlobal Array of points in global coordinate system.
- * @param ptsRef Array of points in reference cell.
- * @param vertices Array of cell vertices in global coordinates.
- * @param dim Dimension of global coordinate system.
- * @param npts Number of points to transform.
- */
- void ptsRefToGlobal(PylithScalar* ptsGlobal,
- const PylithScalar* ptsRef,
- const PylithScalar* vertices,
- const int dim,
- const int npts =1) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param numVertices Number of vertices in cell.
- * @param spaceDim Spatial dimension of coordinates.
- * @param location Location in reference cell at which to compute Jacobian.
- * @param cellDim Dimension of reference cell.
- */
- void jacobian(pylith::scalar_array* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const int numVertices,
- const int spaceDim,
- const PylithScalar* location,
- const int cellDim) const;
-
- /** Compute Jacobian at location in cell.
- *
- * @param jacobian Jacobian at location.
- * @param det Determinant of Jacobian at location.
- * @param vertices Coordinates of vertices of cell.
- * @param ptsRef Points in reference cell at which to compute Jacobian.
- * @param dim Dimension of coordinate system.
- * @param npts Number of points to transform.
- */
- void jacobian(PylithScalar* jacobian,
- PylithScalar* det,
- const PylithScalar* vertices,
- const PylithScalar* ptsRef,
- const int dim,
- const int npts =1) const;
-
- }; // GeometryPoint3D
-
- } // feassemble
-} // pylith
-
-
-// End of file
diff --git a/modulesrc/feassemble/Makefile.am b/modulesrc/feassemble/Makefile.am
index 3723fd7..4e0ba1e 100644
--- a/modulesrc/feassemble/Makefile.am
+++ b/modulesrc/feassemble/Makefile.am
@@ -26,10 +26,6 @@ subpkgpyexec_PYTHON = feassemble.py
swig_sources = \
feassemble.i \
CellGeometry.i \
- GeometryPoint1D.i \
- GeometryPoint2D.i \
- GeometryPoint3D.i \
- GeometryLine1D.i \
GeometryLine2D.i \
GeometryLine3D.i \
GeometryTri2D.i \
diff --git a/modulesrc/feassemble/feassemble.i b/modulesrc/feassemble/feassemble.i
index aa35281..fbd45f1 100644
--- a/modulesrc/feassemble/feassemble.i
+++ b/modulesrc/feassemble/feassemble.i
@@ -22,10 +22,6 @@
// Header files for module C++ code
%{
#include "pylith/feassemble/CellGeometry.hh"
-#include "pylith/feassemble/GeometryPoint1D.hh"
-#include "pylith/feassemble/GeometryPoint2D.hh"
-#include "pylith/feassemble/GeometryPoint3D.hh"
-#include "pylith/feassemble/GeometryLine1D.hh"
#include "pylith/feassemble/GeometryLine2D.hh"
#include "pylith/feassemble/GeometryLine3D.hh"
#include "pylith/feassemble/GeometryTri2D.hh"
@@ -72,10 +68,6 @@ import_array();
%}
%include "CellGeometry.i"
-%include "GeometryPoint1D.i"
-%include "GeometryPoint2D.i"
-%include "GeometryPoint3D.i"
-%include "GeometryLine1D.i"
%include "GeometryLine2D.i"
%include "GeometryLine3D.i"
%include "GeometryTri2D.i"
diff --git a/pylith/feassemble/CellGeometry.py b/pylith/feassemble/CellGeometry.py
index 2098167..2cdc31a 100644
--- a/pylith/feassemble/CellGeometry.py
+++ b/pylith/feassemble/CellGeometry.py
@@ -39,74 +39,6 @@ class CellGeometry(object):
# ----------------------------------------------------------------------
-# GeometryPoint1D class
-class GeometryPoint1D(feassemble.GeometryPoint1D):
- """
- Python object for geometry of a 0-D finite-element cell in 1-D.
- """
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self):
- """
- Constructor.
- """
- feassemble.GeometryPoint1D.__init__(self)
- return
-
-
-# ----------------------------------------------------------------------
-# GeometryPoint2D class
-class GeometryPoint2D(feassemble.GeometryPoint2D):
- """
- Python object for geometry of a 0-D finite-element cell in 2-D.
- """
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self):
- """
- Constructor.
- """
- feassemble.GeometryPoint2D.__init__(self)
- return
-
-
-# ----------------------------------------------------------------------
-# GeometryPoint3D class
-class GeometryPoint3D(feassemble.GeometryPoint3D):
- """
- Python object for geometry of a 0-D finite-element cell in 3-D.
- """
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self):
- """
- Constructor.
- """
- feassemble.GeometryPoint3D.__init__(self)
- return
-
-
-# ----------------------------------------------------------------------
-# GeometryLine1D class
-class GeometryLine1D(feassemble.GeometryLine1D):
- """
- Python object for geometry of a 1-D finite-element cell in 1-D.
- """
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self):
- """
- Constructor.
- """
- feassemble.GeometryLine1D.__init__(self)
- return
-
-
-# ----------------------------------------------------------------------
# GeometryLine2D class
class GeometryLine2D(feassemble.GeometryLine2D):
"""
diff --git a/pylith/feassemble/FIATLagrange.py b/pylith/feassemble/FIATLagrange.py
index e411a71..b16c394 100644
--- a/pylith/feassemble/FIATLagrange.py
+++ b/pylith/feassemble/FIATLagrange.py
@@ -445,19 +445,10 @@ class FIATLagrange(ReferenceCell):
elif 3 == spaceDim:
self.geometry = CellGeometry.GeometryQuad3D()
elif 1 == self.cellDim:
- if 1 == spaceDim:
- self.geometry = CellGeometry.GeometryLine1D()
- elif 2 == spaceDim:
+ if 2 == spaceDim:
self.geometry = CellGeometry.GeometryLine2D()
elif 3 == spaceDim:
self.geometry = CellGeometry.GeometryLine3D()
- elif 0 == self.cellDim:
- if 1 == spaceDim:
- self.geometry = CellGeometry.GeometryPoint1D()
- elif 2 == spaceDim:
- self.geometry = CellGeometry.GeometryPoint2D()
- elif 3 == spaceDim:
- self.geometry = CellGeometry.GeometryPoint3D()
if None == self.geometry:
raise ValueError("Could not set shape of %dD cell for "
"Quadrature object '%s' in spatial " \
diff --git a/pylith/feassemble/FIATSimplex.py b/pylith/feassemble/FIATSimplex.py
index cb88957..4185410 100644
--- a/pylith/feassemble/FIATSimplex.py
+++ b/pylith/feassemble/FIATSimplex.py
@@ -237,19 +237,10 @@ class FIATSimplex(ReferenceCell):
elif 3 == spaceDim:
self.geometry = CellGeometry.GeometryTri3D()
elif self.cellDim == 1:
- if 1 == spaceDim:
- self.geometry = CellGeometry.GeometryLine1D()
- elif 2 == spaceDim:
+ if 2 == spaceDim:
self.geometry = CellGeometry.GeometryLine2D()
elif 3 == spaceDim:
self.geometry = CellGeometry.GeometryLine3D()
- elif self.cellDim == 0:
- if 1 == spaceDim:
- self.geometry = CellGeometry.GeometryPoint1D()
- elif 2 == spaceDim:
- self.geometry = CellGeometry.GeometryPoint2D()
- elif 3 == spaceDim:
- self.geometry = CellGeometry.GeometryPoint3D()
if None == self.geometry:
raise ValueError("Could not set geometry of cell with dimension '%d' for '%s' in spatial " \
"dimension '%s'." % (self.cellDim, self.name, spaceDim))
diff --git a/unittests/pytests/feassemble/TestCellGeometry.py b/unittests/pytests/feassemble/TestCellGeometry.py
index 763a205..bce14ba 100644
--- a/unittests/pytests/feassemble/TestCellGeometry.py
+++ b/unittests/pytests/feassemble/TestCellGeometry.py
@@ -23,7 +23,7 @@
import unittest
import numpy
-from pylith.feassemble.CellGeometry import GeometryPoint1D
+from pylith.feassemble.CellGeometry import GeometryLine2D
# ----------------------------------------------------------------------
@@ -37,9 +37,9 @@ class TestCellGeometry(unittest.TestCase):
Test constructors for cell geometry objects.
"""
- geometry = GeometryPoint1D()
- self.assertEqual(0, geometry.cellDim())
- self.assertEqual(1, geometry.spaceDim())
+ geometry = GeometryLine2D()
+ self.assertEqual(1, geometry.cellDim())
+ self.assertEqual(2, geometry.spaceDim())
return
diff --git a/unittests/pytests/feassemble/TestFIATLagrange.py b/unittests/pytests/feassemble/TestFIATLagrange.py
index 1e9ffe5..705fbba 100644
--- a/unittests/pytests/feassemble/TestFIATLagrange.py
+++ b/unittests/pytests/feassemble/TestFIATLagrange.py
@@ -26,141 +26,6 @@ from pylith.feassemble.FIATLagrange import FIATLagrange
from pylith.utils.testarray import test_scalararray
# ----------------------------------------------------------------------
-class Line2(object):
-
- def __init__(self):
- """
- Setup line2 cell.
- """
- vertices = numpy.array([[-1.0], [1.0]])
- quadPts = numpy.array( [[0.0]],
- dtype=numpy.float64 )
- quadWts = numpy.array( [2.0], dtype=numpy.float64 )
-
- # Compute basis fns and derivatives at quadrature points
- basis = numpy.zeros( (1, 2), dtype=numpy.float64)
- basisDeriv = numpy.zeros( (1, 2, 1), dtype=numpy.float64)
- iQuad = 0
- for q in quadPts:
- basis[iQuad] = numpy.array([self.N0(q), self.N1(q)],
- dtype=numpy.float64).reshape( (2,) )
- deriv = numpy.array([[self.N0p(q)], [self.N1p(q)]],
- dtype=numpy.float64)
- basisDeriv[iQuad] = deriv.reshape((2, 1))
- iQuad += 1
-
- self.cellDim = 1
- 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*(1.0-p)
-
- def N0p(self, p):
- return -0.5
-
- def N1(self, p):
- return 0.5*(1.0+p)
-
- def N1p(self, p):
- return 0.5
-
-
-# ----------------------------------------------------------------------
-class Line2Collocated(Line2):
-
- def __init__(self):
- """
- Setup line2 cell.
- """
- vertices = numpy.array([[-1.0], [1.0]])
- quadPts = vertices[:]
- quadWts = numpy.array( [1.0,1.0], dtype=numpy.float64 )
-
- # Compute basis fns and derivatives at quadrature points
- basis = numpy.zeros( (2, 2), dtype=numpy.float64)
- basisDeriv = numpy.zeros( (2, 2, 1), dtype=numpy.float64)
- iQuad = 0
- for q in quadPts:
- basis[iQuad] = numpy.array([self.N0(q), self.N1(q)],
- dtype=numpy.float64).reshape( (2,) )
- deriv = numpy.array([[self.N0p(q)], [self.N1p(q)]],
- dtype=numpy.float64)
- basisDeriv[iQuad] = deriv.reshape((2, 1))
- iQuad += 1
-
- self.cellDim = 1
- self.numCorners = len(vertices)
- self.numQuadPts = len(quadPts)
- self.vertices = vertices
- self.quadPts = quadPts
- self.quadWts = quadWts
- self.basis = basis
- self.basisDeriv = basisDeriv
- return
-
-
-# ----------------------------------------------------------------------
-class Line3(object):
-
- def __init__(self):
- """
- Setup line3 cell.
- """
- vertices = numpy.array([[-1.0], [1.0], [0.0]])
- quadPts = numpy.array([ [-1.0/3**0.5],
- [+1.0/3**0.5] ])
- quadWts = numpy.array( [1.0, 1.0])
-
- # Compute basis fns and derivatives at quadrature points
- basis = numpy.zeros( (2, 3), dtype=numpy.float64)
- basisDeriv = numpy.zeros( (2, 3, 1), dtype=numpy.float64)
- iQuad = 0
- 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)]])
- basisDeriv[iQuad] = deriv.reshape((3, 1))
- iQuad += 1
-
- self.cellDim = 1
- 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*(1.0-p)
-
- def N0p(self, p):
- return 1.0*p - 0.5
-
- def N1(self, p):
- return 0.5*p*(1.0+p)
-
- def N1p(self, p):
- return 1.0*p + 0.5
-
- def N2(self, p):
- return (1.0-p*p)
-
- def N2p(self, p):
- return -2.0*p
-
-
-# ----------------------------------------------------------------------
class Quad4(object):
def __init__(self):
@@ -1130,62 +995,6 @@ class TestFIATLagrange(unittest.TestCase):
Unit testing of FIATLagrange object.
"""
- def test_initialize_line2(self):
- """
- Test initialize() with line2 cell.
- """
- cell = FIATLagrange()
- cell.inventory.dimension = 1
- cell.inventory.degree = 1
- cell.inventory.order = 1
- cell._configure()
- cell.initialize(spaceDim=1)
-
- cellE = Line2()
- self._checkVals(cellE, cell)
- from pylith.feassemble.CellGeometry import GeometryLine1D
- self.failUnless(isinstance(cell.geometry, GeometryLine1D))
- return
-
-
- def test_initialize_line2_collocated(self):
- """
- Test initialize() with line2 cell.
- """
- cell = FIATLagrange()
- cell.inventory.dimension = 1
- cell.inventory.degree = 1
- cell.inventory.order = 1
- cell.inventory.collocateQuad = True
- cell._configure()
- cell.initialize(spaceDim=1)
-
-
- cellE = Line2Collocated()
- self._checkVals(cellE, cell)
- from pylith.feassemble.CellGeometry import GeometryLine1D
- self.failUnless(isinstance(cell.geometry, GeometryLine1D))
- return
-
-
- def test_initialize_line3(self):
- """
- Test initialize() with line3 cell.
- """
- cell = FIATLagrange()
- cell.inventory.dimension = 1
- cell.inventory.degree = 2
- cell.inventory.order = 2
- cell._configure()
- cell.initialize(spaceDim=2)
-
- cellE = Line3()
- self._checkVals(cellE, cell)
- from pylith.feassemble.CellGeometry import GeometryLine2D
- self.failUnless(isinstance(cell.geometry, GeometryLine2D))
- return
-
-
def test_initialize_quad4(self):
"""
Test initialize() with quad4 cell.
diff --git a/unittests/pytests/feassemble/TestFIATSimplex.py b/unittests/pytests/feassemble/TestFIATSimplex.py
index 251bf59..d22e3e8 100644
--- a/unittests/pytests/feassemble/TestFIATSimplex.py
+++ b/unittests/pytests/feassemble/TestFIATSimplex.py
@@ -26,144 +26,6 @@ from pylith.feassemble.FIATSimplex import FIATSimplex
from pylith.utils.testarray import test_scalararray
# ----------------------------------------------------------------------
-class Line2(object):
-
- def __init__(self):
- """
- Setup line2 cell.
- """
- vertices = numpy.array([[-1.0], [1.0]])
- quadPts = numpy.array( [[0.0]],
- dtype=numpy.float64 )
- quadWts = numpy.array( [2.0], dtype=numpy.float64 )
-
- # Compute basis fns and derivatives at quadrature points
- basis = numpy.zeros( (1, 2), dtype=numpy.float64)
- basisDeriv = numpy.zeros( (1, 2, 1), dtype=numpy.float64)
- iQuad = 0
- for q in quadPts:
- basis[iQuad] = numpy.array([self.N0(q), self.N1(q)],
- dtype=numpy.float64).reshape( (2,) )
- deriv = numpy.array([[self.N0p(q)], [self.N1p(q)]],
- dtype=numpy.float64)
- basisDeriv[iQuad] = deriv.reshape((2, 1))
- iQuad += 1
-
- self.cellDim = 1
- 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*(1.0-p)
-
- def N0p(self, p):
- return -0.5
-
- def N1(self, p):
- return 0.5*(1.0+p)
-
- def N1p(self, p):
- return 0.5
-
-# ----------------------------------------------------------------------
-class Line2Collocated(Line2):
-
- def __init__(self):
- """
- Setup line2 cell.
- """
- vertices = numpy.array([[-1.0], [1.0]])
- quadPts = vertices[:]
- quadWts = numpy.array( [1.0, 1.0], dtype=numpy.float64 )
-
- # Compute basis fns and derivatives at quadrature points
- basis = numpy.zeros( (2, 2), dtype=numpy.float64)
- basisDeriv = numpy.zeros( (2, 2, 1), dtype=numpy.float64)
- iQuad = 0
- for q in quadPts:
- basis[iQuad] = numpy.array([self.N0(q), self.N1(q)],
- dtype=numpy.float64).reshape( (2,) )
- deriv = numpy.array([[self.N0p(q)], [self.N1p(q)]],
- dtype=numpy.float64)
- basisDeriv[iQuad] = deriv.reshape((2, 1))
- iQuad += 1
-
- self.cellDim = 1
- self.numCorners = len(vertices)
- self.numQuadPts = len(quadPts)
- self.vertices = vertices
- self.quadPts = quadPts
- self.quadWts = quadWts
- self.basis = basis
- self.basisDeriv = basisDeriv
- return
-
-
-# ----------------------------------------------------------------------
-class Line3(object):
-
- def __init__(self):
- """
- Setup line3 cell.
- """
- vertices = numpy.array([[-1.0], [1.0], [0.0]])
- quadPts = numpy.array([ [-1.0/3**0.5],
- [+1.0/3**0.5] ])
- quadWts = numpy.array( [1.0, 1.0])
-
- # Compute basis fns and derivatives at quadrature points
- basis = numpy.zeros( (2, 3), dtype=numpy.float64)
- basisDeriv = numpy.zeros( (2, 3, 1), dtype=numpy.float64)
- iQuad = 0
- 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)]])
- basisDeriv[iQuad] = deriv.reshape((3, 1))
- iQuad += 1
-
- self.cellDim = 1
- 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*(1.0-p)
-
- def N0p(self, p):
- return 1.0*p - 0.5
-
-
- def N1(self, p):
- return 0.5*p*(1.0+p)
-
- def N1p(self, p):
- return 1.0*p + 0.5
-
-
- def N2(self, p):
- return (1.0-p*p)
-
- def N2p(self, p):
- return -2.0*p
-
-
-# ----------------------------------------------------------------------
class Tri3(object):
def __init__(self):
@@ -535,61 +397,6 @@ class TestFIATSimplex(unittest.TestCase):
return
- def test_initialize_line2(self):
- """
- Test initialize() with line2 cell.
- """
- cell = FIATSimplex()
- cell.inventory.dimension = 1
- cell.inventory.degree = 1
- cell.inventory.order = 1
- cell._configure()
- cell.initialize(spaceDim=1)
-
- cellE = Line2()
- self._checkVals(cellE, cell)
- from pylith.feassemble.CellGeometry import GeometryLine1D
- self.failUnless(isinstance(cell.geometry, GeometryLine1D))
- return
-
-
- def test_initialize_line2_collodated(self):
- """
- Test initialize() with line2 cell.
- """
- cell = FIATSimplex()
- cell.inventory.dimension = 1
- cell.inventory.degree = 1
- cell.inventory.order = 1
- cell.inventory.collocateQuad = True
- cell._configure()
- cell.initialize(spaceDim=1)
-
- cellE = Line2Collocated()
- self._checkVals(cellE, cell)
- from pylith.feassemble.CellGeometry import GeometryLine1D
- self.failUnless(isinstance(cell.geometry, GeometryLine1D))
- return
-
-
- def test_initialize_line3(self):
- """
- Test initialize() with line3 cell.
- """
- cell = FIATSimplex()
- cell.inventory.dimension = 1
- cell.inventory.degree = 2
- cell.inventory.order = 2
- cell._configure()
- cell.initialize(spaceDim=2)
-
- cellE = Line3()
- self._checkVals(cellE, cell)
- from pylith.feassemble.CellGeometry import GeometryLine2D
- self.failUnless(isinstance(cell.geometry, GeometryLine2D))
- return
-
-
def test_initialize_tri3(self):
"""
Test initialize() with tri3 cell.
diff --git a/unittests/pytests/feassemble/TestMeshQuadrature.py b/unittests/pytests/feassemble/TestMeshQuadrature.py
index 1d756b4..3cd27b7 100644
--- a/unittests/pytests/feassemble/TestMeshQuadrature.py
+++ b/unittests/pytests/feassemble/TestMeshQuadrature.py
@@ -147,27 +147,6 @@ class TestMeshQuadrature(unittest.TestCase):
return
- def test_simplex1D(self):
- """
- Test setup of quadrature for simplex cells for a 1-D problem.
- """
- spaceDim = 1
-
- cell = FIATSimplex()
- cell.inventory.dimension = 1
- cell._configure()
-
- quadrature = Quadrature()
- quadrature.inventory.cell = cell
- quadrature._configure()
-
- quadrature.preinitialize(spaceDim)
- self.assertEqual(1, quadrature.cellDim())
- self.assertEqual(spaceDim, quadrature.spaceDim())
- self.assertEqual(2, quadrature.numBasis())
- return
-
-
def test_simplex2D(self):
"""
Test setup of quadrature for simplex cells for a 2-D problem.
@@ -210,27 +189,6 @@ class TestMeshQuadrature(unittest.TestCase):
return
- def test_lagrange1D(self):
- """
- Test setup of quadrature for Lagrange cells for a 1-D problem.
- """
- spaceDim = 1
-
- cell = FIATLagrange()
- cell.inventory.dimension = 1
- cell._configure()
-
- quadrature = Quadrature()
- quadrature.inventory.cell = cell
- quadrature._configure()
-
- quadrature.preinitialize(spaceDim)
- self.assertEqual(1, quadrature.cellDim())
- self.assertEqual(spaceDim, quadrature.spaceDim())
- self.assertEqual(2, quadrature.numBasis())
- return
-
-
def test_lagrange2D(self):
"""
Test setup of quadrature for Lagrange cells for a 2-D problem.
diff --git a/unittests/pytests/materials/Makefile.am b/unittests/pytests/materials/Makefile.am
index 2e4f3bb..46f675e 100644
--- a/unittests/pytests/materials/Makefile.am
+++ b/unittests/pytests/materials/Makefile.am
@@ -30,8 +30,6 @@ noinst_PYTHON = \
TestHomogeneous.py \
TestMaterial.py \
TestElasticMaterial.py \
- TestElasticStrain1D.py \
- TestElasticStress1D.py \
TestElasticPlaneStrain.py \
TestElasticPlaneStress.py \
TestElasticIsotropic3D.py \
diff --git a/unittests/pytests/materials/TestElasticMaterial.py b/unittests/pytests/materials/TestElasticMaterial.py
index 29e658c..6d9c5fb 100644
--- a/unittests/pytests/materials/TestElasticMaterial.py
+++ b/unittests/pytests/materials/TestElasticMaterial.py
@@ -32,8 +32,8 @@ class TestElasticMaterial(unittest.TestCase):
"""
Setup test subject.
"""
- from pylith.materials.ElasticStrain1D import ElasticStrain1D
- self.material = ElasticStrain1D()
+ from pylith.materials.ElasticPlaneStrain import ElasticPlaneStrain
+ self.material = ElasticPlaneStrain()
return
diff --git a/unittests/pytests/materials/TestElasticStrain1D.py b/unittests/pytests/materials/TestElasticStrain1D.py
deleted file mode 100644
index 871ae58..0000000
--- a/unittests/pytests/materials/TestElasticStrain1D.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/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-2013 University of California, Davis
-#
-# See COPYING for license information.
-#
-# ======================================================================
-#
-
-## @file unittests/pytests/materials/TestElasticStrain1D.py
-
-## @brief Unit testing of ElasticStrain1D object.
-
-import unittest
-
-from pylith.materials.ElasticStrain1D import ElasticStrain1D
-
-# ----------------------------------------------------------------------
-class TestElasticStrain1D(unittest.TestCase):
- """
- Unit testing of ElasticStrain1D object.
- """
-
- def setUp(self):
- """
- Setup test subject.
- """
- self.material = ElasticStrain1D()
- return
-
-
- def test_constructor(self):
- """
- Test constructor.
- """
- self.assertEqual(1, self.material.dimension())
- return
-
-
- def test_useElasticBehavior(self):
- """
- Test useElasticBehavior().
- """
- self.material.useElasticBehavior(False)
- return
-
-
- def testHasStateVars(self):
- self.failIf(self.material.hasStateVars())
- return
-
-
- def testTensorSize(self):
- self.assertEqual(1, self.material.tensorSize())
- return
-
-
- def testNeedNewJacobian(self):
- """
- Test needNewJacobian().
- """
- # Default should be False.
- self.failIf(self.material.needNewJacobian())
-
- # Changing time step should not require new Jacobian.
- self.material.timeStep(1.0)
- self.material.timeStep(2.0)
- self.failIf(self.material.needNewJacobian())
- return
-
-
- def testStableTimeStepImplicit(self):
- """
- Test stableTimeStepImplicit().
- """
- from pylith.topology.Mesh import Mesh
- mesh = Mesh()
- dt = self.material.stableTimeStepImplicit(mesh)
- from pylith.utils.utils import maxdouble
- self.assertAlmostEqual(1.0, dt/maxdouble())
-
-
- def test_factory(self):
- """
- Test factory method.
- """
- from pylith.materials.ElasticStrain1D import material
- m = material()
- return
-
-
-# End of file
diff --git a/unittests/pytests/materials/TestElasticStress1D.py b/unittests/pytests/materials/TestElasticStress1D.py
deleted file mode 100644
index 9fb359a..0000000
--- a/unittests/pytests/materials/TestElasticStress1D.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/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-2013 University of California, Davis
-#
-# See COPYING for license information.
-#
-# ======================================================================
-#
-
-## @file unittests/pytests/materials/TestElasticStress1D.py
-
-## @brief Unit testing of ElasticStress1D object.
-
-import unittest
-
-from pylith.materials.ElasticStress1D import ElasticStress1D
-
-# ----------------------------------------------------------------------
-class TestElasticStress1D(unittest.TestCase):
- """
- Unit testing of ElasticStress1D object.
- """
-
- def setUp(self):
- """
- Setup test subject.
- """
- self.material = ElasticStress1D()
- return
-
-
- def test_constructor(self):
- """
- Test constructor.
- """
- self.assertEqual(1, self.material.dimension())
- return
-
-
- def test_useElasticBehavior(self):
- """
- Test useElasticBehavior().
- """
- self.material.useElasticBehavior(False)
- return
-
-
- def testHasStateVars(self):
- self.failIf(self.material.hasStateVars())
- return
-
-
- def testTensorSize(self):
- self.assertEqual(1, self.material.tensorSize())
- return
-
-
- def testNeedNewJacobian(self):
- """
- Test needNewJacobian().
- """
- # Default should be False.
- self.failIf(self.material.needNewJacobian())
-
- # Changing time step should not require new Jacobian.
- self.material.timeStep(1.0)
- self.material.timeStep(2.0)
- self.failIf(self.material.needNewJacobian())
- return
-
-
- def testStableTimeStepImplicit(self):
- """
- Test stableTimeStepImplicit().
- """
- from pylith.topology.Mesh import Mesh
- mesh = Mesh()
- dt = self.material.stableTimeStepImplicit(mesh)
- from pylith.utils.utils import maxdouble
- self.assertAlmostEqual(1.0, dt/maxdouble())
-
-
- def test_factory(self):
- """
- Test factory method.
- """
- from pylith.materials.ElasticStress1D import material
- m = material()
- return
-
-
-# End of file
diff --git a/unittests/pytests/materials/TestMaterial.py b/unittests/pytests/materials/TestMaterial.py
index aa3d4b5..feea39a 100644
--- a/unittests/pytests/materials/TestMaterial.py
+++ b/unittests/pytests/materials/TestMaterial.py
@@ -32,8 +32,8 @@ class TestMaterial(unittest.TestCase):
"""
Setup test subject.
"""
- from pylith.materials.ElasticStrain1D import ElasticStrain1D
- self.material = ElasticStrain1D()
+ from pylith.materials.ElasticPlaneStrain import ElasticPlaneStrain
+ self.material = ElasticPlaneStrain()
return
@@ -162,8 +162,8 @@ class TestMaterial(unittest.TestCase):
db.inventory.iohandler = iohandler
db._configure()
- from pylith.materials.ElasticStrain1D import ElasticStrain1D
- material = ElasticStrain1D()
+ from pylith.materials.ElasticPlaneStrain import ElasticPlaneStrain
+ material = ElasticPlaneStrain()
material.inventory.quadrature = quadrature
material.inventory.dbProperties = db
material.inventory.label = "my material"
diff --git a/unittests/pytests/materials/testmaterials.py b/unittests/pytests/materials/testmaterials.py
index 25e3aa0..27f582b 100755
--- a/unittests/pytests/materials/testmaterials.py
+++ b/unittests/pytests/materials/testmaterials.py
@@ -63,12 +63,6 @@ class TestApp(Script):
suite = unittest.TestSuite()
- from TestElasticStrain1D import TestElasticStrain1D
- suite.addTest(unittest.makeSuite(TestElasticStrain1D))
-
- from TestElasticStress1D import TestElasticStress1D
- suite.addTest(unittest.makeSuite(TestElasticStress1D))
-
from TestElasticPlaneStrain import TestElasticPlaneStrain
suite.addTest(unittest.makeSuite(TestElasticPlaneStrain))
More information about the CIG-COMMITS
mailing list