Throw exception if unknown grid type

这个提交包含在:
nmannall
2024-07-18 17:38:06 +01:00
父节点 960ced4761
当前提交 bec547f201

查看文件

@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with gprMax. If not, see <http://www.gnu.org/licenses/>. # along with gprMax. If not, see <http://www.gnu.org/licenses/>.
import logging
import gprMax.config as config import gprMax.config as config
from gprMax.grid.mpi_grid import MPIGrid from gprMax.grid.mpi_grid import MPIGrid
from gprMax.model import Model from gprMax.model import Model
@@ -31,6 +33,8 @@ from .updates.cuda_updates import CUDAUpdates
from .updates.opencl_updates import OpenCLUpdates from .updates.opencl_updates import OpenCLUpdates
from .updates.updates import Updates from .updates.updates import Updates
logger = logging.getLogger(__name__)
class Solver: class Solver:
"""Generic solver for Update objects""" """Generic solver for Update objects"""
@@ -120,6 +124,9 @@ def create_solver(model: Model) -> Solver:
updates = CUDAUpdates(grid) updates = CUDAUpdates(grid)
elif type(grid) is OpenCLGrid: elif type(grid) is OpenCLGrid:
updates = OpenCLUpdates(grid) updates = OpenCLUpdates(grid)
else:
logger.error("Cannot create Solver: Unknown grid type")
raise ValueError
solver = Solver(updates) solver = Solver(updates)