Skip to content

Instantly share code, notes, and snippets.

@miho
Last active December 3, 2017 21:46
Show Gist options
  • Select an option

  • Save miho/89068c0d3755c34c67467ac80b731de8 to your computer and use it in GitHub Desktop.

Select an option

Save miho/89068c0d3755c34c67467ac80b731de8 to your computer and use it in GitHub Desktop.
package eu.mihosoft.vrl.user;
@ComponentInfo(name="Dopri45Scheme", category="ODE")
public class Dopri45Scheme implements EmbeddedRKSchemeInterface, java.io.Serializable {
private static final long serialVersionUID=1L;
public double[] getC() {
// add your code
}
public double[][] getA() {
// add your code
}
public int getOrder() {
// add your code
}
public double[] getBOrderP() {
// add your code
}
public double[] getBOrderPPlusOne() {
// add your code
}
}
package eu.mihosoft.vrl.user;
import eu.mihosoft.vrl.user.Dopri45Scheme;
import eu.mihosoft.vrl.math.Trajectory;
import eu.mihosoft.vrl.user.VectorRhsODEInterface;
@ComponentInfo(name="EmbeddedRKTemplate", category="ODE")
public class EmbeddedRKTemplate implements Serializable{
private static final long serialVersionUID=1L;
// multi-out is only typesafe in the UI (the actual return type is Object[])
@OutputInfo(name="Results:", style="multi-out",
elemTypes=[VectorTrajectory.class, Trajectory.class, Trajectory.class, Trajectory.class],
elemNames=["Solution", "TOL", "Local Error", "Step Size h"]
)
public Object[] run(
@ParamInfo(name="f(t,u)")
VectorRhsODEInterface f,
@ParamGroupInfo(group="Initial Values - u|true|no description")
@ParamInfo(name="u", style="array", options="serialization=false")
double[] u0,
@ParamGroupInfo(group="Step & Time;Interval - t|true|no description")
@ParamInfo(name="t0", options="value=0.0D")
double t0,
@ParamGroupInfo(group="Step & Time;Interval - t")
@ParamInfo(name="tn", options="value=1.0D")
double tn,
@ParamGroupInfo(group="Step & Time;Step Size Control|false|no description")
@ParamInfo(name="hmax", options="value=0.1")
double hmax,
@ParamGroupInfo(group="Step & Time;Step Size Control")
@ParamInfo(name="hmin", options="value=1e-4D")
double hmin,
@ParamGroupInfo(group="Step & Time;Step Size Control")
@ParamInfo(name="TOL", options="value=1e-8D")
double tol,
@ParamGroupInfo(group="Step & Time;Step Size Control")
@ParamInfo(name="Filter Output", style="default", options="value=1")
int filter) {
// add your code here
return [solVectorTrajectory, tolTrajectory, localErrorTrajectory, stepSizeTrajectory]
}
public void stop() {
// add your code here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment