Init style: applied astyle.sh

astyle --style=allman --indent=tab --indent-cases {} \;

please apply this style prior to any future commit

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/1/head
Thorsten Liebig 2010-12-06 13:04:37 +01:00
parent 70ae86d63f
commit 9d3761b1d0
57 changed files with 886 additions and 717 deletions

1
.gitignore vendored
View File

@ -7,4 +7,5 @@ Makefile*
*~ *~
*.so* *.so*
*.pro.user* *.pro.user*
*.orig
openEMS openEMS

View File

@ -47,7 +47,8 @@ void ProcessHField::DefineStartStopCoord(double* dstart, double* dstop)
if (Op->SnapToMesh(dstop,stop,true,m_stop_inside)==false) if (Op->SnapToMesh(dstop,stop,true,m_stop_inside)==false)
cerr << "ProcessHField::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl; cerr << "ProcessHField::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
if (g_settings.showProbeDiscretization()) { if (g_settings.showProbeDiscretization())
{
cerr << m_Name << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], true ) << "," cerr << m_Name << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], true ) << ","
<< Op->GetDiscLine( 1, start[1], true ) << "," << Op->GetDiscLine( 2, start[2], true ) << ") -> (" << Op->GetDiscLine( 1, start[1], true ) << "," << Op->GetDiscLine( 2, start[2], true ) << ") -> ("
<< Op->GetDiscLine( 0, stop[0], true ) << ","<< Op->GetDiscLine( 1, stop[1], true ) << "," << Op->GetDiscLine( 0, stop[0], true ) << ","<< Op->GetDiscLine( 1, stop[1], true ) << ","

View File

@ -198,7 +198,8 @@ void ProcessFields::DefineStartStopCoord(double* dstart, double* dstop)
} }
} }
if (g_settings.showProbeDiscretization()) { if (g_settings.showProbeDiscretization())
{
// FIXME the information E-Field / H-Field and therefore which mesh to use is missing // FIXME the information E-Field / H-Field and therefore which mesh to use is missing
bool dualMesh = false; bool dualMesh = false;
cerr << m_filename << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], dualMesh ) << "," cerr << m_filename << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], dualMesh ) << ","

View File

@ -101,7 +101,10 @@ int ProcessFieldsTD::Process()
if (m_fileType==VTK_FILETYPE) if (m_fileType==VTK_FILETYPE)
{ {
ofstream file(filename.c_str()); ofstream file(filename.c_str());
if (file.is_open()==false) { cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;}; if (file.is_open()==false)
{
cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;
};
DumpVectorArray2VTK(file,GetFieldNameByType(m_DumpType),field,discLines,numLines,m_precision,string("Interpolation: ")+m_Eng_Interface->GetInterpolationTypeString(), m_Mesh_Type, discLines_scaling); DumpVectorArray2VTK(file,GetFieldNameByType(m_DumpType),field,discLines,numLines,m_precision,string("Interpolation: ")+m_Eng_Interface->GetInterpolationTypeString(), m_Mesh_Type, discLines_scaling);
file.close(); file.close();
} }

View File

