[cig-commits] r7767 - in short/3D/PyLith/trunk: libsrc/bc modulesrc/bc pylith/bc unittests/libtests/bc unittests/libtests/bc/data

willic3 at geodynamics.org willic3 at geodynamics.org
Tue Jul 31 20:51:43 PDT 2007


Author: willic3
Date: 2007-07-31 20:51:42 -0700 (Tue, 31 Jul 2007)
New Revision: 7767

Added:
   short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8b.spatialdb
Modified:
   short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh
   short/3D/PyLith/trunk/libsrc/bc/Dirichlet.cc
   short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh
   short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
   short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
   short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichlet.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletMulti.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.hh
Log:
More work on traction BC unit tests, but they are not ready yet.
Also changed top-level BC to include upDir vector.



Modified: short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh	2007-08-01 03:51:42 UTC (rev 7767)
@@ -97,7 +97,8 @@
    */
   virtual
   void initialize(const ALE::Obj<ALE::Mesh>& mesh,
-		  const spatialdata::geocoords::CoordSys* cs) = 0;
+		  const spatialdata::geocoords::CoordSys* cs,
+		  const double_array& upDir) = 0;
 
   // NOT IMPLEMENTED ////////////////////////////////////////////////////
 private :

Modified: short/3D/PyLith/trunk/libsrc/bc/Dirichlet.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Dirichlet.cc	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/libsrc/bc/Dirichlet.cc	2007-08-01 03:51:42 UTC (rev 7767)
@@ -37,7 +37,8 @@
 // Initialize boundary condition.
 void
 pylith::bc::Dirichlet::initialize(const ALE::Obj<ALE::Mesh>& mesh,
-				  const spatialdata::geocoords::CoordSys* cs)
+				  const spatialdata::geocoords::CoordSys* cs,
+				  const double_array& upDir)
 { // initialize
   assert(0 != _db);
   assert(!mesh.isNull());

Modified: short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh	2007-08-01 03:51:42 UTC (rev 7767)
@@ -65,7 +65,8 @@
    * @param cs Coordinate system for mesh
    */
   void initialize(const ALE::Obj<ALE::Mesh>& mesh,
-		  const spatialdata::geocoords::CoordSys* cs);
+		  const spatialdata::geocoords::CoordSys* cs,
+		  const double_array& upDir);
 
   /** Set number of degrees of freedom that are constrained at points in field.
    *

Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src	2007-08-01 03:51:42 UTC (rev 7767)
@@ -66,12 +66,12 @@
     return
 
 
-  def initialize(self, mesh, cs):
+  def initialize(self, mesh, cs, upDir):
     """
     Initialize boundary condition.
     """
     # create shim for method 'initialize'
-    #embed{ void BoundaryCondition_initialize(void* objVptr, void* meshVptr, void* csVptr)
+    #embed{ void BoundaryCondition_initialize(void* objVptr, void* meshVptr, void* csVptr, double* upDirPtr)
     try {
       assert(0 != objVptr);
       assert(0 != meshVptr);
@@ -79,7 +79,11 @@
       ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
       spatialdata::geocoords::CoordSys* cs =
         (spatialdata::geocoords::CoordSys*) csVptr;
-      ((pylith::bc::BoundaryCondition*) objVptr)->initialize(*mesh, cs);
+      pylith::double_array upDir(3);
+      upDir[0] = upDirPtr[0];
+      upDir[1] = upDirPtr[1];
+      upDir[2] = upDirPtr[2];
+      ((pylith::bc::BoundaryCondition*) objVptr)->initialize(*mesh, cs, upDir);
     } catch (const std::exception& err) {
       PyErr_SetString(PyExc_RuntimeError,
                       const_cast<char*>(err.what()));
@@ -100,7 +104,14 @@
       raise TypeError, \
             "Argument must be extension module type " \
             "'spatialdata::geocoords::CoordSys'."
-    BoundaryCondition_initialize(self.thisptr, ptrFromHandle(mesh), ptrFromHandle(cs))
+    if 3 != len(upDir):
+      raise TypeError, \
+            "Argument 'upDir' must be a 3 vector (list)."
+    cdef double upDirCpp[3]
+    upDirCpp[0] = upDir[0]
+    upDirCpp[1] = upDir[1]
+    upDirCpp[2] = upDir[2]
+    BoundaryCondition_initialize(self.thisptr, ptrFromHandle(mesh), ptrFromHandle(cs), upDirCpp)
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py	2007-08-01 03:51:42 UTC (rev 7767)
@@ -24,6 +24,23 @@
 
 from pyre.components.Component import Component
 
+# Validator for direction
+def validateDir(value):
+  """
+  Validate direction.
+  """
+  msg = "Direction must be a 3 component vector (list)."
+  if not isinstance(value, list):
+    raise ValueError(msg)
+  if 3 != len(value):
+    raise ValueError(msg)
+  try:
+    nums = map(float, value)
+  except:
+    raise ValueError(msg)
+  return value
+
+
 # BoundaryCondition class
 class BoundaryCondition(Component):
   """
@@ -60,6 +77,12 @@
     label = pyre.inventory.str("label", default="")
     label.meta['tip'] = "Name identifier for object face."
 
+    upDir = pyre.inventory.list("up_dir", default=[0, 0, 1],
+		                validator=validateDir)
+    upDir.meta['tip'] = "Direction perpendicular to horizontal " \
+		        "tangent direction that is not collinear " \
+			"with normal direction."
+
     from spatialdata.spatialdb.SimpleDB import SimpleDB
     db = pyre.inventory.facility("db", factory=SimpleDB,
                                  args=["db"])
@@ -103,7 +126,8 @@
     self.db.initialize()
     self.cppHandle.db = self.db.cppHandle    
     self.cppHandle.initialize(self.mesh.cppHandle,
-                              self.mesh.coordsys.cppHandle)
+                              self.mesh.coordsys.cppHandle,
+			      self.upDir)
     return
 
 
@@ -116,6 +140,7 @@
     Component._configure(self)
     self.id = self.inventory.id
     self.label = self.inventory.label
+    self.upDir = self.inventory.upDir
     self.db = self.inventory.db
     return
 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichlet.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichlet.cc	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichlet.cc	2007-08-01 03:51:42 UTC (rev 7767)
@@ -279,12 +279,14 @@
   db.ioHandler(&dbIO);
 
   int_array fixedDOF(_data->fixedDOF, _data->numFixedDOF);
+  const double upDirVals[] = { 0.0, 0.0, 1.0 };
+  double_array upDir(upDirVals, 3);
 
   bc->id(_data->id);
   bc->label(_data->label);
   bc->db(&db);
   bc->fixedDOF(fixedDOF);
-  bc->initialize(*mesh, &cs);
+  bc->initialize(*mesh, &cs, upDir);
 } // _initialize
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletMulti.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletMulti.cc	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletMulti.cc	2007-08-01 03:51:42 UTC (rev 7767)
@@ -184,12 +184,14 @@
   db.ioHandler(&dbIO);
 
   int_array fixedDOFA(_data->fixedDOFA, _data->numFixedDOFA);
+  const double upDirVals[] = { 0.0, 0.0, 1.0 };
+  double_array upDir(upDirVals, 3);
 
   bcA->id(_data->idA);
   bcA->label(_data->labelA);
   bcA->db(&db);
   bcA->fixedDOF(fixedDOFA);
-  bcA->initialize(*mesh, &cs);
+  bcA->initialize(*mesh, &cs, upDir);
 
   // Setup boundary condition B
   dbIO.filename(_data->dbFilenameB);
@@ -201,7 +203,7 @@
   bcB->label(_data->labelB);
   bcB->db(&db);
   bcB->fixedDOF(fixedDOFB);
-  bcB->initialize(*mesh, &cs);
+  bcB->initialize(*mesh, &cs, upDir);
 } // _initialize
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc	2007-08-01 03:51:42 UTC (rev 7767)
@@ -17,6 +17,8 @@
 #include "pylith/bc/Neumann.hh" // USES Neumann
 
 #include "data/NeumannData.hh" // USES NeumannData
+#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
+#include "pylith/topology/FieldsManager.hh" // USES FieldsManager
 #include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
 #include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
 
@@ -58,14 +60,16 @@
 void
 pylith::bc::TestNeumann::testInitialize(void)
 { // testInitialize
+#if 0
   ALE::Obj<Mesh> mesh;
   Neumann bc;
-  _initialize(&mesh, &bc);
+  topology::FieldsManager fields(mesh);
+  _initialize(&mesh, &bc, &fields);
 
   CPPUNIT_ASSERT(0 != _data);
 
   // Check submesh
-  CPPUNIT_ASSERT_EQUAL(_data.boundaryCellDim, _boundaryMesh->getDimension());
+  CPPUNIT_ASSERT_EQUAL(_data.cellDim, _boundaryMesh->getDimension());
   CPPUNIT_ASSERT_EQUAL(_data.numBoundaryCells, cells->size());
   int iCell = 0;
   for(Mesh::label_sequence::iterator c_iter = cells->begin();
@@ -105,6 +109,7 @@
       } // for
     } // for
   } // for
+#endif
 
 } // testInitialize
 
@@ -113,6 +118,7 @@
 void
 pylith::bc::TestNeumann::testIntegrateResidual(void)
 { // testIntegrateResidual
+#if 0
   CPPUNIT_ASSERT(0 != _data);
 
   ALE::Obj<Mesh> mesh;
@@ -140,14 +146,19 @@
     else
       CPPUNIT_ASSERT_DOUBLES_EQUAL(valsE[i], vals[i], tolerance);
 
+#endif
 } // testIntegrateResidual
 
 // ----------------------------------------------------------------------
 void
 pylith::bc::TestNeumann::_initialize(ALE::Obj<Mesh>* mesh,
-				     Neumann* const bc,
-				     topology::FieldsManager* fields) const
+				     Neumann* const bc) const
+
+// Maybe need to deal with fields inside integrateResidual
+				     // Neumann* const bc,
+				     // topology::FieldsManager* fields) const
 { // _initialize
+#if 0
   CPPUNIT_ASSERT(0 != _data);
   CPPUNIT_ASSERT(0 != mesh);
   CPPUNIT_ASSERT(0 != bc);
@@ -196,6 +207,7 @@
   bc->label(_data->label);
   bc->db(&db);
   bc->initialize(*mesh, &cs, upDir);
+#endif
 } // _initialize
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh	2007-08-01 03:51:42 UTC (rev 7767)
@@ -71,6 +71,7 @@
 protected :
 
   NeumannData* _data; ///< Data for testing
+  feassemble::Quadrature* _quadrature; ///< Data used in testing.
 
   // PRIVATE METHODS ////////////////////////////////////////////////////
 private :
@@ -82,6 +83,9 @@
    */
   void _initialize(ALE::Obj<ALE::Mesh>* mesh,
 		   Neumann* const bc) const;
