source: issm/oecreview/Archive/14312-15392/ISSM-14406-14407.diff@ 15393

Last change on this file since 15393 was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 7.4 KB
RevLine 
[15393]1Index: ../trunk-jpl/test/NightlyRun/android.m
2===================================================================
3--- ../trunk-jpl/test/NightlyRun/android.m (revision 14406)
4+++ ../trunk-jpl/test/NightlyRun/android.m (revision 14407)
5@@ -1,4 +1,4 @@
6-md=triangle(model(),'../Exp/Square.exp',100000.);
7+md=triangle(model(),'../Exp/Square.exp',40000.);
8 md=setmask(md,'all','');
9 md=parameterize(md,'../Par/SquareShelfConstrained.par');
10 md=setflowequation(md,'macayeal','all');
11Index: ../trunk-jpl/src/mobile/android/ISSM/jni/Main.cpp
12===================================================================
13--- ../trunk-jpl/src/mobile/android/ISSM/jni/Main.cpp (revision 14406)
14+++ ../trunk-jpl/src/mobile/android/ISSM/jni/Main.cpp (revision 14407)
15@@ -1,187 +0,0 @@
16-#include "../../../c/issm.h"
17-#include <cstddef>
18-#include <stdio.h>
19-
20-//Android specific header includes:
21-#include <jni.h>
22-#include <android/log.h>
23-#include <android/log.h>
24-
25-//iOS specific header includes:
26-
27-namespace gov_nasa_jpl_issm
28-{
29- /*Global variables{{{*/
30- FemModel *fm;
31- double* xyz; /*keep vertices information here*/
32- /*}}}*/
33- jint Initialize(JNIEnv *env, jclass clazz, jstring jsolution_type, jstring jabsfile, jstring jrelfile) /*{{{*/
34- {
35-
36- /*arguments to constructor: */
37- int argc; //arguments to constructor.
38- char** argv = NULL;
39- COMM communicator = 1; //fake communicator for constructor
40- const char* issmname = "issm.exe";
41- char *solution_type = NULL;
42- char *absfile = NULL;
43- char *relfile = NULL;
44-
45- /*log:*/
46- __android_log_print(ANDROID_LOG_INFO, "Native","Initializing FemModel");
47-
48- /*retrieve from java machine: */
49- solution_type = (char*)env->GetStringUTFChars(jsolution_type,0);
50- absfile = (char*)env->GetStringUTFChars(jabsfile,0);
51- relfile = (char*)env->GetStringUTFChars(jrelfile,0);
52-
53- /*creat arguments to call constructor for FemModel: */
54- argc=4;
55- argv=(char**)malloc(argc*sizeof(char*));
56- argv[0]=(char*)issmname;
57- argv[1]=solution_type;
58- argv[2]=absfile;
59- argv[3]=relfile;
60-
61- /*call Model constructor passing in infile as File Descriptor parameter.*/
62- fm = new FemModel(argc,argv,communicator);
63-
64- /*release strings: */
65- env->ReleaseStringUTFChars(jsolution_type, solution_type); //must realease the char*
66- env->ReleaseStringUTFChars(jabsfile, absfile); //must realease the char*
67- env->ReleaseStringUTFChars(jrelfile, relfile); //must realease the char*
68-
69- /*figure out size of solution: */
70- __android_log_print(ANDROID_LOG_INFO, "Native","Number of elements");
71- jint size = (jint) fm->elements->NumberOfElements();
72-
73- /*retrieve vertices x,y and z coordinates: */
74- __android_log_print(ANDROID_LOG_INFO, "Native","Retrieving vertices");
75- xyz=fm->vertices->ToXYZ();
76-
77- /*log: */
78- __android_log_print(ANDROID_LOG_INFO, "Native","Done Initializing FemModel");
79-
80- return size;
81-
82- }
83- /*}}}*/
84- void Solve(JNIEnv *env, jclass clazz , jdouble alpha, jobject buf){ /*{{{*/
85-
86- int i,count;
87- double x1,y1,z1,vel1;
88- double x2,y2,z2,vel2;
89- double x3,y3,z3,vel3;
90- int v1,v2,v3,eid;
91- Patch* patch=NULL;
92-
93- /*log:*/
94- __android_log_print(ANDROID_LOG_INFO, "Native","Solving ");
95-
96- /*retrieve buffer: */
97- jdouble *dBuf = (jdouble *)env->GetDirectBufferAddress(buf);
98-
99- /*reset basal friction to what it was before: */
100- __android_log_print(ANDROID_LOG_INFO, "Native","alpha %g ",alpha);
101- InputDuplicatex(fm->elements,fm->nodes,fm->vertices,fm->loads,fm->materials,fm->parameters,AndroidFrictionCoefficientEnum,FrictionCoefficientEnum);
102-
103- /*now scale friction by alpha: */
104- InputScalex(fm->elements,fm->nodes,fm->vertices,fm->loads,fm->materials,fm->parameters,FrictionCoefficientEnum,alpha/100);
105-
106- /*solve: */
107- fm -> Solve();
108-
109- /*retrieve results: */
110- __android_log_print(ANDROID_LOG_INFO, "Native","Retrieving results ");
111- patch=fm->elements->ResultsToPatch();
112-
113- /*sort out the velocities: */
114- for(i=0;i<patch->numrows;i++){
115- if ((patch->values[i*patch->numcols+0])==VelEnum){
116-
117- /*Each row of the Patch object is made of the following information:
118- - the result enum_type,
119- - the step and time,
120- - the id of the element,
121- - the interpolation type,
122- - the vertices ids,
123- - and the values at the nodes (could be different from the vertices)
124- */
125- eid=(int)patch->values[i*patch->numcols+3]-1;
126- v1=(int)patch->values[i*patch->numcols+5];
127- x1=xyz[3*(v1-1)+0]; y1=xyz[3*(v1-1)+1]; z1=xyz[3*(v1-1)+2];
128-
129- v2=(int)patch->values[i*patch->numcols+6];
130- x2=xyz[3*(v2-1)+0]; y2=xyz[3*(v2-1)+1]; z2=xyz[3*(v2-1)+2];
131-
132- v3=(int)patch->values[i*patch->numcols+7];
133- x3=xyz[3*(v3-1)+0]; y3=xyz[3*(v3-1)+1]; z3=xyz[3*(v3-1)+2];
134-
135- vel1=patch->values[i*patch->numcols+8];
136- vel2=patch->values[i*patch->numcols+9];
137- vel3=patch->values[i*patch->numcols+10];
138-
139- /*plug into dBuf: */
140- /*vertex 1: */
141- dBuf[12*eid+0]=x1;
142- dBuf[12*eid+1]=y1;
143- dBuf[12*eid+2]=z1;
144-
145- /*vertex 2: */
146- dBuf[12*eid+3]=x2;
147- dBuf[12*eid+4]=y2;
148- dBuf[12*eid+5]=z2;
149-
150- /*vertex 3: */
151- dBuf[12*eid+6]=x3;
152- dBuf[12*eid+7]=y3;
153- dBuf[12*eid+8]=z3;
154-
155- /*values at 3 vertices: */
156- dBuf[12*eid+9]=vel1;
157- dBuf[12*eid+10]=vel2;
158- dBuf[12*eid+11]=vel3;
159-
160- }
161- }
162-
163- /*for(i=0;i<148;i++){
164- __android_log_print(ANDROID_LOG_INFO, "Native","%g %g %g | %g %g %g | %g %g %g | %g %g %g\n",
165- dBuf[12*i+0],dBuf[12*i+1],dBuf[12*i+2],
166- dBuf[12*i+3],dBuf[12*i+4],dBuf[12*i+5],
167- dBuf[12*i+6],dBuf[12*i+7],dBuf[12*i+8],
168- dBuf[12*i+9],dBuf[12*i+10],dBuf[12*i+11]);
169- }*/
170-
171- /*delete temporary data:*/
172- delete patch;
173-
174- }/*}}}*/
175- static JNINativeMethod method_table[] = /*{{{*/
176- {
177- {"createISSMModel" ,"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I" , (void *) Initialize},
178- {"solveISSMModel", "(DLjava/nio/DoubleBuffer;)V", (void *) Solve}
179- };
180- /*}}}*/
181-}
182-
183-using namespace gov_nasa_jpl_issm;
184-extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) /*{{{*/
185-{
186- JNIEnv* env;
187- if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
188- return -1;
189- }
190- else
191- {
192- jclass clazz = env->FindClass("gov/nasa/jpl/issm/IssmJni");
193- if(clazz)
194- {
195- env->RegisterNatives(clazz, method_table, 3);
196- env->DeleteLocalRef(clazz);
197- return JNI_VERSION_1_6;
198- }
199- else return -1;
200- }
201-}
202-/*}}}*/
203Index: ../trunk-jpl/src/mobile/android/ISSM/Makefile.am
204===================================================================
205--- ../trunk-jpl/src/mobile/android/ISSM/Makefile.am (revision 14406)
206+++ ../trunk-jpl/src/mobile/android/ISSM/Makefile.am (revision 14407)
207@@ -1,7 +1 @@
208 EXTRA_DIST = AndroidManifest.xml assets gen jni obj project.properties src Makefile.am bin ic_launcher-web.png libs proguard-project.txt res
209-
210-#Generate JNI library
211-lib_LTLIBRARIES = libISSMJNI.la
212-
213-libISSMJNI_la_SOURCES = ./jni/Main.cpp
214-libISSMJNI_la_LIBADD = $(ISSM_DIR)/src/c/libISSMCore.a $(ISSM_DIR)/externalpackages/gsl/install/lib/libgsl.a
215Index: ../trunk-jpl
216===================================================================
217--- ../trunk-jpl (revision 14406)
218+++ ../trunk-jpl (revision 14407)
219
220Property changes on: ../trunk-jpl
221___________________________________________________________________
222Modified: svn:ignore
223## -1,3 +1,4 ##
224+proj-*
225 projects
226 autom4te.cache
227 aclocal.m4
Note: See TracBrowser for help on using the repository browser.