fix in cylindrical multigrids: check for valid number of subgrids
parent
0735f97eac
commit
92d60b3204
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue