Exemplo n.º 1
0
def test_save_1d_tensor(tempfile, file_options):
    mesh = UnitIntervalMesh(MPI.comm_world, 32)
    u = Function(TensorFunctionSpace(mesh, ("Lagrange", 2)))
    u.vector()[:] = 1.0
    VTKFile(tempfile + "u.pvd", "ascii").write(u)
    for file_option in file_options:
        VTKFile(tempfile + "u.pvd", file_option).write(u)
Exemplo n.º 2
0
def test_save_2d_mesh(tempfile, file_options):
    mesh = UnitSquareMesh(MPI.comm_world, 32, 32)
    VTKFile(tempfile + "mesh.pvd", "ascii").write(mesh)
    f = VTKFile(tempfile + "mesh.pvd", "ascii")
    f.write(mesh, 0.)
    f.write(mesh, 1.)
    for file_option in file_options:
        VTKFile(tempfile + "mesh.pvd", file_option).write(mesh)
Exemplo n.º 3
0
def test_save_3d_tensor(tempfile, file_options):
    mesh = UnitCubeMesh(MPI.comm_world, 8, 8, 8)
    u = Function(TensorFunctionSpace(mesh, ("Lagrange", 2)))
    u.vector()[:] = 1.0
    VTKFile(tempfile + "u.pvd", "ascii").write(u)
    f = VTKFile(tempfile + "u.pvd", "ascii")
    f.write(u, 0.)
    f.write(u, 1.)
    for file_option in file_options:
        VTKFile(tempfile + "u.pvd", file_option).write(u)
Exemplo n.º 4
0
def test_save_2d_vector(tempfile, file_options):
    mesh = UnitSquareMesh(MPI.comm_world, 16, 16)
    u = Function(VectorFunctionSpace(mesh, "Lagrange", 2))
    u.vector()[:] = 1.0
    VTKFile(tempfile + "u.pvd", "ascii").write(u)
    f = VTKFile(tempfile + "u.pvd")
    f.write(u, 0.)
    f.write(u, 1.)
    for file_option in file_options:
        VTKFile(tempfile + "u.pvd", file_option).write(u)
Exemplo n.º 5
0
def test_save_1d_scalar(tempfile, file_options):
    mesh = UnitIntervalMesh(MPI.comm_world, 32)
    u = Function(FunctionSpace(mesh, "Lagrange", 2))
    u.vector[:] = 1.0
    VTKFile(tempfile + "u.pvd", "ascii").write(u)
    f = VTKFile(tempfile + "u.pvd", "ascii")
    f.write(u, 0.)
    f.write(u, 1.)
    for file_option in file_options:
        VTKFile(tempfile + "u.pvd", file_option).write(u)
Exemplo n.º 6
0
def test_save_3d_meshfunctions(tempfile, mesh_function_types, file_options,
                               type_conv):
    mesh = UnitCubeMesh(MPI.comm_world, 8, 8, 8)
    for d in range(mesh.topology.dim + 1):
        for t in mesh_function_types:
            mf = MeshFunction(t, mesh, mesh.topology.dim - d, type_conv[t](1))
            VTKFile(tempfile + "mf.pvd", "ascii").write(mf)
            f = VTKFile(tempfile + "mf.pvd", "ascii")
            f.write(mf, 0.)
            f.write(mf, 1.)
            for file_option in file_options:
                VTKFile(tempfile + "mf.pvd", file_option).write(mf)