def write_read(writer, reader, input_mesh, atol):
with tempfile.TemporaryDirectory() as temp_dir:<EOL><INDENT>filepath = os.path.join(temp_dir, "<STR_LIT>")<EOL>writer(filepath, input_mesh)<EOL>mesh = reader(filepath)<EOL><DEDENT>assert mesh.points.flags["<STR_LIT>"]<EOL>for cell_type, data in input_mesh.cells.items():<EOL><INDENT>assert mesh.cells[cell_type].flags["<STR_LIT>"]<EOL><DEDENT>assert numpy.allclose(input_mesh.points, mesh.points, atol=atol, rtol=<NUM_LIT:0.0>)<EOL>for cell_type, data in input_mesh.cells.items():<EOL><INDENT>assert numpy.allclose(data, mesh.cells[cell_type])<EOL><DEDENT>for key in input_mesh.point_data.keys():<EOL><INDENT>assert numpy.allclose(<EOL>input_mesh.point_data[key], mesh.point_data[key], atol=atol, rtol=<NUM_LIT:0.0><EOL>)<EOL><DEDENT>for cell_type, cell_type_data in input_mesh.cell_data.items():<EOL><INDENT>for key, data in cell_type_data.items():<EOL><INDENT>assert numpy.allclose(<EOL>data, mesh.cell_data[cell_type][key], atol=atol, rtol=<NUM_LIT:0.0><EOL>)<EOL><DEDENT><DEDENT>for name, data in input_mesh.field_data.items():<EOL><INDENT>assert numpy.allclose(data, mesh.field_data[name], atol=atol, rtol=<NUM_LIT:0.0>)<EOL><DEDENT>return<EOL>
Write and read a file, and make sure the data is the same as before.