[cig-commits] r6868 - short/3D/PyLith/trunk/libsrc/topology

brad at geodynamics.org brad at geodynamics.org
Sat May 12 14:05:20 PDT 2007


Author: brad
Date: 2007-05-12 14:05:20 -0700 (Sat, 12 May 2007)
New Revision: 6868

Modified:
   short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc
   short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc
   short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc
Log:
Finished implementing cell geometries.

Modified: short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc	2007-05-12 20:03:05 UTC (rev 6867)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryHex.cc	2007-05-12 21:05:20 UTC (rev 6868)
@@ -43,6 +43,69 @@
   assert(3 == location.size());
   assert(9 == jacobian->size());
   
+  const double x0 = vertices[0];
+  const double y0 = vertices[1];
+  const double z0 = vertices[2];
+
+  const double x1 = vertices[3];
+  const double y1 = vertices[4];
+  const double z1 = vertices[5];
+
+  const double x2 = vertices[6];
+  const double y2 = vertices[7];
+  const double z2 = vertices[8];
+
+  const double x3 = vertices[9];
+  const double y3 = vertices[10];
+  const double z3 = vertices[11];
+
+  const double x4 = vertices[12];
+  const double y4 = vertices[13];
+  const double z4 = vertices[14];
+
+  const double x5 = vertices[15];
+  const double y5 = vertices[16];
+  const double z5 = vertices[17];
+
+  const double x6 = vertices[18];
+  const double y6 = vertices[19];
+  const double z6 = vertices[20];
+
+  const double x7 = vertices[21];
+  const double y7 = vertices[22];
+  const double z7 = vertices[23];
+
+  const double x = location[0];
+  const double y = location[1];
+  const double z = location[2];
+
+  const double f_xy = x2 - x1 - x3 + x0;
+  const double g_xy = y2 - y1 - y3 + y0;
+  const double h_xy = z2 - z1 - z3 + z0;
+
+  const double f_yz = x7 - x3 - x4 + x0;
+  const double g_yz = y7 - y3 - y4 + y0;
+  const double h_yz = z7 - z3 - z4 + z0;
+
+  const double f_xz = x5 - x1 - x4 + x0;
+  const double g_xz = y5 - y1 - y4 + y0;
+  const double h_xz = z5 - z1 - z4 + z0;
+
+  const double f_xyz = x6 - x0 + x1 - x2 + x3 + x4 - x5 - x7;
+  const double g_xyz = y6 - y0 + y1 - y2 + y3 + y4 - y5 - y7;
+  const double h_xyz = z6 - z0 + z1 - z2 + z3 + z4 - z5 - z7;
+
+  (*jacobian)[0] = x1 - x0 + f_xy*y + f_xz*z + f_xyz*y*z;
+  (*jacobian)[1] = x3 - x0 + f_xy*x + f_yz*z + f_xyz*x*z;
+  (*jacobian)[2] = x4 - x0 + f_yz*y + f_xz*x + f_xyz*x*y;
+
+  (*jacobian)[3] = y1 - y0 + g_xy*y + g_xz*z + g_xyz*y*z;
+  (*jacobian)[4] = y3 - y0 + g_xy*x + g_yz*z + g_xyz*x*z;
+  (*jacobian)[5] = y4 - y0 + g_yz*y + g_xz*x + g_xyz*x*y;
+
+  (*jacobian)[6] = z1 - z0 + h_xy*y + h_xz*z + h_xyz*y*z;
+  (*jacobian)[7] = z3 - z0 + h_xy*x + h_yz*z + h_xyz*x*z;
+  (*jacobian)[8] = z4 - z0 + h_yz*y + h_xz*x + h_xyz*x*y;
 } // jacobian
 
 

Modified: short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc	2007-05-12 20:03:05 UTC (rev 6867)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryQuad.cc	2007-05-12 21:05:20 UTC (rev 6868)
@@ -58,10 +58,13 @@
   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;
+  const double f_xy = x2 - x1 - x3 + x0;
+  const double g_xy = y2 - y1 - y3 + y0;
+
+  (*jacobian)[0] = x1 - x0 + f_xy*y;
+  (*jacobian)[1] = x3 - x0 + f_xy*x;
+  (*jacobian)[2] = y1 - y0 + g_xy*y;
+  (*jacobian)[3] = y3 - y0 + g_xy*x;
 } // jacobian
 
 

Modified: short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc	2007-05-12 20:03:05 UTC (rev 6867)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryTet.cc	2007-05-12 21:05:20 UTC (rev 6868)
@@ -34,8 +34,8 @@
 // Compute Jacobian at location in cell.
 void
 pylith::topology::GeometryTet::jacobian(double_array* jacobian,
-					  const double_array& vertices,
-					  const double_array& location) const
+					const double_array& vertices,
+					const double_array& location) const
 { // jacobian
   assert(0 != jacobian);
 
@@ -43,6 +43,31 @@
   assert(3 == location.size());
   assert(9 == jacobian->size());
   
+  const double x0 = vertices[0];
+  const double y0 = vertices[1];
+  const double z0 = vertices[2];
+
+  const double x1 = vertices[3];
+  const double y1 = vertices[4];
+  const double z1 = vertices[5];
+
+  const double x2 = vertices[6];
+  const double y2 = vertices[7];
+  const double z2 = vertices[8];
+
+  const double x3 = vertices[9];
+  const double y3 = vertices[10];
+  const double z3 = vertices[11];
+
+  (*jacobian)[0] = x1 - x0;
+  (*jacobian)[1] = x2 - x0;
+  (*jacobian)[2] = x3 - x0;
+  (*jacobian)[3] = y1 - y0;
+  (*jacobian)[4] = y2 - y0;
+  (*jacobian)[5] = y3 - y0;
+  (*jacobian)[6] = z1 - z0;
+  (*jacobian)[7] = z2 - z0;
+  (*jacobian)[8] = z3 - z0;
 } // jacobian
 
 



More information about the cig-commits mailing list