Commit f67856b5 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Merge branch 'master' of geraldine.fjfi.cvut.cz:/local/projects/tnl/tnl

parents b35d1beb 20760aee
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
/usr/local/share/automake-1.11/INSTALL
 No newline at end of file
+80 −0
Original line number Diff line number Diff line
Installation
============

    Requirements:

    To install TNL, you need:

    cmake 3.4 or later (https://cmake.org/download/)
    GNU g++ 4.8 or later (https://gcc.gnu.org/)
    CUDA 8.0 or later (https://developer.nvidia.com/cuda-downloads)

    For image processing problems, you may optionaly install:
    DCMTK (http://dicom.offis.de/dcmtk.php.en)
    libpng (http://www.libpng.org/pub/png/libpng.html)
    libjpeg (http://libjpeg.sourceforge.net/)

    The latest release of TNL can be downloaded as:

    wget tnl-project.org/data/src/tnl-0.1.tar.bz2

    Unpack it as:

    tar xvf tnl-0.1.tar.bz2
    cd tnl-0.1

    Executing command

    ./install

    will install TNL to a folder ${HOME}/.local . You may change it by

    ./install --prefix=<TNL prefix>

    During the installation, TNL fetches latest version of Gtest and install it only 
    locally to sub-folders Debug and Release. At the end of the installation, the
    script is checking if the prefix folder is visible to your bash and your linker.
    If not, it informs you how to change your ${HOME}/.bashrc file to fix it.

How to write a simple solver
============================

To implement your own solver:

    Create and go to your working directory

    mkdir MyProblem
    cd Myproblem

    Execute a command tnl-quickstart

    tnl-quickstart

    Answer the questions as, for example, follows

    TNL Quickstart -- solver generator
    ----------------------------------
    Problem name:My Problem
    Problem class base name (base name acceptable in C++ code):MyProblem
    Operator name:Laplace

    Write your numerical scheme by editing a file

    Laplace_impl.h

    on lines:
        34, 141 and 265 for 1D, 2D and 3D problem respectively with explicit time discretization
        101, 211 and 332 for 1D, 2D and 3D problem respectively with (semi-)implicit time discretization
    Compile the program by executing

    make

    for CPU version only or 
   
    make WITH_CUDA=yes

    for a solver running on both CPU and GPU. Run it on your favourite HW architecture by executing

    ./MyProblem

    and following the printed help.
+30 −30
Original line number Diff line number Diff line
@@ -41,12 +41,12 @@ operator()( const MeshFunction& u,
    */
    static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); 
    static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 

   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
   const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
   const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); 
   double a;
   a = this->advectionSpeedX;
   return   (0.5 / this->tau ) * this->artificalViscosity *
@@ -102,11 +102,11 @@ updateLinearSystem( const RealType& time,
    * by the Finite difference method.
    */

    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
   const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
   const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); 
   matrixRow.setElement( 0, west,   - lambdaX );
   matrixRow.setElement( 1, center, 2.0 * lambdaX );
   matrixRow.setElement( 2, east,   - lambdaX );
@@ -150,15 +150,15 @@ operator()( const MeshFunction& u,
    */
    static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); 
    static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 

   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >(); 
   double a;
   double b;
   a = this->advectionSpeedX;
@@ -218,14 +218,14 @@ updateLinearSystem( const RealType& time,
    * by the Finite difference method.
    */

    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >(); 
   matrixRow.setElement( 0, south,  -lambdaY );
   matrixRow.setElement( 1, west,   -lambdaX );
   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
@@ -271,18 +271,18 @@ operator()( const MeshFunction& u,
    */
    static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); 
    static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 

   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >(); 
   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse +
          ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse;
@@ -335,17 +335,17 @@ updateLinearSystem( const RealType& time,
    * by the Finite difference method.
    */

   /* const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
   /* const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >(); 
   matrixRow.setElement( 0, down,   -lambdaZ );
   matrixRow.setElement( 1, south,  -lambdaY );
   matrixRow.setElement( 2, west,   -lambdaX );
+30 −30
Original line number Diff line number Diff line
@@ -36,13 +36,13 @@ operator()( const MeshFunction& u,
{
    static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); 
    static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 

    //rho
    const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
    const IndexType& center = entity.getIndex(); 
    const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
    const IndexType& west = neighbourEntities.template getEntityIndex< -1 >();
    const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
    const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
    return (0.5 * this->tau) * ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) 
          - 0.5 * hxInverse * ( u[ west ] * this->velocity[ west ] - u[ east ] * this->velocity[ east ] );
}
@@ -94,11 +94,11 @@ updateLinearSystem( const RealType& time,
    * by the Finite difference method.
    */

    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
   const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
   const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); 
   matrixRow.setElement( 0, west,   - lambdaX );
   matrixRow.setElement( 1, center, 2.0 * lambdaX );
   matrixRow.setElement( 2, east,   - lambdaX );
@@ -142,15 +142,15 @@ operator()( const MeshFunction& u,
    */
    static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); 
    static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 

   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >(); 
   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse;
}
@@ -202,14 +202,14 @@ updateLinearSystem( const RealType& time,
    * by the Finite difference method.
    */

    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >(); 
   matrixRow.setElement( 0, south,  -lambdaY );
   matrixRow.setElement( 1, west,   -lambdaX );
   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
@@ -255,18 +255,18 @@ operator()( const MeshFunction& u,
    */
    static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); 
    static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 

   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >(); 
   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse +
          ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse;
@@ -319,17 +319,17 @@ updateLinearSystem( const RealType& time,
    * by the Finite difference method.
    */

    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
    const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
   const IndexType& center = entity.getIndex(); 
   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
   const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
   const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
   const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
   const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >(); 
   const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
   const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >(); 
   matrixRow.setElement( 0, down,   -lambdaZ );
   matrixRow.setElement( 1, south,  -lambdaY );
   matrixRow.setElement( 2, west,   -lambdaX );
+30 −30

File changed.

Preview size limit exceeded, changes collapsed.

Loading