Skip to content

Commit

Permalink
Merge pull request opensha#104 from GNS-Science/oakley/perf
Browse files Browse the repository at this point in the history
Rupture building peformance improvements
  • Loading branch information
kevinmilner authored Apr 3, 2024
2 parents f567351 + 1825289 commit b52eb0c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ public PlausibilityResult apply(ClusterRupture rupture, boolean verbose) {
result = result.logicalOr(subResult);
else
result = result.logicalAnd(subResult);

if (logicalOr && result.isPass() && !verbose) {
break;
}
if (!logicalOr && !result.canContinue() && !verbose){
break;
}
}
if (result.isPass())
numPasses++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ else if (myProb > 1)
System.out.println("Probability of adding "+receiver.getSectionId()+" with "
+currentSects.size()+" sources: "+track.sum+"/|"+track.getSumHighest()+"| = "+myProb);
prob *= myProb;
if (prob == 0 && !verbose) {
return 0;
}
}

currentSects = nav.getCurrentSects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,9 @@ protected List<Jump> buildPossibleConnections(FaultSubsectionCluster from, Fault
PlausibilityResult result = PlausibilityResult.PASS;
boolean directional = false;
for (PlausibilityFilter filter : filters) {
result = result.logicalAnd(filter.apply(rupture, false));
if (result.canContinue()) {
result = result.logicalAnd(filter.apply(rupture, false));
}
directional = directional || filter.isDirectional(false);
}
if (debug)
Expand All @@ -761,8 +763,12 @@ protected List<Jump> buildPossibleConnections(FaultSubsectionCluster from, Fault
if (debug)
System.out.println("\tTrying reversed: "+rupture);
PlausibilityResult reverseResult = PlausibilityResult.PASS;
for (PlausibilityFilter filter : filters)
for (PlausibilityFilter filter : filters) {
reverseResult = reverseResult.logicalAnd(filter.apply(rupture, false));
if (!reverseResult.canContinue()) {
break;
}
}
if (debug)
System.out.println("\tResult: "+reverseResult);
if (scalarFilter != null && reverseResult.isPass()) {
Expand Down

0 comments on commit b52eb0c

Please sign in to comment.