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

Adding support for adaptive grid.

parent 1afab991
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ if( DEFINED ENV{CI_JOB_NAME} OR ${CMAKE_GENERATOR} STREQUAL "Ninja" )
endif()

#####
# Check for MPI -- poznej podle vraperu compileru -- da se testovat preklad bez MPI
# Check for MPI
#
get_filename_component( CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME )
if( ${CXX_COMPILER_NAME} STREQUAL "mpicxx" )
@@ -267,6 +267,17 @@ if( JPEG_FOUND )
   include_directories( ${JPEG_INCLUDE_DIRS} )
endif()


####
# Adaptive grid - temporary
#
if( ${WITH_ADAPTIVE_GRID} )
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_ADAPTIVE_GRID" )
    if( NOT ${ADAPTIVE_GRID_PATH} EQUAL "" )
        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I ${ADAPTIVE_GRID_PATH}" )
    endif()
endif()

####
# Test for GMP 
#
+8 −0
Original line number Diff line number Diff line
@@ -28,6 +28,9 @@ WITH_EXAMPLES="yes"
WITH_PYTHON="yes"
WITH_TOOLS="yes"
WITH_BENCHMARKS="yes"
# This is temporary
WITH_ADAPTIVE_GRID="no"
ADAPTIVE_GRID_PATH=""

WITH_TEMPLATE_INSTANTIATION="no"
INSTANTIATE_LONG_INT="no"
@@ -65,6 +68,8 @@ do
        --with-benchmarks=*              ) WITH_BENCHMARKS="${option#*=}" ;;
        --with-python=*                  ) WITH_PYTHON="${option#*=}" ;;
        --with-templates-instantiation=* ) WITH_TEMPLATE_INSTANTIATION="${option#*=}" ;;
        --with-adaptive-grid=*           ) WITH_ADAPTIVE_GRID="${option#*=}" ;;
        --adaptive-grid-path=*           ) ADAPTIVE_GRID_PATH="${option#*=}" ;;
        --instantiate-long-int=*         ) INSTANTIATE_LONG_INT="${option#*=}" ;;
        --instantiate-int=*              ) INSTANTIATE_INT="${option#*=}" ;;
        --instantiate-long-double=*      ) INSTANTIATE_LONG_DOUBLE="${option#*=}" ;;
@@ -101,6 +106,7 @@ if [[ ${HELP} == "yes" ]]; then
    echo "   --with-coverage=yes/no                Enables code coverage reports for unit tests. 'no' by default (lcov is required)."
    echo "   --with-examples=yes/no                Compile the 'examples' directory. 'yes' by default."
    echo "   --with-tools=yes/no                   Compile the 'src/Tools' directory. 'yes' by default."
    echo "   --with-benchmarks=yes/no              Compile the 'src/Benchmarks' directory. 'yes' by default."
    echo "   --with-python=yes/no                  Compile the Python bindings. 'yes' by default."
    echo "   --with-templates-instantiation=yes/no Precompiles some TNL templates during the build. 'no' by default."
    echo "   --cmake=CMAKE                         Path to cmake. 'cmake' by default."
@@ -173,6 +179,8 @@ cmake_command=(
         -DWITH_EXAMPLES=${WITH_EXAMPLES}
         -DWITH_TOOLS=${WITH_TOOLS}
         -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
         -DWITH_ADAPTIVE_GRID=${WITH_ADAPTIVE_GRID}
         -DADAPTIVE_GRID_PATH=${ADAPTIVE_GRID_PATH}
         -DWITH_PYTHON=${WITH_PYTHON}
         -DDCMTK_DIR=${DCMTK_DIR}
         -DWITH_TEMPLATE_INSTANTIATION=${WITH_TEMPLATE_INSTANTIATION}
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ class DistributedMeshSynchronizer< Functions::MeshFunction< Grid< MeshDimension,
               requests.push_back( CommunicatorType::IRecv( recieveBuffers[ i ].getData(),  sendSizes[ i ], periodicNeighbors[ i ], 1, group ) );
            }
         }
      };
      }
      
      template< typename CommunicatorType,
                typename MeshFunctionType,
+12 −1
Original line number Diff line number Diff line
@@ -154,6 +154,16 @@ public:
      return idType;
   }
   
   void setAdaptivity( bool adaptive )
   {
      this->adaptivity = adaptive;
   }
   
   bool getAdaptivity() const
   {
      return this->adaptivity;
   }
   
protected:
   String fileName;
   String meshType;
@@ -164,6 +174,7 @@ protected:
   String globalIndexType;
   String localIndexType;
   String idType;
   bool adaptivity = false;

   void reset()
   {
+20 −2
Original line number Diff line number Diff line
@@ -16,6 +16,11 @@
#include <TNL/Meshes/Grid.h>
#include <TNL/Meshes/TypeResolver/GridTypeResolver.h>

#ifdef HAVE_ADAPTIVE_GRID
#include <TNL/Meshes/GridAdaptive.h>
#endif


namespace TNL {
namespace Meshes {   

@@ -161,10 +166,23 @@ bool
GridTypeResolver< Reader, ConfigTag, Device, ProblemSetter, ProblemSetterArgs... >::
resolveGridType( const Reader& reader,
                 ProblemSetterArgs&&... problemSetterArgs )
{
   if( reader.getAdaptivity() )
   {
#ifdef HAVE_ADAPTIVE_GRID
      using GridType = Meshes::GridA< MeshDimension, Real, Device, Index >;
      return resolveTerminate< GridType >( reader, std::forward<ProblemSetterArgs>(problemSetterArgs)... );
#else
      std::cerr << "Adaptive grid is not supported." << std::endl;
      return false;
#endif
   }
   else
   {
      using GridType = Meshes::Grid< MeshDimension, Real, Device, Index >;
      return resolveTerminate< GridType >( reader, std::forward<ProblemSetterArgs>(problemSetterArgs)... );
   }
}

template< typename Reader,
          typename ConfigTag,
Loading