• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

ocsReducedModelTools.hh

Go to the documentation of this file.
00001 // $Id: ocsReducedModelTools.hh,v 1.1.1.1 2004/06/11 22:56:02 zweck Exp $
00002 
00003 // #####################################################################
00004 //
00005 //    ocsTools.hh
00006 //
00007 //    Header file for ocsTools.cc.
00008 //
00009 //    Copyright:
00010 //       Optical Fiber Communications Laboratory (OFCL)
00011 //       Computer Science & Electrical Engineering Department (CSEE)
00012 //       University of Maryland Baltimore County (UMBC)
00013 //
00014 //    The copyright applies to functions written by the OFCL members
00015 // #####################################################################
00016 
00017 
00018 #ifndef _OCS_TOOLS_HH_
00019 #define _OCS_TOOLS_HH_
00020 
00021 #include <unistd.h>
00022 
00023 #ifndef _OCS_SYSTEM_HDRS_
00024 #define _OCS_SYSTEM_HDRS_
00025 
00026 #include <iostream.h>
00027 #include <string.h>
00028 #include <math.h> 
00029 #include <fstream.h>
00030 #include <complex.h>
00031 #include <stdlib.h>
00032 #include <stdio.h>
00033 #include <strstream>
00034 
00035 #include <string>
00036   using namespace std;
00037 
00038 #endif /* _OCS_SYSTEM_HDRS_ */
00039 
00040 #include "ocsConst.hh"
00041 #include "ocsReadWriteTools.hh"
00042 #include "ocsRanNumGen.hh"
00043 
00044 #define NEAR_ZERO 2.2e-13
00045 
00046 typedef complex<double> cplx; 
00047 
00048 // #### square
00049 template<class T> inline T sq(T);
00050 template<class T> inline T sq(T in)
00051 {
00052   return (in*in);
00053 }
00054 
00055 // ##### cube
00056 template<class T> inline T cube(T);
00057 template<class T> inline T cube(T in)
00058 {
00059   return (in*in*in);
00060 }
00061 
00062 // ##### Sign function
00063 inline int sgn(double x); 
00064 inline int sgn(double x) 
00065 {
00066    if (x >= 0)
00067       return(1);
00068    else   
00069       return(-1);
00070 }
00071 
00072 inline double min(double a, double b);
00073 inline double min(double a, double b)
00074 {
00075   if(a<b)
00076     return a;
00077   else
00078     return b;
00079 }
00080 
00081 
00082 // ##############################################################
00083 
00084 // Functions added by Ivan
00085 
00086 
00087 void TransRzRyV3to_Xhat( double *Vector, double *thetaZthetaY);
00088 //                        ,double Rotation[][3]);
00089 void TransRyV3to_YZ( double *Vector, double *thetaY);
00090 void TransRzRxV3to_Xhat( double *Vector, double *thetaZthetaX);
00091 //                    ,double Rotation[][3]);
00092 void RotatesAboutZ(double angle, double *Vector); //, double Rz[][3]);
00093 void RotatesAboutX(double angle, double *Vector); //, double Rx[][3]);
00094 void RotatesAboutY(double angle, double *Vector); //, double Rx[][3]);
00095 void Multiply( double Left[][3], double Right[][3]);  
00096 void Multiply(double Left[][3],double Right[3]);
00097 double ScalarProduct(double *VectorA, double *VectorB);
00098 void CrossProduct(double Left[4], double Right[4], int FirstCoord);
00099 double GetVectorLength(double *Vector, int Dimension);
00100 
00101 double dB2Linear(double dBvalue);
00102 double dBm2Linear(double dBmPower);
00103 double Linear2dB(double LinearValue);
00104 double Linear2dBm(double LinearPower);
00105 
00106 double GetDegreeOfPolarization(double *StokesVector);
00107 double GetPhase(const cplx Phasor);
00108 void Stokes2Jones(const double *Stokes, cplx *Jones);
00109 void Jones2Stokes(const cplx *Jones, double *Stokes);
00110 void Stokes2JonesKeepPower(const double *Stokes, cplx *Jones);
00111 void Jones2StokesKeepPower(const cplx *Jones, double *Stokes);
00112 
00113 // ##########################################################
00114 
00115 // Functions added by John
00116 
00117 double Frequency2Wavelength(double Frequency); // Freq in Hz
00118 double Wavelength2Frequency(double Wavelength); // Freq in Hz
00119 
00120 
00121 // ##############################################################
00122 
00123 // Functions added by Ron
00124 
00125 enum{MOSIX_UNLOCK, MOSIX_LOCK};
00126 int lock_or_unlock_mosix(int what);
00127 int cpujob_mosix(void);
00128 int slow_mosix(void);
00129 inline double dB_to_factor(double G_dB);
00130 inline double factor_to_dB(double factor);
00131 
00132 // ##############################################################
00133 
00134 // ## Numerical Recipes Functions
00135 
00136 void nrerror(char error_text[]);
00137 float erffc(float x);
00138 float gammp(float a, float x);
00139 void gcf(float *gammcf, float a, float x, float *gln);
00140 void gser(float *gamser, float a, float x, float *gln);
00141 float gammln(float xx);
00142 float gammq(float a, float x);
00143 
00144 // ## End of Numerical Recipes Functions
00145 
00146 #endif /* OCS_TOOLS_HH_ */

Generated on Fri Jul 2 2010 12:57:47 for OCS by  doxygen 1.7.1