[cig-commits] [commit] master: astyle cleanup (3b3d5a6)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Oct 15 14:17:53 PDT 2014


Repository : https://github.com/geodynamics/vc

On branch  : master
Link       : https://github.com/geodynamics/vc/compare/627c49b411aa261c79dbf807e71173eb9e5b1317...e91e7f3a67d22391a31bcfa9ff881ef8097ad787

>---------------------------------------------------------------

commit 3b3d5a641abff02d465378f25d72273edf670508
Author: Eric Heien <emheien at ucdavis.edu>
Date:   Wed Oct 15 14:17:59 2014 -0700

    astyle cleanup


>---------------------------------------------------------------

3b3d5a641abff02d465378f25d72273edf670508
 quakelib/src/QuakeLibIO.cpp    |   4 +-
 quakelib/src/QuakeLibOkada.cpp | 111 +++++++++++++++++++++++++----------------
 quakelib/src/QuakeLibOkada.h   |   0
 src/core/VCSimulation.cpp      |   4 +-
 src/simulation/RunEvent.cpp    |   2 +
 5 files changed, 75 insertions(+), 46 deletions(-)

diff --git a/quakelib/src/QuakeLibIO.cpp b/quakelib/src/QuakeLibIO.cpp
index 7017b58..476d419 100644
--- a/quakelib/src/QuakeLibIO.cpp
+++ b/quakelib/src/QuakeLibIO.cpp
@@ -1639,7 +1639,7 @@ int quakelib::ModelWorld::read_files_eqsim(const std::string &geom_file_name, co
         }
 
         // Go through the created elements and assign maximum slip based on fault section area
-        for (eit=eqsim_world.begin_element();eit!=eqsim_world.end_element();++eit) {
+        for (eit=eqsim_world.begin_element(); eit!=eqsim_world.end_element(); ++eit) {
 
             // From Table 2A in Wells Coppersmith 1994
             double moment_magnitude = 4.07+0.98*log10(conv.sqm2sqkm(fault_areas[eit->section_id()]));
@@ -1650,7 +1650,7 @@ int quakelib::ModelWorld::read_files_eqsim(const std::string &geom_file_name, co
             // Set the max slip for the current element
             eit->set_max_slip(max_slip);
 
-            }
+        }
 
 
     }
