Index: /issm/trunk-jpl/src/android/ISSM/assets/Map/antarctica.petsc
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/assets/Map/antarctica.petsc	(revision 14088)
+++ /issm/trunk-jpl/src/android/ISSM/assets/Map/antarctica.petsc	(revision 14089)
@@ -1,3 +1,3 @@
-%Petsc options file: test102.petsc written from Matlab solver array
+%Petsc options file: android.petsc written from Matlab solver array
 
 +NoneAnalysis
Index: /issm/trunk-jpl/src/android/ISSM/assets/Map/greenland.petsc
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/assets/Map/greenland.petsc	(revision 14088)
+++ /issm/trunk-jpl/src/android/ISSM/assets/Map/greenland.petsc	(revision 14089)
@@ -1,3 +1,3 @@
-%Petsc options file: test102.petsc written from Matlab solver array
+%Petsc options file: android.petsc written from Matlab solver array
 
 +NoneAnalysis
Index: /issm/trunk-jpl/src/android/ISSM/jni/Main.cpp
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/jni/Main.cpp	(revision 14088)
+++ /issm/trunk-jpl/src/android/ISSM/jni/Main.cpp	(revision 14089)
@@ -5,4 +5,5 @@
 #include <cstddef>
 #include <stdio.h>
+#include <android/log.h>
 
 namespace com_example_issm
@@ -11,4 +12,5 @@
 	fac* f;
 	FemModel *fm;
+	double* xyz; /*keep vertices information here*/
 	/*}}}*/
 	jint Initialize(JNIEnv *env, jclass clazz, jstring jsolution_type, jstring jabsfile, jstring jrelfile) /*{{{*/
@@ -23,4 +25,7 @@
 		char *absfile = NULL;
 		char *relfile = NULL;
+
+		/*log:*/
+		__android_log_print(ANDROID_LOG_INFO, "Native","Initializing FemModel");
 
 		/*retrieve from java machine: */
@@ -48,18 +53,100 @@
 
 		/*figure out size of solution: */
+		__android_log_print(ANDROID_LOG_INFO, "Native","Number of elements");
 		jint size = (jint) fm->elements->NumberOfElements();
+
+		/*retrieve vertices x,y and z coordinates: */
+		__android_log_print(ANDROID_LOG_INFO, "Native","Retrieving vertices");
+		xyz=fm->vertices->ToXYZ();
 		
+		/*log: */
+		__android_log_print(ANDROID_LOG_INFO, "Native","Done Initializing FemModel");
+
 		return size;
 
 	}
 	/*}}}*/
-	void Solve(JNIEnv *env, jclass clazz , jdouble alpha, jobject buf) /*{{{*/
-	{
+	void Solve(JNIEnv *env, jclass clazz , jdouble alpha, jobject buf){ /*{{{*/
+
+		int i,count;
+		double x1,y1,z1,vel1;
+		double x2,y2,z2,vel2;
+		double x3,y3,z3,vel3;
+		int    v1,v2,v3,eid;
+		Patch* patch=NULL;
+		
+		/*log:*/
+		__android_log_print(ANDROID_LOG_INFO, "Native","Solving ");
+
 		/*fill out the first two slots, extract the same way in java using get(int position)*/
 		jdouble *dBuf = (jdouble *)env->GetDirectBufferAddress(buf);
 
-		//pass bBuff to fem model to allocate data
-		// fm -> Solve(dBuf, alpha);
+		/*pass bBuff to fem model to allocate data. In the future: fm -> Solve(dBuf, alpha)*/
 		fm -> Solve();
+
+		/*retrieve results: */
+		__android_log_print(ANDROID_LOG_INFO, "Native","Retrieving results ");
+		patch=fm->elements->ResultsToPatch();
+
+		/*sort out the velocities: */
+		for(i=0;i<patch->numrows;i++){
+			if ((patch->values[i*patch->numcols+0])==VelEnum){
+
+				/*Each row of the Patch object is made of the following information: 
+				  - the result enum_type, 
+				  - the step and time, 
+				  - the id of the element, 
+				  - the interpolation type, 
+				  - the vertices ids, 
+				  - and the values at the nodes (could be different from the vertices)
+				*/
+				eid=(int)patch->values[i*patch->numcols+3]-1;
+				v1=(int)patch->values[i*patch->numcols+5]; 
+				x1=xyz[3*(v1-1)+0]; y1=xyz[3*(v1-1)+1]; z1=xyz[3*(v1-1)+2];
+				
+				v2=(int)patch->values[i*patch->numcols+6];
+				x2=xyz[3*(v2-1)+0]; y2=xyz[3*(v2-1)+1]; z2=xyz[3*(v2-1)+2];
+				
+				v3=(int)patch->values[i*patch->numcols+7];
+				x3=xyz[3*(v3-1)+0]; y3=xyz[3*(v3-1)+1]; z3=xyz[3*(v3-1)+2];
+
+				vel1=patch->values[i*patch->numcols+8]; 
+				vel2=patch->values[i*patch->numcols+9]; 
+				vel3=patch->values[i*patch->numcols+10]; 
+
+				/*plug into dBuf: */
+				/*vertex 1: */
+				dBuf[12*eid+0]=x1;
+				dBuf[12*eid+1]=y1;
+				dBuf[12*eid+2]=z1;
+
+				/*vertex 2: */
+				dBuf[12*eid+3]=x2;
+				dBuf[12*eid+4]=y2;
+				dBuf[12*eid+5]=z2;
+			
+				/*vertex 3: */
+				dBuf[12*eid+6]=x3;
+				dBuf[12*eid+7]=y3;
+				dBuf[12*eid+8]=z3;
+				
+				/*values at 3 vertices: */
+				dBuf[12*eid+9]=vel1;
+				dBuf[12*eid+10]=vel2;
+				dBuf[12*eid+11]=vel3;
+
+			}
+		}
+
+		/*for(i=0;i<148;i++){
+		__android_log_print(ANDROID_LOG_INFO, "Native","%g %g %g | %g %g %g | %g %g %g | %g %g %g\n",
+				dBuf[12*i+0],dBuf[12*i+1],dBuf[12*i+2],
+				dBuf[12*i+3],dBuf[12*i+4],dBuf[12*i+5],
+				dBuf[12*i+6],dBuf[12*i+7],dBuf[12*i+8],
+				dBuf[12*i+9],dBuf[12*i+10],dBuf[12*i+11]);
+		}*/
+
+		/*delete temporary data:*/
+		delete patch;
 
 	}/*}}}*/
Index: /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/ISSM.java
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/ISSM.java	(revision 14088)
+++ /issm/trunk-jpl/src/android/ISSM/src/com/example/issm/ISSM.java	(revision 14089)
@@ -49,6 +49,6 @@
         //which later on will be pass for native allocation.
         issmNative = new IssmJni();
-        buff = ByteBuffer.allocateDirect(15*8).order(ByteOrder.nativeOrder()).asDoubleBuffer();
         this.createModel();
+        buff = ByteBuffer.allocateDirect(size*12*8).order(ByteOrder.nativeOrder()).asDoubleBuffer();
     }
 //------------------------------------------------------------------------------------------------    
@@ -69,4 +69,8 @@
     {
     	issmNative.solveISSMModel(5,buff);
+
+		//for(int i=0;i< size*12;i++)
+			//System.out.println(buff.get(i));
+
     }
  //------------------------------------------------------------------------------------------------   
