[cig-commits] r4653 - short/3D/PyLith/branches/pylith-0.8/pylith3d/module

willic3 at geodynamics.org willic3 at geodynamics.org
Thu Sep 28 13:09:58 PDT 2006


Author: willic3
Date: 2006-09-28 13:09:58 -0700 (Thu, 28 Sep 2006)
New Revision: 4653

Modified:
   short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc
Log:
Put in bindings for scan_tractions.


Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc	2006-09-28 20:08:55 UTC (rev 4652)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc	2006-09-28 20:09:58 UTC (rev 4653)
@@ -789,7 +789,7 @@
 }
 
 
-// Read coordinates
+// Scan coordinates
 
 char pypylith3d_scan_coords__doc__[] = "";
 char pypylith3d_scan_coords__name__[] = "scan_coords";
@@ -831,7 +831,7 @@
   journal::debug_t debug("pylith3d");
   debug
     << journal::at(__HERE__)
-    << "numberSpaceDimensions:" << numberNodes
+    << "numberNodes:" << numberNodes
     << journal::endl;
 
   // return
@@ -840,7 +840,7 @@
 }
 
 
-// Read differential forces
+// Scan differential forces
 
 char pypylith3d_scan_diff__doc__[] = "";
 char pypylith3d_scan_diff__name__[] = "scan_diff";
@@ -890,7 +890,7 @@
 }
 
 
-// Read time steps at which full output is desired
+// Scan time steps at which full output is desired
 
 char pypylith3d_scan_fuldat__doc__[] = "";
 char pypylith3d_scan_fuldat__name__[] = "scan_fuldat";
@@ -943,7 +943,7 @@
 }
 
 
-// Read load histories
+// Scan load histories
 
 char pypylith3d_scan_hist__doc__[] = "";
 char pypylith3d_scan_hist__name__[] = "scan_hist";
@@ -990,7 +990,7 @@
 }
 
 
-// Read element prestresses
+// Scan element prestresses
 
   // char pypylith3d_scan_prestr__doc__[] = "";
   // char pypylith3d_scan_prestr__name__[] = "scan_prestr";
@@ -1046,7 +1046,7 @@
   // }
 
 
-// Read local coordinate rotations
+// Scan local coordinate rotations
 
 char pypylith3d_scan_skew__doc__[] = "";
 char pypylith3d_scan_skew__name__[] = "scan_skew";
@@ -1097,7 +1097,7 @@
 }
 
 
-// Read slippery node entries
+// Scan slippery node entries
 
 char pypylith3d_scan_slip__doc__[] = "";
 char pypylith3d_scan_slip__name__[] = "scan_slip";
@@ -1144,7 +1144,7 @@
 }
 
 
-// Read split node entries
+// Scan split node entries
 
 char pypylith3d_scan_split__doc__[] = "";
 char pypylith3d_scan_split__name__[] = "scan_split";
@@ -1191,7 +1191,7 @@
 }
 
 
-// Read time step data
+// Scan time step data
 
 char pypylith3d_scan_timdat__doc__[] = "";
 char pypylith3d_scan_timdat__name__[] = "scan_timdat";
@@ -1245,57 +1245,63 @@
 }
 
 
-// Read traction BC
 
-// char pypylith3d_scan_traction__doc__[] = "";
-// char pypylith3d_scan_traction__name__[] = "scan_traction";
+// Scan traction BC
 
-// PyObject * pypylith3d_scan_traction(PyObject *, PyObject *args)
-// {
-  // char* tractionBcUnits;
-  // int f77FileInput;
-  // char* tractionInputFile;
+char pypylith3d_scan_tractions__doc__[] = "";
+char pypylith3d_scan_tractions__name__[] = "scan_tractions";
 
-  // int ok = PyArg_ParseTuple(args, "sis:scan_traction",
-			    // &tractionBcUnits,
-			    // &f77FileInput,
-			    // &tractionInputFile);
+PyObject * pypylith3d_scan_tractions(PyObject *, PyObject *args)
+{
+  int maxElementNodes2d;
+  int numberDegreesFreedom;
+  int f77FileInput;
+  char *tractionUnits;
+  char *tractionInputFile;
 
-  // if (!ok) {
-    // return 0;
-  // }
+  int ok = PyArg_ParseTuple(args, (char *) "iiiss:scan_tractions",
+                            &maxElementNodes2d,
+                            &numberDegreesFreedom,
+			    &f77FileInput,
+			    &tractionUnits,
+			    &tractionInputFile);
 
-  // int errorcode = 0;
-  // const int maxsize = 4096;
-  // char errorstring[maxsize];
-  // int numberTractionBc = 0;
+  if (!ok) {
+    return 0;
+  }
 
-  // scan_traction_f(&numberTractionBc,
-		  // &f77FileInput,
-		  // tractionBcUnits,
-		  // tractionInputFile,
-		  // &errorcode,
-		  // errorstring,
-		  // strlen(tractionBcUnits),
-		  // strlen(tractionInputFile),
-		  // sizeof(errorstring));
+  int errorcode = 0;
+  const int maxsize = 4096;
+  char errorstring[maxsize];
+  int numberTractionBc = 0;
+
+  scan_tractions_f(&numberTractionBc,
+		   &maxElementNodes2d,
+		   &numberDegreesFreedom,
+		   &f77FileInput,
+		   tractionUnits,
+		   tractionInputFile,
+		   &errorcode,
+		   errorstring,
+		   strlen(tractionUnits),
+		   strlen(tractionInputFile),
+		   sizeof(errorstring));
     
-  // if(0 != exceptionhandler(errorcode, errorstring)) {
-    // return 0;
-  // }
+  if(0 != exceptionhandler(errorcode, errorstring)) {
+    return 0;
+  }
 
-  // journal::debug_t debug("pylith3d");
-  // debug
-    // << journal::at(__HERE__)
-    // << "numberTractionBc:" << numberTractionBc
-    // << journal::endl;
+  journal::debug_t debug("pylith3d");
+  debug
+    << journal::at(__HERE__)
+    << "numberTractionBc:" << numberTractionBc
+    << journal::endl;
 
   // return
-  // Py_INCREF(Py_None);
-  // return Py_BuildValue("i",numberTractionBc);
-// }
+  Py_INCREF(Py_None);
+  return Py_BuildValue((char *) "i", numberTractionBc);
+}
 
-
 // Read winkler BC
 
 char pypylith3d_scan_wink__doc__[] = "";



More information about the cig-commits mailing list