[cig-commits] [commit] master: Rename Block to Element in some types (4a1da4d)

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


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

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

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

commit 4a1da4d0c837c07f52968406f91bb6988a76483f
Author: Eric Heien <emheien at ucdavis.edu>
Date:   Wed Sep 24 14:40:35 2014 -0700

    Rename Block to Element in some types


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

4a1da4d0c837c07f52968406f91bb6988a76483f
 src/core/VCEvent.h                 |  5 +++--
 src/core/VCSimulation.cpp          | 27 +++++++++++++--------------
 src/core/VCSimulation.h            | 10 +++++-----
 src/io/EventOutput.cpp             |  4 ++--
 src/io/HDF5Data.cpp                |  4 ++--
 src/simulation/BASSAftershocks.cpp |  4 ++--
 src/simulation/BASSAftershocks.h   |  6 +++---
 src/simulation/RunEvent.cpp        |  8 ++++----
 src/simulation/RunEvent.h          |  7 ++++---
 9 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/src/core/VCEvent.h b/src/core/VCEvent.h
index 51847e7..ab91c7f 100644
--- a/src/core/VCEvent.h
+++ b/src/core/VCEvent.h
@@ -19,6 +19,7 @@
 // DEALINGS IN THE SOFTWARE.
 
 #include "VCBlock.h"
+#include "QuakeLibIO.h"
 #include <map>
 #include <set>
 
@@ -41,8 +42,8 @@ typedef std::set<BlockID> BlockIDSet;
 typedef std::map<BlockID, int> BlockIDProcMapping;
 typedef std::set<FaultID> FaultIDSet;
 typedef std::set<SectionID> SectionIDSet;
-typedef std::map<FaultID, BlockIDSet> FaultBlockMapping;
-typedef std::map<SectionID, BlockIDSet> SectionBlockMapping;
+typedef std::map<FaultID, quakelib::ElementIDSet> FaultBlockMapping;
+typedef std::map<SectionID, quakelib::ElementIDSet> SectionBlockMapping;
 typedef std::vector<FaultID> FaultIDList;
 typedef std::vector<SectionID> SectionIDList;
 
