1   /* Copyright 2002-2025 CS GROUP
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.forces.gravity.potential;
18  
19  import org.hipparchus.util.FastMath;
20  import org.junit.jupiter.api.Assertions;
21  import org.junit.jupiter.api.Test;
22  
23  public class OceanLoadDeformationCoefficientsTest {
24  
25      @Test
26      void testIERS1996EqualsIERS2003()
27          {
28          double[] coeff1996 = OceanLoadDeformationCoefficients.IERS_1996.getCoefficients();
29          double[] coeff2003 = OceanLoadDeformationCoefficients.IERS_2003.getCoefficients();
30          Assertions.assertEquals(coeff1996.length, coeff2003.length);
31          for (int i = 0; i < coeff1996.length; ++i) {
32              Assertions.assertEquals(coeff1996[i], coeff2003[i], 1.0e-15);
33          }
34      }
35  
36      @Test
37      void testIERS1996EqualsIERS2010()
38          {
39          double[] coeff1996 = OceanLoadDeformationCoefficients.IERS_1996.getCoefficients();
40          double[] coeff2010 = OceanLoadDeformationCoefficients.IERS_2010.getCoefficients();
41          Assertions.assertEquals(coeff1996.length, coeff2010.length);
42          for (int i = 0; i < coeff1996.length; ++i) {
43              Assertions.assertEquals(coeff1996[i], coeff2010[i], 1.0e-15);
44          }
45      }
46  
47      @Test
48      void testGegoutHighDegree()
49          {
50          Assertions.assertEquals(251, OceanLoadDeformationCoefficients.GEGOUT.getCoefficients().length);
51      }
52  
53      @Test
54      void testGegoutNotEqualToIERS()
55          {
56          double[] coeff1996   = OceanLoadDeformationCoefficients.IERS_1996.getCoefficients();
57          double[] coeffGegout = OceanLoadDeformationCoefficients.GEGOUT.getCoefficients();
58          for (int i = 0; i < coeff1996.length; ++i) {
59              if (coeff1996[i] == 0) {
60                  Assertions.assertEquals(0.0, coeffGegout[i], 1.0e-15);
61              } else {
62                  Assertions.assertTrue(FastMath.abs(coeff1996[i] - coeffGegout[i]) > FastMath.abs(coeff1996[i]) / 200);
63              }
64          }
65      }
66  
67  }