compatibility with gcc-4.1.2 (for ABI2 builds)

This commit is contained in:
Sebastian Held 2010-09-17 11:07:52 +02:00
parent cc4ffd235f
commit 8cd01c9c0c
12 changed files with 28 additions and 29 deletions

View File

@ -108,8 +108,13 @@ void Operator_SSE_Compressed::ShowStat() const
INLINE int equal(f4vector v1, f4vector v2) INLINE int equal(f4vector v1, f4vector v2)
{ {
#if defined(__SSE__) #if defined(__SSE__)
v4sf compare = __builtin_ia32_cmpeqps( v1.v, v2.v ); // hmm should return v4si... #if (__GNUC__ == 4) && (__GNUC_PATCHLEVEL__ < 4)
return __builtin_ia32_movmskps( compare ) == 0x0f; v4si compare = __builtin_ia32_cmpeqps( v1.v, v2.v );
return __builtin_ia32_movmskps( (v4sf)compare ) == 0x0f;
#else
v4sf compare = __builtin_ia32_cmpeqps( v1.v, v2.v );
return __builtin_ia32_movmskps( compare ) == 0x0f;
#endif
#else #else
return ( return (
v1.f[0] == v2.f[0] && v1.f[0] == v2.f[0] &&

View File

@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <complex.h>
#include <iomanip> #include <iomanip>
#include "time.h" #include "time.h"
#include "process_efield.h" #include "process_efield.h"
@ -33,7 +32,7 @@ void ProcessEField::InitProcess()
{ {
OpenFile(m_Name); OpenFile(m_Name);
for (int n=0; n<3; n++) for (int n=0; n<3; n++)
FD_Values[n].assign(m_FD_Samples.size(),0); FD_Values[n].assign(m_FD_Samples.size(),double_complex(0.0,0.0));
file << "% time-domain E-field probe by openEMS " GIT_VERSION << endl; file << "% time-domain E-field probe by openEMS " GIT_VERSION << endl;
file << "% coords: (" << Op->GetDiscLine(0,start[0])*Op->GetGridDelta() << "," file << "% coords: (" << Op->GetDiscLine(0,start[0])*Op->GetGridDelta() << ","
@ -48,7 +47,7 @@ void ProcessEField::FlushData()
Dump_FD_Data(FD_Values,1.0/(double)m_FD_SampleCount,m_filename + "_FD"); Dump_FD_Data(FD_Values,1.0/(double)m_FD_SampleCount,m_filename + "_FD");
} }
void ProcessEField::Dump_FD_Data(vector<complexdouble> value[3], double factor, string filename) void ProcessEField::Dump_FD_Data(vector<double_complex> value[3], double factor, string filename)
{ {
if (value[0].size()==0) if (value[0].size()==0)
return; return;
@ -68,9 +67,9 @@ void ProcessEField::Dump_FD_Data(vector<complexdouble> value[3], double factor,
for (size_t n=0;n<value[0].size();++n) for (size_t n=0;n<value[0].size();++n)
{ {
file << m_FD_Samples.at(n) file << m_FD_Samples.at(n)
<< "\t" << 2.0 * creal(value[0].at(n))*factor << "\t" << 2.0 * cimag(value[0].at(n))*factor << "\t" << 2.0 * std::real(value[0].at(n))*factor << "\t" << 2.0 * std::imag(value[0].at(n))*factor
<< "\t" << 2.0 * creal(value[1].at(n))*factor << "\t" << 2.0 * cimag(value[1].at(n))*factor << "\t" << 2.0 * std::real(value[1].at(n))*factor << "\t" << 2.0 * std::imag(value[1].at(n))*factor
<< "\t" << 2.0 * creal(value[2].at(n))*factor << "\t" << 2.0 * cimag(value[2].at(n))*factor << "\n"; << "\t" << 2.0 * std::real(value[2].at(n))*factor << "\t" << 2.0 * std::imag(value[2].at(n))*factor << "\n";
} }
file.close(); file.close();
} }
@ -112,7 +111,7 @@ int ProcessEField::Process()
field *= m_weight; field *= m_weight;
for (size_t n=0;n<m_FD_Samples.size();++n) for (size_t n=0;n<m_FD_Samples.size();++n)
{ {
FD_Values[pol].at(n) += field * cexp( -2.0 * 1.0i * M_PI * m_FD_Samples.at(n) * T ); FD_Values[pol].at(n) += (double)field * std::exp( -2.0 * II * M_PI * m_FD_Samples.at(n) * T );
} }
++m_FD_SampleCount; ++m_FD_SampleCount;
} }

View File

@ -20,8 +20,6 @@
#include "processing.h" #include "processing.h"
typedef _Complex double complexdouble;
/*! \brief Process E-field at a point /*! \brief Process E-field at a point
This class calculates the E-field at a point in the FDTD lattice. This class calculates the E-field at a point in the FDTD lattice.
@ -35,11 +33,11 @@ public:
virtual void InitProcess(); virtual void InitProcess();
virtual void FlushData(); virtual void FlushData();
void Dump_FD_Data(vector<complexdouble> value[3], double factor, string filename); void Dump_FD_Data(vector<double_complex> value[3], double factor, string filename);
virtual int Process(); virtual int Process();
protected: protected:
vector<complexdouble> FD_Values[3]; vector<double_complex> FD_Values[3];
}; };
#endif // PROCESS_EFIELD_H #endif // PROCESS_EFIELD_H

View File

@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <complex.h>
#include <iomanip> #include <iomanip>
#include "tools/global.h" #include "tools/global.h"
#include "process_hfield.h" #include "process_hfield.h"
@ -32,7 +31,7 @@ void ProcessHField::InitProcess()
{ {
OpenFile(m_Name); OpenFile(m_Name);
for (int n=0; n<3; n++) for (int n=0; n<3; n++)
FD_Values[n].assign(m_FD_Samples.size(),0); FD_Values[n].assign(m_FD_Samples.size(),double_complex(0.0,0.0));
file << "% time-domain H-field probe by openEMS " GIT_VERSION << endl; file << "% time-domain H-field probe by openEMS " GIT_VERSION << endl;
file << "% coords: (" << Op->GetDiscLine(0,start[0],true)*Op->GetGridDelta() << "," file << "% coords: (" << Op->GetDiscLine(0,start[0],true)*Op->GetGridDelta() << ","
@ -96,7 +95,7 @@ int ProcessHField::Process()
field *= m_weight; field *= m_weight;
for (size_t n=0;n<m_FD_Samples.size();++n) for (size_t n=0;n<m_FD_Samples.size();++n)
{ {
FD_Values[pol].at(n) += field * cexp( -2.0 * 1.0i * M_PI * m_FD_Samples.at(n) * T ); FD_Values[pol].at(n) += (double)field * std::exp( -2.0 * II * M_PI * m_FD_Samples.at(n) * T );
} }
++m_FD_SampleCount; ++m_FD_SampleCount;
} }

View File

@ -20,8 +20,6 @@
#include "process_efield.h" #include "process_efield.h"
typedef _Complex double complexdouble;
/*! \brief Process H-field at a point /*! \brief Process H-field at a point
This class calculates the E-field at a point in the FDTD lattice. This class calculates the E-field at a point in the FDTD lattice.

View File

@ -18,7 +18,6 @@
#include "tools/global.h" #include "tools/global.h"
#include "processcurrent.h" #include "processcurrent.h"
#include <iomanip> #include <iomanip>
#include <complex.h>
ProcessCurrent::ProcessCurrent(Operator* op, Engine* eng) : ProcessIntegral(op, eng) ProcessCurrent::ProcessCurrent(Operator* op, Engine* eng) : ProcessIntegral(op, eng)
{ {

View File

@ -19,7 +19,6 @@
#include "tools/useful.h" #include "tools/useful.h"
#include "processing.h" #include "processing.h"
#include "time.h" #include "time.h"
#include <complex.h>
#include <climits> #include <climits>
Processing::Processing(Operator* op, Engine* eng) Processing::Processing(Operator* op, Engine* eng)
@ -276,7 +275,7 @@ void Processing::DumpBox2File( string vtkfilenameprefix, bool dualMesh ) const
file.close(); file.close();
} }
void Processing::Dump_FD_Data(vector<_Complex double> value, double factor, string filename) void Processing::Dump_FD_Data(vector<double_complex> value, double factor, string filename)
{ {
if (value.size()==0) if (value.size()==0)
return; return;
@ -295,7 +294,7 @@ void Processing::Dump_FD_Data(vector<_Complex double> value, double factor, stri
file << "%dump by openEMS @" << ctime(&rawTime) << "%frequency\treal\timag\n"; file << "%dump by openEMS @" << ctime(&rawTime) << "%frequency\treal\timag\n";
for (size_t n=0;n<value.size();++n) for (size_t n=0;n<value.size();++n)
{ {
file << m_FD_Samples.at(n) << "\t" << 2.0 * creal(value.at(n))*factor << "\t" << 2.0 * cimag(value.at(n))*factor << "\n"; file << m_FD_Samples.at(n) << "\t" << 2.0 * std::real(value.at(n))*factor << "\t" << 2.0 * std::imag(value.at(n))*factor << "\n";
} }
file.close(); file.close();
} }

View File

@ -18,6 +18,10 @@
#ifndef PROCESSING_H #ifndef PROCESSING_H
#define PROCESSING_H #define PROCESSING_H
#include <complex>
typedef std::complex<double> double_complex;
#define II double_complex(0.0,1.0)
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <cmath> #include <cmath>
@ -101,7 +105,7 @@ protected:
//! Sampling interval needed for the FD_Samples //! Sampling interval needed for the FD_Samples
unsigned int m_FD_Interval; unsigned int m_FD_Interval;
void Dump_FD_Data(vector<_Complex double> value, double factor, string filename); void Dump_FD_Data(vector<double_complex> value, double factor, string filename);
//! define if given coords are on main or dualMesh (default is false) //! define if given coords are on main or dualMesh (default is false)
bool m_dualMesh; bool m_dualMesh;

View File

@ -16,7 +16,6 @@
*/ */
#include "processintegral.h" #include "processintegral.h"
#include <complex.h>
#include <iomanip> #include <iomanip>
ProcessIntegral::ProcessIntegral(Operator* op, Engine* eng) : Processing(op, eng) ProcessIntegral::ProcessIntegral(Operator* op, Engine* eng) : Processing(op, eng)
@ -78,7 +77,7 @@ int ProcessIntegral::Process()
double T = time; double T = time;
for (size_t n=0;n<m_FD_Samples.size();++n) for (size_t n=0;n<m_FD_Samples.size();++n)
{ {
FD_Values.at(n) += integral * cexp( -2.0 * 1.0i * M_PI * m_FD_Samples.at(n) * T ); FD_Values.at(n) += (double)integral * std::exp( -2.0 * II * M_PI * m_FD_Samples.at(n) * T );
} }
++m_FD_SampleCount; ++m_FD_SampleCount;
if (m_Flush) if (m_Flush)

View File

@ -57,7 +57,7 @@ protected:
double m_TimeShift; double m_TimeShift;
vector<FDTD_FLOAT> TD_Values; vector<FDTD_FLOAT> TD_Values;
vector<_Complex double> FD_Values; vector<double_complex> FD_Values;
double *m_Results; double *m_Results;
}; };

View File

@ -16,7 +16,6 @@
*/ */
#include "processvoltage.h" #include "processvoltage.h"
#include <complex.h>
#include <iomanip> #include <iomanip>
ProcessVoltage::ProcessVoltage(Operator* op, Engine* eng) : ProcessIntegral(op, eng) ProcessVoltage::ProcessVoltage(Operator* op, Engine* eng) : ProcessIntegral(op, eng)

View File

@ -172,9 +172,9 @@ bits64 {
} }
bits32 { bits32 {
QMAKE_CXXFLAGS_RELEASE += -m32 \ QMAKE_CXXFLAGS_RELEASE += -m32 \
-march=i686 -march=pentium3
QMAKE_LFLAGS_RELEASE += -m32 \ QMAKE_LFLAGS_RELEASE += -m32 \
-march=i686 -march=pentium3
OBJECTS_DIR = ABI2-32 OBJECTS_DIR = ABI2-32
LIBS = ../CSXCAD/ABI2-32/libCSXCAD.so LIBS = ../CSXCAD/ABI2-32/libCSXCAD.so
LIBS += ../fparser/ABI2-32/libfparser.so LIBS += ../fparser/ABI2-32/libfparser.so