[cig-commits] r11775 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Tue Apr 8 17:35:25 PDT 2008


Author: luis
Date: 2008-04-08 17:35:25 -0700 (Tue, 08 Apr 2008)
New Revision: 11775

Modified:
   cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.cpp
   cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.h
Log:
Definition of strike-slip benchmark


Modified: cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.cpp	2008-04-09 00:35:23 UTC (rev 11774)
+++ cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.cpp	2008-04-09 00:35:25 UTC (rev 11775)
@@ -1 +1,113 @@
 #include "OkadaBenchmarkFields.h"
+#include "okada/cervelli.h"
+#include "Misc.h"
+
+using namespace cigma;
+using namespace okada;
+
+// ---------------------------------------------------------------------------
+
+strike_slip::Disloc3d::Disloc3d()
+{
+    // elastic parameters
+    mu = 0.25;
+    nu = 0.25;
+
+    // allocate fault info
+    nsubfaults = 400;
+    subfaults = new double[nsubfaults * 11];
+    models = new double[nsubfaults * 10];
+    flag = new double[1];
+    flag2 = new double[nsubfaults];
+
+    //
+    // define strike slip fault
+    //
+    int i;
+    double *n;
+    double taperd;
+
+    taperd = 10.0;  // (16000.0 - 12000.0)/400
+    linspace(&n, 12000.0, 16000.0, nsubfaults);
+
+    double *fi;
+    double fx1, fy1;
+    double fx2, fy2;
+    double dip, D, Pr, bd;
+    double ss, ds, ts;
+
+    for (i = 0; i < nsubfaults; i++)
+    {
+        fi = &subfaults[11*i];
+
+        fx1 = 12000.0;
+        fy1 = -n[i];
+
+        fx2 = 12000.0;
+        fy2 = n[i];
+
+        dip = 90.0;
+        D   = n[i];
+        Pr  = 0.25;
+        bd  = 0;
+        ss  = -1.0/nsubfaults;
+        ds  = 0;
+        ts  = 0;
+
+        fi[0]  = fx1;
+        fi[1]  = fy1;
+        fi[2]  = fx2;
+        fi[3]  = fy2;
+        fi[4]  = dip;
+        fi[5]  = D;
+        fi[6]  = Pr;
+        fi[7]  = bd;
+        fi[8]  = ss;
+        fi[9]  = ds;
+        fi[10] = ts;
+    }
+
+    delete [] n;
+}
+
+strike_slip::Disloc3d::~Disloc3d()
+{
+    nsubfaults = 0;
+    delete [] subfaults;
+    delete [] models;
+    delete [] flag;
+    delete [] flag2;
+}
+
+bool strike_slip::Disloc3d::eval(double *station, double *disloc)
+{
+    //
+    // XXX: deconstruct the following call.
+    // Specifically, move the call to getM() into the constructor,
+    // and then, instead, call disloc3d() with the appropriate arguments
+    //
+    calc_disp_cervelli(
+        mu, nu,
+        models, subfaults, nsubfaults,
+        station, 1,
+        displacement, derivatives, stress,
+        flag, flag2);
+
+    //
+    // copy the answer into the output array
+    // XXX: add a selection method which defaults to displacements?
+    //
+    disloc[0] = displacement[0];
+    disloc[1] = displacement[1];
+    disloc[2] = displacement[2];
+
+    if (*flag > 0)
+    {
+        return false;
+    }
+
+    return true;
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------

Modified: cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.h
===================================================================
--- cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.h	2008-04-09 00:35:23 UTC (rev 11774)
+++ cs/benchmark/cigma/trunk/src/OkadaBenchmarkFields.h	2008-04-09 00:35:25 UTC (rev 11775)
@@ -1,7 +1,7 @@
 #ifndef __OkadaBenchmarkFields_h__
 #define __OkadaBenchmarkFields_h__
 
-#include "Field.h"
+#include "UserField.h"
 
 namespace okada
 {
@@ -15,34 +15,47 @@
     }
 }
 
-class okada::strike_slip::Disloc3d : public cigma::Field
+class okada::strike_slip::Disloc3d : public cigma::UserField
 {
 public:
     Disloc3d();
     ~Disloc3d();
 
 public:
-    FieldType getType() { return USER_FIELD; }
     int n_dim() { return 3; }
     int n_rank() { return 3; }
 
 public:
     bool eval(double *station, double *disloc);
+
+public:
+    double mu, nu;
+    double displacement[3];
+    double derivatives[9];
+    double stress[6];
+
+    int nsubfaults;
+    double *subfaults;
+    double *models;
+    double *flag;
+    double *flag2;
 };
 
-class okada::reverse_slip::Disloc3d : public cigma::Field
+
+/*
+class okada::reverse_slip::Disloc3d : public cigma::UserField
 {
 public:
     Disloc3d();
     ~Disloc3d();
 
 public:
-    FieldType getType() { return USER_FIELD; }
     int n_dim() { return 3; }
     int n_rank() { return 3; }
 
 public:
     bool eval(double *station, double *disloc);
 };
+*/
 
 #endif



More information about the cig-commits mailing list