[cig-commits] r16100 - in short/3D/PyLith/trunk/unittests/libtests/faults: . data

brad at geodynamics.org brad at geodynamics.org
Sun Dec 13 15:03:04 PST 2009


Author: brad
Date: 2009-12-13 15:03:04 -0800 (Sun, 13 Dec 2009)
New Revision: 16100

Added:
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh
Modified:
   short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh
Log:
More work on setting up friction unit tests.

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2009-12-13 21:02:07 UTC (rev 16099)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2009-12-13 23:03:04 UTC (rev 16100)
@@ -45,6 +45,7 @@
 	TestFaultCohesiveKinSrcsQuad4.cc \
 	TestFaultCohesiveKinSrcsTet4.cc \
 	TestFaultCohesiveKinSrcsHex8.cc \
+	TestFaultCohesiveDynL.cc \
 	test_faults.cc
 
 
@@ -71,7 +72,8 @@
 	TestFaultCohesiveKinSrcsTri3.hh \
 	TestFaultCohesiveKinSrcsQuad4.hh \
 	TestFaultCohesiveKinSrcsTet4.hh \
-	TestFaultCohesiveKinSrcsHex8.hh
+	TestFaultCohesiveKinSrcsHex8.hh \
+	TestFaultCohesiveDynL.hh
 
 # Source files associated with testing data
 testfaults_SOURCES += \
@@ -128,7 +130,8 @@
 	data/CohesiveKinSrcsDataTri3.cc \
 	data/CohesiveKinSrcsDataQuad4.cc \
 	data/CohesiveKinSrcsDataTet4.cc \
-	data/CohesiveKinSrcsDataHex8.cc
+	data/CohesiveKinSrcsDataHex8.cc \
+	data/CohesiveDynLData.cc
 
 noinst_HEADERS += \
 	data/CohesiveData.hh \
@@ -184,7 +187,8 @@
 	data/CohesiveKinSrcsDataTri3.hh \
 	data/CohesiveKinSrcsDataQuad4.hh \
 	data/CohesiveKinSrcsDataTet4.hh \
-	data/CohesiveKinSrcsDataHex8.hh
+	data/CohesiveKinSrcsDataHex8.hh \
+	data/CohesiveDynLData.hh
 
 AM_CPPFLAGS = \
 	$(PYTHON_EGG_CPPFLAGS) -I$(PYTHON_INCDIR) \

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc	2009-12-13 21:02:07 UTC (rev 16099)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc	2009-12-13 23:03:04 UTC (rev 16100)
@@ -80,10 +80,10 @@
   FaultCohesiveDynL fault;
 
   const std::string& label = "test database";
-  spatialdata::spatialdb::UniformDB db;
+  spatialdata::spatialdb::SimpleDB db;
   db.label(label.c_str());
   fault.dbInitialTract(&db);
-  CPPUNIT_ASSERT(0 != fault._dbInitialTract)
+  CPPUNIT_ASSERT(&db == fault._dbInitialTract);
   CPPUNIT_ASSERT_EQUAL(label, std::string(fault._dbInitialTract->label()));
  } // testDBInitialTract
 
@@ -162,14 +162,30 @@
 } // testInitialize
 
 // ----------------------------------------------------------------------
-// Test constrainSolnSpace().
+// Test constrainSolnSpace() for sticking case.
 void
-pylith::faults::TestFaultCohesiveDynL::testConstrainSolnSpace(void)
-{ // testConstrainSolnSpace
+pylith::faults::TestFaultCohesiveDynL::testConstrainSolnSpaceStick(void)
+{ // testConstrainSolnSpaceStick
   // STUFF GOES HERE
-} // testConstrainSolnSpace
+} // testConstrainSolnSpaceStick
 
 // ----------------------------------------------------------------------
+// Test constrainSolnSpace() for slipping case.
+void
+pylith::faults::TestFaultCohesiveDynL::testConstrainSolnSpaceSlip(void)
+{ // testConstrainSolnSpaceSlip
+  // STUFF GOES HERE
+} // testConstrainSolnSpaceSlip
+
+// ----------------------------------------------------------------------
+// Test constrainSolnSpace() for opening case.
+void
+pylith::faults::TestFaultCohesiveDynL::testConstrainSolnSpaceOpen(void)
+{ // testConstrainSolnSpaceOpen
+  // STUFF GOES HERE
+} // testConstrainSolnSpaceOpen
+
+// ----------------------------------------------------------------------
 // Test updateStateVars().
 void
 pylith::faults::TestFaultCohesiveDynL::testUpdateStateVars(void)
@@ -196,7 +212,7 @@
 pylith::faults::TestFaultCohesiveDynL::_initialize(
 					topology::Mesh* const mesh,
 					FaultCohesiveDynL* const fault,
-					topology::SolutionFields* const fields) const
+					topology::SolutionFields* const fields)
 { // _initialize
   CPPUNIT_ASSERT(0 != mesh);
   CPPUNIT_ASSERT(0 != fault);
@@ -225,12 +241,13 @@
 			  _data->spaceDim);
   
   // Setup initial tractions
-  delete _dbInitialTract; _dbInitialTract =
+  spatialdata::spatialdb::SimpleDB* db =
       new spatialdata::spatialdb::SimpleDB("initial tractions");
-  CPPUNIT_ASSERT(0 != _dbInitialTract)
+  CPPUNIT_ASSERT(0 != db);
   spatialdata::spatialdb::SimpleIOAscii ioInitialTract;
   ioInitialTract.filename(_data->initialTractFilename);
