Added logic to only run required field updates for 2D domains (slice of 3D). This avoids updating unused field components and should make the 2D updates faster.

这个提交包含在:
Craig Warren
2015-11-02 18:44:40 +00:00
父节点 2001925170
当前提交 d1c8b58033
共有 2 个文件被更改,包括 173 次插入218 次删除

查看文件

@@ -36,6 +36,9 @@ cpdef update_ex(int nx, int ny, int nz, int nthreads, floattype_t[:, :] updateco
cdef int i, j, k, listIndex
if ny == 1 or nz == 1:
pass
else:
for i in prange(0, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(1, nz):
@@ -56,6 +59,9 @@ cpdef update_ex_dispersive_multipole_A(int nx, int ny, int nz, int nthreads, int
cdef int i, j, k, listIndex, p
cdef float phi = 0.0
if ny == 1 or nz == 1:
pass
else:
for i in prange(0, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(1, nz):
@@ -78,6 +84,9 @@ cpdef update_ex_dispersive_multipole_B(int nx, int ny, int nz, int nthreads, int
cdef int i, j, k, listIndex, p
if ny == 1 or nz == 1:
pass
else:
for i in prange(0, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(1, nz):
@@ -98,6 +107,9 @@ cpdef update_ex_dispersive_1pole_A(int nx, int ny, int nz, int nthreads, floatty
cdef int i, j, k, listIndex
cdef float phi = 0.0
if ny == 1 or nz == 1:
pass
else:
for i in prange(0, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(1, nz):
@@ -118,6 +130,9 @@ cpdef update_ex_dispersive_1pole_B(int nx, int ny, int nz, int nthreads, complex
cdef int i, j, k, listIndex
if ny == 1 or nz == 1:
pass
else:
for i in prange(0, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(1, nz):
@@ -139,6 +154,9 @@ cpdef update_ey(int nx, int ny, int nz, int nthreads, floattype_t[:, :] updateco
cdef int i, j, k, listIndex
if nx == 1 or nz == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(0, ny):
for k in range(1, nz):
@@ -159,6 +177,9 @@ cpdef update_ey_dispersive_multipole_A(int nx, int ny, int nz, int nthreads, int
cdef int i, j, k, listIndex, p
cdef float phi = 0.0
if nx == 1 or nz == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(0, ny):
for k in range(1, nz):
@@ -182,6 +203,9 @@ cpdef update_ey_dispersive_multipole_B(int nx, int ny, int nz, int nthreads, int
cdef int i, j, k, listIndex, p
if nx == 1 or nz == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(0, ny):
for k in range(1, nz):
@@ -202,6 +226,9 @@ cpdef update_ey_dispersive_1pole_A(int nx, int ny, int nz, int nthreads, floatty
cdef int i, j, k, listIndex
cdef float phi = 0.0
if nx == 1 or nz == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(0, ny):
for k in range(1, nz):
@@ -222,6 +249,9 @@ cpdef update_ey_dispersive_1pole_B(int nx, int ny, int nz, int nthreads, complex
cdef int i, j, k, listIndex
if nx == 1 or nz == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(0, ny):
for k in range(1, nz):
@@ -243,6 +273,9 @@ cpdef update_ez(int nx, int ny, int nz, int nthreads, floattype_t[:, :] updateco
cdef int i, j, k, listIndex
if nx == 1 or ny == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(0, nz):
@@ -263,6 +296,9 @@ cpdef update_ez_dispersive_multipole_A(int nx, int ny, int nz, int nthreads, int
cdef int i, j, k, listIndex, p
cdef float phi = 0.0
if nx == 1 or ny == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(0, nz):
@@ -286,6 +322,9 @@ cpdef update_ez_dispersive_multipole_B(int nx, int ny, int nz, int nthreads, int
cdef int i, j, k, listIndex, p
if nx == 1 or ny == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(0, nz):
@@ -306,6 +345,9 @@ cpdef update_ez_dispersive_1pole_A(int nx, int ny, int nz, int nthreads, floatty
cdef int i, j, k, listIndex
cdef float phi = 0.0
if nx == 1 or ny == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(0, nz):
@@ -326,6 +368,9 @@ cpdef update_ez_dispersive_1pole_B(int nx, int ny, int nz, int nthreads, complex
cdef int i, j, k, listIndex
if nx == 1 or ny == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(0, nz):
@@ -347,6 +392,9 @@ cpdef update_hx(int nx, int ny, int nz, int nthreads, floattype_t[:, :] updateco
cdef int i, j, k, listIndex
if nx == 1:
pass
else:
for i in prange(1, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(0, ny):
for k in range(0, nz):
@@ -368,6 +416,9 @@ cpdef update_hy(int nx, int ny, int nz, int nthreads, floattype_t[:, :] updateco
cdef int i, j, k, listIndex
if ny == 1:
pass
else:
for i in prange(0, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(1, ny):
for k in range(0, nz):
@@ -389,6 +440,9 @@ cpdef update_hz(int nx, int ny, int nz, int nthreads, floattype_t[:, :] updateco
cdef int i, j, k, listIndex
if nz == 1:
pass
else:
for i in prange(0, nx, nogil=True, schedule='static', chunksize=1, num_threads=nthreads):
for j in range(0, ny):
for k in range(1, nz):

查看文件

@@ -1,99 +0,0 @@
# Copyright (C) 2015: The University of Edinburgh
# Authors: Craig Warren and Antonis Giannopoulos
#
# This file is part of gprMax.
#
# gprMax is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# gprMax is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup, Extension
#import py2exe, os, sys, re
import os, sys, re
from cx_Freeze import setup, Executable
#sys.argv.append('py2exe')
# Main package name
packagename = 'gprMax'
# Read version number from gprMax/gprMax.py
version = re.search('^__version__\s*=\s*\'(.*)\'',
open(os.path.join(packagename, 'gprMax.py')).read(),
re.M).group(1)
includes = []
include_files = []
excludes = []
packages = ['gprMax']
options = {
'build_exe': {
'path': [],
'includes': includes,
'include_files': include_files,
'excludes': excludes,
'packages': packages,
'optimize': 2,
}
}
executables = [
Executable('gprMax/gprMax.py'),
]
setup(name=packagename,
version=version,
author='Craig Warren and Antonis Giannopoulos',
url='http://www.gprmax.com',
description='Electromagnetic Modelling Software based on the Finite-Difference Time-Domain (FDTD) method',
license='GPLv3+',
classifiers=[
'Environment :: Console',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows :: Windows 7',
'Operating System :: POSIX :: Linux',
'Programming Language :: Cython',
'Programming Language :: Python :: 3 :: Only'
],
options=options,
executables=executables
)
#setup(name=packagename,
# version=version,
# author='Craig Warren and Antonis Giannopoulos',
# url='http://www.gprmax.com',
# description='Electromagnetic Modelling Software based on the Finite-Difference Time-Domain (FDTD) method',
# license='GPLv3+',
# classifiers=[
# 'Environment :: Console',
# 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
# 'Operating System :: MacOS :: MacOS X',
# 'Operating System :: Microsoft :: Windows :: Windows 7',
# 'Operating System :: POSIX :: Linux',
# 'Programming Language :: Cython',
# 'Programming Language :: Python :: 3 :: Only'
# ],
# console=[{'script':'gprMax\gprMax.py'}],
# options = {"py2exe": {"compressed": False,
# "optimize": 2,
# "includes": includes,
# "excludes": excludes,
# "packages": packages,
# "dll_excludes": dll_excludes,
# "bundle_files": 1,
# }
# },
# zipfile = None,
# )