@ -156,7 +156,8 @@ void Processing::DefineStartStopCoord(double* dstart, double* dstop)
if (Op->SnapToMesh(dstop,stop,m_dualMesh,m_stop_inside)==false) if (Op->SnapToMesh(dstop,stop,m_dualMesh,m_stop_inside)==false)
cerr << "Processing::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl; cerr << "Processing::DefineStartStopCoord: Warning: Snapped line outside field domain!!" << endl;
if (g_settings.showProbeDiscretization()) { if (g_settings.showProbeDiscretization())
{
cerr << m_Name << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], m_dualMesh ) << "," cerr << m_Name << ": snapped coords: (" << Op->GetDiscLine( 0, start[0], m_dualMesh ) << ","
<< Op->GetDiscLine( 1, start[1], m_dualMesh ) << "," << Op->GetDiscLine( 2, start[2], m_dualMesh ) << ") -> (" << Op->GetDiscLine( 1, start[1], m_dualMesh ) << "," << Op->GetDiscLine( 2, start[2], m_dualMesh ) << ") -> ("
<< Op->GetDiscLine( 0, stop[0], m_dualMesh ) << ","<< Op->GetDiscLine( 1, stop[1], m_dualMesh ) << "," << Op->GetDiscLine( 0, stop[0], m_dualMesh ) << ","<< Op->GetDiscLine( 1, stop[1], m_dualMesh ) << ","
@ -191,15 +192,18 @@ void Processing::DumpBox2File( string vtkfilenameprefix, bool dualMesh ) const
// normalize coordinates // normalize coordinates
double s1[3], s2[3]; double s1[3], s2[3];
for (int i=0; i<3; i++) { for (int i=0; i<3; i++)
{
s1[i] = min(Op->GetDiscLine(i,start[i],dualMesh),Op->GetDiscLine(i,stop[i],dualMesh)); s1[i] = min(Op->GetDiscLine(i,start[i],dualMesh),Op->GetDiscLine(i,stop[i],dualMesh));
s2[i] = max(Op->GetDiscLine(i,start[i],dualMesh),Op->GetDiscLine(i,stop[i],dualMesh)); s2[i] = max(Op->GetDiscLine(i,start[i],dualMesh),Op->GetDiscLine(i,stop[i],dualMesh));
} }
// fix degenerate box/plane -> line (paraview display problem) // fix degenerate box/plane -> line (paraview display problem)
if (((s1[0] == s2[0]) && (s1[1] == s2[1])) || ((s1[0] == s2[0]) && (s1[2] == s2[2])) || ((s1[2] == s2[2]) && (s1[1] == s2[1]))) { if (((s1[0] == s2[0]) && (s1[1] == s2[1])) || ((s1[0] == s2[0]) && (s1[2] == s2[2])) || ((s1[2] == s2[2]) && (s1[1] == s2[1])))
{
// line are not displayed correctly -> enlarge // line are not displayed correctly -> enlarge
for (int i=0; i<3; i++) { for (int i=0; i<3; i++)
{
double delta = min( Op->GetMeshDelta( i, start,dualMesh ), Op->GetMeshDelta( i, stop,dualMesh ) ) / Op->GetGridDelta() / 4.0; double delta = min( Op->GetMeshDelta( i, start,dualMesh ), Op->GetMeshDelta( i, stop,dualMesh ) ) / Op->GetGridDelta() / 4.0;
s1[i] -= delta; s1[i] -= delta;
s2[i] += delta; s2[i] += delta;
@ -209,7 +213,8 @@ void Processing::DumpBox2File( string vtkfilenameprefix, bool dualMesh ) const
// rescale coordinates // rescale coordinates
#ifndef OUTPUT_IN_DRAWINGUNITS #ifndef OUTPUT_IN_DRAWINGUNITS
double scaling = Op->GetGridDelta(); double scaling = Op->GetGridDelta();
for (int i=0; i<3; i++) { for (int i=0; i<3; i++)
{
s1[i] *= scaling; s1[i] *= scaling;
s2[i] *= scaling; s2[i] *= scaling;
} }

View File

@ -21,7 +21,8 @@
#include <fstream> #include <fstream>
#include "operator.h" #include "operator.h"
namespace NS_Engine_Multithread { namespace NS_Engine_Multithread
{
class thread; // evil hack to access numTS from multithreading context class thread; // evil hack to access numTS from multithreading context
} }

View File

@ -58,10 +58,12 @@ Engine_Multithread::~Engine_Multithread()
#ifdef ENABLE_DEBUG_TIME #ifdef ENABLE_DEBUG_TIME
NS_Engine_Multithread::DBG().cout() << "Engine_Multithread::~Engine_Multithread()" << endl; NS_Engine_Multithread::DBG().cout() << "Engine_Multithread::~Engine_Multithread()" << endl;
std::map<boost::thread::id, std::vector<double> >::iterator it; std::map<boost::thread::id, std::vector<double> >::iterator it;
for (it=m_timer_list.begin(); it!=m_timer_list.end(); it++) { for (it=m_timer_list.begin(); it!=m_timer_list.end(); it++)
{
NS_Engine_Multithread::DBG().cout() << "*** DEBUG Thread: " << it->first << std::endl; NS_Engine_Multithread::DBG().cout() << "*** DEBUG Thread: " << it->first << std::endl;
std::vector<double>::iterator it2; std::vector<double>::iterator it2;
for (it2=it->second.begin(); it2<it->second.end();) { for (it2=it->second.begin(); it2<it->second.end();)
{
NS_Engine_Multithread::DBG().cout() << "after voltage update, before barrier1: " << fixed << setprecision(6) << *(it2++) << std::endl; NS_Engine_Multithread::DBG().cout() << "after voltage update, before barrier1: " << fixed << setprecision(6) << *(it2++) << std::endl;
NS_Engine_Multithread::DBG().cout() << "after barrier1, before barrier2: " << fixed << setprecision(6) << *(it2++) << std::endl; NS_Engine_Multithread::DBG().cout() << "after barrier1, before barrier2: " << fixed << setprecision(6) << *(it2++) << std::endl;
NS_Engine_Multithread::DBG().cout() << "after barrier2, before current update: " << fixed << setprecision(6) << *(it2++) << std::endl; NS_Engine_Multithread::DBG().cout() << "after barrier2, before current update: " << fixed << setprecision(6) << *(it2++) << std::endl;
@ -134,9 +136,12 @@ void Engine_Multithread::Reset()
m_stopThreads = true; m_stopThreads = true;
m_stopBarrier->wait(); // wait for the threads to finish m_stopBarrier->wait(); // wait for the threads to finish
m_thread_group.join_all(); // wait for termination m_thread_group.join_all(); // wait for termination
delete m_IterateBarrier; m_IterateBarrier = 0; delete m_IterateBarrier;
delete m_startBarrier; m_startBarrier = 0; m_IterateBarrier = 0;
delete m_stopBarrier; m_stopBarrier = 0; delete m_startBarrier;
m_startBarrier = 0;
delete m_stopBarrier;
m_stopBarrier = 0;
} }
Engine_SSE_Compressed::Reset(); Engine_SSE_Compressed::Reset();
@ -219,7 +224,8 @@ void Engine_Multithread::Apply2Current(int threadID)
// //
// ************************************************************************************************************************* // *************************************************************************************************************************
// //
namespace NS_Engine_Multithread { namespace NS_Engine_Multithread
{
thread::thread( Engine_Multithread* ptr, unsigned int start, unsigned int stop, unsigned int stop_h, unsigned int threadID ) thread::thread( Engine_Multithread* ptr, unsigned int start, unsigned int stop, unsigned int stop_h, unsigned int threadID )
{ {
@ -236,7 +242,8 @@ void thread::operator()()
//DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") started." << endl; //DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") started." << endl;
while (!m_enginePtr->m_stopThreads) { while (!m_enginePtr->m_stopThreads)
{
// wait for start // wait for start
//DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") waiting..." << endl; //DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") waiting..." << endl;
m_enginePtr->m_startBarrier->wait(); m_enginePtr->m_startBarrier->wait();

View File

@ -34,9 +34,11 @@
class Engine_Multithread; class Engine_Multithread;
namespace NS_Engine_Multithread { namespace NS_Engine_Multithread
{
class DBG { // debug class DBG // debug
{
public: public:
DBG() {} DBG() {}
~DBG() { std::cout << os.str();} ~DBG() { std::cout << os.str();}
@ -45,7 +47,8 @@ namespace NS_Engine_Multithread {
std::ostringstream os; std::ostringstream os;
}; };
class Timer { //debug class Timer //debug
{
public: public:
Timer() {gettimeofday(&t1,NULL);} Timer() {gettimeofday(&t1,NULL);}
double elapsed() {gettimeofday(&t2,NULL); return (t2.tv_sec-t1.tv_sec) + (t2.tv_usec-t1.tv_usec)*1e-6;} double elapsed() {gettimeofday(&t2,NULL); return (t2.tv_sec-t1.tv_sec) + (t2.tv_usec-t1.tv_usec)*1e-6;}
@ -53,7 +56,8 @@ namespace NS_Engine_Multithread {
timeval t1,t2; timeval t1,t2;
}; };
class thread { class thread
{
public: public:
thread( Engine_Multithread* ptr, unsigned int start, unsigned int stop, unsigned int stop_h, unsigned int threadID ); thread( Engine_Multithread* ptr, unsigned int start, unsigned int stop, unsigned int stop_h, unsigned int threadID );
void operator()(); void operator()();

View File

@ -34,7 +34,8 @@ Excitation::Excitation( double timestep )
Curr_dir = 0; Curr_dir = 0;
Curr_Count = 0; Curr_Count = 0;
for (int n=0;n<3;++n) { for (int n=0; n<3; ++n)
{
Volt_index[n] = 0; Volt_index[n] = 0;
Curr_index[n] = 0; Curr_index[n] = 0;
Volt_Count_Dir[n] = 0; Volt_Count_Dir[n] = 0;
@ -55,7 +56,8 @@ Excitation::~Excitation()
delete[] Curr_delay; delete[] Curr_delay;
delete[] Curr_dir; delete[] Curr_dir;
delete[] Curr_amp; delete[] Curr_amp;
for (int n=0;n<3;++n) { for (int n=0; n<3; ++n)
{
delete[] Volt_index[n]; delete[] Volt_index[n];
delete[] Curr_index[n]; delete[] Curr_index[n];
} }
@ -64,7 +66,8 @@ Excitation::~Excitation()
bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS ) bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS )
{ {
if (!Excite) { if (!Excite)
{
cerr << "Can't read openEMS excitation settings... " << endl; cerr << "Can't read openEMS excitation settings... " << endl;
return false; return false;
} }

View File

@ -96,7 +96,11 @@ void Engine_Ext_CylinderMultiGrid::SyncVoltages()
unsigned int pos[3]; unsigned int pos[3];
pos[0] = m_Eng_MG->Op_CMG->GetSplitPos()-1; pos[0] = m_Eng_MG->Op_CMG->GetSplitPos()-1;
unsigned int pos1_half = 0; unsigned int pos1_half = 0;
f4vector v_null; v_null.f[0] = 0;v_null.f[1] = 0;v_null.f[2] = 0;v_null.f[3] = 0; f4vector v_null;
v_null.f[0] = 0;
v_null.f[1] = 0;
v_null.f[2] = 0;
v_null.f[3] = 0;
for (pos[1]=0; pos[1]<numLines[1]-1; pos[1]+=2) for (pos[1]=0; pos[1]<numLines[1]-1; pos[1]+=2)
{ {
pos1_half = pos[1]/2; pos1_half = pos[1]/2;

View File

@ -264,7 +264,8 @@ void Engine_Ext_UPML::DoPostVoltageUpdates(int threadID)
f_help = volt_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]]; f_help = volt_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]];
volt_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] = m_Eng->GetVolt(2,pos); volt_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] = m_Eng->GetVolt(2,pos);
m_Eng->SetVolt(2,pos, f_help + m_Op_UPML->vvfn[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] * volt_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]]); } m_Eng->SetVolt(2,pos, f_help + m_Op_UPML->vvfn[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] * volt_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]]);
}
} }
} }
break; break;
@ -482,7 +483,8 @@ void Engine_Ext_UPML::DoPostCurrentUpdates(int threadID)
f_help = curr_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]]; f_help = curr_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]];
curr_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] = m_Eng->GetCurr(2,pos); curr_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] = m_Eng->GetCurr(2,pos);
m_Eng->SetCurr(2,pos, f_help + m_Op_UPML->iifn[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] * curr_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]]); } m_Eng->SetCurr(2,pos, f_help + m_Op_UPML->iifn[2][loc_pos[0]][loc_pos[1]][loc_pos[2]] * curr_flux[2][loc_pos[0]][loc_pos[1]][loc_pos[2]]);
}
} }
} }
break; break;

