你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Sort non-compound materials by numID
这个提交包含在:
@@ -57,21 +57,54 @@ class Material:
|
||||
f"'==' not supported between instances of 'Material' and '{type(value)}'"
|
||||
)
|
||||
|
||||
def __lt__(self, value: object) -> bool:
|
||||
if isinstance(value, Material):
|
||||
return self.ID < value.ID
|
||||
else:
|
||||
def __lt__(self, value: "Material") -> bool:
|
||||
"""Less than comparator for two Materials.
|
||||
|
||||
Only non-compound materials (i.e. default or user added
|
||||
materials) are guaranteed to have the same numID for the same
|
||||
material across MPI ranks. Therefore compound materials are
|
||||
sorted by ID and non-compound materials are always less than
|
||||
compound materials.
|
||||
"""
|
||||
if not isinstance(value, Material):
|
||||
raise TypeError(
|
||||
f"'<' not supported between instances of 'Material' and '{type(value)}'"
|
||||
)
|
||||
|
||||
def __gt__(self, value: object) -> bool:
|
||||
if isinstance(value, Material):
|
||||
return self.ID > value.ID
|
||||
elif self.is_compound_material() and value.is_compound_material():
|
||||
return self.ID < value.ID
|
||||
else:
|
||||
return value.is_compound_material() or self.numID < value.numID
|
||||
|
||||
def __gt__(self, value: "Material") -> bool:
|
||||
"""Greater than comparator for two Materials.
|
||||
|
||||
Only non-compound materials (i.e. default or user added
|
||||
materials) are guaranteed to have the same numID for the same
|
||||
material across MPI ranks. Therefore compound materials are
|
||||
sorted by ID and are always greater than non-compound materials.
|
||||
"""
|
||||
if not isinstance(value, Material):
|
||||
raise TypeError(
|
||||
f"'>' not supported between instances of 'Material' and '{type(value)}'"
|
||||
)
|
||||
elif self.is_compound_material() and value.is_compound_material():
|
||||
return self.ID > value.ID
|
||||
else:
|
||||
return self.is_compound_material() or self.numID > value.numID
|
||||
|
||||
def is_compound_material(self) -> bool:
|
||||
"""Check if a material is a compound material.
|
||||
|
||||
The ID of a compound material comprises of the component
|
||||
material IDs joined by a '+' symbol. Therefore we check for a
|
||||
compound material by looking for a '+' symbol in the material
|
||||
ID.
|
||||
|
||||
Returns:
|
||||
is_compound_material: True if material is a compound
|
||||
material. False otherwise.
|
||||
"""
|
||||
return self.ID.count("+") > 0
|
||||
|
||||
@staticmethod
|
||||
def create_compound_id(*materials: "Material") -> str:
|
||||
|
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2b2fbdb39eb6ad15c35877be207a7a0d3f19cc22faad223d058988f788842f7b
|
||||
oid sha256:a23ccc9ed81685385ff300c0c00e70329945db364dd7eb9607a511870469c720
|
||||
size 75462640
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#material: 1 0 1 0 free_space
|
||||
#material: 4.9 0 1 0 myWater
|
||||
#material: 3 0 2 0 boxMaterial
|
||||
#material: 2 0 1.5 0 boxMaterial+boxMaterial+free_space+free_space
|
||||
#material: 1.5 0 1.25 0 boxMaterial+free_space+free_space+free_space
|
||||
#material: 1 0 1 0 free_space
|
||||
#material: 1.975 0 1 0 free_space+free_space+free_space+myWater
|
||||
#material: 2.95 0 1 0 free_space+free_space+myWater+myWater
|
||||
#material: 3.925 0 1 0 free_space+myWater+myWater+myWater
|
||||
#material: 4.9 0 1 0 myWater
|
||||
|
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6304565819cdb7c5b2af86d57bb25e3f22c92b9aae431934e2c2eca029928d59
|
||||
oid sha256:4b8f8c4979f4c82eb4be8a9a63cfaf19408b9f493d1bf3082a8226e97542ae4a
|
||||
size 4980400
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#material: 1 0 1 0 free_space
|
||||
#material: 4.9 0 1 0 myWater
|
||||
#material: 3 0 2 0 boxMaterial
|
||||
#material: 2 0 1.5 0 boxMaterial+boxMaterial+free_space+free_space
|
||||
#material: 1.5 0 1.25 0 boxMaterial+free_space+free_space+free_space
|
||||
#material: 1 0 1 0 free_space
|
||||
#material: 1.975 0 1 0 free_space+free_space+free_space+myWater
|
||||
#material: 2.95 0 1 0 free_space+free_space+myWater+myWater
|
||||
#material: 3.925 0 1 0 free_space+myWater+myWater+myWater
|
||||
#material: 4.9 0 1 0 myWater
|
||||
|
在新工单中引用
屏蔽一个用户