function mfc_hypermesh_install(varargin)
  v='0.0.1';
  v_fc_tools='0.0.14';
  p = inputParser; 
  p.addParamValue('version', v, @ischar ); % default - dim=-1 has
  p.addParamValue('dir', './fc-hypermesh-full', @ischar );
  p.addParamValue('fc_tools',v_fc_tools , @ischar ); % fc_tools version
  p.parse(varargin{:});
  version=p.Results.version;
  
  fprintf('1- Downloading and extracting the toolboxes\n');
  fprintf('   -> <fc-tools>[%s] ...',p.Results.fc_tools)
  fc_tools_dir=get_inst_fc_tools(p.Results.fc_tools,p.Results.dir);
  fprintf(' OK\n');
  fprintf('   -> <fc-hypermesh>[%s] ...',p.Results.version)
  fc_hypermesh_dir=get_inst_fc_hypermesh(p.Results.version,p.Results.dir);
  fprintf(' OK\n');
  currentdir=pwd;
  cd(fc_hypermesh_dir)
  fprintf('2- Setting the <fc-hypermesh> toolbox\n');
  fc_hypermesh.configure('fc_tools_dir',fc_tools_dir);
  cd(currentdir)
  fprintf('3- Using the <fc-hypermesh> toolbox \n');
  fprintf('   Under Matlab:\n')
  fprintf('     addpath(''%s'')\n',fc_hypermesh_dir)
  fprintf('     fc_hypermesh.init()\n')
  logfile=[mfilename('fullpath'),'.log'];
  fprintf('\n   See %s\n',logfile);
  fid=fopen(logfile,'w');
  fprintf(fid,'addpath(''%s'')\n',fc_hypermesh_dir);
  fprintf(fid,'fc_hypermesh.init()\n');
  fclose(fid);
end

  
function fulldir=get_inst_fc_tools(ver,dir)
  urlfile=sprintf('http://www.math.univ-paris13.fr/~cuvelier/software/codes/fc-tools/%s/mfc-tools-%s.tar.gz',ver,ver);
  try
    untar(urlfile,dir)
  catch
    error('Unable to get :\n  -> %s\n',urlfile);
  end
  %fprintf('Getting <fctools>[%s] toolbox\n',ver)
  fulldir=fullfile(pwd,sprintf('%s%smfc-tools-%s',dir,filesep,ver));
end


function fulldir=get_inst_fc_hypermesh(ver,dir)
  urlfile=sprintf('http://www.math.univ-paris13.fr/~cuvelier/software/codes/fc-hypermesh/%s/mfc-hypermesh-%s.tar.gz',ver,ver);
  try
    untar(urlfile,dir)
  catch
    error('Unable to get :\n  -> %s\n',urlfile);
  end
  %fprintf('Getting <fc-hypermesh>[%s] toolbox\n',ver)
  fulldir=fullfile(pwd,sprintf('%s%smfc-hypermesh-%s',dir,filesep,ver));
end