View File

@ -32,14 +32,18 @@ Operator_Ext_Cylinder::Operator_Ext_Cylinder(Operator_Cylinder* op) : Operator_E
Operator_Ext_Cylinder::~Operator_Ext_Cylinder() Operator_Ext_Cylinder::~Operator_Ext_Cylinder()
{ {
delete[] vv_R0;vv_R0=NULL; delete[] vv_R0;
delete[] vi_R0;vi_R0=NULL; vv_R0=NULL;
delete[] vi_R0;
vi_R0=NULL;
} }
bool Operator_Ext_Cylinder::BuildExtension() bool Operator_Ext_Cylinder::BuildExtension()
{ {
delete[] vv_R0;vv_R0=NULL; delete[] vv_R0;
delete[] vi_R0;vi_R0=NULL; vv_R0=NULL;
delete[] vi_R0;
vi_R0=NULL;
//if r=0 is not included -> obviously no special treatment for r=0 //if r=0 is not included -> obviously no special treatment for r=0
//if alpha direction is not closed, PEC-BC at r=0 necessary and already set... //if alpha direction is not closed, PEC-BC at r=0 necessary and already set...

View File

@ -61,10 +61,14 @@ Operator_Ext_PML_SF::Operator_Ext_PML_SF(Operator* op) : Operator_Extension(op)
m_numLines[1]=0; m_numLines[1]=0;
m_numLines[2]=0; m_numLines[2]=0;
vv[0] = NULL; vv[1] = NULL; vv[0] = NULL;
vi[0] = NULL; vi[1] = NULL; vv[1] = NULL;
ii[0] = NULL; ii[1] = NULL; vi[0] = NULL;
iv[0] = NULL; iv[1] = NULL; vi[1] = NULL;
ii[0] = NULL;
ii[1] = NULL;
iv[0] = NULL;
iv[1] = NULL;
for (int n=0; n<6; ++n) for (int n=0; n<6; ++n)
m_BC[n]=0; m_BC[n]=0;

View File

@ -136,7 +136,8 @@ bool Operator::SnapToMesh(double* dcoord, unsigned int* uicoord, bool lower, boo
uicoord[n]=0; uicoord[n]=0;
if (dcoord[n]<discLines[n][0]) if (dcoord[n]<discLines[n][0])
{ {
ok=false;uicoord[n]=0; ok=false;
uicoord[n]=0;
if (inside) inside[n] = false; if (inside) inside[n] = false;
} }
else if (dcoord[n]==discLines[n][0]) else if (dcoord[n]==discLines[n][0])
@ -400,9 +401,12 @@ void Operator::DumpPEC2File( string filename )
double scaling = 1; double scaling = 1;
#endif #endif
for (pos[0]=0; pos[0]<numLines[0]-1; pos[0]++) { for (pos[0]=0; pos[0]<numLines[0]-1; pos[0]++)
for (pos[1]=0; pos[1]<numLines[1]-1; pos[1]++) { {
for (pos[2]=0; pos[2]<numLines[2]-1; pos[2]++) { for (pos[1]=0; pos[1]<numLines[1]-1; pos[1]++)
{
for (pos[2]=0; pos[2]<numLines[2]-1; pos[2]++)
{
if ((pos[1] != 0) && (pos[2] != 0)) if ((pos[1] != 0) && (pos[2] != 0))
{ {
// PEC surrounds the computational area; do not output this // PEC surrounds the computational area; do not output this
@ -529,11 +533,21 @@ bool Operator::SetGeometryCSX(ContinuousStructure* geo)
{ {
discLines[n] = grid->GetLines(n,discLines[n],numLines[n],true); discLines[n] = grid->GetLines(n,discLines[n],numLines[n],true);
if (n==1) if (n==1)
if (numLines[n]<3) {cerr << "CartOperator::SetGeometryCSX: you need at least 3 disc-lines in every direction (3D!)!!!" << endl; Reset(); return false;} if (numLines[n]<3)
{
cerr << "CartOperator::SetGeometryCSX: you need at least 3 disc-lines in every direction (3D!)!!!" << endl;
Reset();
return false;
}
} }
MainOp = new AdrOp(numLines[0],numLines[1],numLines[2]); MainOp = new AdrOp(numLines[0],numLines[1],numLines[2]);
MainOp->SetGrid(discLines[0],discLines[1],discLines[2]); MainOp->SetGrid(discLines[0],discLines[1],discLines[2]);
if (grid->GetDeltaUnit()<=0) {cerr << "CartOperator::SetGeometryCSX: grid delta unit must not be <=0 !!!" << endl; Reset(); return false;} if (grid->GetDeltaUnit()<=0)
{
cerr << "CartOperator::SetGeometryCSX: grid delta unit must not be <=0 !!!" << endl;
Reset();
return false;
}
else gridDelta=grid->GetDeltaUnit(); else gridDelta=grid->GetDeltaUnit();
MainOp->SetGridDelta(1); MainOp->SetGridDelta(1);
MainOp->AddCellAdrOp(); MainOp->AddCellAdrOp();
@ -659,10 +673,14 @@ int Operator::CalcECOperator( DebugFlags debugFlags )
//cleanup //cleanup
for (int n=0; n<3; ++n) for (int n=0; n<3; ++n)
{ {
delete[] EC_C[n];EC_C[n]=NULL; delete[] EC_C[n];
delete[] EC_G[n];EC_G[n]=NULL; EC_C[n]=NULL;
delete[] EC_L[n];EC_L[n]=NULL; delete[] EC_G[n];
delete[] EC_R[n];EC_R[n]=NULL; EC_G[n]=NULL;
delete[] EC_L[n];
EC_L[n]=NULL;
delete[] EC_R[n];
EC_R[n]=NULL;
} }
return 0; return 0;
@ -912,7 +930,9 @@ bool Operator::Calc_EffMatPos(int ny, const unsigned int* pos, double* EffMat) c
EffMat[1]/=area; EffMat[1]/=area;
//******************************* mu,sigma averaging *****************************// //******************************* mu,sigma averaging *****************************//
loc_pos[0]=pos[0];loc_pos[1]=pos[1];loc_pos[2]=pos[2]; loc_pos[0]=pos[0];
loc_pos[1]=pos[1];
loc_pos[2]=pos[2];
double length=0; double length=0;
//shift down //shift down
shiftCoord[n] = coord[n]-delta_M*0.25; shiftCoord[n] = coord[n]-delta_M*0.25;
@ -998,7 +1018,11 @@ void Operator::Init_EC()
bool Operator::Calc_EC() bool Operator::Calc_EC()
{ {
if (CSX==NULL) {cerr << "CartOperator::Calc_EC: CSX not given or invalid!!!" << endl; return false;} if (CSX==NULL)
{
cerr << "CartOperator::Calc_EC: CSX not given or invalid!!!" << endl;
return false;
}
unsigned int ipos; unsigned int ipos;
unsigned int pos[3]; unsigned int pos[3];
double inEC[4]; double inEC[4];
@ -1358,7 +1382,9 @@ bool Operator::CalcFieldExcitation()
bool Operator::CalcPEC() bool Operator::CalcPEC()
{ {
m_Nr_PEC[0]=0; m_Nr_PEC[1]=0; m_Nr_PEC[2]=0; m_Nr_PEC[0]=0;
m_Nr_PEC[1]=0;
m_Nr_PEC[2]=0;
CalcPEC_Range(0,numLines[0]-1,m_Nr_PEC); CalcPEC_Range(0,numLines[0]-1,m_Nr_PEC);

View File

@ -183,14 +183,22 @@ bool Operator_Cylinder::SetGeometryCSX(ContinuousStructure* geo)
} }
} }
else if (minmaxA>2*PI) else if (minmaxA>2*PI)
{cerr << "Operator_Cylinder::SetGeometryCSX: Alpha Max-Min must not be larger than 2*PI!!!" << endl; Reset(); return false;} {
cerr << "Operator_Cylinder::SetGeometryCSX: Alpha Max-Min must not be larger than 2*PI!!!" << endl;
Reset();
return false;
}
else else
{ {
CC_closedAlpha=false; CC_closedAlpha=false;
} }
if (discLines[0][0]<0) if (discLines[0][0]<0)
{cerr << "Operator_Cylinder::SetGeometryCSX: r<0 not allowed in Cylinder Coordinates!!!" << endl; Reset(); return false;} {
cerr << "Operator_Cylinder::SetGeometryCSX: r<0 not allowed in Cylinder Coordinates!!!" << endl;
Reset();
return false;
}
else if (discLines[0][0]==0.0) else if (discLines[0][0]==0.0)
{ {
cout << "Operator_Cylinder::SetGeometryCSX: r=0 included..." << endl; cout << "Operator_Cylinder::SetGeometryCSX: r=0 included..." << endl;
@ -208,7 +216,8 @@ void Operator_Cylinder::ApplyElectricBC(bool* dirs)
if (dirs==NULL) return; if (dirs==NULL) return;
if (CC_closedAlpha) if (CC_closedAlpha)
{ {
dirs[2]=0;dirs[3]=0; //no PEC in alpha directions... dirs[2]=0;
dirs[3]=0; //no PEC in alpha directions...
} }
if (CC_R0_included) if (CC_R0_included)
{ {
@ -231,7 +240,8 @@ void Operator_Cylinder::ApplyMagneticBC(bool* dirs)
if (dirs==NULL) return; if (dirs==NULL) return;
if (CC_closedAlpha) if (CC_closedAlpha)
{ {
dirs[2]=0;dirs[3]=0; //no PMC in alpha directions... dirs[2]=0;
dirs[3]=0; //no PMC in alpha directions...
} }
if (CC_R0_included) if (CC_R0_included)
{ {

View File

@ -68,11 +68,15 @@ void Operator_Multithread::Reset()
m_thread_group.join_all(); m_thread_group.join_all();
delete m_CalcEC_Start;m_CalcEC_Start=NULL; delete m_CalcEC_Start;
delete m_CalcEC_Stop;m_CalcEC_Stop=NULL; m_CalcEC_Start=NULL;
delete m_CalcEC_Stop;
m_CalcEC_Stop=NULL;
delete m_CalcPEC_Start;m_CalcPEC_Start=NULL; delete m_CalcPEC_Start;
delete m_CalcPEC_Stop;m_CalcPEC_Stop=NULL; m_CalcPEC_Start=NULL;
delete m_CalcPEC_Stop;
m_CalcPEC_Stop=NULL;
} }
void Operator_Multithread::CalcStartStopLines(unsigned int &numThreads, vector<unsigned int> &start, vector<unsigned int> &stop) const void Operator_Multithread::CalcStartStopLines(unsigned int &numThreads, vector<unsigned int> &start, vector<unsigned int> &stop) const
@ -106,11 +110,15 @@ int Operator_Multithread::CalcECOperator( DebugFlags debugFlags )
cout << "Multithreaded operator using " << m_numThreads << " threads." << std::endl; cout << "Multithreaded operator using " << m_numThreads << " threads." << std::endl;
m_thread_group.join_all(); m_thread_group.join_all();
delete m_CalcEC_Start;m_CalcEC_Start = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller delete m_CalcEC_Start;
delete m_CalcEC_Stop;m_CalcEC_Stop = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller m_CalcEC_Start = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller
delete m_CalcEC_Stop;
m_CalcEC_Stop = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller
delete m_CalcPEC_Start;m_CalcPEC_Start = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller delete m_CalcPEC_Start;
delete m_CalcPEC_Stop;m_CalcPEC_Stop = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller m_CalcPEC_Start = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller
delete m_CalcPEC_Stop;
m_CalcPEC_Stop = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller
for (unsigned int n=0; n<m_numThreads; n++) for (unsigned int n=0; n<m_numThreads; n++)
{ {
@ -123,7 +131,11 @@ int Operator_Multithread::CalcECOperator( DebugFlags debugFlags )
bool Operator_Multithread::Calc_EC() bool Operator_Multithread::Calc_EC()
{ {
if (CSX==NULL) {cerr << "CartOperator::Calc_EC: CSX not given or invalid!!!" << endl; return false;} if (CSX==NULL)
{
cerr << "CartOperator::Calc_EC: CSX not given or invalid!!!" << endl;
return false;
}
MainOp->SetPos(0,0,0); MainOp->SetPos(0,0,0);
@ -136,7 +148,9 @@ bool Operator_Multithread::Calc_EC()
bool Operator_Multithread::CalcPEC() bool Operator_Multithread::CalcPEC()
{ {
m_Nr_PEC[0]=0; m_Nr_PEC[1]=0; m_Nr_PEC[2]=0; m_Nr_PEC[0]=0;
m_Nr_PEC[1]=0;
m_Nr_PEC[2]=0;
m_Nr_PEC_thread = new unsigned int[m_numThreads][3]; m_Nr_PEC_thread = new unsigned int[m_numThreads][3];

View File

@ -77,9 +77,12 @@ openEMS::~openEMS()
void openEMS::Reset() void openEMS::Reset()
{ {
if (PA) PA->DeleteAll(); if (PA) PA->DeleteAll();
delete PA; PA=0; delete PA;
delete FDTD_Eng; FDTD_Eng=0; PA=0;
delete FDTD_Op; FDTD_Op=0; delete FDTD_Eng;
FDTD_Eng=0;
delete FDTD_Op;
FDTD_Op=0;
} }
//! \brief processes a command line argument //! \brief processes a command line argument
@ -412,7 +415,8 @@ int openEMS::SetupFDTD(const char* file)
cout << "Creation time for operator: " << CalcDiffTime(OpDoneTime,startTime) << " s" << endl; cout << "Creation time for operator: " << CalcDiffTime(OpDoneTime,startTime) << " s" << endl;
if (m_no_simulation) { if (m_no_simulation)
{
// simulation was disabled (to generate debug output only) // simulation was disabled (to generate debug output only)
return 1; return 1;
} }
@ -438,8 +442,12 @@ int openEMS::SetupFDTD(const char* file)
bool acc; bool acc;
double bnd[6] = {0,0,0,0,0,0}; double bnd[6] = {0,0,0,0,0,0};
acc = prim->GetBoundBox(bnd,true); acc = prim->GetBoundBox(bnd,true);
start[0]= bnd[0];start[1]=bnd[2];start[2]=bnd[4]; start[0]= bnd[0];
stop[0] = bnd[1];stop[1] =bnd[3];stop[2] =bnd[5]; start[1]=bnd[2];
start[2]=bnd[4];
stop[0] = bnd[1];
stop[1] =bnd[3];
stop[2] =bnd[5];
CSPropProbeBox* pb = Probes.at(i)->ToProbeBox(); CSPropProbeBox* pb = Probes.at(i)->ToProbeBox();
Processing* proc = NULL; Processing* proc = NULL;
if (pb) if (pb)
@ -505,8 +513,12 @@ int openEMS::SetupFDTD(const char* file)
bool acc; bool acc;
double bnd[6] = {0,0,0,0,0,0}; double bnd[6] = {0,0,0,0,0,0};
acc = prim->GetBoundBox(bnd,true); acc = prim->GetBoundBox(bnd,true);
start[0]= bnd[0];start[1]=bnd[2];start[2]=bnd[4]; start[0]= bnd[0];
stop[0] = bnd[1];stop[1] =bnd[3];stop[2] =bnd[5]; start[1]=bnd[2];
start[2]=bnd[4];
stop[0] = bnd[1];
stop[1] =bnd[3];
stop[2] =bnd[5];
CSPropDumpBox* db = DumpProps.at(i)->ToDumpBox(); CSPropDumpBox* db = DumpProps.at(i)->ToDumpBox();
if (db) if (db)
{ {

View File

@ -20,7 +20,12 @@
AdrOp::AdrOp(unsigned int muiImax, unsigned int muiJmax, unsigned int muiKmax, unsigned int muiLmax) AdrOp::AdrOp(unsigned int muiImax, unsigned int muiJmax, unsigned int muiKmax, unsigned int muiLmax)
{ {
//error-handling... //error-handling...
error = new ErrorMsg(9); if (error==NULL) { fprintf(stderr,"Memory allocation failed!! exiting..."); exit(1); } error = new ErrorMsg(9);
if (error==NULL)
{
fprintf(stderr,"Memory allocation failed!! exiting...");
exit(1);
}
error->SetMsg(1,"Adress Operator: Memory allocation failed!! exiting..."); error->SetMsg(1,"Adress Operator: Memory allocation failed!! exiting...");
error->SetMsg(2,"Adress Operator: Invalid Adress requested!! exiting..."); error->SetMsg(2,"Adress Operator: Invalid Adress requested!! exiting...");
error->SetMsg(3,"Adress Operator: Invalid Position set!! exiting..."); error->SetMsg(3,"Adress Operator: Invalid Position set!! exiting...");
@ -58,7 +63,10 @@ AdrOp::AdrOp(unsigned int muiImax, unsigned int muiJmax, unsigned int muiKmax, u
reflect=false; reflect=false;
uiTypeOffset=0; uiTypeOffset=0;
clCellAdr=NULL; clCellAdr=NULL;
dGrid[0]=NULL;dGrid[1]=NULL;dGrid[2]=NULL;dGrid[3]=NULL; dGrid[0]=NULL;
dGrid[1]=NULL;
dGrid[2]=NULL;
dGrid[3]=NULL;
dDeltaUnit=1; dDeltaUnit=1;
bDebug=false; bDebug=false;
} }
@ -100,8 +108,10 @@ AdrOp::AdrOp(AdrOp* origOP)
AdrOp::~AdrOp() AdrOp::~AdrOp()
{ {
// cerr << "\n------Adress Operator deconstructed-----\n" << endl; // cerr << "\n------Adress Operator deconstructed-----\n" << endl;
delete error; error=NULL; delete error;
delete clCellAdr; clCellAdr=NULL; error=NULL;
delete clCellAdr;
clCellAdr=NULL;
} }
unsigned int AdrOp::SetPos(unsigned int muiIpos, unsigned int muiJpos, unsigned int muiKpos, unsigned int muiLpos) unsigned int AdrOp::SetPos(unsigned int muiIpos, unsigned int muiJpos, unsigned int muiKpos, unsigned int muiLpos)
@ -259,9 +269,21 @@ double AdrOp::GetNodeVolume(unsigned int uiNode)
unsigned int uiPos[4]={GetPosFromNode(0,uiNode),GetPosFromNode(1,uiNode),GetPosFromNode(2,uiNode),GetPosFromNode(3,uiNode)}; unsigned int uiPos[4]={GetPosFromNode(0,uiNode),GetPosFromNode(1,uiNode),GetPosFromNode(2,uiNode),GetPosFromNode(3,uiNode)};
for (unsigned int n=0; n<uiDimension; n++) for (unsigned int n=0; n<uiDimension; n++)
{ {
if ((uiPos[n]>0) && (uiPos[n]<uiMax[n]-1)) { dVol*=0.5*dDeltaUnit*(dGrid[n][uiPos[n]+1]-dGrid[n][uiPos[n]-1]); ADRESSEXPENSE(4,0,1,3,0,4) } if ((uiPos[n]>0) && (uiPos[n]<uiMax[n]-1))
else if ((uiPos[n]==0) && (uiPos[n]<uiMax[n]-1)) { dVol*=dDeltaUnit*(dGrid[n][uiPos[n]+1]-dGrid[n][uiPos[n]]); ADRESSEXPENSE(3,0,1,2,0,4) } {
else if ((uiPos[n]>0) && (uiPos[n]==uiMax[n]-1)) { dVol*=dDeltaUnit*(dGrid[n][uiPos[n]]-dGrid[n][uiPos[n]-1]); ADRESSEXPENSE(3,0,1,2,0,4) } dVol*=0.5*dDeltaUnit*(dGrid[n][uiPos[n]+1]-dGrid[n][uiPos[n]-1]);
ADRESSEXPENSE(4,0,1,3,0,4)
}
else if ((uiPos[n]==0) && (uiPos[n]<uiMax[n]-1))
{
dVol*=dDeltaUnit*(dGrid[n][uiPos[n]+1]-dGrid[n][uiPos[n]]);
ADRESSEXPENSE(3,0,1,2,0,4)
}
else if ((uiPos[n]>0) && (uiPos[n]==uiMax[n]-1))
{
dVol*=dDeltaUnit*(dGrid[n][uiPos[n]]-dGrid[n][uiPos[n]-1]);
ADRESSEXPENSE(3,0,1,2,0,4)
}
} }
return dVol; return dVol;
} }
@ -430,7 +452,8 @@ AdrOp* AdrOp::AddCellAdrOp()
AdrOp* AdrOp::DeleteCellAdrOp() AdrOp* AdrOp::DeleteCellAdrOp()
{ {
delete clCellAdr; clCellAdr=NULL; delete clCellAdr;
clCellAdr=NULL;
return NULL; return NULL;
} }
@ -517,7 +540,12 @@ unsigned int deltaAdrOp::GetAdr(int pos)
if (uiMax==1) return 0; if (uiMax==1) return 0;
if (pos<0) pos=pos*-1; if (pos<0) pos=pos*-1;
else if (pos>(int)uiMax-1) pos=2*(uiMax-1)-pos+1; else if (pos>(int)uiMax-1) pos=2*(uiMax-1)-pos+1;
if ((pos<0) || (pos>(int)uiMax-1)) {fprintf(stderr," Error exiting... "); getchar(); exit(-1);} if ((pos<0) || (pos>(int)uiMax-1))
{
fprintf(stderr," Error exiting... ");
getchar();
exit(-1);
}
return pos; return pos;
} }

View File

@ -34,7 +34,8 @@
using namespace std; using namespace std;
class AdrOp{ class AdrOp
{
public: public:
///Constructor, define dimension/size here ///Constructor, define dimension/size here
AdrOp(unsigned int muiImax, unsigned int muiYmax, unsigned int muiKmax=0, unsigned int muiLmax=0); AdrOp(unsigned int muiImax, unsigned int muiYmax, unsigned int muiKmax=0, unsigned int muiLmax=0);

View File

@ -23,20 +23,35 @@
ErrorMsg::ErrorMsg(unsigned int NoMessage) ErrorMsg::ErrorMsg(unsigned int NoMessage)
{ {
NoMsg=NoMessage; NoMsg=NoMessage;
if (NoMsg>0) Msg = new char*[NoMsg]; if (Msg==NULL) { fprintf(stderr,"Memory allocation failed!! exiting..."); exit(1); } if (NoMsg>0) Msg = new char*[NoMsg];
if (Msg==NULL)
{
fprintf(stderr,"Memory allocation failed!! exiting...");
exit(1);
}
for (unsigned int i=0; i<NoMsg; i++) Msg[i]=NULL; for (unsigned int i=0; i<NoMsg; i++) Msg[i]=NULL;
} }
ErrorMsg::~ErrorMsg() ErrorMsg::~ErrorMsg()
{ {
for (unsigned int i=0;i<NoMsg;i++) {delete[] Msg[i]; Msg[i]=NULL;}; for (unsigned int i=0; i<NoMsg; i++)
delete[] Msg; Msg=NULL; {
delete[] Msg[i];
Msg[i]=NULL;
};
delete[] Msg;
Msg=NULL;
} }
void ErrorMsg::SetMsg(unsigned int nr, const char *Message) void ErrorMsg::SetMsg(unsigned int nr, const char *Message)
{ {
if ((nr<1) || (nr>NoMsg) || (Message==NULL)) ownError(); if ((nr<1) || (nr>NoMsg) || (Message==NULL)) ownError();
Msg[nr-1] = new char[strlen(Message)+1]; if (Msg[nr-1]==NULL) { fprintf(stderr,"Memory allocation failed!! exiting..."); exit(1); } Msg[nr-1] = new char[strlen(Message)+1];
if (Msg[nr-1]==NULL)
{
fprintf(stderr,"Memory allocation failed!! exiting...");
exit(1);
}
Msg[nr-1]=strcpy(Msg[nr-1],Message); Msg[nr-1]=strcpy(Msg[nr-1],Message);
} }

View File

@ -104,7 +104,11 @@ ExpenseLog::ExpenseLog(void)
ExpenseLog::~ExpenseLog(void) ExpenseLog::~ExpenseLog(void)
{ {
for (size_t i=0;i<vModules.size();++i) {delete vModules.at(i); vModules.at(i)=NULL;} for (size_t i=0; i<vModules.size(); ++i)
{
delete vModules.at(i);
vModules.at(i)=NULL;
}
vModules.clear(); vModules.clear();
} }

View File

@ -36,7 +36,8 @@
#endif #endif
template <typename T> class aligned_allocator { template <typename T> class aligned_allocator
{
public: public:
// The following will be the same for virtually all allocators. // The following will be the same for virtually all allocators.
typedef T * pointer; typedef T * pointer;
@ -47,30 +48,36 @@ public:
typedef size_t size_type; typedef size_t size_type;
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
T * address(T& r) const { T * address(T& r) const
{
return &r; return &r;
} }
const T * address(const T& s) const { const T * address(const T& s) const
{
return &s; return &s;
} }
size_t max_size() const { size_t max_size() const
{
// The following has been carefully written to be independent of // The following has been carefully written to be independent of
// the definition of size_t and to avoid signed/unsigned warnings. // the definition of size_t and to avoid signed/unsigned warnings.
return (static_cast<size_t>(0) - static_cast<size_t>(1)) / sizeof(T); return (static_cast<size_t>(0) - static_cast<size_t>(1)) / sizeof(T);
} }
// The following must be the same for all allocators. // The following must be the same for all allocators.
template <typename U> struct rebind { template <typename U> struct rebind
{
typedef aligned_allocator<U> other; typedef aligned_allocator<U> other;
}; };
bool operator!=(const aligned_allocator& other) const { bool operator!=(const aligned_allocator& other) const
{
return !(*this == other); return !(*this == other);
} }
void construct(T * const p, const T& t) const { void construct(T * const p, const T& t) const
{
void * const pv = static_cast<void *>(p); void * const pv = static_cast<void *>(p);
new (pv) T(t); new (pv) T(t);
} }
@ -80,7 +87,8 @@ public:
// Returns true if and only if storage allocated from *this // Returns true if and only if storage allocated from *this
// can be deallocated from other, and vice versa. // can be deallocated from other, and vice versa.
// Always returns true for stateless allocators. // Always returns true for stateless allocators.
bool operator==(const aligned_allocator& other) const { bool operator==(const aligned_allocator& other) const
{
return true; return true;
} }
@ -92,7 +100,8 @@ public:
~aligned_allocator() { } ~aligned_allocator() { }
// The following will be different for each allocator. // The following will be different for each allocator.
T * allocate(const size_t n) const { T * allocate(const size_t n) const
{
// std::cout << "Allocating " << n << (n == 1 ? " object" : "objects") << " of size " << sizeof(T) << "." << std::endl; // std::cout << "Allocating " << n << (n == 1 ? " object" : "objects") << " of size " << sizeof(T) << "." << std::endl;
// The return value of allocate(0) is unspecified. // The return value of allocate(0) is unspecified.
// aligned_allocator returns NULL in order to avoid depending // aligned_allocator returns NULL in order to avoid depending
@ -100,14 +109,16 @@ public:
// (the implementation can define malloc(0) to return NULL, // (the implementation can define malloc(0) to return NULL,
// in which case the bad_alloc check below would fire). // in which case the bad_alloc check below would fire).
// All allocators can return NULL in this case. // All allocators can return NULL in this case.
if (n == 0) { if (n == 0)
{
return NULL; return NULL;
} }
// All allocators should contain an integer overflow check. // All allocators should contain an integer overflow check.
// The Standardization Committee recommends that std::length_error // The Standardization Committee recommends that std::length_error
// be thrown in the case of integer overflow. // be thrown in the case of integer overflow.
if (n > max_size()) { if (n > max_size())
{
throw std::length_error("aligned_allocator<T>::allocate() - Integer overflow."); throw std::length_error("aligned_allocator<T>::allocate() - Integer overflow.");
} }
@ -119,7 +130,8 @@ public:
return static_cast<T *>(pv); return static_cast<T *>(pv);
} }
void deallocate(T * const p, const size_t n) const { void deallocate(T * const p, const size_t n) const
{
// std::cout << "Deallocating " << n << (n == 1 ? " object" : "objects") << " of size " << sizeof(T) << "." << std::endl; // std::cout << "Deallocating " << n << (n == 1 ? " object" : "objects") << " of size " << sizeof(T) << "." << std::endl;
// aligned_allocator wraps free(). // aligned_allocator wraps free().
UNUSED(n); UNUSED(n);
@ -127,7 +139,8 @@ public:
} }
// The following will be the same for all allocators that ignore hints. // The following will be the same for all allocators that ignore hints.
template <typename U> T * allocate(const size_t n, const U * /* const hint */) const { template <typename U> T * allocate(const size_t n, const U * /* const hint */) const
{
return allocate(n); return allocate(n);
} }
@ -150,7 +163,8 @@ private:
#endif #endif
// The definition of destroy() must be the same for all allocators. // The definition of destroy() must be the same for all allocators.
template <typename T> void aligned_allocator<T>::destroy(T * const p) const { template <typename T> void aligned_allocator<T>::destroy(T * const p) const
{
p->~T(); p->~T();
} }

View File

@ -68,7 +68,8 @@ void Delete_N_3DArray_v4sf(f4vector**** array, const unsigned int* numLines)
f4vector* Create1DArray_v4sf(const unsigned int numLines) f4vector* Create1DArray_v4sf(const unsigned int numLines)
{ {
f4vector* array=NULL; f4vector* array=NULL;
if (MEMALIGN( (void**)&array, 16, sizeof(typeof(f4vector))*numLines )) { if (MEMALIGN( (void**)&array, 16, sizeof(typeof(f4vector))*numLines ))
{
cerr << "cannot allocate aligned memory" << endl; cerr << "cannot allocate aligned memory" << endl;
exit(3); exit(3);
} }
@ -82,21 +83,24 @@ f4vector*** Create3DArray_v4sf(const unsigned int* numLines)
f4vector*** array=NULL; f4vector*** array=NULL;
unsigned int pos[3]; unsigned int pos[3];
if (MEMALIGN( (void**)&array, 16, sizeof(typeof(f4vector**))*numLines[0] )) { if (MEMALIGN( (void**)&array, 16, sizeof(typeof(f4vector**))*numLines[0] ))
{
cerr << "cannot allocate aligned memory" << endl; cerr << "cannot allocate aligned memory" << endl;
exit(3); exit(3);
} }
//array = new f4vector**[numLines[0]]; //array = new f4vector**[numLines[0]];
for (pos[0]=0; pos[0]<numLines[0]; ++pos[0]) for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
{ {
if (MEMALIGN( (void**)&array[pos[0]], 16, sizeof(typeof(f4vector*))*numLines[1] )) { if (MEMALIGN( (void**)&array[pos[0]], 16, sizeof(typeof(f4vector*))*numLines[1] ))
{
cerr << "cannot allocate aligned memory" << endl; cerr << "cannot allocate aligned memory" << endl;
exit(3); exit(3);
} }
//array[pos[0]] = new f4vector*[numLines[1]]; //array[pos[0]] = new f4vector*[numLines[1]];
for (pos[1]=0; pos[1]<numLines[1]; ++pos[1]) for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
{ {
if (MEMALIGN( (void**)&array[pos[0]][pos[1]], 16, sizeof(typeof(f4vector))*numZ )) { if (MEMALIGN( (void**)&array[pos[0]][pos[1]], 16, sizeof(typeof(f4vector))*numZ ))
{
cerr << "cannot allocate aligned memory" << endl; cerr << "cannot allocate aligned memory" << endl;
exit(3); exit(3);
} }
@ -115,7 +119,8 @@ f4vector*** Create3DArray_v4sf(const unsigned int* numLines)
f4vector**** Create_N_3DArray_v4sf(const unsigned int* numLines) f4vector**** Create_N_3DArray_v4sf(const unsigned int* numLines)
{ {
f4vector**** array=NULL; f4vector**** array=NULL;
if (MEMALIGN( (void**)&array, 16, sizeof(typeof(f4vector***))*3 )) { if (MEMALIGN( (void**)&array, 16, sizeof(typeof(f4vector***))*3 ))
{
cerr << "cannot allocate aligned memory" << endl; cerr << "cannot allocate aligned memory" << endl;
exit(3); exit(3);
} }