+		   // Maybe need to deal with fields in integrateResidual.
+		   // Neumann* const bc,
+		   // topology::FieldsManager* fields) const;
 
 }; // class TestNeumann
 

Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.cc	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.cc	2007-08-01 03:51:42 UTC (rev 7767)
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestNeumannHex8.hh" // Implementation of class methods
+
+#include "data/NeumannDataHex8.hh" // USES NeumannDataHex8
+
+#include "pylith/feassemble/Quadrature2Din3D.hh" // USES Quadrature2Din3D
+#include "pylith/feassemble/GeometryQuad3D.hh" // USES GeometryQuad3D
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestNeumannHex8 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestNeumannHex8::setUp(void)
+{ // setUp
+  _data = new NeumannDataHex8();
+  _quadrature = new feassemble::Quadrature2Din3D();
+  CPPUNIT_ASSERT(0 != _quadrature);
+  feassemble::GeometryQuad3D geometry;
+  _quadrature->refGeometry(&geometry);
+} // setUp
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.hh	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumannHex8.hh	2007-08-01 03:51:42 UTC (rev 7767)
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestNeumannHex8.hh
+ *
+ * @brief C++ TestNeumann object.
+ *
+ * C++ unit testing for Neumann for mesh with 3-D hex cells.
+ */
+
+#if !defined(pylith_bc_testneumannhex8_hh)
+#define pylith_bc_testneumannhex8_hh
+
+#include "TestNeumann.hh" // ISA TestNeumann
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace bc {
+    class TestNeumannHex8;
+  } // bc
+} // pylith
+
+/// C++ unit testing for Neumann for mesh with 3-D hex cells.
+class pylith::bc::TestNeumannHex8 : public TestNeumann
+{ // class TestNeumann
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestNeumannHex8 );
+  CPPUNIT_TEST( testInitialize );
+  CPPUNIT_TEST( testIntegrateResidual );
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Setup testing data.
+  void setUp(void);
+
+}; // class TestNeumannHex8
+
+#endif // pylith_bc_neumannhex8_hh
+
+
+// End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am	2007-08-01 03:51:42 UTC (rev 7767)
@@ -21,7 +21,9 @@
 	tet4.mesh \
 	tet4.spatialdb \
 	hex8.mesh \
