FEDEM Solver  R8.0
Source code of the dynamics solver
FFaMath.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
13 #ifndef FFA_MATH_H
14 #define FFA_MATH_H
15 
16 #include <cmath>
17 
18 #if _MSC_VER > 1300 && _MSC_VER < 1500
19 #define hypot _hypot
20 #endif
21 
22 #ifndef EPS_ZERO
24 #define EPS_ZERO 1.0e-15
25 #endif
26 
27 #ifndef M_PI
29 #define M_PI 3.14159265358979323846
30 #endif
31 
32 #ifndef RAD
34 #define RAD(x) (x)*M_PI/180.0
35 #endif
36 
38 extern double round (double value, int precision);
39 
40 #ifdef FFA_DEBUG
41 extern double atan3 (double y, double x, const char* func = 0);
42 #else
44 inline double atan3 (double y, double x, const char* = 0)
45 {
46  return fabs(y) > EPS_ZERO || fabs(x) > EPS_ZERO ? atan2(y,x) : 0.0;
47 }
48 #endif
49 
50 
51 namespace FFa
52 {
55  int cubicSolve (double A, double B, double C, double D, double* X);
57  int bilinearSolve (const double* A, const double* B, double* X, double* Y);
58 }
59 
60 #endif
double round(double value, int precision)
Rounds off value down to precision significant digits.
Definition: FFaMath.C:31
double atan3(double y, double x, const char *=0)
Checks for singular rotations before using atan2 library function.
Definition: FFaMath.H:44
#define EPS_ZERO
Division by zero tolerance.
Definition: FFaMath.H:24
Various math utilities.
Definition: FFaMath.H:52
int bilinearSolve(const double *A, const double *B, double *X, double *Y)
Solves a bi-linear set of equations in X and Y.
Definition: FFaMath.C:158
int cubicSolve(double A, double B, double C, double D, double *X)
Solves the cubic equation A*x3 + B*x2 + C*x + D = 0.
Definition: FFaMath.C:61
integer(ptr), save, private x
Definition: extCtrlSysRoutinesModule.f90:16