comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDerivateFacet.java @ 3091:179e38aa678d

Some fixing charts are generated now flys-artifacts/trunk@4690 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Mon, 18 Jun 2012 13:29:15 +0000
parents 960307cf2adc
children cd309f8597f6
comparison
equal deleted inserted replaced
3090:22def36d37b7 3091:179e38aa678d
29 implements FacetTypes { 29 implements FacetTypes {
30 30
31 /** House logger. */ 31 /** House logger. */
32 private static Logger logger = Logger.getLogger(FixDerivateFacet.class); 32 private static Logger logger = Logger.getLogger(FixDerivateFacet.class);
33 33
34 private double maxQ;
35 34
36 /** Trivial Constructor. */ 35 /** Trivial Constructor. */
37 public FixDerivateFacet() { 36 public FixDerivateFacet() {
38 } 37 }
39 38
73 String function = access.getFunction(); 72 String function = access.getFunction();
74 Function ff = FunctionFactory.getInstance().getFunction(function); 73 Function ff = FunctionFactory.getInstance().getFunction(function);
75 Function.Derivative fd = ff.getDerivative(); 74 Function.Derivative fd = ff.getDerivative();
76 75
77 Parameters params = result.getParameters(); 76 Parameters params = result.getParameters();
78 77 double maxQ = FixFacetUtils.getMaxQ(params, currentKm);
79 // Determine maxQ 78
80 double[] maxQs = params 79 String[] paramNames = ff.getParameterNames();
81 .interpolate("km", currentKm, new String [] { "max_q" }); 80
82 if(maxQs != null) { 81 double[] coeffs = params.interpolate("km", currentKm, paramNames);
83 maxQ = maxQs[0]; 82 if(coeffs == null) {
83 logger.warn("getData: coeffs == null");
84 return null;
84 } 85 }
85
86 int row = params.binarySearch("km", currentKm, Math.pow(10, -4));
87 if(row < 0) {
88 row = -row - 1;
89 logger.debug("getData: no direct hit in params.binarySearch");
90 }
91 String[] paramNames = ff.getParameterNames();
92 int[] paramInd = params.columnIndices(paramNames);
93 double[] coeffs = new double[paramNames.length];
94 params.get(row, paramInd, coeffs);
95 86
96 de.intevation.flys.artifacts.math.Function mf = 87 de.intevation.flys.artifacts.math.Function mf =
97 fd.instantiate(coeffs); 88 fd.instantiate(coeffs);
98
99 double maxQ = getMaxQ(result, currentKm);
100 89
101 FixFunction fix = new FixFunction( 90 FixFunction fix = new FixFunction(
102 "", 91 "",
103 ff.getDescription(), 92 ff.getDescription(),
104 mf, 93 mf,
111 return null; 100 return null;
112 } 101 }
113 } 102 }
114 103
115 104
116 protected double getMaxQ(FixResult result, double km) {
117 return maxQ;
118 }
119
120 /** 105 /**
121 * Create a deep copy of this Facet. 106 * Create a deep copy of this Facet.
122 * @return a deep copy. 107 * @return a deep copy.
123 */ 108 */
124 @Override 109 @Override

http://dive4elements.wald.intevation.org