-	hex8.spatialdb
+	hex8.spatialdb \
+	hex8b.mesh \
+	hex8b.spatialdb
 
 # 'export' the input files by performing a mock install
 export_datadir = $(top_builddir)/unittests/libtests/bc/data

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.cc	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.cc	2007-08-01 03:51:42 UTC (rev 7767)
@@ -10,27 +10,36 @@
 // ======================================================================
 //
 
-#include "DirichletData.hh"
+#include "NeumannData.hh"
 
 // ----------------------------------------------------------------------
 // Constructor
-pylith::bc::DirichletData::DirichletData(void) :
-  numDOF(0),
-  numFixedDOF(0),
-  numConstrainedPts(0),
+pylith::bc::NeumannData::NeumannData(void) :
+  meshFilename(0),
+  spaceDim(0),
+  cellDim(0),
+  numBasis(0),
+  numQuadPts(0),
+  quadPts(0),
+  quadWts(0),
+  basis(0),
+  basisDeriv(0),
+  verticesRef(0),
   id(0),
   label(0),
-  fixedDOF(0),
-  constrainedPoints(0),
-  values(0),
-  meshFilename(0),
-  dbFilename(0)
+  dbFilename(0),
+  numBoundaryCells(0),
+  numVertices(0),
+  numCorners(0),
+  cells(0),
+  tractionCell(0),
+  valsResidual(0)
 { // constructor
 } // constructor
 
 // ----------------------------------------------------------------------
 // Destructor