-  _dbInitialTract->ioHandler(&ioInitialTract);
+  db->ioHandler(&ioInitialTract);
+  delete _dbInitialTract; _dbInitialTract = db;
 
   int firstFaultVertex    = 0;
   int firstLagrangeVertex = mesh->sieveMesh()->getIntSection(_data->label)->size();
@@ -249,11 +266,6 @@
   
   fault->initialize(*mesh, upDir, normalDir); 
   
-  delete[] sources; sources = 0;
-  for (int i=0; i < nsrcs; ++i)
-    delete[] names[i];
-  delete[] names; names = 0;
-  
   // Setup fields
   fields->add("residual", "residual");
   fields->add("disp(t)", "displacement");

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh	2009-12-13 21:02:07 UTC (rev 16099)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh	2009-12-13 23:03:04 UTC (rev 16100)
@@ -26,6 +26,7 @@
 #include "pylith/faults/faultsfwd.hh" // forward declarations
 #include "pylith/topology/topologyfwd.hh" // USES Mesh, SubMesh
 #include "pylith/feassemble/feassemblefwd.hh" // HOLDSA Quadrature
+#include "spatialdata/spatialdb/spatialdbfwd.hh" // HOLDSA SpatialDB
 
 #include <vector> // HASA std::vector
 
@@ -48,6 +49,14 @@
   CPPUNIT_TEST( testConstructor );
   CPPUNIT_TEST( testDBInitialTract );
 
+  // Tests in derived classes:
+  // testInitialize()
+  // testConstrainSolnSpaceStick()
+  // testConstrainSolnSpaceSlip()
+  // testConstrainSolnSpaceOpen()
+  // testUpdateStateVars()
+  // testCalcTractions()
+
   CPPUNIT_TEST_SUITE_END();
 
   // PROTECTED MEMBERS //////////////////////////////////////////////////
@@ -76,9 +85,15 @@
   /// Test initialize().
   void testInitialize(void);
 
-  /// Test constrainSolnSpace().
-  void testConstrainSolnSpace(void);
+  /// Test constrainSolnSpace() for sticking case.
+  void testConstrainSolnSpaceStick(void);
 
+  /// Test constrainSolnSpace() for slipping case.
+  void testConstrainSolnSpaceSlip(void);
+
+  /// Test constrainSolnSpace for fault opening case().
+  void testConstrainSolnSpaceOpen(void);
+
   /// Test updateStateVars().
   void testUpdateStateVars(void);
 
@@ -96,7 +111,7 @@
    */
   void _initialize(topology::Mesh* const mesh,
 		   FaultCohesiveDynL* const fault,
-		   topology::SolutionFields* const fields) const;
+		   topology::SolutionFields* const fields);
 
   /** Determine if vertex is a Lagrange multiplier constraint vertex.
    *

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc	2009-12-13 23:03:04 UTC (rev 16100)
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "CohesiveDynLData.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::faults::CohesiveDynLData::CohesiveDynLData(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),
+  initialTractFilename(0),
+  fieldIncr(0),
+  orientation(0),
+  area(0),
+  fieldIncrSlip(0),
+  fieldIncrOpen(0),
+  constraintVertices(0),
+  constraintCells(0),
+  numConstraintVert(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::faults::CohesiveDynLData::~CohesiveDynLData(void)
+{ // destructor
+} // destructor
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh	2009-12-13 23:03:04 UTC (rev 16100)
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_faults_cohesivedynldata_hh)
+#define pylith_faults_cohesivedynldata_hh
+
+namespace pylith {
+  namespace faults {
+     class CohesiveDynLData;
+  } // pylith
+} // faults
+
+class pylith::faults::CohesiveDynLData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+  
+  /// Constructor
+  CohesiveDynLData(void);
+
+  /// Destructor
+  ~CohesiveDynLData(void);
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+  char* meshFilename; ///< Filename for input mesh
+
+  /// @name Quadrature information
+  //@{
+  int spaceDim; ///< Number of dimensions in vertex coordinates
+  int cellDim; ///< Number of dimensions associated with cell
+  int numBasis; ///< Number of vertices in cell
+  int numQuadPts; ///< Number of quadrature points
+  double* quadPts; ///< Coordinates of quad pts in ref cell
+  double* quadWts; ///< Weights of quadrature points
+  double* basis; ///< Basis fns at quadrature points
+  double* basisDeriv; ///< Derivatives of basis fns at quad pts
+  double* verticesRef; ///< Coordinates of vertices in ref cell (dual basis)
+  //@}
+
+  /// @name Fault information
+  //@{
+  int id; ///< Fault material identifier
+  char* label; ///< Label for fault
+  char* initialTractFilename; ///< Name of db for final slip
+  //@}
+
+  /// @name Input fields
+  //@{
+  double* fieldIncr; ///< Solution increment field at time t.
+  //@}
+
+  /// @name Calculated values.
+  //@{
+  double* orientation; ///< Expected values for fault orientation.
+  double* area; ///< Expected values for fault area.
+  double* fieldIncrSlip; ///< Expected values for solution increment for slipping case.
+  double* fieldIncrOpen; ///< Expected values for solution increment for opening case.
+
+  int* constraintVertices; ///< Expected points for constraint vertices
+  int* constraintCells; ///< Expected cells for constraint vertices
+  int numConstraintVert; ///< Number of constraint vertices
+  //@}
+
+};
+
+#endif // pylith_faults_cohesivedynldata_hh
+
+// End of file



More information about the CIG-COMMITS mailing list