diff --git a/quakelib/src/QuakeLibOkada.cpp b/quakelib/src/QuakeLibOkada.cpp
index 869dc18..cee3c0b 100644
--- a/quakelib/src/QuakeLibOkada.cpp
+++ b/quakelib/src/QuakeLibOkada.cpp
@@ -3334,20 +3334,23 @@ double quakelib::Okada::I1v(double _R, double xi, double eta, double _q) {
 //
 // gravity change on the free surface (z=0)
 double quakelib::Okada::calc_dg_dilat(Vec<2> location, double c, double dip, double L, double W, double US, double UD, double UT, double lambda, double mu) {
-    OP_CMP(3); OP_MULT(3); OP_ADD(3); OP_SUB(1);
+    OP_CMP(3);
+    OP_MULT(3);
+    OP_ADD(3);
+    OP_SUB(1);
     // Evaluating delta_g* at free surface so z=0
     // From Okubo '92, delta_g* is the dilatational component of gravity changes
 
     if (mu <= 0) throw std::invalid_argument("Mu must be greater than zero.");
 
-	precalc(dip, lambda, mu);
+    precalc(dip, lambda, mu);
 
     // Everything is in M-K-S units
     double G   = 0.000000000066738; //Big G gravitation constant
     double RHO = 2670.0;   //mean crustal density (rough estimate)
 
-	double _p = p(location[1],0.0,c);
-	double _q = q(location[1],0.0,c);
+    double _p = p(location[1],0.0,c);
+    double _q = q(location[1],0.0,c);
     double dgS_star= 0.0; //contribution from Strike
     double dgD_star= 0.0; //Dip
     double dgT_star= 0.0; //Tensile
@@ -3358,10 +3361,12 @@ double quakelib::Okada::calc_dg_dilat(Vec<2> location, double c, double dip, dou
         OP_MULT(1);
         dgS_star = US*dSg_star(location[0],_p,_q,L,W);
     }
+
     if (UD != 0.0) {
         OP_MULT(1);
         dgD_star = UD*dDg_star(location[0],_p,_q,L,W);
     }
+
     if (UT != 0.0) {
         OP_MULT(2);
         dgT_star = UT*dTg_star(location[0],_p,_q,L,W);
@@ -3375,89 +3380,109 @@ double quakelib::Okada::calc_dg_dilat(Vec<2> location, double c, double dip, dou
 // double bar evaluation (chinnery) for dilatational gravity
 //
 double quakelib::Okada::dSg_star(double x, double _p, double _q, double L, double W) {
-    OP_ADD(1); OP_SUB(6);
+    OP_ADD(1);
+    OP_SUB(6);
     return Sg_star(x,_p,_q) - Sg_star(x,_p-W,_q) - Sg_star(x-L,_p,_q) + Sg_star(x-L,_p-W,_q);
 }
 double quakelib::Okada::dDg_star(double x, double _p, double _q, double L, double W) {
-    OP_ADD(1); OP_SUB(6);
+    OP_ADD(1);
+    OP_SUB(6);
     return Dg_star(x,_p,_q) - Dg_star(x,_p-W,_q) - Dg_star(x-L,_p,_q) + Dg_star(x-L,_p-W,_q);
 }
 double quakelib::Okada::dTg_star(double x, double _p, double _q, double L, double W) {
-    OP_ADD(1); OP_SUB(6);
+    OP_ADD(1);
+    OP_SUB(6);
     return Tg_star(x,_p,_q) - Tg_star(x,_p-W,_q) - Tg_star(x-L,_p,_q) + Tg_star(x-L,_p-W,_q);
 }
 //
 // dilatational gravity globals
 //
-double quakelib::Okada::Sg_star(double xi, double eta, double _q){
-	double _R = R(xi,eta,_q);
+double quakelib::Okada::Sg_star(double xi, double eta, double _q) {
+    double _R = R(xi,eta,_q);
     return _sin_o_dip*I4g(_R,eta,_q);
 }
-double quakelib::Okada::Dg_star(double xi, double eta, double _q){
-	double _R = R(xi,eta,_q);
+double quakelib::Okada::Dg_star(double xi, double eta, double _q) {
+    double _R = R(xi,eta,_q);
     return -1.0*_sin_o_dip*_cos_o_dip*I5g(_R,xi,eta,_q);
 }
-double quakelib::Okada::Tg_star(double xi, double eta, double _q){
-    OP_ADD(2); OP_MULT(2);
-	double _R = R(xi,eta,_q);
+double quakelib::Okada::Tg_star(double xi, double eta, double _q) {
+    OP_ADD(2);
+    OP_MULT(2);
+    double _R = R(xi,eta,_q);
     return _sin_o_2_dip*I5g(_R,xi,eta,_q);
 }
-double quakelib::Okada::I4g(double _R, double eta, double _q){
-	double _dtil = dtil(_q,eta);
-	double _Rpeta 	 = _R+eta;
+double quakelib::Okada::I4g(double _R, double eta, double _q) {
+    double _dtil = dtil(_q,eta);
+    double _Rpeta    = _R+eta;
     double _Rpdtil   = _R+_dtil;
 
-    if (_cos_o_dip!=0.0){
+    if (_cos_o_dip!=0.0) {
         double ret_value = _one_minus_two_nu*log(_Rpdtil)/_cos_o_dip;
+
         if (!singularity4(_Rpeta)) {
-            OP_SUB(1); OP_LOG(1); OP_MULT(2); OP_DIV(1);
+            OP_SUB(1);
+            OP_LOG(1);
+            OP_MULT(2);
+            OP_DIV(1);
             ret_value -= _one_minus_two_nu*log(_Rpeta)*_sin_o_dip/_cos_o_dip;
         } else {
-            OP_SUB(2); OP_LOG(1);
+            OP_SUB(2);
+            OP_LOG(1);
             ret_value += _one_minus_two_nu*log(_R-eta)*_sin_o_dip/_cos_o_dip;
         }
+
         return ret_value;
-    } else{
+    } else {
         return -1.0*_one_minus_two_nu*_q/_Rpdtil;
     }
 }
-double quakelib::Okada::I5g(double _R, double xi, double eta, double _q){
-	double _dtil = dtil(_q,eta);
+double quakelib::Okada::I5g(double _R, double xi, double eta, double _q) {
+    double _dtil = dtil(_q,eta);
     double _Rpdtil   = _R+_dtil;
-    if (_cos_o_dip!=0.0){
+
+    if (_cos_o_dip!=0.0) {
         return 2.0*_one_minus_two_nu*I1g(_R,xi,eta,_q);
-    } else{
+    } else {
         return -1.0*_one_minus_two_nu*xi*_sin_o_dip/_Rpdtil;
     }
 }
 
-double quakelib::Okada::I1g(double _R, double xi, double eta, double _q){
-	OP_MULT(1);OP_ADD(1);
-	double _Rpeta = _R+eta;
-	double xi_cos = xi*_cos_o_dip;
+double quakelib::Okada::I1g(double _R, double xi, double eta, double _q) {
+    OP_MULT(1);
+    OP_ADD(1);
+    double _Rpeta = _R+eta;
+    double xi_cos = xi*_cos_o_dip;
+
     if (_cos_o_dip!=0.0) {
-        if (!singularity2(xi)){
-		    OP_MULT(2); OP_ADD(1); OP_SUB(1); OP_DIV(1);
-		    return atan((_Rpeta*(1.0+_sin_o_dip)-_q*_cos_o_dip)/xi_cos);
-	    } else {
-		    return 0.0;
-	    }
+        if (!singularity2(xi)) {
+            OP_MULT(2);
+            OP_ADD(1);
+            OP_SUB(1);
+            OP_DIV(1);
+            return atan((_Rpeta*(1.0+_sin_o_dip)-_q*_cos_o_dip)/xi_cos);
+        } else {
+            return 0.0;
+        }
     } else {
         return M_PI*0.5;
     }
 }
 
-double quakelib::Okada::I0g(double _R, double eta, double _q){
-	double _dtil = dtil(_q,eta);
-	double _Rpeta 	 = _R+eta;
-	double ret_value = -1.0*_sin_o_dip*log(_R+_dtil);
+double quakelib::Okada::I0g(double _R, double eta, double _q) {
+    double _dtil = dtil(_q,eta);
+    double _Rpeta    = _R+eta;
+    double ret_value = -1.0*_sin_o_dip*log(_R+_dtil);
+
     if (!singularity4(_Rpeta)) {
-    	OP_ADD(1); OP_LOG(1);
-    	ret_value += log(_R+eta);
+        OP_ADD(1);
+        OP_LOG(1);
+        ret_value += log(_R+eta);
     } else {
-    	OP_SUB(2); OP_LOG(1);
-    	ret_value -= log(_R-eta);
+        OP_SUB(2);
+        OP_LOG(1);
+        ret_value -= log(_R-eta);
     }
+
     return ret_value;
 }
 
diff --git a/src/core/VCSimulation.cpp b/src/core/VCSimulation.cpp
index 6c97aa3..8337d2b 100644
--- a/src/core/VCSimulation.cpp
+++ b/src/core/VCSimulation.cpp
@@ -590,10 +590,12 @@ void VCSimulation::distributeBlocks(const quakelib::ElementIDSet &local_id_list,
     delete proc_block_count;
     delete proc_block_disps;
 #else   // MPI_C_FOUND
+
     // Copy the local IDs into the global list just for the single processor
-    for (it=local_id_list.begin();it!=local_id_list.end();++it) {
+    for (it=local_id_list.begin(); it!=local_id_list.end(); ++it) {
         global_id_list.insert(std::make_pair(*it, 0));
     }
+
 #endif
 }
 
diff --git a/src/simulation/RunEvent.cpp b/src/simulation/RunEvent.cpp
index 5bbc54f..7c6ab62 100644
--- a/src/simulation/RunEvent.cpp
+++ b/src/simulation/RunEvent.cpp
@@ -203,6 +203,7 @@ void RunEvent::processBlocksSecondaryFailures(VCSimulation *sim, quakelib::Model
         delete fullA;
     } else {
 #ifdef MPI_C_FOUND
+
         for (i=0; i<num_local_failed; ++i) {
             MPI_Send(&(A[i*num_global_failed]), num_global_failed, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD);
             MPI_Send(&(b[i]), 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD);
@@ -211,6 +212,7 @@ void RunEvent::processBlocksSecondaryFailures(VCSimulation *sim, quakelib::Model
         for (i=0; i<num_local_failed; ++i) {
             MPI_Recv(&(x[i]), 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
         }
+
 #else
         assertThrow(false, "Single processor version of code, but processor MPI rank is non-zero.");
 #endif



More information about the CIG-COMMITS mailing list