def generate_mesh(meshing_dir, params):
    '\n    Launch Mesh Generator to generate mesh.\n\n    @param meshing_dir: the meshing directory\n    @param params: the meshing parameters\n    @return: the mesh generation log content\n    @raise TypeError: if any input parameter is not of required type\n    @raise ValueError: if any input parameter is None/empty, or any field of MeshingParameters is not\n                        of valid value\n    @raise ServiceError: if error occurs during generating mesh\n    '
    signature = (__name__ + '.generate_mesh()')
    helper.log_entrance(_LOGGER, signature, {'meshing_dir': meshing_dir, 'params': params})
    helper.check_not_none_nor_empty(meshing_dir, 'meshing_dir')
    helper.check_is_directory(meshing_dir, 'meshing_dir')
    helper.check_type_value(params, 'params', MeshingParameters, False)
    helper.check_not_none_nor_empty(params.infile, 'params.infile')
    helper.check_is_file(params.infile, 'params.infile')
    helper.check_not_none_nor_empty(params.outfile, 'params.outfile')
    helper.check_not_none_nor_empty(params.maxh, 'params.maxh')
    helper.check_not_none_nor_empty(params.minh, 'params.minh')
    helper.check_not_none_nor_empty(params.fineness, 'params.fineness')
    helper.check_not_none_nor_empty(params.grading, 'params.grading')
    helper.check_not_none_nor_empty(params.usetolerance, 'params.usetolerance')
    if (params.usetolerance == '1'):
        helper.check_not_none_nor_empty(params.tolerance, 'params.tolerance')
    try:
        config_file_path = os.path.join(meshing_dir, _CONFIG_FILE_NAME)
        log_file_path = os.path.join(meshing_dir, _LOG_FILE_NAME)
        with open(config_file_path, 'w') as f:
            f.write('\n'.join((('%s: %s' % item) for item in vars(params).items() if (item[1] is not None))))
        with open(log_file_path, 'w') as log_file:
            _LOGGER.debug('Start mesh generator in subprocess.')
            subprocess.call(MESH_GENERATOR_BIN, cwd=meshing_dir, stdout=log_file)
            _LOGGER.debug('End mesh generator in subprocess.')
        with open(log_file_path, 'r') as log_file:
            ret = log_file.read()
            helper.log_exit(_LOGGER, signature, [ret])
            return ret
    except Exception as e:
        helper.log_exception(_LOGGER, signature, e)
        raise ServiceError(('Error occurs when generating mesh. Caused by:\n' + unicode(str(e))))
Launch Mesh Generator to generate mesh.

@param meshing_dir: the meshing directory
@param params: the meshing parameters
@return: the mesh generation log content
@raise TypeError: if any input parameter is not of required type
@raise ValueError: if any input parameter is None/empty, or any field of MeshingParameters is not
                    of valid value
@raise ServiceError: if error occurs during generating mesh
def generate_mesh(meshing_dir, params):
    '\n    Launch Mesh Generator to generate mesh.\n\n    @param meshing_dir: the meshing directory\n    @param params: the meshing parameters\n    @return: the mesh generation log content\n    @raise TypeError: if any input parameter is not of required type\n    @raise ValueError: if any input parameter is None/empty, or any field of MeshingParameters is not\n                        of valid value\n    @raise ServiceError: if error occurs during generating mesh\n    '
    signature = (__name__ + '.generate_mesh()')
    helper.log_entrance(_LOGGER, signature, {'meshing_dir': meshing_dir, 'params': params})
    helper.check_not_none_nor_empty(meshing_dir, 'meshing_dir')
    helper.check_is_directory(meshing_dir, 'meshing_dir')
    helper.check_type_value(params, 'params', MeshingParameters, False)
    helper.check_not_none_nor_empty(params.infile, 'params.infile')
    helper.check_is_file(params.infile, 'params.infile')
    helper.check_not_none_nor_empty(params.outfile, 'params.outfile')
    helper.check_not_none_nor_empty(params.maxh, 'params.maxh')
    helper.check_not_none_nor_empty(params.minh, 'params.minh')
    helper.check_not_none_nor_empty(params.fineness, 'params.fineness')
    helper.check_not_none_nor_empty(params.grading, 'params.grading')
    helper.check_not_none_nor_empty(params.usetolerance, 'params.usetolerance')
    if (params.usetolerance == '1'):
        helper.check_not_none_nor_empty(params.tolerance, 'params.tolerance')
    try:
        config_file_path = os.path.join(meshing_dir, _CONFIG_FILE_NAME)
        log_file_path = os.path.join(meshing_dir, _LOG_FILE_NAME)
        with open(config_file_path, 'w') as f:
            f.write('\n'.join((('%s: %s' % item) for item in vars(params).items() if (item[1] is not None))))
        with open(log_file_path, 'w') as log_file:
            _LOGGER.debug('Start mesh generator in subprocess.')
            subprocess.call(MESH_GENERATOR_BIN, cwd=meshing_dir, stdout=log_file)
            _LOGGER.debug('End mesh generator in subprocess.')
        with open(log_file_path, 'r') as log_file:
            ret = log_file.read()
            helper.log_exit(_LOGGER, signature, [ret])
            return ret
    except Exception as e:
        helper.log_exception(_LOGGER, signature, e)
        raise ServiceError(('Error occurs when generating mesh. Caused by:\n' + unicode(str(e))))