本文整理汇总了Python中PerceptMesh.get_parallel_size方法的典型用法代码示例。如果您正苦于以下问题:Python PerceptMesh.get_parallel_size方法的具体用法?Python PerceptMesh.get_parallel_size怎么用?Python PerceptMesh.get_parallel_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerceptMesh
的用法示例。
在下文中一共展示了PerceptMesh.get_parallel_size方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hex27_hex27_0
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_hex27_hex27_0(self):
fixture_setup()
scalarDimension = 0
eMesh = PerceptMesh()
p_size = eMesh.get_parallel_size()
gmesh_spec = "1x1x" + str(p_size) + "|bbox:0,0,0,1,1," + str(p_size)
eMesh.new_mesh(GMeshSpec(gmesh_spec))
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, HEX8_HEX27_1, proc_rank_field)
eMesh.commit()
eMesh.print_info()
eMesh.save_as("hex27_hex27_cube1x1x" + str(p_size) + "-orig.e")
breaker.setRemoveOldElements(True)
breaker.doBreak()
eMesh.save_as("hex27_hex27_cube1x1x" + str(p_size) + "_0.e")
em1 = PerceptMesh(3)
p_size = em1.get_parallel_size()
em1.open("hex27_hex27_cube1x1x" + str(p_size) + "_0.e")
proc_rank_field = em1.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(em1, HEX27_HEX27_8, proc_rank_field)
em1.commit()
breaker.setIgnoreSideSets(True)
breaker.setRemoveOldElements(True)
breaker.doBreak()
em1.save_as("hex27_hex27_cube1x1x" + str(p_size) + "_1.e")
示例2: test_wedge6_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_wedge6_1(self):
fixture_setup()
eMesh = PerceptMesh()
p_size = eMesh.get_parallel_size()
if p_size == 1:
wedgeFixture = WedgeFixture()
wedgeFixture.createMesh(MPI.COMM_WORLD, 4,3,2,0,1,0,1,0,1, "swept_wedge_0.e")
示例3: fixture_setup_0
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def fixture_setup_0(self):
eMesh = PerceptMesh()
p_size = eMesh.get_parallel_size()
gmesh_spec = "4x4x" + str((4*p_size)) + "|bbox:0,0,0,1,1,1"
eMesh.new_mesh(GMeshSpec(gmesh_spec))
eMesh.commit()
eMesh.save_as("./exodus_files/hex_fixture.e")
示例4: test_hex8_hex8_8_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_hex8_hex8_8_1(self):
fixture_setup()
eMesh = PerceptMesh()
p_size = eMesh.get_parallel_size()
gmesh_spec = "4x4x"+str(4*p_size)+"|bbox:0,0,0,1,1,1"
eMesh.new_mesh(GMeshSpec(gmesh_spec))
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, HEX8_HEX8_8, proc_rank_field)
eMesh.commit()
breaker.doBreak
示例5: test_hex20_hex20_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_hex20_hex20_1(self):
fixture_setup()
eMesh = PerceptMesh(3)
p_size = eMesh.get_parallel_size()
if p_size <= 3:
eMesh.open("hex20_hex20_cube1x1x"+str(p_size) + "_0.e")
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, HEX20_HEX20_8, proc_rank_field)
eMesh.commit()
breaker.setRemoveOldElements(True)
breaker.doBreak()
eMesh.save_as("hex20_hex20_cube1x1x" + str(p_size) + "_1.e")
示例6: test_wedge6_2
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_wedge6_2(self):
fixture_setup()
eMesh = PerceptMesh(3)
p_size = eMesh.get_parallel_size()
if p_size == 1:
wedgeFixture = WedgeFixture()
wedgeFixture.createMesh(MPI.COMM_WORLD, 4,3,2,0,1,0,1,0,1, "swept_wedge_0.e")
eMesh.open("swept_wedge_0.e")
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, WEDGE6_WEDGE6_8, proc_rank_field)
eMesh.commit()
breaker.doBreak()
eMesh.save_as("swept-wedge_1.e")
示例7: test_hex8_tet4_6_12_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_hex8_tet4_6_12_1(self):
fixture_setup()
eMesh = PerceptMesh(3)
p_size = eMesh.get_parallel_size()
gmesh_spec = "1x1x" + str(p_size) + "|bbox:0,0,0,1,1," + str(p_size)
eMesh.new_mesh(GMeshSpec(gmesh_spec))
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, HEX8_TET4_6_12, proc_rank_field)
eMesh.commit()
eMesh.print_info()
breaker.setRemoveOldElements(True)
breaker.doBreak()
eMesh.save_as("hex_tet_6_12_cube1x1x1.e")
示例8: fixture_setup_0
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def fixture_setup_0():
eMesh = PerceptMesh()
p_size = eMesh.get_parallel_size()
gmesh_spec = "4x4x"+str(4*p_size)+"|bbox:0,0,0,1,1,1"
eMesh.new_mesh(GMeshSpec(gmesh_spec))
eMesh.commit()
eMesh.save_as("hex_fixture.e")
eMesh = PerceptMesh()
eMesh.open("exodus_files/"+input_files_loc+"hex_fixture.e")
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, HEX8_TET4_24, proc_rank_field)
eMesh.commit()
breaker.doBreak()
eMesh.save_as("tet_fixture.e")
示例9: test_unit_perceptMesh_wedge6_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_unit_perceptMesh_wedge6_1(self):
eMesh = PerceptMesh()
p_size = eMesh.get_parallel_size()
if p_size == 1:
wedgeFixture = WedgeFixture()
wedgeFixture.createMesh(self.pm, 4, 3, 2, 0, 1, 0, 1, 0, 1, "swept-wedge_0.e")
示例10: test_high_level_interface
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import get_parallel_size [as 别名]
def test_high_level_interface(self):
self.fixture_setup()
p_size = parallel_machine_size(self.pm)
if p_size <= 2:
eMesh = PerceptMesh(2)
eMesh.open("./exodus_files/quad_fixture.e")
vectorDimension = 0
eMesh.add_field("coords_mag_field", FEMMetaData.NODE_RANK, vectorDimension)
eMesh.commit()
f_coords = eMesh.get_field("coordinates")
coords_mag_field = eMesh.get_field("coords_mag_field")
ff_coords = FieldFunction("ff_coords", f_coords, eMesh, 2, 2)
#eval_vec3_print(0.1,0.1,0.1,0.0,ff_coords)
coords_mag_sf = StringFunction("sqrt(x*x + y*y )" , "coords_mag_sf", 2, 1)
x = 0.123
y = 0.234
vv = sqrt(x*x + y*y )
v1 = eval_func2(x,y,0,coords_mag_sf)
print "vv = ", vv, "== v1 = ", v1
self.assertEqual(vv, v1)
coords_mag_field_function = FieldFunction("coords_mag_field_function", coords_mag_field, eMesh, 2, 1)
coords_mag_field_function.interpolateFrom(coords_mag_sf)
eMesh.save_as("./exodus_files/quad_fixture_with_coords_mag.e")
ff_coords.add_alias("mc")
sfcm = StringFunction("sqrt(mc[0]*mc[0]+mc[1]*mc[1]+mc[2]*mc[2])", "sfcm", 3, 1)
add_newlines = True
eMesh.print_info("quad fixture", 2, add_newlines)
self.assertTrue(eMesh.get_spatial_dim() == 2)
self.assertTrue(eMesh.get_number_elements() == 12*12)
self.assertTrue(eMesh.get_number_nodes() == 13*13)
self.assertTrue(eMesh.get_parallel_size() == p_size)
self.assertTrue(eMesh.get_bulk_data() != 0)
self.assertTrue(eMesh.get_fem_meta_data() != 0)
# // entity data setter/getters
node = eMesh.get_node(1)
self.assertTrue(node != 0)
cm1 = eMesh.get_field_data(coords_mag_field, node)
co1 = [0,0]
co1[0] = eMesh.get_field_data(f_coords, node, 0)
co1[1] = eMesh.get_field_data(f_coords, node, 1)
print "cm1= ", cm1, " co1= ", co1
eMesh.set_field_data(123.0, f_coords, node, 0)
co1[0] = eMesh.get_field_data(f_coords, node, 0)
print " co1= ", co1
element = eMesh.get_element(1)
self.assertTrue(element != 0)
element1 = eMesh.get_entity(eMesh.element_rank(), 1)
self.assertTrue(element == element1)
#/// find node closest to given point
node = eMesh.get_node(0,0)
self.assertTrue(node != 0)
#/// find element that contains given point
element = eMesh.get_element(0.01, 0.01)
self.assertTrue(element != 0)