feelpp / viewer

1 stars 1 forks source link

Cemosis Viewer

Kitware has developed for Cemosis a web viewer allowing Cemosis users to visualize Feel++ data type using remote rendering.

The application has been built on top of React and ParaViewWeb open-source libraries.

Instantiation

Compiled version instantiation

Kitware used WebPack in order to build a compiled version of the Cemosis viewer. This version lives in the ./dist directory.

To use to compiled version, you need to:

<script src="https://github.com/feelpp/viewer/raw/master/Viewer.js"></script>
<body>
    <div id="root"></div>

    <script>
        var containerId = 'root';

        var data = '...';

        var configuration = {
            ...
        };

        var viewer = new Cemosis.Viewer(containerId, data, configuration);
    </script>
</body>

You need to set manually the size of the container as the application has been conceived to use the whole space available:

#root
{
    position: absolute;
    width: 100%;
    height: 100%;
}

Source version instantiation

In case your main application is using React (as a frontend library) and WebPack (for the building process), you can consider to use the Viewer sources instead of the compiled version.

You need to use the Root component defined in ./src/Components/Root/Root.js:

const data = '...';

const configuration = {
    ...
};

<Root
    data={data}
    configuration={configuration}
/>

Parameters

To correctly use the viewer, using the source or the compiled version, you need to properly configure it.

You need to pass to the viewer two parameters:

Setup

Development

In order to develop on the project and test new features, you need two things:

  1. Start server:

    To start the server you need to run the following command:

    node ./bin/startRenderingServer.js --pvpython [PVPYTHON_EXECUTABLE_PATH] --data-directory-path [DATA_DIRECTORY_PATH] --data-load-signature-decoder [DATA_LOAD_SIGNATURE_DECODER_EXECUTABLE_PATH]

    The following parameters need to be passed:

    • PVPYTHON_EXECUTABLE_PATH: Path to pvpython executable, 5.5 version is required
    • DATA_DIRECTORY_PATH: Path to the directory used to store the data available to be loaded by the viewer: (.../data)
    • DATA_LOAD_SIGNATURE_DECODER_EXECUTABLE_PATH: Path to decodeDataLoadSignature executable: (.../bin/decodeDataLoadSignature.js)
  2. Open the testing web page:

    Open the page http://localhost:8080/ with your browser

Production

In order to deploy the viewer in a production environment, you need several things:

  1. Get dependencies

    sudo apt-get update
    sudo apt-get upgrade
    sudo reboot
    sudo apt-get install nvidia-384 python-dev libx11-dev mesa-common-dev apache2-dev apache2 libapr1-dev apache2-utils
    sudo reboot
  2. Install CMake

    mkdir /mnt/tmp/cmake
    cd /mnt/tmp/cmake
    curl -OL https://cmake.org/files/v3.9/cmake-3.9.4-Linux-x86_64.tar.gz
    tar -zxf cmake-3.9.4-Linux-x86_64.tar.gz
  3. Get EGL

    sudo mkdir -p /mnt/tmp/EGL
    sudo mkdir /mnt/tmp/KHR
    sudo chown -R ubuntu:ubuntu /mnt/tmp
    cd /mnt/tmp
    mkdir -p egl/EGL
    mkdir -p egl/KHR
    cd egl/EGL
    curl -OL https://www.khronos.org/registry/EGL/api/EGL/egl.h
    curl -OL https://www.khronos.org/registry/EGL/api/EGL/eglext.h
    curl -OL https://www.khronos.org/registry/EGL/api/EGL/eglplatform.h
    cd ../KHR
    curl -OL https://www.khronos.org/registry/EGL/api/KHR/khrplatform.h
  4. Build ParaView with EGL support

    mkdir /home/ubuntu/paraview
    mkdir -p /mnt/tmp/paraview/build
    cd /mnt/tmp/paraview
    git clone --recursive https://gitlab.kitware.com/paraview/paraview.git src
    cd build
    /mnt/tmp/cmake/cmake-3.9.4-Linux-x86_64/bin/cmake \
        -DCMAKE_INSTALL_PREFIX:PATH=/home/ubuntu/paraview \
        -DBUILD_TESTING:BOOL=OFF \
        -DPARAVIEW_BUILD_QT_GUI:BOOL=OFF \
        -DPARAVIEW_ENABLE_PYTHON:BOOL=ON \
        -DVTK_USE_X:BOOL=OFF \
        -DVTK_OPENGL_HAS_EGL:BOOL=ON \
        -DEGL_INCLUDE_DIR:PATH=/mnt/tmp/egl \
        -DEGL_LIBRARY:FILEPATH=/usr/lib/nvidia-384/libEGL.so \
        -DEGL_opengl_LIBRARY:FILEPATH=/usr/lib/nvidia-384/libOpenGL.so \
        ../src/
    make -j8
    make install
  5. Create a ParaView shared folder

    cd /opt/
    mkdir Others
    cd Others
    mkdir logs
    mkdir proxy
    cd proxy
    touch proxy.txt
  6. Clone this project

    cd /opt/
    mkdir Projects
    cd Projects
    git clone git@gitlab.kitware.io:Cemosis/Viewer.git
  7. Get WSLink

    cd /opt/
    mkdir Softwares
    cd Softwares
    git clone https://github.com/Kitware/wslink.git
  8. Enable required Apache module

    sudo a2enmod vhost_alias
    sudo a2enmod proxy
    sudo a2enmod proxy_http
    sudo a2enmod proxy_wstunnel
    sudo a2enmod rewrite
    sudo a2enmod headers
  9. Configure Apache VirtualHosts

    cd /etc/apache2/sites-available/
    cp /opt/Projects/documentation/examples/virtualHost.conf viewer.conf
    vim viewer.conf # Change parameters following your configuration
    a2ensite viewer.conf
    service apache2 restart
  10. Configure ParaViewWeb process launcher

    cd /opt/
    cd Others
    cp /opt/Projects/documentation/examples/launcher.json launcher.json
    vim launcher.json # Change parameters following your configuration
  11. Start the ParaViewWeb process launcher

    /opt/Softwares/ParaView/bin/pvpython /opt/Softwares/wslink/python/src/wslink/launcher.py /opt/Others/launcher.json