-pylith::bc::DirichletData::~DirichletData(void)
+pylith::bc::NeumannData::~NeumannData(void)
 { // destructor
 } // destructor
 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.hh	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannData.hh	2007-08-01 03:51:42 UTC (rev 7767)
@@ -34,23 +34,39 @@
 // PUBLIC MEMBERS ///////////////////////////////////////////////////////
 public:
 
-  int numDOF; ///< Number of degrees of freedom at each point.
-  int boundaryCellDim; ///< Dimension of surface cells.
-  int numBoundaryCells; ///< Number of cells on Neumann boundary.
-  int numBoundaryVertices; ///< Number of vertices on Neumann boundary.
-  int numVertices; ///< Number of vertices in the mesh.
+  char* meshFilename; ///< Filename for input mesh.
+
+  /// @name Quadrature information
+  //@{
   int spaceDim; ///< Spatial dimension for the problem.
+  int cellDim; ///< Dimension of surface cells.
+  int numBasis; ///< Number of basis functions for surface cells.
+  int numQuadPts; ///< Number of quadrature points per boundary cell.
+  double* quadPts; ///< Coordinates of quadrature points in ref cell.
+  double* quadWts; ///< Weights of quadrature points.
+  double* basis; ///< Cell basis functions at quad points.
+  double* basisDeriv; ///< Derivatives of cell basis functions at quad points.
+  double* verticesRef; ///< Coordinates of vertices in ref cell (dual basis).
+  //@}
 
+  /// @name BC information
+  //@{
   int id; ///< Boundary condition identifier
   char* label; ///< Label for boundary condition group
+  char* dbFilename; ///< Filename of simple spatial database.
+  //@}
 