diff --git a/src/core/VCSimulation.cpp b/src/core/VCSimulation.cpp
index edeac26..edfcd04 100644
--- a/src/core/VCSimulation.cpp
+++ b/src/core/VCSimulation.cpp
@@ -100,8 +100,8 @@ int VCSimulation::numFaults(void) const {
 /*!
  Calculate the stress before and after an event of the blocks that failed during the event.
  */
-void VCSimulation::getInitialFinalStresses(const BlockIDSet &block_set, double &shear_init, double &shear_final, double &normal_init, double &normal_final) const {
-    BlockIDSet::const_iterator      it;
+void VCSimulation::getInitialFinalStresses(const quakelib::ElementIDSet &block_set, double &shear_init, double &shear_final, double &normal_init, double &normal_final) const {
+    quakelib::ElementIDSet::const_iterator      it;
 
     shear_init = shear_final = normal_init = normal_final = 0.0;
 
@@ -118,12 +118,12 @@ void VCSimulation::getInitialFinalStresses(const BlockIDSet &block_set, double &
     }
 }
 
-void VCSimulation::sumStresses(const BlockIDSet &block_set,
+void VCSimulation::sumStresses(const quakelib::ElementIDSet &block_set,
                                double &shear_stress,
                                double &shear_stress0,
                                double &normal_stress,
                                double &normal_stress0) const {
-    BlockIDSet::const_iterator      it;
+    quakelib::ElementIDSet::const_iterator      it;
 
     shear_stress = shear_stress0 = normal_stress = normal_stress0 = 0;
 
@@ -140,9 +140,9 @@ void VCSimulation::printTimers(void) {
 }
 
 void VCSimulation::determineBlockNeighbors(void) {
-    BlockList::iterator bit, iit;
-    BlockIDSet          all_blocks;
-    double              block_size;
+    BlockList::iterator     bit, iit;
+    quakelib::ElementIDSet  all_blocks;
+    double                  block_size;
 
     for (bit=begin(); bit!=end(); ++bit) {
         for (iit=begin(); iit!=end(); ++iit) {
@@ -158,9 +158,9 @@ void VCSimulation::determineBlockNeighbors(void) {
     }
 }
 
-std::pair<BlockIDSet::const_iterator, BlockIDSet::const_iterator> VCSimulation::getNeighbors(const BlockID &bid) const {
-    std::map<BlockID, BlockIDSet>::const_iterator       it;
-    BlockIDSet      empty_set;
+std::pair<quakelib::ElementIDSet::const_iterator, quakelib::ElementIDSet::const_iterator> VCSimulation::getNeighbors(const BlockID &bid) const {
+    std::map<BlockID, quakelib::ElementIDSet>::const_iterator       it;
+    quakelib::ElementIDSet      empty_set;
 
     it = neighbor_map.find(bid);
 
@@ -529,10 +529,10 @@ void VCSimulation::distributeUpdateField(void) {
 /*!
  Distributes a list of blocks among all processors. Used for determining failed blocks in a sweep.
  */
-void VCSimulation::distributeBlocks(const BlockIDSet &local_id_list, BlockIDProcMapping &global_id_list) {
+void VCSimulation::distributeBlocks(const quakelib::ElementIDSet &local_id_list, BlockIDProcMapping &global_id_list) {
 #ifdef MPI_C_FOUND
-    int                         i, n, p;
-    BlockIDSet::const_iterator  it;
+    int                                     i, n, p;
+    quakelib::ElementIDSet::const_iterator  it;
     int                         *proc_block_count = new int[world_size];
     int                         *proc_block_disps = new int[world_size];
     BlockID                     *local_block_ids = new BlockID[local_id_list.size()];
@@ -596,7 +596,6 @@ void VCSimulation::distributeBlocks(const BlockIDSet &local_id_list, BlockIDProc
 /*!
  Collect the individual event sweeps spread through all nodes
  on to the root node in a single sweep.
- NOTE: This does not transfer stresses, these will be zeroed in the output file
  */
 void VCSimulation::collectEventSweep(VCEventSweep &cur_sweep) {
 #ifdef MPI_C_FOUND
diff --git a/src/core/VCSimulation.h b/src/core/VCSimulation.h
index 344cea6..68a2b33 100644
--- a/src/core/VCSimulation.h
+++ b/src/core/VCSimulation.h
@@ -75,9 +75,9 @@ class VCSimulation : public SimFramework, public VCParams, public VCSimData, pub
         };
 
         int numFaults(void) const;
-        void getInitialFinalStresses(const BlockIDSet &block_set, double &shear_init, double &shear_final, double &normal_init, double &normal_final) const;
+        void getInitialFinalStresses(const quakelib::ElementIDSet &block_set, double &shear_init, double &shear_final, double &normal_init, double &normal_final) const;
 
-        void sumStresses(const BlockIDSet &block_set, double &shear_stress, double &shear_stress0, double &normal_stress, double &normal_stress0) const;
+        void sumStresses(const quakelib::ElementIDSet &block_set, double &shear_stress, double &shear_stress0, double &normal_stress, double &normal_stress0) const;
 
         double sumGreenShear(const BlockID &r) const {
             double sum = 0;
@@ -122,10 +122,10 @@ class VCSimulation : public SimFramework, public VCParams, public VCSimData, pub
         void multiplySumRow(double *c, const double *b, const GREEN_VAL *a, const int n, const bool dense);
         void multiplyRow(double *c, const double *b, const GREEN_VAL *a, const int n);
         void distributeUpdateField(void);
-        void distributeBlocks(const BlockIDSet &local_id_list, BlockIDProcMapping &global_id_list);
+        void distributeBlocks(const quakelib::ElementIDSet &local_id_list, BlockIDProcMapping &global_id_list);
         void collectEventSweep(VCEventSweep &cur_sweep);
 
-        std::pair<BlockIDSet::const_iterator, BlockIDSet::const_iterator> getNeighbors(const BlockID &bid) const;
+        std::pair<quakelib::ElementIDSet::const_iterator, quakelib::ElementIDSet::const_iterator> getNeighbors(const BlockID &bid) const;
         void printTimers(void);
 
         bool isLocalBlockID(const BlockID &block_id) const {
@@ -149,7 +149,7 @@ class VCSimulation : public SimFramework, public VCParams, public VCSimData, pub
         GREEN_VAL                   *decompress_buf;
 
         //! Map of which blocks have which neighbors
-        std::map<BlockID, BlockIDSet>   neighbor_map;
+        std::map<BlockID, quakelib::ElementIDSet>   neighbor_map;
 };
 
 #endif
diff --git a/src/io/EventOutput.cpp b/src/io/EventOutput.cpp
index 16b3285..4bc7c70 100644
--- a/src/io/EventOutput.cpp
+++ b/src/io/EventOutput.cpp
@@ -113,7 +113,7 @@ SimRequest EventOutput::run(SimFramework *_sim) {
 #endif
     } else if (sim->getEventOutfileType() == "text") {
         VCEvent &event = sim->getCurrentEvent();
-        BlockIDSet                  involved_blocks;
+        ElementIDSet                involved_blocks;
         EventSweeps::iterator       it;
         VCEventSweep::iterator      eit;
         unsigned int                i, sweep_num, rec_num;
@@ -126,7 +126,7 @@ SimRequest EventOutput::run(SimFramework *_sim) {
         }
 
         // Write the event details
-        event.getInvolvedBlocks(involved_blocks);
+        event.getInvolvedElements(involved_blocks);
         event_outfile << event.getEventNumber() << " " << event.getEventYear() << " ";
         event_outfile << event.getEventTrigger() << " " << event.getMagnitude(involved_blocks) << " ";
         event_outfile << event.getShearStressInit() << " " << event.getNormalStressInit() << " ";
diff --git a/src/io/HDF5Data.cpp b/src/io/HDF5Data.cpp
index 2b8f872..00f4129 100644
--- a/src/io/HDF5Data.cpp
+++ b/src/io/HDF5Data.cpp
@@ -628,7 +628,7 @@ void HDF5DataWriter::writeEvent(VCEvent &event) {
     EventSweeps::iterator       it;
     VCEventSweep::iterator      eit;
     VCGeneralEventSet::iterator git;
-    BlockIDSet                  involved_blocks;
+    quakelib::ElementIDSet      involved_blocks;
     EventInfo                   e_info;
     EventSweepInfo              *s_info_array;
     herr_t                      status;
@@ -686,7 +686,7 @@ void HDF5DataWriter::writeEvent(VCEvent &event) {
     e_info.start_sweep_rec = start_recs;
     e_info.end_sweep_rec = end_recs;
 
-    event.getInvolvedBlocks(involved_blocks);
+    event.getInvolvedElements(involved_blocks);
 
     e_info.event_number = event.getEventNumber();
     e_info.event_year = event.getEventYear();
diff --git a/src/simulation/BASSAftershocks.cpp b/src/simulation/BASSAftershocks.cpp
index 198035d..5e1bd24 100644
--- a/src/simulation/BASSAftershocks.cpp
+++ b/src/simulation/BASSAftershocks.cpp
@@ -53,7 +53,7 @@ SimRequest BASSAftershocks::run(SimFramework *_sim) {
 
     // Generate initial seed shock based on the current event
     event_blocks.clear();
-    sim->getCurrentEvent().getInvolvedBlocks(event_blocks);
+    sim->getCurrentEvent().getInvolvedElements(event_blocks);
 
     // Select a random block in the event to be the center of the aftershocks
     initial_shock = VCEventAftershock(sim->getCurrentEvent().getMagnitude(event_blocks),
@@ -91,7 +91,7 @@ SimRequest BASSAftershocks::run(SimFramework *_sim) {
 
 unsigned int BASSAftershocks::generateAftershocks(VCSimulation *sim, VCEventAftershock seed) {
     VCEventAftershock       aftershock;
-    BlockIDSet::iterator    it;
+    quakelib::ElementIDSet::iterator  it;
     float                   Ms, t, r, theta, seed_x, seed_y;
     int                     selected_ind;
 
diff --git a/src/simulation/BASSAftershocks.h b/src/simulation/BASSAftershocks.h
index eef0082..32daa64 100644
--- a/src/simulation/BASSAftershocks.h
+++ b/src/simulation/BASSAftershocks.h
@@ -42,10 +42,10 @@ class BASSAftershocks : public SimPlugin {
         float _q;       //! Decay rate of aftershocks (distance)
 
         //! Vector of aftershocks that need to be processed
-        AftershockVector    events_to_process;
+        AftershockVector        events_to_process;
 
-        BlockIDSet          event_blocks;
-        bool                first;
+        quakelib::ElementIDSet  event_blocks;
+        bool                    first;
 
         //! Work horse function
         unsigned int generateAftershocks(VCSimulation *sim, VCEventAftershock seed);
diff --git a/src/simulation/RunEvent.cpp b/src/simulation/RunEvent.cpp
index 1baa76a..0dca2e6 100644
--- a/src/simulation/RunEvent.cpp
+++ b/src/simulation/RunEvent.cpp
@@ -117,9 +117,9 @@ void RunEvent::processBlocksSecondaryFailures(VCSimulation *sim, VCEventSweep &c
     int             lid;
     BlockID         gid;
     unsigned int    i, n;
-    BlockIDSet                      local_id_list;
+    quakelib::ElementIDSet          local_id_list;
     BlockIDProcMapping              global_id_list;
-    BlockIDSet::const_iterator      it;
+    quakelib::ElementIDSet::const_iterator      it;
     BlockIDProcMapping::const_iterator  jt;
 
     for (lid=0; lid<sim->numLocalBlocks(); ++lid) {
@@ -386,11 +386,11 @@ SimRequest RunEvent::run(SimFramework *_sim) {
 }
 
 void RunEvent::recordEventStresses(VCSimulation *sim) {
-    BlockIDSet involved_blocks;
+    quakelib::ElementIDSet involved_blocks;
     double shear_init, shear_final, normal_init, normal_final;
     double total_shear_init, total_shear_final, total_normal_init, total_normal_final;
 
-    sim->getCurrentEvent().getInvolvedBlocks(involved_blocks);
+    sim->getCurrentEvent().getInvolvedElements(involved_blocks);
 
     sim->getInitialFinalStresses(involved_blocks, shear_init, shear_final, normal_init, normal_final);
 
diff --git a/src/simulation/RunEvent.h b/src/simulation/RunEvent.h
index c778e54..0ee9c9e 100644
--- a/src/simulation/RunEvent.h
+++ b/src/simulation/RunEvent.h
@@ -29,9 +29,10 @@
  */
 class RunEvent : public SimPlugin {
     private:
-        BlockIDSet          local_failed_blocks;
-        BlockIDProcMapping  global_failed_blocks;
-        BlockIDSet          looseBlocks;
+        quakelib::ElementIDSet  local_failed_blocks;
+        BlockIDProcMapping      global_failed_blocks;
+        quakelib::ElementIDSet  looseBlocks;
+        unsigned int            sweep_num;
 
         void processBlocksOrigFail(VCSimulation *sim, VCEventSweep &current_sweep);
         void processBlocksSecondaryFailures(VCSimulation *sim, VCEventSweep &current_sweep);



More information about the CIG-COMMITS mailing list