FixedPointOsculatingToAveragedConverter.java

  1. /* Copyright 2020-2025 Exotrail
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS 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.  *   http://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. package org.orekit.propagation.conversion.averaging.converters;

  18. import org.orekit.propagation.conversion.averaging.AveragedOrbitalState;

  19. /**
  20.  * Abstract class for osculating-to-averaged converters based on a fixed-point algorithm.
  21.  *
  22.  * @author Romain Serra
  23.  * @since 12.1
  24.  * @see OsculatingToAveragedConverter
  25.  * @param <T> type of averaged orbital state
  26.  */
  27. public abstract class FixedPointOsculatingToAveragedConverter<T extends AveragedOrbitalState>
  28.         implements OsculatingToAveragedConverter<T> {

  29.     /** Default convergence threshold. */
  30.     public static final double DEFAULT_EPSILON = 1e-12;
  31.     /** Default maximum number of iterations. */
  32.     public static final int DEFAULT_MAX_ITERATIONS = 100;

  33.     /** Convergence threshold. */
  34.     private double epsilon;
  35.     /** Maximum number of iterations. */
  36.     private int maxIterations;

  37.     /**
  38.      * Protected constructor.
  39.      * @param epsilon tolerance for convergence
  40.      * @param maxIterations maximum number of iterations
  41.      */
  42.     protected FixedPointOsculatingToAveragedConverter(final double epsilon,
  43.                                                       final int maxIterations) {
  44.         this.epsilon = epsilon;
  45.         this.maxIterations = maxIterations;
  46.     }

  47.     /**
  48.      * Getter for the maximum number of iterations.
  49.      * @return maximum number of iterations
  50.      */
  51.     public int getMaxIterations() {
  52.         return maxIterations;
  53.     }

  54.     /**
  55.      * Getter for the convergence threshold.
  56.      * @return convergence threshold
  57.      */
  58.     public double getEpsilon() {
  59.         return epsilon;
  60.     }

  61.     /**
  62.      * Setter for epsilon.
  63.      * @param epsilon convergence threshold.
  64.      */
  65.     public void setEpsilon(final double epsilon) {
  66.         this.epsilon = epsilon;
  67.     }

  68.     /**
  69.      * Setter for maximum number of iterations.
  70.      * @param maxIterations maximum iterations
  71.      */
  72.     public void setMaxIterations(final int maxIterations) {
  73.         this.maxIterations = maxIterations;
  74.     }
  75. }