File: miscGriddedData.h

package info (click to toggle)
groops 0%2Bgit20250907%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 11,140 kB
  • sloc: cpp: 135,607; fortran: 1,603; makefile: 20
file content (82 lines) | stat: -rw-r--r-- 3,837 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***********************************************/
/**
* @file miscGriddedData.h
*
* @brief Misc functions for values on grid.
*
* @author Torsten Mayer-Guerr
* @date 2008-08-06
*
*/
/***********************************************/

#ifndef __GROOPS_MISCGRIDDEDDATA__
#define __GROOPS_MISCGRIDDEDDATA__

#include "base/vector3d.h"
#include "base/sphericalHarmonics.h"
#include "base/griddedData.h"
#include "parallel/parallel.h"
#include "classes/kernel/kernel.h"

/***********************************************/

/** @brief Functions for values on grid.
* @ingroup miscGroup */
namespace MiscGriddedData
{
  /** @brief Compute some statistics (rms, mean, max...). */
  void statistics(const std::vector<Double> &values, const std::vector<Double> &weights,
                  Double &rms, Double &avg, Double &vmin, Double &vmax, Double &mean);

  /** @brief Prints out some statistics (rms, mean, max...).
  * (only at master node, calls from clients will be ignored). */
  void printStatistics(const GriddedData &grid);

  /** @brief Prints out some statistics (rms, mean, max...).
  * (only at master node, calls from clients will be ignored). */
  void printStatistics(const GriddedDataRectangular &grid);

  /** @brief Generates functionals of a spherical harmonics expansion on a grid.
  * Must be called from every node in parallel computations.
  * @param harmonic spherical harmonics expansion
  * @param points harm is evaluated at these points (fast on rectangular grid)
  * @param kernel define the ouput functional.
  * @param comm   communicator for parallel computation.
  * @param timing start a loop timer for all grid points (only relevant for non-rectangular grids).
  * @return values at @a points (only valid at master). */
  std::vector<Double> synthesisSphericalHarmonics(const SphericalHarmonics &harmonic, const std::vector<Vector3d> &points, KernelPtr kernel,
                                                  Parallel::CommunicatorPtr comm, Bool timing = TRUE);

  /** @brief Generates a linear functional for the synthesis of spherical harmonics coefficients on a grid.
  * This function generates a matrix A which represents the synthesis of a spherical harmonics vector x by matrix multiplication (y = Ax).
  * The columns of A start at degree zero are sorted degreewise.
  * @param maxDegree maximum expansion degree
  * @param GM geocentric gravitational constant
  * @param R reference radius
  * @param points evaluation points
  * @param kernel define the ouput functional.
  * @param isInterior flag whether interior of the sphere is requested
  * @return Matrix A. */
  Matrix synthesisSphericalHarmonicsMatrix(UInt maxDegree, Double GM, Double R, const std::vector<Vector3d> &points, KernelPtr kernel, Bool isInterior=FALSE);


  /** @brief Estimate spherical harmonics for each grid data column.
  * Must be called from every node in parallel computations.
  * @param grid points, areas (used as weights), data columns.
  * @param kernel define the input functional.
  * @param minDegree minumum expansion degree
  * @param maxDegree maximum expansion degree
  * @param GM geocentric gravitational constant
  * @param R reference radius
  * @param useLeastSquares least suqares adjustment, otherwise simple quadrature formular.
  * @param comm   communicator for parallel computation.
  * @param timing start a loop timer for all grid points (only relevant for non-rectangular grids). */
  std::vector<SphericalHarmonics> analysisSphericalHarmonics(const GriddedData &grid, KernelPtr kernel, UInt minDegree, UInt maxDegree, Double GM, Double R,
                                                             Bool useLeastSquares, Parallel::CommunicatorPtr comm, Bool timing = TRUE);

} // namespace GriddedData

/***********************************************/

#endif /* __GROOPS_GRIDDEDDATA__ */