本文整理汇总了Python中PerceptMesh.save_as方法的典型用法代码示例。如果您正苦于以下问题:Python PerceptMesh.save_as方法的具体用法?Python PerceptMesh.save_as怎么用?Python PerceptMesh.save_as使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerceptMesh
的用法示例。
在下文中一共展示了PerceptMesh.save_as方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_break_quad_to_quad_sierra_2
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_break_quad_to_quad_sierra_2(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
doGenSideSets = True
if p_size <= 3:
n = 12
nx = n
ny = n
fixture = QuadFixture_4(pm,nx,ny,doGenSideSets)
isCommited = False
eMesh = PerceptMesh(fixture.meta_data, fixture.bulk_data, isCommited)
eMesh.commit()
fixture.generate_mesh()
eMesh.save_as("quad_fixture_mbreak_0.e")
eMesh.close()
eMesh1 = PerceptMesh(2)
eMesh1.open("quad_fixture_mbreak_0.e")
scalarDimension = 0
proc_rank_field = eMesh1.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh1, QUAD4_QUAD4_4_SIERRA, proc_rank_field)
eMesh1.commit()
i = 0
while i < 2:
print "\n\n\n ================ tmp Refine Pass = ", i
breaker.doBreak()
eMesh1.save_as("quad_fixture_mbreak_" + str(i) + ".e")
i = i + 1
示例2: test_break_tri3_to_tri6_sierra
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_break_tri3_to_tri6_sierra(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
print p_size, "++++++++++++++++++++"
for i in range(100):
print "-------------------"
if p_size <= 3:
n = 12
nx = n
ny = n
createEdgeSets = True
fixture = QuadFixture_3(pm, nx, ny, createEdgeSets)
isCommited = False
eMesh = PerceptMesh(fixture.meta_data, fixture.bulk_data, isCommited)
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
eMesh.add_field("proc_rank_ede", eMesh.edge_rank(), scalarDimension)
breaker = Refiner(eMesh, TRI3_TRI6_1, proc_rank_field)
eMesh.commit()
fixture.generate_mesh()
eMesh.print_info("tri mesh tri6")
eMesh.save_as("quad_fixture_tri3_tri6_0.e")
breaker.doBreak()
eMesh.print_info("tri mesh enriched")
eMesh.save_as("quad_fixture_tri6_tri6_0.e")
eMesh.save_as("quad_fixture_tri3_tri6_1.e")
示例3: test_break_quad4_to_quad9_to_quad9
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_break_quad4_to_quad9_to_quad9(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
doGenSideSets = True
if p_size <= 3:
n = 12
nx = n
ny = n
fixture = QuadFixture_4(pm, nx, ny, doGenSideSets)
isCommited = False
eMesh = PerceptMesh(fixture.meta_data, fixture.bulk_data, isCommited)
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, QUAD4_QUAD9_1, proc_rank_field)
eMesh.commit()
fixture.generate_mesh()
breaker.doBreak()
eMesh.save_as("quad_fixture_quad9_quad9_0.e")
em1 = PerceptMesh(2)
em1.open("quad_fixture_quad9_quad9_0.e")
scalarDimension = 0
proc_rank_field = em1.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(em1, QUAD9_QUAD9_4, proc_rank_field)
em1.commit()
breaker.doBreak()
em1.save_as("quad_fixture_quad9_quad9_1.e")
示例4: fixture_setup_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def fixture_setup_1(self):
p_size = self.pm.size
if p_size <= 2:
n = 12
nx = n
ny = n
fixture = QuadFixture_4(self.pm, nx, ny, 1)
fixture.meta_data.commit()
fixture.generate_mesh()
eMesh = PerceptMesh(fixture.meta_data, fixture.bulk_data)
eMesh.print_info("quad fixture", 2)
eMesh.save_as("./exodus_files/quad_fixture.e")
if p_size <= 2:
n = 12
nx = n
ny = n
fixture = QuadFixture_4(self.pm, nx, ny, 0)
fixture.meta_data.commit()
fixture.generate_mesh()
eMesh = PerceptMesh(fixture.meta_data, fixture.bulk_data)
eMesh.print_info("quad fixture no sidesets", 2)
eMesh.save_as("./exodus_files/quad_fixture_no_sidesets.e")
示例5: test_mesh_diff
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_mesh_diff(self):
self.fixture_setup()
p_size = parallel_machine_size(self.pm)
if p_size <= 2:
eMesh_0 = PerceptMesh(2)
eMesh_0.open_read_only("./exodus_files/quad_fixture.e")
eMesh_0.save_as("./exodus_files/quad_fixture_readwrite.e")
eMesh_1 = PerceptMesh(2)
eMesh_2 = PerceptMesh(2)
eMesh_1.open_read_only("./exodus_files/quad_fixture_readwrite.e")
eMesh_2.open_read_only("./exodus_files/quad_fixture.e")
if p_size == 1:
add_newlines = False
eMesh_1.print_info("quad fixture", 2, add_newlines)
eMesh_2.print_info("quad fixture", 2, add_newlines)
#Here the unit test compares an expected output string with the output of the print_infos
diff_msg = "diff report: "
diff = PerceptMesh.mesh_difference(eMesh_1, eMesh_2, diff_msg, True )
self.assertFalse(diff)
#metaData_1 = eMesh_1.get_fem_meta_data()
#metaData_2 = eMesh_2.get_fem_meta_data()
bulkData_1 = eMesh_1.get_bulk_data()
#bulkData_2 = eMesh_2.get_bulk_data()
#coordField_1 = eMesh_1.get_coordinates_field()
#coordField_2 = eMesh_2.get_coordinates_field()
#diff = PerceptMesh.mesh_difference(metaData_1, metaData_2, bulkData_1, bulkData_2, diff_msg, True)
#self.assertFalse(diff)
buckets = bulkData_1.buckets(FEMMetaData.NODE_RANK)
示例6: test_fieldFunction_demo_2
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_fieldFunction_demo_2(self):
eMesh = PerceptMesh()
eMesh.new_mesh(GMeshSpec("3x3x3|bbox:0,0,0,1,1,1"))
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, 3, 3)
eval_vec3_print(0.1,0.1,0.1,0.0,ff_coords)
coords_mag_sf = StringFunction("sqrt(x*x + y*y + z*z)" , "coords_mag_sf", 3, 1)
x = 0.123
y = 0.234
z = 0.345
vv = sqrt(x*x + y*y + z*z)
v1 = eval_func(x,y,z,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, 3, 1)
coords_mag_field_function.interpolateFrom(coords_mag_sf)
eMesh.save_as("./cubehex8_withCoordMag_out.e")
ff_coords.add_alias("mc")
sfcm = StringFunction("sqrt(mc[0]*mc[0]+mc[1]*mc[1]+mc[2]*mc[2])", "sfcm", 3, 1)
示例7: test_use_case_3
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_use_case_3(self):
try:
subprocess.call("sierra aria -i tet_mesh.e -o result_0.e")
pMesh = PerceptMesh()
pMesh.open("tet-mesh.e")
uniform_refiner = Refiner(pMesh, TET4_TET4_8)
pMesh.commit()
uniform_refiner.doBreak()
pMesh.save_as("tet-mesh_refined.e")
subprocess.call("sierra aria -i tet_mesh_refined.e -o result_1.e")
pMesh_0 = PerceptMesh()
pMesh_1 = PerceptMesh()
pMesh_0.open_read_only("result_0.e")
pMesh_1.open_read_only("result_1.e")
ff_0 = Field_Function(pMesh_0)
ff_1 = Field_Function(pMesh_1)
diff = StringFunction("ff_0 - ff_1")
#diffnorm = eval_norm(pMesh.get_bulk_data, diff, 2)
#print "diffnorm = ", diffnorm
except:
print "Sierra not found."
示例8: fixture_setup_0
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [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")
示例9: test_hex20_hex20_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [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")
示例10: test_hex8_tet4_6_12_2
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_hex8_tet4_6_12_2(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
eMesh = PerceptMesh(3)
eMesh.open("hex_fixture.e")
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.doBreak()
eMesh.save_as("hex_tet_6_12_1.e")
示例11: test_break_quad_to_quad_sierra_sidesets
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_break_quad_to_quad_sierra_sidesets(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size == 1 or p_size == 2:
eMesh = PerceptMesh(2)
eMesh.open("quad_fixture.e")
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, QUAD4_QUAD4_4_SIERRA, proc_rank_field)
eMesh.commit()
eMesh.print_info("after refinement break_quad_to_quad_sierra_sidesets")
breaker.doBreak()
eMesh.save_as("quad_sidesets_sierra_out.e")
示例12: test_use_case_2
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_use_case_2(self):
pMesh = PerceptMesh()
pMesh.open("exodus_files/tet-mesh.e")
uniform_refiner = Refiner(pMesh, TET4_TET4_8)
pMesh.commit()
i = 0
while i < 3:
uniform_refiner.doBreak()
i = i + 1
pMesh.save_as("tet-mesh-refined-3-times.e")
示例13: test_hex8_tet4_6_12_1
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [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")
示例14: test_use_case_2
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_use_case_2(self):
pMesh = PerceptMesh() # create an empty PerceptMesh
pMesh.open("exodus_files/tet-mesh.e") # open the mesh, but don't commit its meta data
uniform_refiner = Refiner(pMesh, TET4_TET4_8) # define a Refiner on the mesh
pMesh.commit() # commit the mesh
i = 0
while i < 3:
uniform_refiner.doBreak() # refine the mesh 3 times
i = i + 1
pMesh.save_as("tet-mesh-refined-3-times.e") # save in exodus format
示例15: test_hex20_hex20_1_2
# 需要导入模块: import PerceptMesh [as 别名]
# 或者: from PerceptMesh import save_as [as 别名]
def test_hex20_hex20_1_2(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size == 1 or p_size == 3:
eMesh = PerceptMesh(3)
eMesh.open("hex20_hex20_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()
eMesh.save_as("hex20_hex20_0.e")
breaker.doBreak()
eMesh.save_as("hex20_hex20_1.e")