[cig-commits] [commit] master: Rename UNDEFINED tags (f91539d)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Oct 8 17:05:17 PDT 2014


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

On branch  : master
Link       : https://github.com/geodynamics/vc/compare/23464fca3efa2b6ad7ee0ce8f60c225b18b49741...e4325192ad1118379f46ba66899cb98143d09e04

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

commit f91539d0fee5e91d1de6f1c5e549118de9451d97
Author: Eric Heien <emheien at ucdavis.edu>
Date:   Wed Sep 24 14:37:01 2014 -0700

    Rename UNDEFINED tags


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

f91539d0fee5e91d1de6f1c5e549118de9451d97
 quakelib/src/QuakeLibIO.h            | 5 +++++
 src/core/VCBlock.cpp                 | 5 +++--
 src/core/VCBlock.h                   | 5 -----
 src/core/VCSimulation.cpp            | 6 +++---
 src/simulation/BASSAftershocks.cpp   | 2 +-
 src/simulation/ProgressMonitor.cpp   | 2 +-
 src/simulation/UpdateBlockStress.cpp | 6 +++---
 7 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/quakelib/src/QuakeLibIO.h b/quakelib/src/QuakeLibIO.h
index c35f368..f79551c 100644
--- a/quakelib/src/QuakeLibIO.h
+++ b/quakelib/src/QuakeLibIO.h
@@ -35,6 +35,11 @@
 #ifndef _QUAKELIB_IO_H_
 #define _QUAKELIB_IO_H_
 