-  int* numCorners; ///< Array defining the number of vertices for each
-                   /// boundary cell.
-  int* cells; ///< Array of vertices defining each boundary cell.
-  double* tractionVals; ///< Traction values at specified points.
+  /// @name Calculated values.
+  //@{
+  int numBoundaryCells; ///< Expected number of cells on Neumann boundary.
+  int numVertices; ///< Expected number of vertices in the mesh.
+  int* numCorners; ///< Expected number of vertices for each boundary cell.
+  int* cells; ///< Expected array of vertices defining each boundary cell.
+  double* tractionCell; ///< Expected traction values at quadrature points.
+  double* valsResidual; ///< Expected residual at each vertex.
+  //@}
 
-  char* meshFilename; ///< Filename for input mesh.
-  char* dbFilename; ///< Filename of simple spatial database.
+
 };
 
 #endif // pylith_bc_neumanndata_hh

Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.cc	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.cc	2007-08-01 03:51:42 UTC (rev 7767)
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/* Mesh: hex8b.mesh
+ *
+ * Neumann BC on faces defined by vertices 0, 2, 4, 6, 8, 10.
+ *
+ * Constant value of 4 Pa horizontal shear applied on both faces.
+ * Since each face has an area of 2 m^2, we should obtain the following
+ * values:
+ * 2 N in x-direction:  Vertices 0, 2, 8, 10
+ * 4 N in x-direction:  Vertices 4, 6.
+ */
+
+#include "NeumannDataHex8.hh"
+
+const char* pylith::bc::NeumannDataHex8::_meshFilename = 
+  "data/hex8b.mesh";
+const int pylith::bc::NeumannDataHex8::_spaceDim = 3;
+const int pylith::bc::NeumannDataHex8::_cellDim = 2;
+const int pylith::bc::NeumannDataHex8::_numBasis = 4;
+const int pylith::bc::NeumannDataHex8::_numQuadPts = 4;
+const double pylith::bc::NeumannDataHex8::_quadPts[] = {
+  -0.57735027, -0.57735027,
+  +0.57735027, -0.57735027,
+  +0.57735027, +0.57735027,
+  -0.57735027, +0.57735027,
+};
+const double pylith::bc::NeumannDataHex8::_quadWts[] = {
+  1.0, 1.0, 1.0, 1.0
+};
+const double pylith::bc::NeumannDataHex8::_basis[] = {
+  0.62200847,  0.16666667,  0.16666667,  0.0446582,
+  0.16666667,  0.62200847,  0.0446582,   0.16666667,
+  0.16666667,  0.0446582,   0.62200847,  0.16666667,
+  0.0446582,   0.16666667,  0.16666667,  0.62200847,
+};
+const double pylith::bc::NeumannDataHex8::_basisDeriv[] = {
+  -0.39433757, -0.39433757,
+  +0.39433757, -0.10566243,
+  +0.10566243, +0.10566243,
+  -0.10566243, +0.39433757,
+
+  -0.39433757, -0.10566243,
+  +0.39433757, -0.39433757,
+  +0.10566243, +0.39433757,
+  -0.10566243, +0.10566243,
+
+  -0.10566243, -0.10566243,
+  +0.10566243, -0.39433757,
+  +0.39433757, +0.39433757,
+  -0.39433757, +0.10566243,
+
+  -0.10566243, -0.39433757,
+  +0.10566243, -0.10566243,
+  +0.39433757, +0.10566243,
+  -0.39433757, +0.39433757,
+};
+const double pylith::bc::NeumannDataHex8::_verticesRef[] = {
+  -1.0, -1.0,
+  +1.0, -1.0,
+  +1.0, +1.0,
+  -1.0, +1.0
+};
+
+const int pylith::bc::NeumannDataHex8::_id = 0;
+const char* pylith::bc::NeumannDataHex8::_label = "tractionVerts";
+const char* pylith::bc::NeumannDataHex8::_dbFilename =
+  "data/hex8b.spatialdb";
+
+const int pylith::bc::NeumannDataHex8::_numBoundaryCells = 2;
+const int pylith::bc::NeumannDataHex8::_numVertices = 12;
+const int pylith::bc::NeumannDataHex8::_numCorners[] = { 4, 4 };
+const int pylith::bc::NeumannDataHex8::_cells[] = { 0,  4,  6,  2,
+						    4,  8, 10,  6 };
+const double pylith::bc::NeumannDataHex8::_tractionCell[] = { 1.0, 0.0, 0.0,
+							      1.0, 0.0, 0.0,
+							      1.0, 0.0, 0.0,
+							      1.0, 0.0, 0.0,
+							      1.0, 0.0, 0.0,
+							      1.0, 0.0, 0.0,
+							      1.0, 0.0, 0.0,
+							      1.0, 0.0, 0.0};
+const double pylith::bc::NeumannDataHex8::_valsResidual[] = { 2.0, 0.0, 0.0,
+							      0.0, 0.0, 0.0,
+							      2.0, 0.0, 0.0,
+							      0.0, 0.0, 0.0,
+							      4.0, 0.0, 0.0,
+							      0.0, 0.0, 0.0,
+							      4.0, 0.0, 0.0,
+							      0.0, 0.0, 0.0,
+							      2.0, 0.0, 0.0,
+							      0.0, 0.0, 0.0,
+							      2.0, 0.0, 0.0,
+							      0.0, 0.0, 0.0};
+
+
+pylith::bc::NeumannDataHex8::NeumannDataHex8(void)
+{ // constructor
+  meshFilename = const_cast<char*>(_meshFilename);
+  spaceDim = _spaceDim;
+  cellDim = _cellDim;
+  numBasis = _numBasis;
+  numQuadPts = _numQuadPts;
+  quadPts = const_cast<double*>(_quadPts);
+  quadWts = const_cast<double*>(_quadWts);
+  basis = const_cast<double*>(_basis);
+  basisDeriv = const_cast<double*>(_basisDeriv);
+  verticesRef = const_cast<double*>(_verticesRef);
+  id = _id;
+  label = const_cast<char*>(_label);
+  dbFilename = const_cast<char*>(_dbFilename);
+  numBoundaryCells = _numBoundaryCells;
+  numVertices = _numVertices;
+  numCorners = const_cast<int*>(_numCorners);
+  cells = const_cast<int*>(_cells);
+  tractionCell = const_cast<double*>(_tractionCell);
+  valsResidual = const_cast<double*>(_valsResidual);
+
+} // constructor
+
+pylith::bc::NeumannDataHex8::~NeumannDataHex8(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.hh	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/NeumannDataHex8.hh	2007-08-01 03:51:42 UTC (rev 7767)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_bc_dirichletdatahex8_hh)
+#define pylith_bc_dirichletdatahex8_hh
+
+#include "DirichletData.hh"
+
+namespace pylith {
+  namespace bc {
+     class DirichletDataHex8;
+  } // pylith
+} // bc
+
+class pylith::bc::DirichletDataHex8 : public DirichletData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  DirichletDataHex8(void);
+
+  /// Destructor
+  ~DirichletDataHex8(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+  static const int _numDOF; ///< Number of degrees of freedom at each point.
+
+  static const int _numFixedDOF; ///< Number of fixedDOF at constrained points.
+  static const int _numConstrainedPts; ///< Number of points constrained.
+
+  static const int _id; ///< Boundary condition identifier
+  static const char* _label; /// Label for boundary condition group
+
+  static const int _fixedDOF[]; ///< Degrees of freedom constrained at points
+
+  static const int _constrainedPoints[]; ///< Array of indices of constrained pts.
+  static const double _values[]; ///< Values at constrained points.
+
+  static const char* _meshFilename; ///< Filename of input mesh.
+  static const char* _dbFilename; ///< Filename of simple spatial database.
+};
+
+#endif // pylith_bc_dirichletdatahex8_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8b.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8b.spatialdb	2007-07-31 21:56:41 UTC (rev 7766)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8b.spatialdb	2007-08-01 03:51:42 UTC (rev 7767)
@@ -0,0 +1,14 @@
+#SPATIAL.ascii 1
+SimpleDB {
+  num-values = 3
+  value-names =  horiz-shear-traction vert-shear-traction normal-traction
+  value-units =  Pa  Pa  Pa
+  num-locs = 1
+  data-dim = 0
+  space-dim = 3
+  cs-data = cartesian {
+    to-meters = 1.0
+    space-dim = 3
+  }
+}
+ 0.0  0.0  0.0    4.0  0.0  0.0



More information about the cig-commits mailing list