[cig-commits] [commit] master: Change event element query function (45feec9)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Oct 8 17:06:38 PDT 2014
Repository : https://github.com/geodynamics/vc
On branch : master
Link : https://github.com/geodynamics/vc/compare/23464fca3efa2b6ad7ee0ce8f60c225b18b49741...e4325192ad1118379f46ba66899cb98143d09e04
>---------------------------------------------------------------
commit 45feec96adf9dd9b6bddd5441797c88eeb6c25cb
Author: Eric Heien <emheien at ucdavis.edu>
Date: Wed Oct 8 00:16:20 2014 -0700
Change event element query function
>---------------------------------------------------------------
45feec96adf9dd9b6bddd5441797c88eeb6c25cb
quakelib/src/QuakeLibIO.h | 13 ++++++++-----
src/simulation/BASSAftershocks.cpp | 3 +--
src/simulation/RunEvent.cpp | 2 +-
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/quakelib/src/QuakeLibIO.h b/quakelib/src/QuakeLibIO.h
index a31bea3..026e583 100644
--- a/quakelib/src/QuakeLibIO.h
+++ b/quakelib/src/QuakeLibIO.h
@@ -673,10 +673,14 @@ namespace quakelib {
_sweeps[pos]._normal_final = normal_final;
}
- void getInvolvedElements(ElementIDSet &element_id_set) const {
+ ElementIDSet getInvolvedElements(void) const {
+ ElementIDSet element_id_set;
+
for (std::vector<SweepData>::const_iterator it=_sweeps.begin(); it!=_sweeps.end(); ++it) {
element_id_set.insert(it->_element_id);
}
+
+ return element_id_set;
}
void clear(void) {
@@ -884,8 +888,8 @@ namespace quakelib {
}
//! Get a set of block IDs for all the blocks that failed in this event.
- void getInvolvedElements(ElementIDSet &element_id_set) const {
- _sweeps.getInvolvedElements(element_id_set);
+ ElementIDSet getInvolvedElements(void) const {
+ return _sweeps.getInvolvedElements();
}
//! Get the magnitude of the earthquake in this event based on the set of specified blocks.
@@ -902,8 +906,7 @@ namespace quakelib {
//! Get the magnitude of the earthquake in this event.
double getMagnitude(void) const {
- ElementIDSet block_id_set;
- getInvolvedElements(block_id_set);
+ ElementIDSet block_id_set = getInvolvedElements();
return getMagnitude(block_id_set);
}
diff --git a/src/simulation/BASSAftershocks.cpp b/src/simulation/BASSAftershocks.cpp
index db53436..eba291c 100644
--- a/src/simulation/BASSAftershocks.cpp
+++ b/src/simulation/BASSAftershocks.cpp
@@ -52,8 +52,7 @@ SimRequest BASSAftershocks::run(SimFramework *_sim) {
events_to_process.clear();
// Generate initial seed shock based on the current event
- event_blocks.clear();
- sim->getCurrentEvent().getInvolvedElements(event_blocks);
+ event_blocks = sim->getCurrentEvent().getInvolvedElements();
// Select a random block in the event to be the center of the aftershocks
initial_shock = VCEventAftershock(sim->getCurrentEvent().getMagnitude(event_blocks),
diff --git a/src/simulation/RunEvent.cpp b/src/simulation/RunEvent.cpp
index 7d775fc..48a6820 100644
--- a/src/simulation/RunEvent.cpp
+++ b/src/simulation/RunEvent.cpp
@@ -486,7 +486,7 @@ void RunEvent::recordEventStresses(VCSimulation *sim) {
double shear_init, shear_final, normal_init, normal_final;
double total_shear_init, total_shear_final, total_normal_init, total_normal_final;
- sim->getCurrentEvent().getInvolvedElements(involved_blocks);
+ involved_blocks = sim->getCurrentEvent().getInvolvedElements();
sim->getInitialFinalStresses(involved_blocks, shear_init, shear_final, normal_init, normal_final);
More information about the CIG-COMMITS
mailing list