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

gss can have grid, zone, or slab type

parent 557df470
No related branches found
No related tags found
1 merge request!146Lib updates
......@@ -54,6 +54,7 @@ import gov.usgs.earthquake.nshmp.tree.LogicTree;
*/
public class GridSourceSet extends AbstractSourceSet<PointSource> {
final SourceType type;
final List<Location> locations;
final List<Mfd> mfds;
final LogicTree<List<Mfd>> mfdsTree;
......@@ -86,6 +87,7 @@ public class GridSourceSet extends AbstractSourceSet<PointSource> {
private GridSourceSet(Builder builder) {
super(builder);
this.type = builder.type;
this.locations = builder.locations;
this.mfds = builder.mfds;
this.mfdsTree = builder.mfdsTree;
......@@ -105,8 +107,11 @@ public class GridSourceSet extends AbstractSourceSet<PointSource> {
*/
// System.out.println(Δm);
// this.optimizable = (sourceType() != FIXED_STRIKE) && !Double.isNaN(Δm);
this.optimizable = (sourceType() != FIXED_STRIKE) && this.magMaster.isPresent();
// TODO magMaster is always present, no?
this.optimizable =
(type != SourceType.ZONE) &&
(sourceType() != FIXED_STRIKE) &&
this.magMaster.isPresent();
// System.out.println(Arrays.toString(magMaster.orElseThrow()));
double[] depthMags = this.mfds.get(0).data().xValues().toArray();
......@@ -136,7 +141,7 @@ public class GridSourceSet extends AbstractSourceSet<PointSource> {
@Override
public SourceType type() {
return GRID;
return type;
}
/**
......@@ -252,6 +257,7 @@ public class GridSourceSet extends AbstractSourceSet<PointSource> {
private static final String ID = "GridSourceSet.Builder";
private SourceType type;
private List<Location> locations = Lists.newArrayList();
private List<Mfd> mfds = Lists.newArrayList();
private LogicTree<List<Mfd>> mfdsTree;
......@@ -269,6 +275,11 @@ public class GridSourceSet extends AbstractSourceSet<PointSource> {
private Map<FocalMech, Double> mechMap;
private boolean singularMechs = true;
Builder type(SourceType type) {
this.type = type;
return this;
}
Builder strike(double strike) {
this.strike = OptionalDouble.of(checkStrike(strike));
this.sourceType = FIXED_STRIKE;
......@@ -411,8 +422,9 @@ public class GridSourceSet extends AbstractSourceSet<PointSource> {
@Override
void validateState(String buildId) {
super.validateState(buildId);
checkState(type != null, "%s source type not set", buildId);
checkState(strike != null, "%s strike not set", buildId);
checkState(sourceType != null, "%s source type not set", buildId);
checkState(sourceType != null, "%s point source type not set", buildId);
checkState(!locations.isEmpty(), "%s has no locations", buildId);
checkState(!mfds.isEmpty(), "%s has no Mfds", buildId);
checkState(rupScaling != null, "%s has no rupture-scaling relation set", buildId);
......
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