Added averaging check for API to convert y/n to True/False

这个提交包含在:
craig-warren
2024-05-16 12:59:36 +01:00
父节点 18eed3c386
当前提交 23c88cee25
共有 7 个文件被更改,包括 17 次插入3 次删除

查看文件

@@ -23,6 +23,7 @@ import numpy as np
import gprMax.config as config import gprMax.config as config
from ..cython.geometry_primitives import build_box from ..cython.geometry_primitives import build_box
from ..hash_cmds_geometry import check_averaging
from ..materials import Material from ..materials import Material
from .cmds_geometry import UserObjectGeometry, rotate_2point_object from .cmds_geometry import UserObjectGeometry, rotate_2point_object
@@ -87,6 +88,7 @@ class Box(UserObjectGeometry):
try: try:
# Try user-specified averaging # Try user-specified averaging
averagebox = self.kwargs["averaging"] averagebox = self.kwargs["averaging"]
averagebox = check_averaging(averagebox)
except KeyError: except KeyError:
# Otherwise go with the grid default # Otherwise go with the grid default
averagebox = grid.averagevolumeobjects averagebox = grid.averagevolumeobjects

查看文件

@@ -21,6 +21,7 @@ import logging
import numpy as np import numpy as np
from ..cython.geometry_primitives import build_cone from ..cython.geometry_primitives import build_cone
from ..hash_cmds_geometry import check_averaging
from ..materials import Material from ..materials import Material
from .cmds_geometry import UserObjectGeometry from .cmds_geometry import UserObjectGeometry
@@ -61,10 +62,11 @@ class Cone(UserObjectGeometry):
# Check averaging # Check averaging
try: try:
# Try user-specified averaging # Try user-specified averaging
averagecylinder = self.kwargs["averaging"] averagecone = self.kwargs["averaging"]
averagecone = check_averaging(averagecone)
except KeyError: except KeyError:
# Otherwise go with the grid default # Otherwise go with the grid default
averagecylinder = grid.averagevolumeobjects averagecone = grid.averagevolumeobjects
# Check materials have been specified # Check materials have been specified
# Isotropic case # Isotropic case
@@ -106,7 +108,7 @@ class Cone(UserObjectGeometry):
# Isotropic case # Isotropic case
if len(materials) == 1: if len(materials) == 1:
averaging = materials[0].averagable and averagecylinder averaging = materials[0].averagable and averagecone
numID = numIDx = numIDy = numIDz = materials[0].numID numID = numIDx = numIDy = numIDz = materials[0].numID
# Uniaxial anisotropic case # Uniaxial anisotropic case

查看文件

@@ -21,6 +21,7 @@ import logging
import numpy as np import numpy as np
from ..cython.geometry_primitives import build_cylinder from ..cython.geometry_primitives import build_cylinder
from ..hash_cmds_geometry import check_averaging
from ..materials import Material from ..materials import Material
from .cmds_geometry import UserObjectGeometry from .cmds_geometry import UserObjectGeometry
@@ -59,6 +60,7 @@ class Cylinder(UserObjectGeometry):
try: try:
# Try user-specified averaging # Try user-specified averaging
averagecylinder = self.kwargs["averaging"] averagecylinder = self.kwargs["averaging"]
averagecylinder = check_averaging(averagecylinder)
except KeyError: except KeyError:
# Otherwise go with the grid default # Otherwise go with the grid default
averagecylinder = grid.averagevolumeobjects averagecylinder = grid.averagevolumeobjects

查看文件

@@ -21,6 +21,7 @@ import logging
import numpy as np import numpy as np
from ..cython.geometry_primitives import build_cylindrical_sector from ..cython.geometry_primitives import build_cylindrical_sector
from ..hash_cmds_geometry import check_averaging
from ..materials import Material from ..materials import Material
from .cmds_geometry import UserObjectGeometry from .cmds_geometry import UserObjectGeometry
@@ -74,6 +75,7 @@ class CylindricalSector(UserObjectGeometry):
try: try:
# Try user-specified averaging # Try user-specified averaging
averagecylindricalsector = self.kwargs["averaging"] averagecylindricalsector = self.kwargs["averaging"]
averagecylindricalsector = check_averaging(averagecylindricalsector)
except KeyError: except KeyError:
# Otherwise go with the grid default # Otherwise go with the grid default
averagecylindricalsector = grid.averagevolumeobjects averagecylindricalsector = grid.averagevolumeobjects

查看文件

@@ -21,6 +21,7 @@ import logging
import numpy as np import numpy as np
from ..cython.geometry_primitives import build_ellipsoid from ..cython.geometry_primitives import build_ellipsoid
from ..hash_cmds_geometry import check_averaging
from ..materials import Material from ..materials import Material
from .cmds_geometry import UserObjectGeometry from .cmds_geometry import UserObjectGeometry
@@ -60,6 +61,7 @@ class Ellipsoid(UserObjectGeometry):
try: try:
# Try user-specified averaging # Try user-specified averaging
averageellipsoid = self.kwargs["averaging"] averageellipsoid = self.kwargs["averaging"]
averageellipsoid = check_averaging(averageellipsoid)
except KeyError: except KeyError:
# Otherwise go with the grid default # Otherwise go with the grid default
averageellipsoid = grid.averagevolumeobjects averageellipsoid = grid.averagevolumeobjects

查看文件

@@ -21,6 +21,7 @@ import logging
import numpy as np import numpy as np
from ..cython.geometry_primitives import build_sphere from ..cython.geometry_primitives import build_sphere
from ..hash_cmds_geometry import check_averaging
from ..materials import Material from ..materials import Material
from .cmds_geometry import UserObjectGeometry from .cmds_geometry import UserObjectGeometry
@@ -55,6 +56,7 @@ class Sphere(UserObjectGeometry):
try: try:
# Try user-specified averaging # Try user-specified averaging
averagesphere = self.kwargs["averaging"] averagesphere = self.kwargs["averaging"]
averagesphere = check_averaging(averagesphere)
except KeyError: except KeyError:
# Otherwise go with the grid default # Otherwise go with the grid default
averagesphere = grid.averagevolumeobjects averagesphere = grid.averagevolumeobjects

查看文件

@@ -21,6 +21,7 @@ import logging
import numpy as np import numpy as np
from ..cython.geometry_primitives import build_triangle from ..cython.geometry_primitives import build_triangle
from ..hash_cmds_geometry import check_averaging
from ..materials import Material from ..materials import Material
from .cmds_geometry import UserObjectGeometry, rotate_point from .cmds_geometry import UserObjectGeometry, rotate_point
@@ -80,6 +81,7 @@ class Triangle(UserObjectGeometry):
try: try:
# Try user-specified averaging # Try user-specified averaging
averagetriangularprism = self.kwargs["averaging"] averagetriangularprism = self.kwargs["averaging"]
averagetriangularprism = check_averaging(averagetriangularprism)
except KeyError: except KeyError:
# Otherwise go with the grid default # Otherwise go with the grid default
averagetriangularprism = grid.averagevolumeobjects averagetriangularprism = grid.averagevolumeobjects