+#define UNDEFINED_ELEMENT_ID    UINT_MAX
+#define UNDEFINED_FAULT_ID      UINT_MAX
+#define UNDEFINED_SECTION_ID    UINT_MAX
+#define UNDEFINED_EVENT_ID      UINT_MAX
+
 namespace quakelib {
     typedef unsigned int UIndex;
     static const UIndex INVALID_INDEX = std::numeric_limits<unsigned int>::max();
diff --git a/src/core/VCBlock.cpp b/src/core/VCBlock.cpp
index d73e0e6..0b4a0b7 100644
--- a/src/core/VCBlock.cpp
+++ b/src/core/VCBlock.cpp
@@ -20,6 +20,7 @@
 
 #include "VCBlock.h"
 #include "QuakeLibOkada.h"
+#include "QuakeLibIO.h"
 #include <sstream>
 #include <string.h>
 #include <iomanip>
@@ -113,7 +114,7 @@ void Block::get_rake_and_normal_stress_due_to_block(double stresses[2], const do
 /*!*/
 
 std::ostream &operator<<(std::ostream &os, const BlockVal &bv) {
-    if (bv.block_id == UNDEFINED_BLOCK_ID) os << "(Undef, ";
+    if (bv.block_id == UNDEFINED_ELEMENT_ID) os << "(Undef, ";
     else os << "(B" << bv.block_id << ", ";
 
     os << bv.val << ")";
@@ -122,7 +123,7 @@ std::ostream &operator<<(std::ostream &os, const BlockVal &bv) {
 
 void Block::clear(void) {
     quakelib::SimElement::clear();
-    id = UNDEFINED_BLOCK_ID;
+    id = UNDEFINED_ELEMENT_ID;
     fid = UNDEFINED_FAULT_ID;
     sid = UNDEFINED_SECTION_ID;
     self_shear = self_normal = dynamic_val = stress_drop = std::numeric_limits<float>::quiet_NaN();
diff --git a/src/core/VCBlock.h b/src/core/VCBlock.h
index 69576ae..6522be7 100644
--- a/src/core/VCBlock.h
+++ b/src/core/VCBlock.h
@@ -35,11 +35,6 @@ typedef unsigned int BlockID;
 typedef unsigned int FaultID;
 typedef unsigned int SectionID;
 
-#define UNDEFINED_BLOCK_ID      UINT_MAX
-#define UNDEFINED_FAULT_ID      UINT_MAX
-#define UNDEFINED_SECTION_ID    UINT_MAX
-#define UNDEFINED_EVENT_ID      UINT_MAX
-
 struct StateCheckpointData {
     double      slipDeficit;
     double      cff;
diff --git a/src/core/VCSimulation.cpp b/src/core/VCSimulation.cpp
index 9e7d5ef..edeac26 100644
--- a/src/core/VCSimulation.cpp
+++ b/src/core/VCSimulation.cpp
@@ -726,7 +726,7 @@ void VCSimulation::partitionBlocks(void) {
                     break;
 
                 case PARTITION_DISTANCE:
-                    base_id = UNDEFINED_BLOCK_ID;
+                    base_id = UNDEFINED_ELEMENT_ID;
 
                     if (i == world_size-1) num_local_blocks = avail_ids.size();
 
@@ -734,7 +734,7 @@ void VCSimulation::partitionBlocks(void) {
 
                     while (more_to_assign) {
                         // Find a starting segment
-                        if (base_id == UNDEFINED_BLOCK_ID) {
+                        if (base_id == UNDEFINED_ELEMENT_ID) {
                             base_id = *(avail_ids.begin());
                             cur_fault = getBlock(base_id).getFaultID();
                             dist_map.clear();
@@ -758,7 +758,7 @@ void VCSimulation::partitionBlocks(void) {
                         if (cur_assigns.size() >= num_local_blocks) more_to_assign = false;
 
                         // If we're out of blocks to assign, start another fault
-                        if (dist_map.size() == 0) base_id = UNDEFINED_BLOCK_ID;
+                        if (dist_map.size() == 0) base_id = UNDEFINED_ELEMENT_ID;
                     }
 
                     break;
diff --git a/src/simulation/BASSAftershocks.cpp b/src/simulation/BASSAftershocks.cpp
index b36173d..198035d 100644
--- a/src/simulation/BASSAftershocks.cpp
+++ b/src/simulation/BASSAftershocks.cpp
@@ -37,7 +37,7 @@ SimRequest BASSAftershocks::run(SimFramework *_sim) {
 
     // If the last event wasn't a static failure event, don't generate aftershocks
     // Otherwise we're generating aftershocks for aftershocks, which is already done by the model
-    if (sim->getCurrentEvent().getEventTrigger() == UNDEFINED_BLOCK_ID) return SIM_STOP_OK;
+    if (sim->getCurrentEvent().getEventTrigger() == UNDEFINED_ELEMENT_ID) return SIM_STOP_OK;
 
     // Get BASS parameters
     _Mm = sim->getBASSMinMagnitude();
diff --git a/src/simulation/ProgressMonitor.cpp b/src/simulation/ProgressMonitor.cpp
index a96303d..cdcc184 100644
--- a/src/simulation/ProgressMonitor.cpp
+++ b/src/simulation/ProgressMonitor.cpp
@@ -71,7 +71,7 @@ void ProgressMonitor::getStats(VCSimulation *sim, BlockVal &min, BlockVal &avg,
     min_val.val = DBL_MAX;
     max_val.val = -DBL_MAX;
     sum_val.val = 0;
-    min_val.block_id = max_val.block_id = sum_val.block_id = UNDEFINED_BLOCK_ID;
+    min_val.block_id = max_val.block_id = sum_val.block_id = UNDEFINED_ELEMENT_ID;
 
     // Get the minimum, maximum and sum CFF values on this node
     for (lid=0; lid<sim->numLocalBlocks(); ++lid) {
diff --git a/src/simulation/UpdateBlockStress.cpp b/src/simulation/UpdateBlockStress.cpp
index 3c5b444..0d5fa20 100644
--- a/src/simulation/UpdateBlockStress.cpp
+++ b/src/simulation/UpdateBlockStress.cpp
@@ -133,10 +133,10 @@ SimRequest UpdateBlockStress::run(SimFramework *_sim) {
 void UpdateBlockStress::nextAftershock(BlockVal &next_aftershock) {
     if (sim->isRootNode() && sim->numAftershocksToProcess() > 0) {
         next_aftershock.val = sim->nextAftershockTime() - sim->getYear();
-        next_aftershock.block_id = UNDEFINED_BLOCK_ID;
+        next_aftershock.block_id = UNDEFINED_ELEMENT_ID;
     } else {
         next_aftershock.val = DBL_MAX;
-        next_aftershock.block_id = UNDEFINED_BLOCK_ID;
+        next_aftershock.block_id = UNDEFINED_ELEMENT_ID;
     }
 }
 
@@ -178,7 +178,7 @@ void UpdateBlockStress::nextStaticFailure(BlockVal &next_static_fail) {
 
     // Go through the blocks and find which one will fail first
     next_static_fail.val = DBL_MAX;
-    next_static_fail.block_id = UNDEFINED_BLOCK_ID;
+    next_static_fail.block_id = UNDEFINED_ELEMENT_ID;
 
     for (lid=0; lid<sim->numLocalBlocks(); ++lid) {
         gid = sim->getGlobalBID(lid);



More information about the CIG-COMMITS mailing list