Commit 914231d3 authored by Luc Maisonobe's avatar Luc Maisonobe

Fixed findbugs, checkstyle and javadoc warnings.

parent 0dac1f1b
......@@ -114,7 +114,20 @@
<Method name ="getAdditionalStateDot" params="" returns="double[]" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel$GradientHessian"/>
<Or>
<Method name="getGradient" params="" returns="double[]" />
<Method name="getHessian" params="" returns="double[][]" />
</Or>
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel$GradientHessian"/>
<Method name="&lt;init>" params="double[],double[][]" returns="void" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<!-- the following is an intended switch fall-through in the SP3Parser -->
<Match>
<Class name="~.*\.SP3Parser$"/>
......
......@@ -534,7 +534,7 @@ public class BoxAndSolarArraySpacecraft implements RadiationSensitive, DragSensi
if (ABSORPTION_COEFFICIENT.equals(paramName)) {
absorptionCoeffDS = new DerivativeStructure(1, 1, 0, absorptionCoeff);
specularReflectionCoeffDS = new DerivativeStructure(1, 1, specularReflectionCoeff);
} else if (REFLECTION_COEFFICIENT.equals(paramName)) {
} else if (REFLECTION_COEFFICIENT.equals(paramName)) {
absorptionCoeffDS = new DerivativeStructure(1, 1, absorptionCoeff);
specularReflectionCoeffDS = new DerivativeStructure(1, 1, 0, specularReflectionCoeff);
} else {
......@@ -571,7 +571,7 @@ public class BoxAndSolarArraySpacecraft implements RadiationSensitive, DragSensi
}
}
// convert to inertial
// convert to inertial
return FieldRotation.applyInverseTo(rotation, new FieldVector3D<DerivativeStructure>(1.0 / mass, force));
}
......@@ -586,7 +586,7 @@ public class BoxAndSolarArraySpacecraft implements RadiationSensitive, DragSensi
* @param dot dot product of facet and fluxSat (must be negative)
* @return contribution of the facet to force in spacecraft frame
*/
private Vector3D facetRadiationAcceleration(final Vector3D normal, double area, final Vector3D fluxSat,
private Vector3D facetRadiationAcceleration(final Vector3D normal, final double area, final Vector3D fluxSat,
final double dot) {
final double psr = fluxSat.getNorm();
......@@ -610,7 +610,8 @@ public class BoxAndSolarArraySpacecraft implements RadiationSensitive, DragSensi
* @param dot dot product of facet and fluxSat (must be negative)
* @return contribution of the facet to force in spacecraft frame
*/
private FieldVector3D<DerivativeStructure> facetRadiationAcceleration(final FieldVector3D<DerivativeStructure> normal, double area,
private FieldVector3D<DerivativeStructure> facetRadiationAcceleration(final FieldVector3D<DerivativeStructure> normal,
final double area,
final FieldVector3D<DerivativeStructure> fluxSat,
final DerivativeStructure dot) {
final DerivativeStructure psr = fluxSat.getNorm();
......@@ -637,8 +638,8 @@ public class BoxAndSolarArraySpacecraft implements RadiationSensitive, DragSensi
* @param diffuseReflectionCoeffDS diffuse reflection coefficient
* @return contribution of the facet to force in spacecraft frame
*/
private FieldVector3D<DerivativeStructure> facetRadiationAcceleration(final Vector3D normal, double area, final Vector3D fluxSat,
final double dot,
private FieldVector3D<DerivativeStructure> facetRadiationAcceleration(final Vector3D normal, final double area,
final Vector3D fluxSat, final double dot,
final DerivativeStructure specularReflectionCoeffDS,
final DerivativeStructure diffuseReflectionCoeffDS) {
final double psr = fluxSat.getNorm();
......
......@@ -129,7 +129,7 @@ public class SphericalSpacecraft implements RadiationSensitive, DragSensitive {
if (ABSORPTION_COEFFICIENT.equals(paramName)) {
absorptionCoeffDS = new DerivativeStructure(1, 1, 0, absorptionCoeff);
specularReflectionCoeffDS = new DerivativeStructure(1, 1, specularReflectionCoeff);
} else if (REFLECTION_COEFFICIENT.equals(paramName)) {
} else if (REFLECTION_COEFFICIENT.equals(paramName)) {
absorptionCoeffDS = new DerivativeStructure(1, 1, absorptionCoeff);
specularReflectionCoeffDS = new DerivativeStructure(1, 1, 0, specularReflectionCoeff);
} else {
......
......@@ -95,6 +95,7 @@ public class DragForce extends AbstractParameterizable implements ForceModel {
return new EventDetector[0];
}
/** {@inheritDoc} */
public double getParameter(final String name) throws IllegalArgumentException {
complainIfNotSupported(name);
return spacecraft.getDragCoefficient();
......@@ -108,8 +109,10 @@ public class DragForce extends AbstractParameterizable implements ForceModel {
/** {@inheritDoc} */
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date, final Frame frame,
final FieldVector3D<DerivativeStructure> position, final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation, DerivativeStructure mass)
final FieldVector3D<DerivativeStructure> position,
final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation,
final DerivativeStructure mass)
throws OrekitException {
// retrieve derivation properties
......
......@@ -34,7 +34,7 @@ import org.orekit.time.AbsoluteDate;
public interface DragSensitive {
/** Parameter name for drag coefficient enabling jacobian processing. */
public static final String DRAG_COEFFICIENT = "drag coefficient";
String DRAG_COEFFICIENT = "drag coefficient";
/** Compute the acceleration due to drag.
* <p>
......@@ -82,6 +82,7 @@ public interface DragSensitive {
* @param date current date
* @param frame inertial reference frame for state (both orbit and attitude)
* @param position position of spacecraft in reference frame
* @param rotation orientation (attitude) of the spacecraft with respect to reference frame
* @param mass current mass
* @param density atmospheric density at spacecraft position
* @param relativeVelocity relative velocity of atmosphere with respect to spacecraft,
......
......@@ -61,8 +61,8 @@ import org.orekit.time.AbsoluteDate;
* As this class uses finite differences to compute derivatives, the steps for
* finite differences <strong>must</strong> be initialized by calling {@link
* #setSteps(double, double)} prior to use derivatives, otherwise an exception
* will be thrown by {@link #accelerationDerivatives(AbsoluteDate, Frame,
* FieldVector3D<DerivativeStructure>, FieldVector3D<DerivativeStructure>, FieldRotation<DerivativeStructure>, DerivativeStructure)} and by {@link
* will be thrown by {@link #accelerationDerivatives(AbsoluteDate, Frame, FieldVector3D,
* FieldVector3D, FieldRotation, DerivativeStructure)} and by {@link
* #accelerationDerivatives(SpacecraftState, String)}.
* </p>
*
......@@ -372,7 +372,7 @@ public class CunninghamAttractionModel extends AbstractParameterizable implement
}
/** {@inheritDoc} */
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date,final Frame frame,
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date, final Frame frame,
final FieldVector3D<DerivativeStructure> position,
final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation,
......
......@@ -58,8 +58,8 @@ import org.orekit.time.AbsoluteDate;
* As this class uses finite differences to compute derivatives, the steps for
* finite differences <strong>must</strong> be initialized by calling {@link
* #setSteps(double, double)} prior to use derivatives, otherwise an exception
* will be thrown by {@link #accelerationDerivatives(AbsoluteDate, Frame,
* FieldVector3D<DerivativeStructure>, FieldVector3D<DerivativeStructure>, FieldRotation<DerivativeStructure>, DerivativeStructure)} and by {@link
* will be thrown by {@link #accelerationDerivatives(AbsoluteDate, Frame, FieldVector3D,
* FieldVector3D, FieldRotation, DerivativeStructure)} and by {@link
* #accelerationDerivatives(SpacecraftState, String)}.
* </p>
*
......@@ -288,7 +288,7 @@ public class DrozinerAttractionModel extends AbstractParameterizable implements
}
/** {@inheritDoc} */
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date,final Frame frame,
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date, final Frame frame,
final FieldVector3D<DerivativeStructure> position,
final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation,
......
......@@ -493,7 +493,7 @@ public class HolmesFeatherstoneAttractionModel
hessian[2][2] *= muOr;
// convert gradient and Hessian from spherical to Cartesian
SphericalCoordinates sc = new SphericalCoordinates(position);
final SphericalCoordinates sc = new SphericalCoordinates(position);
return new GradientHessian(sc.toCartesianGradient(gradient),
sc.toCartesianHessian(hessian, gradient));
......
......@@ -80,8 +80,10 @@ public class ThirdBodyAttraction extends AbstractParameterizable implements Forc
/** {@inheritDoc} */
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date, final Frame frame,
final FieldVector3D<DerivativeStructure> position, final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation, DerivativeStructure mass)
final FieldVector3D<DerivativeStructure> position,
final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation,
final DerivativeStructure mass)
throws OrekitException {
// compute bodies separation vectors and squared norm
......
......@@ -138,8 +138,10 @@ public class ConstantThrustManeuver extends AbstractParameterizable implements F
/** {@inheritDoc} */
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date, final Frame frame,
final FieldVector3D<DerivativeStructure> position, final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation, DerivativeStructure mass)
final FieldVector3D<DerivativeStructure> position,
final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation,
final DerivativeStructure mass)
throws OrekitException {
if (firing) {
return new FieldVector3D<DerivativeStructure>(mass.reciprocal().multiply(thrust),
......@@ -163,23 +165,21 @@ public class ConstantThrustManeuver extends AbstractParameterizable implements F
if (firing) {
if (THRUST.equals(paramName)) {
DerivativeStructure thrustDS = new DerivativeStructure(1, 1, 0, thrust);
final DerivativeStructure thrustDS = new DerivativeStructure(1, 1, 0, thrust);
return new FieldVector3D<DerivativeStructure>(thrustDS.divide(s.getMass()),
s.getAttitude().getRotation().applyInverseTo(direction));
} else if (FLOW_RATE.equals(paramName)) {
s.getAttitude().getRotation().applyInverseTo(direction));
} else if (FLOW_RATE.equals(paramName)) {
// acceleration does not depend on flow rate (only mass decrease does)
return new FieldVector3D<DerivativeStructure>(new DerivativeStructure(1, 1, 0.0),
new DerivativeStructure(1, 1, 0.0),
new DerivativeStructure(1, 1, 0.0));
final DerivativeStructure zero = new DerivativeStructure(1, 1, 0.0);
return new FieldVector3D<DerivativeStructure>(zero, zero, zero);
} else {
throw new OrekitException(OrekitMessages.UNKNOWN_PARAMETER, paramName);
}
} else {
// constant (and null) acceleration when not firing
return new FieldVector3D<DerivativeStructure>(new DerivativeStructure(1, 1, 0.0),
new DerivativeStructure(1, 1, 0.0),
new DerivativeStructure(1, 1, 0.0));
final DerivativeStructure zero = new DerivativeStructure(1, 1, 0.0);
return new FieldVector3D<DerivativeStructure>(zero, zero, zero);
}
}
......
......@@ -34,10 +34,10 @@ import org.orekit.time.AbsoluteDate;
public interface RadiationSensitive {
/** Parameter name for absorption coefficient. */
public static final String ABSORPTION_COEFFICIENT = "absorption coefficient";
String ABSORPTION_COEFFICIENT = "absorption coefficient";
/** Parameter name for reflection coefficient. */
public static final String REFLECTION_COEFFICIENT = "reflection coefficient";
String REFLECTION_COEFFICIENT = "reflection coefficient";
/** Compute the acceleration due to radiation pressure.
* @param date current date
......@@ -60,7 +60,6 @@ public interface RadiationSensitive {
* @param rotation orientation (attitude) of the spacecraft with respect to reference frame
* @param mass spacecraft mass
* @param flux radiation flux in the same inertial frame as spacecraft orbit
* @param paramName name of the parameter with respect to which derivatives are required
* @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s<sup>2</sup>)
* @throws OrekitException if acceleration cannot be computed
*/
......
......@@ -371,6 +371,7 @@ public class Transform
/** Transform a position vector (including translation effects).
* @param position vector to transform
* @param <T> the type of the field elements
* @return transformed position
*/
public <T extends ExtendedFieldElement<T>> FieldVector3D<T> transformPosition(final FieldVector3D<T> position) {
......@@ -387,6 +388,7 @@ public class Transform
/** Transform a vector (ignoring translation effects).
* @param vector vector to transform
* @param <T> the type of the field elements
* @return transformed vector
*/
public <T extends ExtendedFieldElement<T>> FieldVector3D<T> transformVector(final FieldVector3D<T> vector) {
......@@ -418,6 +420,7 @@ public class Transform
/** Transform {@link FieldPVCoordinates} including kinematic effects.
* @param pv the couple position-velocity to transform.
* @param <T> the type of the field elements
* @return transformed position/velocity
*/
public <T extends ExtendedFieldElement<T>> FieldPVCoordinates<T> transformPVCoordinates(final FieldPVCoordinates<T> pv) {
......
......@@ -114,10 +114,21 @@ public class Jacobianizer {
retriever);
}
/** {@inheritDoc} */
/** Compute acceleration and derivatives with respect to state.
* @param date current date
* @param frame inertial reference frame for state (both orbit and attitude)
* @param position position of spacecraft in reference frame
* @param velocity velocity of spacecraft in reference frame
* @param rotation orientation (attitude) of the spacecraft with respect to reference frame
* @param mass spacecraft mass
* @return acceleration with derivatives
* @exception OrekitException if the underlying force models cannot compute the acceleration
*/
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date, final Frame frame,
final FieldVector3D<DerivativeStructure> position, final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation, final DerivativeStructure mass)
final FieldVector3D<DerivativeStructure> position,
final FieldVector3D<DerivativeStructure> velocity,
final FieldRotation<DerivativeStructure> rotation,
final DerivativeStructure mass)
throws OrekitException {
final int parameters = mass.getFreeParameters();
......@@ -200,7 +211,12 @@ public class Jacobianizer {
}
/** {@inheritDoc} */
/** Compute acceleration and derivatives with respect to parameter.
* @param s current state
* @param paramName parameter with respect to which derivation is desired
* @return acceleration with derivatives
* @exception OrekitException if the underlying force models cannot compute the acceleration
*/
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final SpacecraftState s, final String paramName) throws OrekitException {
if (!hParam.containsKey(paramName)) {
......@@ -232,22 +248,38 @@ public class Jacobianizer {
}
/** {@inheritDoc} */
/** Get parameter value from its name.
* @param name parameter name
* @return parameter value
* @exception IllegalArgumentException if parameter is not supported
*/
public double getParameter(final String name) throws IllegalArgumentException {
return forceModel.getParameter(name);
}
/** {@inheritDoc} */
/** Get the names of the supported parameters.
* @return parameters names
* @see #isSupported(String)
*/
public Collection<String> getParametersNames() {
return forceModel.getParametersNames();
}
/** {@inheritDoc} */
/** Check if a parameter is supported.
* <p>Supported parameters are those listed by {@link #getParametersNames()}.</p>
* @param name parameter name to check
* @return true if the parameter is supported
* @see #getParametersNames()
*/
public boolean isSupported(final String name) {
return forceModel.isSupported(name);
}
/** {@inheritDoc} */
/** Set the value for a given parameter.
* @param name parameter name
* @param value parameter value
* @exception IllegalArgumentException if parameter is not supported
*/
public void setParameter(final String name, final double value) throws IllegalArgumentException {
forceModel.setParameter(name, value);
}
......
......@@ -466,9 +466,6 @@ public class PartialDerivativesEquations implements AdditionalEquations {
/** Fill Jacobians rows when mass is needed.
* @param accelerationComponent component of acceleration (along either x, y or z)
* @param index component index (0 for x, 1 for y, 2 for z)
* @param dAccdPos array where to <em>accumulate</em> acceleration derivatives with respect to position
* @param dAccdVel array where to <em>accumulate</em> acceleration derivatives with respect to velocity
* @param dAccdM array where to <em>accumulate</em> acceleration derivatives with respect to mass (may be null when
*/
private void addToRow(final DerivativeStructure accelerationComponent, final int index) {
......
......@@ -41,6 +41,7 @@ import org.orekit.time.TimeShiftable;
* This class is the angular counterpart to {@link FieldPVCoordinates}.
* </p>
* <p>Instances of this class are guaranteed to be immutable.</p>
* @param <T> the type of the field elements
* @author Luc Maisonobe
* @since 6.0
* @see AngularCoordinates
......@@ -72,6 +73,7 @@ public class FieldAngularCoordinates<T extends ExtendedFieldElement<T>>
* @param start start orientation
* @param end end orientation
* @param dt time elapsed between the dates of the two orientations
* @param <T> the type of the field elements
* @return FieldRotation<T> rate allowing to go from start to end orientations
*/
public static <T extends ExtendedFieldElement<T>> FieldVector3D<T> estimateRate(final FieldRotation<T> start, final FieldRotation<T> end, final double dt) {
......@@ -205,9 +207,10 @@ public class FieldAngularCoordinates<T extends ExtendedFieldElement<T>>
* then use interpolation to add derivatives consistent with the FieldRotation<T>s.
* </p>
* @param date interpolation date
* @param useFieldRotation<T>Rates if true, use sample points FieldRotation<T> rates,
* @param useRotationRates if true, use sample points FieldRotation<T> rates,
* otherwise ignore them and use only FieldRotation<T>s
* @param sample sample points on which interpolation should be done
* @param <T> the type of the field elements
* @return a new position-velocity, interpolated at specified date
*/
@SuppressWarnings("unchecked")
......@@ -316,6 +319,7 @@ public class FieldAngularCoordinates<T extends ExtendedFieldElement<T>>
* @param offsetDate date of the linear offset model to remove
* @param offset linear offset model to remove
* @param threshold threshold for rotations too close to 2&pi;
* @param <T> the type of the field elements
* @return modified Rodrigues vector and derivative, or null if rotation is too close to 2&pi;
*/
private static <T extends ExtendedFieldElement<T>> T[][] getModifiedRodrigues(final AbsoluteDate date, final FieldAngularCoordinates<T> ac,
......@@ -371,6 +375,7 @@ public class FieldAngularCoordinates<T extends ExtendedFieldElement<T>>
/** Convert a modified Rodrigues vector and derivative to angular coordinates.
* @param r modified Rodrigues vector (with first derivatives)
* @param offset linear offset model to add (its date must be consistent with the modified Rodrigues vector)
* @param <T> the type of the field elements
* @return angular coordinates
*/
private static <T extends ExtendedFieldElement<T>> FieldAngularCoordinates<T> createFromModifiedRodrigues(final T[][] r,
......
......@@ -37,6 +37,7 @@ import org.orekit.time.TimeShiftable;
* This class is the angular counterpart to {@link FieldAngularCoordinates}.
* </p>
* <p>Instances of this class are guaranteed to be immutable.</p>
* @param <T> the type of the field elements
* @author Luc Maisonobe
* @since 6.0
* @see PVCoordinates
......@@ -267,6 +268,7 @@ public class FieldPVCoordinates<T extends ExtendedFieldElement<T>>
* @param start start position
* @param end end position
* @param dt time elapsed between the dates of the two positions
* @param <T> the type of the field elements
* @return velocity allowing to go from start to end positions
*/
public static <T extends ExtendedFieldElement<T>> FieldVector3D<T> estimateVelocity(final FieldVector3D<T> start,
......@@ -308,6 +310,7 @@ public class FieldPVCoordinates<T extends ExtendedFieldElement<T>>
* @param useVelocities if true, use sample points velocities,
* otherwise ignore them and use only positions
* @param sample sample points on which interpolation should be done
* @param <T> the type of the field elements
* @return a new position-velocity, interpolated at specified date
*/
@SuppressWarnings("unchecked")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment