[cig-commits] r6860 - in short/3D/PyLith/trunk: . libsrc
libsrc/topology
brad at geodynamics.org
brad at geodynamics.org
Fri May 11 17:37:14 PDT 2007
Author: brad
Date: 2007-05-11 17:37:14 -0700 (Fri, 11 May 2007)
New Revision: 6860
Added:
short/3D/PyLith/trunk/libsrc/topology/CellGeometry.cc
short/3D/PyLith/trunk/libsrc/topology/CellGeometry.hh
short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc
short/3D/PyLith/trunk/libsrc/topology/GeometryHex.hh
short/3D/PyLith/trunk/libsrc/topology/GeometryLine.cc
short/3D/PyLith/trunk/libsrc/topology/GeometryLine.hh
short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.cc
short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.hh
short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc
short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.hh
short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc
short/3D/PyLith/trunk/libsrc/topology/GeometryTet.hh
short/3D/PyLith/trunk/libsrc/topology/GeometryTri.cc
short/3D/PyLith/trunk/libsrc/topology/GeometryTri.hh
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/Makefile.am
short/3D/PyLith/trunk/libsrc/topology/Makefile.am
short/3D/PyLith/trunk/libsrc/topology/Mesh.hh
Log:
Worked on C++ implementation of computing Jacobian in reference cell.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/TODO 2007-05-12 00:37:14 UTC (rev 6860)
@@ -16,13 +16,10 @@
1. Implement cell geometry stuff.
Compute Jacobian in cell.
- i. CellGeometry
- ii. GeometryPoint
- iii. GeometryLine
- iv. GeometryTri
- v. GeometryTet
- vi. GeometryQuad
- vii. GeometryHex
+ a. C++ source code
+ i. GeometryTet
+ ii. GeometryHex
+ b. C++ unit tests
2. Implement Dirichlet boundary conditions
a. C++
Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am 2007-05-12 00:37:14 UTC (rev 6860)
@@ -61,7 +61,14 @@
meshio/PsetFileAscii.cc \
meshio/PsetFileBinary.cc \
meshio/SolutionIO.cc \
- meshio/SolutionIOVTK.cc
+ meshio/SolutionIOVTK.cc \
+ topology/CellGeometry.cc \
+ topology/GeometryPoint.cc \
+ topology/GeometryLine.cc \
+ topology/GeometryTri.cc \
+ topology/GeometryTet.cc \
+ topology/GeometryQuad.cc \
+ topology/GeometryHex.cc
if ENABLE_CUBIT
libpylith_la_SOURCES += \
Added: short/3D/PyLith/trunk/libsrc/topology/CellGeometry.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/CellGeometry.cc 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/CellGeometry.cc 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "CellGeometry.hh" // implementation of class methods
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::topology::CellGeometry::CellGeometry(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor.
+pylith::topology::CellGeometry::~CellGeometry(void)
+{ // destructor
+} // destructor
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/CellGeometry.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/CellGeometry.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/CellGeometry.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/CellGeometry.hh
+ *
+ * @brief C++ abstract base class for cell geometry calculations.
+ */
+
+#if !defined(pylith_topology_cellgeometry_hh)
+#define pylith_topology_cellgeometry_hh
+
+#include "pylith/utils/arrayfwd.hh" // USES double_array
+
+namespace pylith {
+ namespace topology {
+ class CellGeometry;
+ } // topology
+} // pylith
+
+class pylith::topology::CellGeometry
+{ // CellGeometry
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ CellGeometry(void);
+
+ /// Default destructor.
+ virtual
+ ~CellGeometry(void);
+
+ /** Compute Jacobian at location in cell.
+ *
+ * @param jacobian Jacobian at location.
+ * @param vertices Coordinates of vertices of cell.
+ * @param location Location in reference cell at which to compute Jacobian.
+ */
+ virtual
+ void jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const = 0;
+
+}; // CellGeometry
+
+#endif // pylith_topology_cellgeometry_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "GeometryHex.hh" // implementation of class methods
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::topology::GeometryHex::GeometryHex(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor.
+pylith::topology::GeometryHex::~GeometryHex(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute Jacobian at location in cell.
+void
+pylith::topology::GeometryHex::jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const
+{ // jacobian
+ assert(0 != jacobian);
+
+ assert(3*8 == vertices.size());
+ assert(3 == location.size());
+ assert(9 == jacobian->size());
+
+} // jacobian
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryHex.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryHex.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryHex.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/GeometryHex.hh
+ *
+ * @brief C++ implementation of cell geometry calculations for 3-D
+ * hexahedral cell.
+ */
+
+#if !defined(pylith_topology_geometryhex_hh)
+#define pylith_topology_geometryhex_hh
+
+#include "CellGeometry.hh" // ISA CellGeometry
+
+namespace pylith {
+ namespace topology {
+ class GeometryHex;
+ } // topology
+} // pylith
+
+class pylith::topology::GeometryHex
+{ // GeometryHex
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ GeometryHex(void);
+
+ /// Default destructor.
+ ~GeometryHex(void);
+
+ /** Compute Jacobian at location in cell.
+ *
+ * @param jacobian Jacobian at location.
+ * @param vertices Coordinates of vertices of cell.
+ * @param location Location in reference cell at which to compute Jacobian.
+ */
+ void jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const;
+
+}; // GeometryHex
+
+#endif // pylith_topology_geometryhex_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryLine.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryLine.cc 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryLine.cc 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "GeometryLine.hh" // implementation of class methods
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::topology::GeometryLine::GeometryLine(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor.
+pylith::topology::GeometryLine::~GeometryLine(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute Jacobian at location in cell.
+void
+pylith::topology::GeometryLine::jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const
+{ // jacobian
+ assert(0 != jacobian);
+
+ assert(2 == vertices.size());
+ assert(1 == location.size());
+ assert(1 == jacobian->size());
+
+ (*jacobian)[0] = vertices[1]-vertices[0];
+} // jacobian
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryLine.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryLine.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryLine.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/GeometryLine.hh
+ *
+ * @brief C++ implementation of cell geometry calculations for 1-D
+ * line cell.
+ */
+
+#if !defined(pylith_topology_geometryline_hh)
+#define pylith_topology_geometryline_hh
+
+#include "CellGeometry.hh" // ISA CellGeometry
+
+namespace pylith {
+ namespace topology {
+ class GeometryLine;
+ } // topology
+} // pylith
+
+class pylith::topology::GeometryLine
+{ // GeometryLine
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ GeometryLine(void);
+
+ /// Default destructor.
+ ~GeometryLine(void);
+
+ /** Compute Jacobian at location in cell.
+ *
+ * @param jacobian Jacobian at location.
+ * @param vertices Coordinates of vertices of cell.
+ * @param location Location in reference cell at which to compute Jacobian.
+ */
+ void jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const;
+
+}; // GeometryLine
+
+#endif // pylith_topology_geometryline_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.cc 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.cc 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "GeometryPoint.hh" // implementation of class methods
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::topology::GeometryPoint::GeometryPoint(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor.
+pylith::topology::GeometryPoint::~GeometryPoint(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute Jacobian at location in cell.
+void
+pylith::topology::GeometryPoint::jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const
+{ // jacobian
+ assert(0 != jacobian);
+
+ assert(1 == vertices.size());
+ assert(1 == location.size());
+ assert(1 == jacobian->size());
+
+ (*jacobian)[0] = 1.0;
+} // jacobian
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryPoint.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/GeometryPoint.hh
+ *
+ * @brief C++ implementation of cell geometry calculations for 0-D
+ * point cell.
+ */
+
+#if !defined(pylith_topology_geometrypoint_hh)
+#define pylith_topology_geometrypoint_hh
+
+#include "CellGeometry.hh" // ISA CellGeometry
+
+namespace pylith {
+ namespace topology {
+ class GeometryPoint;
+ } // topology
+} // pylith
+
+class pylith::topology::GeometryPoint
+{ // GeometryPoint
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ GeometryPoint(void);
+
+ /// Default destructor.
+ ~GeometryPoint(void);
+
+ /** Compute Jacobian at location in cell.
+ *
+ * @param jacobian Jacobian at location.
+ * @param vertices Coordinates of vertices of cell.
+ * @param location Location in reference cell at which to compute Jacobian.
+ */
+ void jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const;
+
+}; // GeometryPoint
+
+#endif // pylith_topology_geometrypoint_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "GeometryQuad.hh" // implementation of class methods
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::topology::GeometryQuad::GeometryQuad(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor.
+pylith::topology::GeometryQuad::~GeometryQuad(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute Jacobian at location in cell.
+void
+pylith::topology::GeometryQuad::jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const
+{ // jacobian
+ assert(0 != jacobian);
+
+ assert(2*4 == vertices.size());
+ assert(2 == location.size());
+ assert(4 == jacobian->size());
+
+ const double x0 = vertices[0];
+ const double y0 = vertices[1];
+
+ const double x1 = vertices[2];
+ const double y1 = vertices[3];
+
+ const double x2 = vertices[4];
+ const double y2 = vertices[5];
+
+ const double x3 = vertices[6];
+ const double y3 = vertices[7];
+
+ const double x = location[0];
+ const double y = location[1];
+
+ (*jacobian)[0] = x1 - x0 + (x3 - x1 - x2 + x0)*y;
+ (*jacobian)[1] = x2 - x0 + (x3 - x1 - x2 + x0)*x;
+ (*jacobian)[2] = y1 - y0 + (y3 - y1 - y2 + y0)*y;
+ (*jacobian)[3] = y2 - y0 + (y3 - y1 - y2 + y0)*x;
+} // jacobian
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/GeometryQuad.hh
+ *
+ * @brief C++ implementation of cell geometry calculations for 2-D
+ * quadrilateral cell.
+ */
+
+#if !defined(pylith_topology_geometryquad_hh)
+#define pylith_topology_geometryquad_hh
+
+#include "CellGeometry.hh" // ISA CellGeometry
+
+namespace pylith {
+ namespace topology {
+ class GeometryQuad;
+ } // topology
+} // pylith
+
+class pylith::topology::GeometryQuad
+{ // GeometryQuad
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ GeometryQuad(void);
+
+ /// Default destructor.
+ ~GeometryQuad(void);
+
+ /** Compute Jacobian at location in cell.
+ *
+ * @param jacobian Jacobian at location.
+ * @param vertices Coordinates of vertices of cell.
+ * @param location Location in reference cell at which to compute Jacobian.
+ */
+ void jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const;
+
+}; // GeometryQuad
+
+#endif // pylith_topology_geometryquad_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "GeometryTet.hh" // implementation of class methods
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::topology::GeometryTet::GeometryTet(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor.
+pylith::topology::GeometryTet::~GeometryTet(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute Jacobian at location in cell.
+void
+pylith::topology::GeometryTet::jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const
+{ // jacobian
+ assert(0 != jacobian);
+
+ assert(12 == vertices.size());
+ assert(3 == location.size());
+ assert(9 == jacobian->size());
+
+} // jacobian
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryTet.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryTet.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryTet.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/GeometryTet.hh
+ *
+ * @brief C++ implementation of cell geometry calculations for 3-D
+ * tetrahedral cell.
+ */
+
+#if !defined(pylith_topology_geometrytet_hh)
+#define pylith_topology_geometrytet_hh
+
+#include "CellGeometry.hh" // ISA CellGeometry
+
+namespace pylith {
+ namespace topology {
+ class GeometryTet;
+ } // topology
+} // pylith
+
+class pylith::topology::GeometryTet
+{ // GeometryTet
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ GeometryTet(void);
+
+ /// Default destructor.
+ ~GeometryTet(void);
+
+ /** Compute Jacobian at location in cell.
+ *
+ * @param jacobian Jacobian at location.
+ * @param vertices Coordinates of vertices of cell.
+ * @param location Location in reference cell at which to compute Jacobian.
+ */
+ void jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const;
+
+}; // GeometryTet
+
+#endif // pylith_topology_geometrytet_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryTri.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryTri.cc 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryTri.cc 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "GeometryTri.hh" // implementation of class methods
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::topology::GeometryTri::GeometryTri(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor.
+pylith::topology::GeometryTri::~GeometryTri(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute Jacobian at location in cell.
+void
+pylith::topology::GeometryTri::jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const
+{ // jacobian
+ assert(0 != jacobian);
+
+ assert(2*3 == vertices.size());
+ assert(2 == location.size());
+ assert(4 == jacobian->size());
+
+ const double x0 = vertices[0];
+ const double y0 = vertices[1];
+
+ const double x1 = vertices[2];
+ const double y1 = vertices[3];
+
+ const double x2 = vertices[4];
+ const double y2 = vertices[5];
+
+ (*jacobian)[0] = x1 - x0;
+ (*jacobian)[1] = x2 - x0;
+ (*jacobian)[2] = y1 - y0;
+ (*jacobian)[3] = y2 - y0;
+} // jacobian
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/topology/GeometryTri.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryTri.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryTri.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/GeometryTri.hh
+ *
+ * @brief C++ implementation of cell geometry calculations for 2-D
+ * triangular cell.
+ */
+
+#if !defined(pylith_topology_geometrytri_hh)
+#define pylith_topology_geometrytri_hh
+
+#include "CellGeometry.hh" // ISA CellGeometry
+
+namespace pylith {
+ namespace topology {
+ class GeometryTri;
+ } // topology
+} // pylith
+
+class pylith::topology::GeometryTri
+{ // GeometryTri
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ GeometryTri(void);
+
+ /// Default destructor.
+ ~GeometryTri(void);
+
+ /** Compute Jacobian at location in cell.
+ *
+ * @param jacobian Jacobian at location.
+ * @param vertices Coordinates of vertices of cell.
+ * @param location Location in reference cell at which to compute Jacobian.
+ */
+ void jacobian(double_array* jacobian,
+ const double_array& vertices,
+ const double_array& location) const;
+
+}; // GeometryTri
+
+#endif // pylith_topology_geometrytri_hh
+
+
+// End of file
Modified: short/3D/PyLith/trunk/libsrc/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Makefile.am 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/Makefile.am 2007-05-12 00:37:14 UTC (rev 6860)
@@ -14,7 +14,13 @@
include $(top_srcdir)/subpackage.am
subpkginclude_HEADERS = \
- Mesh.hh
+ CellGeometry.hh \
+ GeometryPoint.hh \
+ GeometryLine.hh \
+ GeometryTri.hh \
+ GeometryTet.hh \
+ GeometryQuad.hh \
+ GeometryHex.hh
noinst_HEADERS =
Modified: short/3D/PyLith/trunk/libsrc/topology/Mesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Mesh.hh 2007-05-11 23:18:12 UTC (rev 6859)
+++ short/3D/PyLith/trunk/libsrc/topology/Mesh.hh 2007-05-12 00:37:14 UTC (rev 6860)
@@ -40,3 +40,6 @@
#endif // pylith_topology_mesh_hh
+
+
+// End of file
More information about the cig-commits
mailing list