Difference between revisions of "Onelab/Mobile"

From ONELAB
Jump to: navigation, search
 
(82 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Mobile - Test the Beta =
 
== Android ==
 
Requirement:
 
* ''You need an Android device running Android >= 4.0''
 
<br />
 
Here is the step to install Onelab on your device:
 
# Download the file ([http://onelab.info/files/.Onelab.apk Onelab.apk])
 
# You have to allow installation of non-Market apps <br /> > Settings > Security > Unknown sources
 
# Then you can install the application <br />To do that, you can upload the file on your SD card and then use a [https://play.google.com/store/search?q=file%20explorer&c=apps file explorer] to open the file. <br />Or you can use Android SDK's tool named adb and install the file: <source lang="bash">adb install Onelab.apk</source>
 
  
== iOS (iPad, iPhone, ...)==
+
Onelab/Mobile is available for iOS (iPhone and iPad) and Android:
Requirement:
+
* [https://itunes.apple.com/us/app/onelab/id845930897 Download Onelab/Mobile for iPhone and iPad on the App Store]
* ''You need an iOS device running iOS >= 6.0''
+
* [https://play.google.com/store/apps/details?id=org.geuz.onelab Download Onelab/Mobile for Android devices on Google Play]
<br />
+
Onelab/Mobile contains [[Gmsh]] and [[GetDP]] and runs all computations locally on your mobile device.
To install the application on your device, you need to send us your device ID. <br />
 
To know how to locate this ID you can check [https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingProfiles/MaintainingProfiles.html##//apple_ref/doc/uid/TP40012582-CH30-SW46 apple website]. <br />
 
Then we will add your device in the list of the device for Onelab beta, and you will be able to [https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html#//apple_ref/doc/uid/TP40012582-CH8-SW6 install Onelab]. <br />
 
  
= How to add a model =
+
== Running a pre-packaged model ==
== Android ==
 
On Android, you can open .geo, .pro files from a [https://play.google.com/store/search?q=file%20explorer&c=apps file explorer].
 
  
== iOS ==
+
The list of available models appears when you launch the app. Selecting a model will load it. You can then press '''Run''' to launch a simulation with the default set of parameters. When available, additional information about a model can be obtained by long-pressing on the model description and selecting '''Visit model website'''.
To add a model on iOS you can use [http://support.apple.com/kb/HT4094 File Sharing]. <br />
 
The model have to be in a directory with extension ".onelab". <br />
 
Example for magnet: <br />
 
<code>
 
  
magnet.onelab/
+
<gallery widths=133px heights=200px perrow=3>
    magnet.geo
+
Image:iPhone_1.png|List of models on iPhone; select a model to open it.
    magnet.pro
+
Image:iPhone_2.png|Press '''Run''' to launch a computation with the default set of parameters.
    magnet_data.pro
+
Image:iPhone_3.png|Press '''Parameters''' to see and/or modify the parameters.
    Magnetostatics.pro
+
</gallery>
    infos.xml
+
 
</code>
+
== Modifying a model ==
and the file "infos.xml" look like:
+
 
<source lang="xml">
+
To run a model with different parameters, press '''Parameters''' and modify any of the presets. Then press '''Run''' again: all the simulation steps will be performed with the new parameter values. To restore the preset parameters values, press '''Reset'''.  
<?xml version="1.0" encoding="utf-8"?>
 
  
<models>
+
Advanced users can also directly edit the model input files: long-press on the model description and select '''Edit model files'''. To free up space, temporary model files (meshes, solution files) can be removed by long-pressing on the model description and selecting '''Clear results'''. To completey remove a model, long-press on the model description and select '''Remove'''.
        <model>
 
                <title>Magnet</title>
 
                <summary>Simple magnet example.</summary>
 
                <file type="pro">magnet.pro</file>
 
        </model>
 
</models>
 
</source>
 
  
= Mobile - Build for iOS =
+
== Sharing a model ==
Requirement:
 
* ''You need to be on a Mac''
 
* ''You need to have xcode >= 4''
 
* ''You need to have the iOS SDK >= 6.0''
 
== Compile the framework for iOS simulator ==
 
To compile for the simulator, the framework have to be for i386 architecture
 
Example for Gmsh:
 
<source lang="bash">
 
mkdir buildIOSSimulator
 
cd buildIOSSimulator
 
cmake -DENABLE_LIB=1 -DDEFAULT=0 -DENABLE_BLAS_LAPACK=1 -DENABLE_MESH=1 -DENABLE_ONELAB=1 -DENABLE_POST=1 -DCMAKE_CXX_FLAGS='-m32' ../
 
make framework
 
</source>
 
  
== Compile the frameworks for iOS device ==
+
To share a model by email, long-press on the model description and select '''Email model files'''.
To compile for an iOS device you need a toolchain (e.g. [https://code.google.com/p/ios-cmake/ ios-cmake]).
 
<source lang="bash">
 
mkdir buildIOS
 
cd buildIOS
 
cmake -DDEFAULT=0 -DENABLE_LIB=1 -DENABLE_BLAS_LAPACK=1 -DENABLE_MESH=1 -DENABLE_ONELAB=1 -DENABLE_POST=1 -DCMAKE_TOOLCHAIN_FILE=/path/to/iOS.cmake -Gxcode ../
 
xcodebuild -target lib -configuration Release
 
</source>
 
  
== Create the project ==
+
== Installing a new model ==
To create the project you have to create a new directory and then, create the project with cmake
 
<source lang="bash">
 
mkdir iOSProject
 
cd iOSProject
 
cmake ../contrib/mobile/
 
make xcodeProject
 
</source>
 
Then you can use "open" command to open the project with xcode.
 
<source lang="bash">open Onelab/Onelab.xcodeproj</source>
 
  
= Mobile - Build for Android =
+
To install a new model:
''This procedure has been tested only on a Linux distribution''
+
<ol>
<br />
+
<li>Put all the model files (.pro, .geo) in a directory, which should also contain a file named '''infos.xml''' with the model information:
Requirement:
+
<source lang="xml">
* ''You need to have Android SDK with a level >= 14''
+
<?xml version="1.0" encoding="utf-8"?>
* ''You also need Android NDK to compile libraries''
+
<models>
== Compile the libraries ==
+
  <model>
Most of the Android powered device run on an ARMv7 architecture. <br />
+
    <title>Your model title</title>
Here is the way to compile Gmsh library for this architecture. <br />
+
    <summary>Your model summary</summary>
To do this, you need a toolchain (e.g [http://code.google.com/p/android-cmake/ android-cmake])<br />
+
    <file type="pro">your_main_pro_file.pro</file>
<source lang="bash">
+
    <preview type="png">your_128x128_pixel_screenshot.png</preview>
mkdir buildAndroid
+
    <url>http://your_model_website.com</url>
cd buildAndroid
+
  </model>
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/android.toolchain.cmake -DDEFAULT=0 -DENABLE_LIB=1 -DENABLE_BLAS_LAPACK=1 -DENABLE_MESH=1 -DENABLE_ONELAB=1 -DENABLE_POST=1 ../
+
</models>
make androidGmsh
 
 
</source>
 
</source>
 +
(See e.g. [http://onelab.info/files/inductor Inductor] or [http://onelab.info/files/waveguides Waveguides].)
 +
<li>[https://en.wikipedia.org/wiki/Zip_%28file_format%29 Zip] the directory.
 +
<li>Open the .zip file on your device (e.g. through iCloud, Dropbox or Google Drive; or by emailing it to yourself and opening the attachment; or by putting it on a web server and downloading the file on the device with Safari or Chrome).
 +
</ol>
 +
The new models will be extracted alongside the app's built-in models.
  
== Create the project ==
+
== Installing beta versions of Onelab/Mobile ==
The project need multiples libraries:
 
* Gmsh
 
* GetDP
 
* ONELAB (see below)
 
* PETSc
 
* BLAS & LAPACK
 
 
 
The ONELAB library is a small library to interface the application (Java) with Gmsh (Native library).
 
You can build it from gmsh-svn (it's in /contrib/mobile/)
 
  
To use the automated cmake procedure you have to create a directory (e.g. Gmsh) with:
+
Please send an email to mobile@onelab.info if you want to become a Onelab/Mobile beta-tester.
* The library with directory name and without any extension (e.g. Gmsh)
 
* The headers (they can be obtain with "''make getHeaders''")
 
The final directory for Gmsh looks like<br />
 
<code>
 
  
Gmsh/
+
== Compiling Onelab/Mobile ==
    Gmsh
 
    Headers/
 
        *.h
 
</code>
 
  
Then you can create the project:
+
The Onelab/Mobile source code is available in the [http://gitlab.onelab.info/gmsh/gmsh/tree/master/contrib/mobile/ contrib/mobile directory of the Gmsh source code repository]. Build scripts are provided for [http://gitlab.onelab.info/gmsh/gmsh/tree/master/contrib/mobile/utils/ios_build.sh iOS] (requires a Mac with Xcode >= 6) and [http://gitlab.onelab.info/gmsh/gmsh/tree/master/contrib/mobile/utils/android_build.sh Android] (requires Android SDK >= 14 and the Android NDK).
<source lang="bash">
 
make androidProject
 
</source>
 
Then you can open the project with [https://developer.android.com/sdk/installing/bundle.html Eclipse] or with [https://developer.android.com/sdk/installing/studio.html Android Studio]
 
You can also compile using the command line:
 
<source lang="bash">
 
android update project --name Onelab --path . --target targetID
 
ant release
 
</source>
 

Latest revision as of 14:55, 13 April 2017

Onelab/Mobile is available for iOS (iPhone and iPad) and Android:

Onelab/Mobile contains Gmsh and GetDP and runs all computations locally on your mobile device.

Running a pre-packaged model

The list of available models appears when you launch the app. Selecting a model will load it. You can then press Run to launch a simulation with the default set of parameters. When available, additional information about a model can be obtained by long-pressing on the model description and selecting Visit model website.

Modifying a model

To run a model with different parameters, press Parameters and modify any of the presets. Then press Run again: all the simulation steps will be performed with the new parameter values. To restore the preset parameters values, press Reset.

Advanced users can also directly edit the model input files: long-press on the model description and select Edit model files. To free up space, temporary model files (meshes, solution files) can be removed by long-pressing on the model description and selecting Clear results. To completey remove a model, long-press on the model description and select Remove.

Sharing a model

To share a model by email, long-press on the model description and select Email model files.

Installing a new model

To install a new model:

  1. Put all the model files (.pro, .geo) in a directory, which should also contain a file named infos.xml with the model information:
    <?xml version="1.0" encoding="utf-8"?>
    <models>
      <model>
        <title>Your model title</title>
        <summary>Your model summary</summary>
        <file type="pro">your_main_pro_file.pro</file>
        <preview type="png">your_128x128_pixel_screenshot.png</preview>
        <url>http://your_model_website.com</url>
      </model>
    </models>
    

    (See e.g. Inductor or Waveguides.)

  2. Zip the directory.
  3. Open the .zip file on your device (e.g. through iCloud, Dropbox or Google Drive; or by emailing it to yourself and opening the attachment; or by putting it on a web server and downloading the file on the device with Safari or Chrome).

The new models will be extracted alongside the app's built-in models.

Installing beta versions of Onelab/Mobile

Please send an email to mobile@onelab.info if you want to become a Onelab/Mobile beta-tester.

Compiling Onelab/Mobile

The Onelab/Mobile source code is available in the contrib/mobile directory of the Gmsh source code repository. Build scripts are provided for iOS (requires a Mac with Xcode >= 6) and Android (requires Android SDK >= 14 and the Android NDK).