Index: /issm/trunk-jpl/src/m/solve/solve.js
===================================================================
--- /issm/trunk-jpl/src/m/solve/solve.js	(revision 20268)
+++ /issm/trunk-jpl/src/m/solve/solve.js	(revision 20269)
@@ -63,4 +63,5 @@
 	//If we are restarting, actually use the provided runtime name:
 	restart=options.getfieldvalue('restart','');
+
 	//First, build a runtime name that is unique
 	if (restart==1 ){
@@ -87,16 +88,4 @@
 	}
 
-	//flaim analysis (To be removed?)
-	if (solutionenum == FlaimSolutionEnum()){
-		//fmdir     = options.getfieldvalue('fmdir',['fm' num2str(feature('GetPid'))]);
-		//overwrite = options.getfieldvalue('overwrite','n');
-		//keep      = options.getfieldvalue('keep','y');
-		//latsgn    = options.getfieldvalue('latsgn',0);
-		//cmap      = options.getfieldvalue('cmap',[]);
-		throw  Error("solve error message: flaim runs not supported yet!");
-		//flaim_sol(md,options);
-		//md.priv.solution=EnumToString(solutionenum);
-		//return;
-	}
 
 	//Do we load results only?
@@ -106,76 +95,12 @@
 	}
 
-	//Write all input files
-	fid = marshall(md);                                          // bin file
+	//Marshall into a binary array (fid) all the fields of model.
+	var fid = marshall(md);                                          // bin file
+	
+	//deal with toolkits options: 
 	toolkitsstring= md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits'); // toolkits file
 
-	if (cluster.classname() != 'local'){ //{{{
 
-		throw Error('non local clusters not supported yet!');
-
-		cluster.BuildQueueScript(md.priv.runtimename,md.miscellaneous.name,md.priv.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof,md.qmu.isdakota); // queue file
-
-		//Stop here if batch mode
-		if (options.getfieldvalue('batch','no') === 'yes'){
-			if (md.verbose.solution){
-				console.log('batch mode requested: not launching job interactively');
-				console.log('launch solution sequence on remote cluster by hand');
-			}
-			return;
-		}
-
-		//Upload all required files
-		modelname = md.miscellaneous.name;
-		filelist  = [modelname + '.bin ',modelname + '.toolkits '];
-		if (ispc){
-			filelist.push(modelname + '.bat ');
-		}
-		else{
-			filelist.push(modelname + '.queue ');
-		}
-
-		if (md.qmu.isdakota){
-			filelist.push(modelname + '.qmu.in');
-		}
-
-		if (restart == ''){
-			cluster.UploadQueueJob(md.miscellaneous.name,md.priv.runtimename,filelist);
-		}
-
-		//launch queue job: 
-		cluster.LaunchQueueJob(md.miscellaneous.name,md.priv.runtimename,filelist,restart);
-
-		//wait on lock
-		if (md.settings.waitonlock == 'NaN'){
-			//load when user enters 'y'
-			console.log('solution launched on remote cluster. log in to detect job completion.');
-			throw Error("solve error message: user detection of successfull completion of job not support yet!");
-			/*choice=input('Is the job successfully completed? (y/n)','s');
-			  if ~strcmp(choice,'y'), 
-			  console.log('Results not loaded... exiting'); 
-			  else
-			  md=loadresultsfromcluster(md);
-			  end*/
-		}
-		else if (md.settings.waitonlock>0){
-			//we wait for the done file
-			done=waitonlock(md);
-			if (md.verbose.solution){
-				console.log('loading results from cluster');
-			}
-			loadresultsfromcluster(md);
-		}
-		else if (md.settings.waitonlock==0){
-			console.log('Model results must be loaded manually with md=loadresultsfromcluster(md);');
-		}
-
-		//post processes qmu results if necessary
-		if (md.qmu.isdakota){
-			/*if ~strncmpi(options.getfieldvalue('keep','y'),'y',1)
-			  system(['rm -rf qmu' num2str(feature('GetPid'))]);
-			  end*/
-		}
-	} //}}}
-	else{ //if (cluster.classname() == 'local') 
+	if (cluster.classname() == 'local'){  //{{{
 
 		/*We are running locally on the machine, using the issm module:*/
@@ -189,8 +114,16 @@
 			
 		//Load results: 
-		var results = loadresultsfrombuffer(md,outputbuffer,outputbuffersize); //loadresults: [array,solution_type]
+		md.results = loadresultsfrombuffer(md,outputbuffer,outputbuffersize); 
+		
+		return md;
 
-		return results;
+	} //}}}
+	else { //{{{
 
-	}
+		/*We are running somewhere else on a computational server. Send the buffer to that server and retrieve output: */
+		cluster.UploadAndRun(fid,toolkitsstring,solutionstring,md.miscellaneous.name);
+
+		return md;
+
+	} //}}}
 }
