fix in cylindrical multigrids: check for valid number of subgrids

pull/1/head
Thorsten Liebig 2011-03-14 10:37:12 +01:00
parent 0735f97eac
commit 92d60b3204
3 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,11 @@ Operator_CylinderMultiGrid::~Operator_CylinderMultiGrid()
Operator_CylinderMultiGrid* Operator_CylinderMultiGrid::New(vector<double> Split_Radii, unsigned int numThreads)
{
if ((Split_Radii.size()==0) || (Split_Radii.size()>CYLIDINDERMULTIGRID_LIMIT))
{
cerr << "Operator_CylinderMultiGrid::New: Warning: Number of multigrids invalid! Split-Number: " << Split_Radii.size() << endl;
return NULL;
}
cout << "Create cylindrical multi grid FDTD operator " << endl;
Operator_CylinderMultiGrid* op = new Operator_CylinderMultiGrid(Split_Radii);
op->setNumThreads(numThreads);

View File

@ -18,6 +18,8 @@
#ifndef OPERATOR_CYLINDERMULTIGRID_H
#define OPERATOR_CYLINDERMULTIGRID_H
#define CYLIDINDERMULTIGRID_LIMIT 20
#include "operator_cylinder.h"
//! This is a cylindrical FDTD operator using a simple multi-grid approach.

View File

@ -457,6 +457,8 @@ bool openEMS::SetupOperator(TiXmlElement* FDTD_Opts)
{
string rad(radii);
FDTD_Op = Operator_CylinderMultiGrid::New(SplitString2Double(rad,','),m_engine_numThreads);
if (FDTD_Op==NULL)
FDTD_Op = Operator_Cylinder::New(m_engine_numThreads);
}
else
FDTD_Op = Operator_Cylinder::New(m_engine_numThreads);