00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef SMATH_H
00014 #define SMATH_H
00015
00016 #if defined(HAVE_CONFIG_H)
00017
00018 #include <config.h>
00019 #elif defined(BLD_PROCEDURE)
00020
00021 #include <portinfo.h>
00022 #endif
00023
00024
00025 #ifdef __cplusplus
00026 namespace shells {
00027 #define DECLARE_EXTERN extern "C"
00028 #else
00029 #define DECLARE_EXTERN extern
00030 #endif
00031
00032 DECLARE_EXTERN double sinv3 (double [3][3]);
00033 DECLARE_EXTERN void smulvec3 (double [3], double [3][3], double [3]);
00034 DECLARE_EXTERN double ssppr3 (double [3], double [3], double [3]);
00035 DECLARE_EXTERN void smult3 (double [3][3], double [3][3], double [3][3]);
00036 DECLARE_EXTERN void smulvecTr3 (double a[3], double c[3][3], double b[3]);
00037 DECLARE_EXTERN void stran3 (double a[3][3]);
00038 DECLARE_EXTERN double snormalize3 (double a[3]);
00039
00040 static void szero3 (double a[3][3])
00041
00042 {
00043 a[0][0] = 0.0; a[0][1] = 0.0; a[0][2] = 0.0;
00044 a[1][0] = 0.0; a[1][1] = 0.0; a[1][2] = 0.0;
00045 a[2][0] = 0.0; a[2][1] = 0.0; a[2][2] = 0.0;
00046 }
00047
00048
00049
00050 static double sskpr3 (double a[3], double b[3])
00051
00052 {
00053 return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];
00054 }
00055
00056
00057
00058 static void skrpr3 (double c[3], double a[3], double b[3])
00059
00060 {
00061 c[0] = a[1]*b[2] - a[2]*b[1];
00062 c[1] = a[2]*b[0] - a[0]*b[2];
00063 c[2] = a[0]*b[1] - a[1]*b[0];
00064 }
00065
00066
00067
00068 static void scopy3 (double a[3][3], double b[3][3])
00069
00070 {
00071 a[0][0]=b[0][0]; a[0][1]=b[0][1]; a[0][2]=b[0][2];
00072 a[1][0]=b[1][0]; a[1][1]=b[1][1]; a[1][2]=b[1][2];
00073 a[2][0]=b[2][0]; a[2][1]=b[2][1]; a[2][2]=b[2][2];
00074 }
00075
00076
00077
00078 static void smulscl3 (double scalar, double a[3][3])
00079
00080 {
00081 a[0][0]*=scalar; a[0][1]*=scalar; a[0][2]*=scalar;
00082 a[1][0]*=scalar; a[1][1]*=scalar; a[1][2]*=scalar;
00083 a[2][0]*=scalar; a[2][1]*=scalar; a[2][2]*=scalar;
00084 }
00085
00086
00087
00088 static void smulsclvec3 (double scalar, double a[3])
00089
00090 {
00091 a[0]*=scalar;
00092 a[1]*=scalar;
00093 a[2]*=scalar;
00094 }
00095
00096 static void saverage3(double a[3], double b[3], double c[3])
00097
00098 {
00099 a[0] = b[0];
00100 a[1] = b[1];
00101 a[2] = b[2];
00102
00103 a[0] += c[0];
00104 a[1] += c[1];
00105 a[2] += c[2];
00106
00107 a[0] *= 0.5;
00108 a[1] *= 0.5;
00109 a[2] *= 0.5;
00110 }
00111
00112 static void sdifference3(double a[3], double b[3], double c[3])
00113
00114 {
00115 a[0] = b[0];
00116 a[1] = b[1];
00117 a[2] = b[2];
00118
00119 a[0] -= c[0];
00120 a[1] -= c[1];
00121 a[2] -= c[2];
00122 }
00123
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127
00128 #undef DECLARE_EXTERN
00129
00130 #endif
00131
00132
00133