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.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics;
20 import org.orekit.time.AbsoluteDate;
21
22 /** Wrapper providing normalized coefficients from un-normalized ones.
23 * @author Luc Maisonobe
24 * @since 6.0
25 */
26 class Normalizer implements NormalizedSphericalHarmonicsProvider {
27
28 /** Un-normalized provider to which everything is delegated. */
29 private final UnnormalizedSphericalHarmonicsProvider unnormalized;
30
31 /** Factors for normalization. */
32 private final double[][] factors;
33
34 /** Simple constructor.
35 * @param unnormalized provider to normalize
36 */
37 Normalizer(final UnnormalizedSphericalHarmonicsProvider unnormalized) {
38 this.unnormalized = unnormalized;
39 this.factors = GravityFieldFactory.getUnnormalizationFactors(unnormalized.getMaxDegree(),
40 unnormalized.getMaxOrder());
41 }
42
43 /** {@inheritDoc} */
44 @Override
45 public int getMaxDegree() {
46 return unnormalized.getMaxDegree();
47 }
48
49 /** {@inheritDoc} */
50 @Override
51 public int getMaxOrder() {
52 return unnormalized.getMaxOrder();
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public double getMu() {
58 return unnormalized.getMu();
59 }
60
61 /** {@inheritDoc} */
62 @Override
63 public double getAe() {
64 return unnormalized.getAe();
65 }
66
67 /** {@inheritDoc} */
68 @Override
69 public AbsoluteDate getReferenceDate() {
70 return unnormalized.getReferenceDate();
71 }
72
73 /** {@inheritDoc} */
74 @Override
75 public TideSystem getTideSystem() {
76 return unnormalized.getTideSystem();
77 }
78
79 /** {@inheritDoc} */
80 @Override
81 public NormalizedSphericalHarmonics onDate(final AbsoluteDate date) {
82 final UnnormalizedSphericalHarmonics harmonics = unnormalized.onDate(date);
83 return new NormalizedSphericalHarmonics() {
84
85 /** {@inheritDoc} */
86 @Override
87 public AbsoluteDate getDate() {
88 return date;
89 }
90
91 /** {@inheritDoc} */
92 @Override
93 public double getNormalizedCnm(final int n, final int m) {
94 return harmonics.getUnnormalizedCnm(n, m) / factors[n][m];
95 }
96
97 /** {@inheritDoc} */
98 @Override
99 public double getNormalizedSnm(final int n, final int m) {
100 return harmonics.getUnnormalizedSnm(n, m) / factors[n][m];
101 }
102
103 };
104 }
105
106 }