Skip to content
Snippets Groups Projects
Commit b73827cd authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

added mfdTree implementation

parent 5dc7da54
No related branches found
No related tags found
1 merge request!277mfd-tree and text updates
......@@ -9,6 +9,7 @@ import java.util.function.Predicate;
import gov.usgs.earthquake.nshmp.geo.Location;
import gov.usgs.earthquake.nshmp.mfd.Mfd;
import gov.usgs.earthquake.nshmp.tree.LogicGroup;
import gov.usgs.earthquake.nshmp.tree.LogicTree;
/**
......@@ -47,15 +48,26 @@ public class ClusterRuptureSet extends AbstractRuptureSet<ClusterSource> {
@Override
public LogicTree<Mfd> mfdTree() {
System.err.println("TODO Cluster MFD tree implementation");
// only returning first cluster source
throw new UnsupportedOperationException();
// return source.mfdTree;
/*
* A ClusterSource is composed of multiple FaultRuptureSets that rupture
* together at some rate. For the purposes of reporting an MFD tree for the
* rupture set, we combine the SINGLE MFDs associated with each
* FaultRuptureSet and set the rate of each magnitude to its weight. We then
* build a logic group where the weight (scale) of each branch is set to the
* cluster rate.
*/
ClusterSource clusterSource = source.get(0);
double rate = clusterSource.rate();
LogicGroup.Builder<Mfd> builder = LogicGroup.builder();
for (FaultRuptureSet frs : clusterSource.faults()) {
Mfd mfd = ModelTrees.reduceMfdTree(frs.mfdTree());
builder.addBranch(frs.name(), mfd, rate);
}
return builder.build();
}
@Override
// this is problemtic as we are not getting the rate weight
// is this still a problem?
public Iterator<ClusterSource> iterator() {
return source.iterator();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment