本文整理汇总了Python中PerceptMesh类的典型用法代码示例。如果您正苦于以下问题:Python PerceptMesh类的具体用法?Python PerceptMesh怎么用?Python PerceptMesh使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PerceptMesh类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fixture_setup_1
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")
示例2: test_wedge6_1
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: test_fieldFunction_readMesh_createField_interpolateFrom
def test_fieldFunction_readMesh_createField_interpolateFrom(self):
num_x = 3
num_y = 3
num_z = 3
config_mesh = str(num_x) + "x" + str(num_y) + "x" + str(num_z) + "|bbox:0,0,0,1,1,1"
eMesh = PerceptMesh()
eMesh.new_mesh(GMeshSpec(config_mesh))
vectorDimension = 0
eMesh.add_field("coords_mag_field", FEMMetaData.NODE_RANK, vectorDimension)
eMesh.commit()
#p_rank = eMesh.get_bulk_data().parallel_rank()
#setRank(p_rank)
#from Util
f_coords = eMesh.get_field("coordinates")
coords_mag_field = eMesh.get_field("coords_mag_field")
#VERIFY_OP_ON Here the unit test does something
ff_coords = FieldFunction("ff_coords", f_coords, eMesh, 3, 3, FieldFunction.SIMPLE_SEARCH)
#here we could evaluate the function
#eval_vec3_print(0.1,0.2,0.3,0.0,ff_coords)
coords_mag_sf = StringFunction("sqrt(x*x + y*y + z*z)", "coords_mag_sf", 3, 1)
coords_mag_field_function = FieldFunction("coords_mag_field_function", coords_mag_field, eMesh, 3, 3, FieldFunction.SIMPLE_SEARCH)
coords_mag_field_function.interpolateFrom(coords_mag_sf)
#The following is not doable from Python
checkCoordMag = CheckCoordMag()
#eMesh.nodalOpLoop(checkCoordMag, coords_mag_field)
print checkCoordMag.error
ff_coords.add_alias("mc")
sfcm = StringFunction("sqrt(mc[0]*mc[0]+mc[1]*mc[1]+mc[2]*mc[2])", "sfcm", Dimensions(3), Dimensions(1))
tol1 = 1.e-12
vv = eval_vec3(0.1, 0.2, 0.3, 0.0, ff_coords)
print
print "0.1 == vv[0] = ", vv[0], "passed"
print "0.2 == vv[1] = ", vv[1], "passed"
print "0.3 == vv[2] = ", vv[2], "passed"
self.assertAlmostEqual(.1, vv[0], delta=tol1)
self.assertAlmostEqual(.2, vv[1], delta=tol1)
self.assertAlmostEqual(.3, vv[2], delta=tol1)
vv = eval_func(0.1, 0.2, 0.3, 0.0, sfcm)
v_expect = sqrt(0.1*0.1+0.2*0.2+0.3*0.3)
if ((vv-v_expect) < tol1):
print "vv = ", vv, " == v_expect = ", v_expect, "passed"
coords_mag_field_function.interpolateFrom(sfcm)
示例4: test_hex20_hex20_1
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")
示例5: test_wedge6_wedge18_enrich
def test_wedge6_wedge18_enrich(self):
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size == 1:
wedgeFixture = WedgeFixture()
bulk = wedgeFixture.createMesh(MPI.COMM_WORLD, 4,3,2,0,1,0,1,0,1,"")
eMesh = PerceptMesh(wedgeFixture.getMetaData(), bulk, False)
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, WEDGE6_WEDGE18_1, proc_rank_field)
eMesh.commit()
wedgeFixture.createBulkAfterMetaCommit(MPI.COMM_WORLD)
breaker.doBreak()
示例6: test_quad4_quad4_test_1
def test_quad4_quad4_test_1(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size <= 3:
n = 12
nx = n
ny = n
fixture = QuadFixture_4(pm,nx,ny,True)
fixture.meta_data.commit()
fixture.generate_mesh()
eMesh = PerceptMesh(fixture.meta_data, fixture.bulk_data)
eMesh.print_info("quad fixture")
eMesh.save_as("quad_fixture_test_1.e")
示例7: test_wedge6_2
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")
示例8: fixture_setup_0
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_quad8_to_quad8
def test_quad8_to_quad8(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size <= 3:
eMesh = PerceptMesh(2)
eMesh.open("quad_fixture_quad8_quad8_0.e")
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, QUAD8_QUAD8_4, proc_rank_field)
eMesh.commit()
breaker.setIgnoreSideSets(False)
breaker.doBreak()
eMesh.save_as("quad_fixture_quad8_quad8_1.e")
示例10: test_use_case_1
def test_use_case_1(self):
pMesh = PerceptMesh()
pMesh.new_mesh(GMeshSpec("3x3x3|bbox:0,0,0,2,2,2"))
field = pMesh.add_field("coordinates", 1)
pMesh.commit()
input_array = array([1.0, 0.5, 0.5])
input_array_2 = array([1.0, 1.5, 1.5])
ff = FieldFunction("ff", field, pMesh, 3, 3)
ff.add_alias("myalias")
ff_output = ff.evaluate(input_array)
f2 = FieldFunction("f2", field, pMesh, 3, 3)
f2_output = f2.evaluate(input_array_2)
sf = StringFunction("x+y+z", "myname", 3, 1)
sf_output = sf.evaluate(input_array)
sf_diff = StringFunction("ff-f2", "myname")
norm = L1Norm(pMesh.get_bulk_data())
value = norm.evaluate(ff)
diffnorm = norm.evaluate(sf_diff)
示例11: test_hex8_hex8_8_1
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
示例12: fixture_setup_1
def fixture_setup_1():
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size <= 3:
n = 12
nx = n
ny = n
fixture = QuadFixture_4(pm, nx, ny, True)
fixture.meta_data.commit()
fixture.generate_mesh()
eMesh = PerceptMesh(fixture.meta_data, fixture.bulk_data)
eMesh.print_info("quad fixture", 2)
eMesh.save_as("quad_fixture.e")
fixture = QuadFixture_4(pm, nx, ny, False)
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("quad_fixture_no_sidesets.e")
示例13: test_break_tri_to_tri_sierra_1_test
def test_break_tri_to_tri_sierra_1_test(self):
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size <= 2:
n = 2
nx = n
ny = n
createEdgeSets = False
fixture = QuadFixture_4(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_edge", eMesh.edge_rank(), scalarDimension)
breaker = Refiner(eMesh, TRI3_TRI3_4, proc_rank_field)
eMesh.commit()
fixture.generate_mesh()
breaker.setRemoveOldElements(False)
breaker.doBreak()
eMesh.dump_elements_compact()
示例14: test_heterogeneous_mesh
def test_heterogeneous_mesh(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(MPI.COMM_WORLD)
if p_size <= 1:
mesh = HeterogeneousFixture(MPI.COMM_WORLD, False)
#put_io_part_attribute(mesh.m_block_hex)
#put_io_part_attribute(mesh.m_block_wedge)
#put_io_part_attribute(mesh.m_block_tet)
mesh.m_metaData.commit()
mesh.populate()
isCommited = True
em1 = PerceptMesh(mesh.m_metaData, mesh.m_bulkData, isCommited)
em1.save_as("heterogeneous_0.e")
em1.close()
eMesh = PerceptMesh(3)
eMesh.open("heterogeneous_0.e")
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
示例15: test_beam_refine
def test_beam_refine(self):
fixture_setup()
pm = MPI.COMM_WORLD
p_size = parallel_machine_size(pm)
if p_size <= 1:
mesh = BeamFixture(pm, False)
mesh.m_metaData.commit()
mesh.populate()
isCommited = True
em1 = PerceptMesh(mesh.m_metaData, mesh.m_bulkData, isCommited)
em1.save_as("beam_0.e")
eMesh = PerceptMesh()
eMesh.open("beam_0.e")
scalarDimension = 0
proc_rank_field = eMesh.add_field("proc_rank", eMesh.element_rank(), scalarDimension)
breaker = Refiner(eMesh, BEAM2_BEAM2_2, proc_rank_field)
eMesh.commit()
breaker.setIgnoreSideSets(True)
breaker.doBreak()