1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * This is not the original file distributed by the Apache Software Foundation
20 * It has been modified by the Hipparchus project
21 */
22
23 package org.hipparchus.ode.sampling;
24
25 import org.hipparchus.ode.EquationsMapper;
26 import org.hipparchus.ode.ODEStateAndDerivative;
27
28 /** This class is a step interpolator that does nothing.
29 *
30 * <p>This class is used when the {@link ODEStepHandler "step handler"}
31 * set up by the user does not need step interpolation. It does not
32 * recompute the state when {@link AbstractODEStateInterpolator#getInterpolatedState(double)
33 * getInterpolatedState} is called, only updating time and copying current state
34 * vector.</p>
35 *
36 * @see ODEStepHandler
37 *
38 */
39
40 public class DummyStepInterpolator extends AbstractODEStateInterpolator {
41
42 /** Serializable version identifier. */
43 private static final long serialVersionUID = 20160402L;
44
45 /** Simple constructor.
46 * @param isForward integration direction indicator
47 * @param globalPreviousState start of the global step
48 * @param globalCurrentState end of the global step
49 * @param softPreviousState start of the restricted step
50 * @param softCurrentState end of the restricted step
51 * @param equationsMapper mapper for ODE equations primary and secondary components
52 */
53 public DummyStepInterpolator(final boolean isForward,
54 final ODEStateAndDerivative globalPreviousState,
55 final ODEStateAndDerivative globalCurrentState,
56 final ODEStateAndDerivative softPreviousState,
57 final ODEStateAndDerivative softCurrentState,
58 final EquationsMapper equationsMapper) {
59 super(isForward, globalPreviousState, globalCurrentState,
60 softPreviousState, softCurrentState, equationsMapper);
61 }
62
63 /** {@inheritDoc} */
64 @Override
65 protected DummyStepInterpolator create(boolean newForward,
66 ODEStateAndDerivative newGlobalPreviousState,
67 ODEStateAndDerivative newGlobalCurrentState,
68 ODEStateAndDerivative newSoftPreviousState,
69 ODEStateAndDerivative newSoftCurrentState,
70 EquationsMapper newMapper) {
71 return new DummyStepInterpolator(newForward,
72 newGlobalPreviousState, newGlobalCurrentState,
73 newSoftPreviousState, newSoftCurrentState,
74 newMapper);
75 }
76
77 /** {@inheritDoc}.
78 * In this class, this method does nothing: the interpolated state
79 * is always the state at the end of the current step.
80 */
81 @Override
82 protected ODEStateAndDerivative computeInterpolatedStateAndDerivatives(EquationsMapper equationsMapper,
83 double time, double theta,
84 double thetaH, double oneMinusThetaH) {
85 return new ODEStateAndDerivative(time,
86 getCurrentState().getCompleteState(),
87 getCurrentState().getCompleteDerivative());
88 }
89
90 }