nf2ff: use double for integral values

pull/1/head
Thorsten Liebig 2012-09-17 12:33:30 +02:00
parent 9d77b83105
commit e1376be1e5
4 changed files with 40 additions and 40 deletions

View File

@ -466,8 +466,8 @@ bool nf2ff::Write2HDF5(string filename)
size_t pos = 0;
size_t datasize[2]={m_numPhi,m_numTheta};
size_t size = datasize[0]*datasize[1];
float* buffer = new float[size];
complex<float>** field_data;
double* buffer = new double[size];
complex<double>** field_data;
string field_names[2]={"E_theta", "E_phi"};
for (int n=0;n<2;++n)
{
@ -515,7 +515,7 @@ bool nf2ff::Write2HDF5(string filename)
stringstream ss;
ss << "f" << fn;
pos = 0;
float** field_data = GetRadPower(fn);
double** field_data = GetRadPower(fn);
for (size_t j=0;j<m_numPhi;++j)
for (size_t i=0;i<m_numTheta;++i)
{
@ -533,7 +533,7 @@ bool nf2ff::Write2HDF5(string filename)
//write frequency attribute
hdf_file.WriteAtrribute("/nf2ff", "Frequency",m_freq);
buffer = new float[m_freq.size()];
buffer = new double[m_freq.size()];
//write radiated power attribute
for (size_t fn=0;fn<m_freq.size();++fn)
buffer[fn] = GetTotalRadPower(fn);

View File

@ -37,12 +37,12 @@ public:
bool AnalyseFile(string E_Field_file, string H_Field_file);
float GetTotalRadPower(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetTotalRadPower();}
float GetMaxDirectivity(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetMaxDirectivity();}
double GetTotalRadPower(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetTotalRadPower();}
double GetMaxDirectivity(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetMaxDirectivity();}
complex<float>** GetETheta(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetETheta();}
complex<float>** GetEPhi(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetEPhi();}
float** GetRadPower(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetRadPower();}
complex<double>** GetETheta(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetETheta();}
complex<double>** GetEPhi(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetEPhi();}
double** GetRadPower(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetRadPower();}
//! Write results to a hdf5 file
bool Write2HDF5(string filename);

View File

@ -95,10 +95,10 @@ void nf2ff_calc_thread::operator()()
}
}
complex<float>** m_Nt=m_data.m_Nt;
complex<float>** m_Np=m_data.m_Np;
complex<float>** m_Lt=m_data.m_Lt;
complex<float>** m_Lp=m_data.m_Lp;
complex<double>** m_Nt=m_data.m_Nt;
complex<double>** m_Np=m_data.m_Np;
complex<double>** m_Lt=m_data.m_Lt;
complex<double>** m_Lp=m_data.m_Lp;
float center[3] = {m_nf_calc->m_centerCoord[0],m_nf_calc->m_centerCoord[1],m_nf_calc->m_centerCoord[2]};
if (mesh_type==1)
@ -174,11 +174,11 @@ nf2ff_calc::nf2ff_calc(float freq, vector<float> theta, vector<float> phi, vecto
m_phi[n]=phi.at(n);
unsigned int numLines[2] = {m_numTheta, m_numPhi};
m_E_theta = Create2DArray<std::complex<float> >(numLines);
m_E_phi = Create2DArray<std::complex<float> >(numLines);
m_H_theta = Create2DArray<std::complex<float> >(numLines);
m_H_phi = Create2DArray<std::complex<float> >(numLines);
m_P_rad = Create2DArray<float>(numLines);
m_E_theta = Create2DArray<std::complex<double> >(numLines);
m_E_phi = Create2DArray<std::complex<double> >(numLines);
m_H_theta = Create2DArray<std::complex<double> >(numLines);
m_H_phi = Create2DArray<std::complex<double> >(numLines);
m_P_rad = Create2DArray<double>(numLines);
if (center.size()==3)
{
@ -285,8 +285,8 @@ bool nf2ff_calc::AddPlane(float **lines, unsigned int* numLines, complex<float>*
}
}
complex<float> power = 0;
float area;
complex<double> power = 0;
double area;
for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
@ -318,10 +318,10 @@ bool nf2ff_calc::AddPlane(float **lines, unsigned int* numLines, complex<float>*
thread_data[n].H_field=H_field;
thread_data[n].Js=Js;
thread_data[n].Ms=Ms;
thread_data[n].m_Nt=Create2DArray<complex<float> >(numAngles);
thread_data[n].m_Np=Create2DArray<complex<float> >(numAngles);
thread_data[n].m_Lt=Create2DArray<complex<float> >(numAngles);
thread_data[n].m_Lp=Create2DArray<complex<float> >(numAngles);
thread_data[n].m_Nt=Create2DArray<complex<double> >(numAngles);
thread_data[n].m_Np=Create2DArray<complex<double> >(numAngles);
thread_data[n].m_Lt=Create2DArray<complex<double> >(numAngles);
thread_data[n].m_Lp=Create2DArray<complex<double> >(numAngles);
boost::thread *t = new boost::thread( nf2ff_calc_thread(this,start,stop,n,thread_data[n]) );

View File

@ -47,10 +47,10 @@ typedef struct
complex<float>**** Ms;
//local working data OUT
complex<float>** m_Nt;
complex<float>** m_Np;
complex<float>** m_Lt;
complex<float>** m_Lp;
complex<double>** m_Nt;
complex<double>** m_Np;
complex<double>** m_Lt;
complex<double>** m_Lp;
} nf2ff_data;
@ -75,12 +75,12 @@ public:
nf2ff_calc(float freq, vector<float> theta, vector<float> phi, vector<float> center);
~nf2ff_calc();
float GetTotalRadPower() const {return m_radPower;}
float GetMaxDirectivity() const {return m_maxDir;}
double GetTotalRadPower() const {return m_radPower;}
double GetMaxDirectivity() const {return m_maxDir;}
complex<float>** GetETheta() const {return m_E_theta;}
complex<float>** GetEPhi() const {return m_E_phi;}
float** GetRadPower() const {return m_P_rad;}
complex<double>** GetETheta() const {return m_E_theta;}
complex<double>** GetEPhi() const {return m_E_phi;}
double** GetRadPower() const {return m_P_rad;}
unsigned int GetNumThreads() const {return m_numThreads;}
void SetNumThreads(unsigned int n) {m_numThreads=n;}
@ -91,14 +91,14 @@ protected:
float m_freq;
float m_radius;
float m_radPower;
float m_maxDir;
double m_radPower;
double m_maxDir;
complex<float>** m_E_theta;
complex<float>** m_E_phi;
complex<float>** m_H_theta;
complex<float>** m_H_phi;
float** m_P_rad;
complex<double>** m_E_theta;
complex<double>** m_E_phi;
complex<double>** m_H_theta;
complex<double>** m_H_phi;
double** m_P_rad;
float m_centerCoord[3];
unsigned int m_numTheta;