def gmsh_block_adapt3D(xy_dim=10.0, z_dim=5.0, in_res=1.0):
    """Generate the mesh adapter."""
    try:
        from pygmsh import Geometry
    except ImportError:
        from pygmsh.built_in import Geometry
    geo = Geometry()
    code = ['xydim = {};'.format(xy_dim), 'zdim = {};'.format(z_dim),
        'innerres = {};'.format(in_res),
        'Point(1) = {0,      0,      0, innerres};',
        'Point(2) = {xydim,  0,      0, innerres};',
        'Point(3) = {xydim,  xydim,  0, xydim};',
        'Point(4) = {0,      xydim,  0, xydim};', 'Line(1) = {1, 2};',
        'Line(2) = {2, 3};', 'Line(3) = {3, 4};', 'Line(4) = {4, 1};',
        'Transfinite Line{1} = xydim/innerres + 1;',
        'Transfinite Line{2, 3, 4} = 2;', 'Line Loop(1) = {4, 1, 2, 3};',
        'Plane Surface(1) = {1};',
        'Extrude{0,0,zdim}{Surface{1};Layers{1};Recombine;};']
    geo.add_raw_code(code)
    return geo
