Commit c0c6ca00 authored by COULAUD Olivier's avatar COULAUD Olivier
parents d83c641f b854d3b8
......@@ -4,8 +4,8 @@ if(insource)
MESSAGE(FATAL_ERROR "${PROJECT_NAME} requires an out of source build. Goto ./Build and tapes cmake ../")
endif(insource)
project(Addons_ckernelapi_scalfmm CXX C)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ScaLFMM_CXX_FLAGS}")
project(ADDONS_CKERNELAPI_SCALFMM CXX C)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCALFMM_CXX_FLAGS}")
# Active language
# -----------------------
......@@ -14,7 +14,7 @@ MESSAGE(STATUS " CXX ${CMAKE_CXX_COMPILER_ID}" )
# if ask to build addon
if(ScalFMM_ADDON_CKERNELAPI)
if(SCALFMM_ADDON_CKERNELAPI)
# first build lib scalfmmckernelapi
set(LIBRARY_OUTPUT_PATH ../lib/${CMAKE_BUILD_TYPE})
......@@ -58,7 +58,7 @@ if(ScalFMM_ADDON_CKERNELAPI)
foreach(fuse_key ${FUSE_LIST})
file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}")
if(lines_fuse)
if( NOT ScalFMM_USE_${fuse_key} )
if( NOT SCALFMM_USE_${fuse_key} )
MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" )
set(compile_exec "FALSE")
endif()
......
......@@ -60,7 +60,7 @@ if(SCALFMM_ADDON_FMMAPI)
foreach(fuse_key ${FUSE_LIST})
file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}")
if(lines_fuse)
if( NOT ScalFMM_USE_${fuse_key} )
if( NOT SCALFMM_USE_${fuse_key} )
MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" )
set(compile_exec "FALSE")
endif()
......
......@@ -24,7 +24,7 @@
#include "../../Src/Components/FBasicParticleContainer.hpp"
#ifdef ScalFMM_USE_MPI
#ifdef SCALFMM_USE_MPI
#include "../../Src/Utils/FMpi.hpp"
#endif
......@@ -268,7 +268,7 @@ struct ScalFmmCoreHandle {
int treeHeight; // hombre de niveaux de l'arbre (int)
FReal boxWidth; // taille de la boîte racine (FReal)
FReal boxCenter[3]; // position du centre de la boîte racine (FReal[3])
#ifdef ScalFMM_USE_MPI
#ifdef SCALFMM_USE_MPI
MPI_Comm mpiCom; // communicateur MPI (MPI_Comm)
#endif
int nbThreads; // nombre de threads (int)
......@@ -304,7 +304,7 @@ int FmmCore_isParameterUsed(void */*fmmCore*/, int *name, int *flag){
case FMMCORE_ROOT_BOX_WIDTH :
case FMMCORE_ROOT_BOX_CENTER :
case FMMCORE_TREE_HEIGHT :
#ifdef ScalFMM_USE_MPI
#ifdef SCALFMM_USE_MPI
case FMMCORE_MPI_COMMUNICATOR:
#endif
case FMMCORE_THREADS_NUMBER:
......@@ -343,7 +343,7 @@ int FmmCore_setParameter(void *fmmCore, int *name, void*value){
case FMMCORE_ROOT_BOX_CENTER :
memcpy(corehandle->config.boxCenter, value, sizeof(FReal)*3);
break;
#ifdef ScalFMM_USE_MPI
#ifdef SCALFMM_USE_MPI
case FMMCORE_MPI_COMMUNICATOR:
corehandle->config.mpiCom = *(MPI_Comm*)value;
break;
......@@ -388,7 +388,7 @@ int FmmCore_getParameter(void *fmmCore, int *name, void*value){
case FMMCORE_ROOT_BOX_CENTER :
memcpy(value,corehandle->config.boxCenter, sizeof(FReal)*3);
break;
#ifdef ScalFMM_USE_MPI
#ifdef SCALFMM_USE_MPI
case FMMCORE_MPI_COMMUNICATOR:
*(MPI_Comm*)value = corehandle->config.mpiCom;
break;
......
This diff is collapsed.
# add a target to generate API documentation with Doxygen
OPTION( ScalFMM_BUILD_DOC "Set to ON to build the Doxygen documentation " OFF )
IF(ScalFMM_BUILD_DOC)
find_package(Doxygen)
if(DOXYGEN_FOUND)
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(
doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
# INSTALL(FILES ${ScalFMM_BINARY_DIR}/Doc/scalfmm.tag
# DESTINATION doc/
# )
# INSTALL(DIRECTORY ${ScalFMM_BINARY_DIR}/Doc/html
# DESTINATION doc/
# )
endif(DOXYGEN_FOUND)
endif(ScalFMM_BUILD_DOC)
doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
# INSTALL(FILES ${SCALFMM_BINARY_DIR}/Doc/scalfmm.tag DESTINATION doc/ )
# INSTALL(DIRECTORY ${SCALFMM_BINARY_DIR}/Doc/html DESTINATION doc/ )
else()
message( WARNING "You ask to enable the doc generation but Doxygen cannot be found." )
endif(DOXYGEN_FOUND)
......@@ -22,8 +22,9 @@
* <ul>
* <li> CMake for compiling, ccmake for configuring the build. Version 2.8.12.1 or later </li>
* <li> Open MP </li>
* <li> MPI, if you want to use distributed version of the algorithm </li>
* <li> MPI, if you want to use distributed version of the algorithm (Optional) </li>
* <li> A compiler supporting C++ 2011 </li>
* <li> BLAS, FFTW, ... (Optionals) </li>
* </ul>
*
* \section build Build
......@@ -32,7 +33,7 @@
* <li> Go to scalfmm/Build directory </li>
* <li> type <b> $> cmake .. </b>
* <ul>
* <li> If you want to enable MPI, use <b> $> cmake .. -DScaLFMM_USE_MPI=ON </b> </li>
* <li> If you want to enable MPI, use <b> $> cmake .. -DSCALFMM_USE_MPI=ON </b> </li>
* </ul>
* </li>
* <li> then configure your build with <b> $> ccmake .. </b> if needed </li>
......@@ -40,8 +41,8 @@
* </ul>
*
* an example : <br>
* <b> cmake -DScalFMM_USE_BLAS=ON -DScalFMM_USE_MKL_AS_BLAS=ON \ <br>
* -DScalFMM_USE_SSE=OFF -DScalFMM_USE_AVX=ON ../ </b>
* <b> cmake -DSCALFMM_USE_BLAS=ON -DSCALFMM_USE_MKL_AS_BLAS=ON \ <br>
* -DSCALFMM_USE_SSE=OFF -DSCALFMM_USE_AVX=ON ../ </b>
*
* \subsection conf Configuration of the build
*
......@@ -49,33 +50,29 @@
*
* <ul>
* <li> CMAKE_INSTALL_PREFIX : to choose where to install ScalFmm </li>
* <li> ScalFMM_USE_MPI : to use and enable MPI. Warning, you need to use this parameter at the first cmake command you write. </li>
* <li> ScalFMM_ATTACHE_SOURCE : to build with -g </li>
* <li> SScalFMM_BUILD_TESTS : to build the text and the examples </li>
* <li> ScalFMM_BUILD_UTESTS : to build the unit tests </li>
* <li> ScalFMM_USE_ADDONS : to activate add ons </li>
* <li> SCALFMM_USE_MPI : to use and enable MPI. Warning, you need to use this parameter at the first cmake command you write. </li>
* <li> SCALFMM_ATTACHE_SOURCE : to build with -g (which enables debugging with release binaries)</li>
* <li> SCALFMM_BUILD_EXAMPLES : to build the examples </li>
* <li> SCALFMM_BUILD_TESTS : to build the tests </li>
* <li> SCALFMM_BUILD_UTESTS : to build the unit tests </li>
* <li> SCALFMM_BUILD_DOC : to enable make doc to generate the documentation </li>
* <li> SCALFMM_USE_ADDONS : to activate add ons </li>
* <ul>
* <li> SCALFMM_ADDON_FMMAPI : to build Fmm Api </li>
* </ul>
* <li> ScalFMM_USE_DOUBLE_PRECISION : to build in double precision </li>
* <li> ScalFMMUSE_MEM_STATS : to use memory stats (which count any new/delete done during a simulation) </li>
* <li> ScalFMM_USE_BLAS : to enable BLAS (needed by Chebyshev interpolation kernel) </li>
* <li> SCALFMM_USE_BLAS : to enable BLAS (needed by Chebyshev interpolation kernel) </li>
* <ul>
* <li> SCALFMM_USE_MKL_AS_BLAS : to use MKL as blas </li>
* </ul>
* <li> ScalFMM_USE_FFT : Use FFTW needed for uniform point for interpolation kernel</li>
* <li> SCALFMM_USE_FFT : Use FFTW needed by the uniform interpolation kernel</li>
* <ul>
* <li> ( ScalFMM_USE_MKL_AS_FFTW : to use MKL as FFTW </li>
* <li> ( SCALFMM_USE_MKL_AS_FFTW : to use MKL as FFTW) </li>
* </ul>
* <li> ScalFMM_USE_TRACE : to create trace </li>
* <ul>
* <li> ScalFMM_USE_ITAC : to use Intel ITAC tool as trace generator </li>
* </ul>
* <li> ScalFMM_USE_LOG to print output debug information
* <li> ScalFMM_USE_ASSERT enable safe tests during execution
* <li> ScalFMM_USE_MEM_STATS to profile memory
* <li> ScalFMM_USE_SSE compile with SEE support
* <li> ScalFMM_USE_AVX compile with AVX support
* <li> SCALFMM_USE_LOG to print output debug information during the execution
* <li> SCALFMM_USE_ASSERT enable safe tests during execution
* <li> SCALFMM_USE_SSE compile with SEE support
* <li> SCALFMM_USE_AVX compile with AVX support
* <li>
* </ul>
*
......@@ -86,6 +83,10 @@
* The whole project is documented using Doxygen. You can build the doc
* by typing <b> $> make doc </b> in the Build directory.
* Notice that if you would like to create you own executable and rely on ScalFMM you can simply create
* a .cpp file and store it inside the Tests/Utils directory. Then by running cmake one more time (cmake ..)
* you will be able to compile your file without the need to change CMake files.
*
*
*/
/*! \page quick Quick Start
* In this section, we present the data structure organization and the
* classes design to understand fully ScalFmm and customized it.
* classes design to understand fully ScalFmm and to customize it.
* Remark : There is a big difference between the versions 1.0 and 2.0
* Remark 1.2 : There is a big difference between the versions 1.0 and 1.2
* since we do not store array of particles anymore but rather several arrays.
* This was needed in order to be able to vectorize the P2P code.
* We would like to inform users that are not familiar with 'C++' and
* who are familiar with 'C' and would like to create a kernel
* (and do not want to work on the parallelization),
* that an C API have been made for them.
* Remark 1.3 : There is a big difference between the versions 1.2 and 1.3
* The precision is choosen with template (usually called FReal) and no more
* during the configure.
* We would like to inform users who want to create a kernel and who are not familiar with 'C++'
* but are familiar with 'C' that an C API have been made for them.
* In order to get access to this API, go in Addons/CKernelApi.
* (To compile, enable the addons and then the CKernelApi).
* (To compile, enable the addons and then the CKernelApi in the CMake stage).
* However, to have access to all the features of ScalFmm it is required to use C++
* as described in this QuickStart.
......
......@@ -4,7 +4,7 @@ if(insource)
MESSAGE(FATAL_ERROR "${PROJECT_NAME} requires an out of source build. Goto scalfmm/Build and tapes cmake ../")
endif(insource)
project(Examples_scalfmm CXX)
project(EXAMPLES_SCALFMM CXX)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BUILD_TYPE})
ADD_DEFINITIONS( ${ScaLFMM_CXX_FLAGS})
# Find all code files
......@@ -36,7 +36,7 @@ foreach(exec ${source_tests_files})
foreach(fuse_key ${FUSE_LIST})
file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}")
if(lines_fuse)
if( NOT ScalFMM_USE_${fuse_key} )
if( NOT SCALFMM_USE_${fuse_key} )
MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" )
set(compile_exec "FALSE")
endif()
......
This diff is collapsed.
This diff is collapsed.
......@@ -92,6 +92,6 @@ int main(int argc, char ** argv){
driverExportData(outfilename, particles , NbPoints,loader.getNbRecordPerline() );
}
//
delete particles ;
delete[] particles ;
return 0;
}
......@@ -36,7 +36,7 @@
#include "Core/FFmmAlgorithmThread.hpp"
#ifdef ScalFMM_USE_BLAS
#ifdef SCALFMM_USE_BLAS
// chebyshev kernel
#include "Kernels/Chebyshev/FChebCell.hpp"
......@@ -47,7 +47,7 @@
//
// spherical kernel
#include "Kernels/Spherical/FSphericalCell.hpp"
#ifdef ScalFMM_USE_BLAS
#ifdef SCALFMM_USE_BLAS
#include "Kernels/Spherical/FSphericalBlasKernel.hpp"
#include "Kernels/Spherical/FSphericalBlockBlasKernel.hpp"
#endif
......@@ -67,7 +67,7 @@
#include "Kernels/Rotation/FRotationKernel.hpp"
#include "Kernels/Rotation/FRotationCell.hpp"
#ifdef ScalFMM_USE_FFT
#ifdef SCALFMM_USE_FFT
// Uniform grid kernel
#include "Kernels/Uniform/FUnifCell.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
......@@ -153,7 +153,7 @@ int main(int argc, char* argv[])
std::cout << " Energy of the system: "<< energyD <<std::endl;
////////////////////////////////////////////////////////////////////
#ifdef ScalFMM_USE_BLAS
#ifdef SCALFMM_USE_BLAS
{ // begin Chebyshev kernel
// accuracy
......@@ -449,7 +449,7 @@ int main(int argc, char* argv[])
#endif
#ifdef ScalFMM_USE_FFT
#ifdef SCALFMM_USE_FFT
//
////////////////////////////////////////////////////////////////////
//
......@@ -545,7 +545,7 @@ int main(int argc, char* argv[])
typedef FSphericalKernel<FReal, CellClass, ContainerClass > KernelClass;
typedef FFmmAlgorithmThread<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
#ifndef ScalFMM_USE_BLAS
#ifndef SCALFMM_USE_BLAS
CellClass::Init(DevP, true);
#endif
OctreeClass tree(TreeHeight, SubTreeHeight, loader.getBoxWidth(), loader.getCenterOfBox());
......
......@@ -33,3 +33,9 @@ version 1.1
- Add SSE and AVX code for 1/r kernel
- CMake improvements
1.3 in progress
-----
- The choice of floating point values is done by template (by passing template to all classes) and no more at configure time
- There is no more ScalFMM variables and defines but only SCALFMM (all letters in upper case)
- BLAS and FFTW are turned on by default, and the compilation continue even if they are not found
- We start to use unique ptr (and advise to use it) in the main files
#-----------------------------------------------------------------------------
#
# ScalFMMConfig.cmake - ScalFMM CMake configuration file for external projects.
# SCALFMMConfig.cmake - SCALFMM CMake configuration file for external projects.
#
# This file is configured by ScalFMM and used by the ScalFMM.cmake module
# to load ScalFMM's settings for an external project.
# This file is configured by SCALFMM and used by the SCALFMM.cmake module
# to load SCALFMM's settings for an external project.
#
@ScalFMM_CONFIG_INSTALL_ONLY@
@SCALFMM_CONFIG_INSTALL_ONLY@
#
SET(ScalFMM_VERSION_MAJOR "@ScalFMM_MAJOR_VERSION@")
SET(ScalFMM_VERSION_MINOR "@ScalFMM_MINOR_VERSION@")
SET(ScalFMM_VERSION_BUILD "@ScalFMM_BUILD_VERSION@")
SET(SCALFMM_VERSION_MAJOR "@SCALFMM_MAJOR_VERSION@")
SET(SCALFMM_VERSION_MINOR "@SCALFMM_MINOR_VERSION@")
SET(SCALFMM_VERSION_BUILD "@SCALFMM_BUILD_VERSION@")
#
SET(ScalFMM_PREFIX "@CMAKE_INSTALL_PREFIX@")
SET(ScalFMM_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
SET(ScalFMM_LIBRARIES_DIR "@CMAKE_INSTALL_PREFIX@/lib")
SET(ScalFMM_LIBRARIES_ADD "@SCALFMM_LIBRARIES@")
SET(ScalFMM_LIBRARY_NAME "@scalfmm_lib@")
SET(SCALFMM_PREFIX "@CMAKE_INSTALL_PREFIX@")
SET(SCALFMM_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
SET(SCALFMM_LIBRARIES_DIR "@CMAKE_INSTALL_PREFIX@/lib")
SET(SCALFMM_LIBRARIES_ADD "@SCALFMM_LIBRARIES@")
SET(SCALFMM_LIBRARY_NAME "@scalfmm_lib@")
SET(ScaLFMM_CXX_FLAGS "@ScaLFMM_CXX_FLAGS@")
#
SET(ScalFMM_SOURCE_DIR "@ScalFMM_SOURCE_DIR@")
SET(ScalFMM_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
SET(ScalFMM_USE_FILE "@ScalFMM_USE_FILE@")
SET(SCALFMM_SOURCE_DIR "@SCALFMM_SOURCE_DIR@")
SET(SCALFMM_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
SET(SCALFMM_USE_FILE "@SCALFMM_USE_FILE@")
#
SET(ScalFMM_BUILD_TYPE "@CMAKE_BUILD_TYPE@")
SET(SCALFMM_BUILD_TYPE "@CMAKE_BUILD_TYPE@")
#
# ScalFMM Options
# SCALFMM Options
#
SET(ScalFMM_USE_MPI "@ScalFMM_USE_MPI@")
SET(ScalFMM_USE_BLAS "@ScaLFMM_USE_BLAS@")
SET(ScalFMM_USE_MKL "@ScalFMM_USE_MKL_AS_BLAS@")
SET(ScalFMM_USE_DOUBLE_PRECISION "@ScalFMM_USE_DOUBLE_PRECISION@")
SET(ScalFMM_USE_MEM_STATS "@ScalFMM_USE_MEM_STATS@")
SET(ScalFMM_USE_SSE "@ScalFMM_USE_SSE@")
SET(ScalFMM_FLAGS "@ScaLFMM_FLAGS_OPTI@")
SET(ScalFMM_USE_ADDONS "@ScalFMM_USE_ADDONS@")
SET(ScalFMM_USE_LOG "@ScalFMM_USE_LOG@")
SET(ScalFMM_USE_FFT "@ScalFMM_USE_FFT@")
SET(ScalFMM_USE_STARPU "@ScalFMM_USE_STARPU@")
SET(ScalFMM_USE_SSE "@ScalFMM_USE_SSE@")
SET(ScalFMM_USE_AVX "@ScalFMM_USE_AVX@")
SET(SCALFMM_USE_MPI "@SCALFMM_USE_MPI@")
SET(SCALFMM_USE_BLAS "@ScaLFMM_USE_BLAS@")
SET(SCALFMM_USE_MKL "@SCALFMM_USE_MKL_AS_BLAS@")
SET(SCALFMM_USE_DOUBLE_PRECISION "@SCALFMM_USE_DOUBLE_PRECISION@")
SET(SCALFMM_USE_MEM_STATS "@SCALFMM_USE_MEM_STATS@")
SET(SCALFMM_USE_SSE "@SCALFMM_USE_SSE@")
SET(SCALFMM_FLAGS "@ScaLFMM_FLAGS_OPTI@")
SET(SCALFMM_USE_ADDONS "@SCALFMM_USE_ADDONS@")
SET(SCALFMM_USE_LOG "@SCALFMM_USE_LOG@")
SET(SCALFMM_USE_FFT "@SCALFMM_USE_FFT@")
SET(SCALFMM_USE_STARPU "@SCALFMM_USE_STARPU@")
SET(SCALFMM_USE_SSE "@SCALFMM_USE_SSE@")
SET(SCALFMM_USE_AVX "@SCALFMM_USE_AVX@")
#
SET(ScalFMM_DOC_TAGS "@CMAKE_BINARY_DIR@/Doc/scalfmm.tag")
SET(SCALFMM_DOC_TAGS "@CMAKE_BINARY_DIR@/Doc/scalfmm.tag")
#
IF(ScalFMM_USE_ADDONS)
SET(ScalFMM_LIBRARIES "-L${ScalFMM_LIBRARIES_DIR} -l${ScalFMM_LIBRARY_NAME} ${ScalFMM_LIBRARIES_ADD}" )
IF(SCALFMM_USE_ADDONS)
SET(SCALFMM_LIBRARIES "-L${SCALFMM_LIBRARIES_DIR} -l${SCALFMM_LIBRARY_NAME} ${SCALFMM_LIBRARIES_ADD}" )
ELSE()
SET(ScalFMM_LIBRARIES "-L${ScalFMM_LIBRARIES_DIR} -l${ScalFMM_LIBRARY_NAME}" )
SET(SCALFMM_LIBRARIES "-L${SCALFMM_LIBRARIES_DIR} -l${SCALFMM_LIBRARY_NAME}" )
ENDIF()
SET(ScalFMM_INCLUDE_DIRS ${ScalFMM_INCLUDE_DIR}
${ScalFMM_INCLUDE_DIR}/Utils
${ScalFMM_INCLUDE_DIR}/Components
${ScalFMM_INCLUDE_DIR}/Arranger
${ScalFMM_INCLUDE_DIR}/Containers
${ScalFMM_INCLUDE_DIR}/Core
${ScalFMM_INCLUDE_DIR}/Extensions
${ScalFMM_INCLUDE_DIR}/Files
${ScalFMM_INCLUDE_DIR}/Kernels
${ScalFMM_INCLUDE_DIR}/Chebyshev)
SET(SCALFMM_INCLUDE_DIRS ${SCALFMM_INCLUDE_DIR}
${SCALFMM_INCLUDE_DIR}/Utils
${SCALFMM_INCLUDE_DIR}/Components
${SCALFMM_INCLUDE_DIR}/Arranger
${SCALFMM_INCLUDE_DIR}/Containers
${SCALFMM_INCLUDE_DIR}/Core
${SCALFMM_INCLUDE_DIR}/Extensions
${SCALFMM_INCLUDE_DIR}/Files
${SCALFMM_INCLUDE_DIR}/Kernels
${SCALFMM_INCLUDE_DIR}/Chebyshev)
#SCALFMM_BUILD_TESTS => OFF
#SCALFMM_BUILD_UTESTS => OFF
......@@ -18,7 +18,7 @@ file(
)
# Add CUDA files once they are compiled from cu to .o
if(ScalFMM_USE_CUDA)
if(SCALFMM_USE_CUDA)
# Find all the CU files in my project
file(GLOB_RECURSE source_cu_files ./*.cu)
......
#ifndef FCOORDINATECOMPUTER_HPP
#define FCOORDINATECOMPUTER_HPP
#include "../Utils/FGlobal.hpp"
#include "FTreeCoordinate.hpp"
#include "../Utils/FPoint.hpp"
#include "../Utils/FMath.hpp"
#include "../Utils/FAssert.hpp"
/**
* @brief The FCoordinateComputer struct is the main class to get the tree coordinate
* from the simulation box properties.
*/
struct FCoordinateComputer {
template <class FReal>
static inline int GetTreeCoordinate(const FReal inRelativePosition, const FReal boxWidth,
const FReal boxWidthAtLeafLevel, const int treeHeight) {
FAssertLF( (inRelativePosition >= 0 && inRelativePosition <= boxWidth), "inRelativePosition : ",inRelativePosition, " boxWidth ", boxWidth );
if(inRelativePosition == boxWidth){
return FMath::pow2(treeHeight-1)-1;
}
const FReal indexFReal = inRelativePosition / boxWidthAtLeafLevel;
return static_cast<int>(indexFReal);
}
template <class FReal>
static inline FTreeCoordinate GetCoordinateFromPosition(const FPoint<FReal>& centerOfBox, const FReal boxWidth, const int treeHeight,
const FPoint<FReal>& pos) {
const FPoint<FReal> boxCorner(centerOfBox,-(boxWidth/2));
const FReal boxWidthAtLeafLevel(boxWidth/FReal(1<<(treeHeight-1)));
// box coordinate to host the particle
FTreeCoordinate host;
// position has to be relative to corner not center
host.setX( GetTreeCoordinate<FReal>( pos.getX() - boxCorner.getX(), boxWidth, boxWidthAtLeafLevel, treeHeight));
host.setY( GetTreeCoordinate<FReal>( pos.getY() - boxCorner.getY(), boxWidth, boxWidthAtLeafLevel, treeHeight));
host.setZ( GetTreeCoordinate<FReal>( pos.getZ() - boxCorner.getZ(), boxWidth, boxWidthAtLeafLevel, treeHeight));
return host;
}
template <class FReal>
static inline FTreeCoordinate GetCoordinateFromPositionAndCorner(const FPoint<FReal>& cornerOfBox, const FReal boxWidth, const int treeHeight,
const FPoint<FReal>& pos) {
const FReal boxWidthAtLeafLevel(boxWidth/FReal(1<<(treeHeight-1)));
// box coordinate to host the particle
FTreeCoordinate host;
// position has to be relative to corner not center
host.setX( GetTreeCoordinate<FReal>( pos.getX() - cornerOfBox.getX(), boxWidth, boxWidthAtLeafLevel, treeHeight));
host.setY( GetTreeCoordinate<FReal>( pos.getY() - cornerOfBox.getY(), boxWidth, boxWidthAtLeafLevel, treeHeight));
host.setZ( GetTreeCoordinate<FReal>( pos.getZ() - cornerOfBox.getZ(), boxWidth, boxWidthAtLeafLevel, treeHeight));
return host;
}
};
#endif // FCOORDINATECOMPUTER_HPP
......@@ -29,7 +29,7 @@
#include "../Utils/FMath.hpp"
#include "../Utils/FNoCopyable.hpp"
#include "../Utils/FAssert.hpp"
#include "FCoordinateComputer.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
......@@ -78,13 +78,7 @@ class FOctree : public FNoCopyable {
* @return the morton index
*/
FTreeCoordinate getCoordinateFromPosition(const FPoint<FReal>& inPosition) const {
// box coordinate to host the particle
FTreeCoordinate host;
// position has to be relative to corner not center
host.setX( getTreeCoordinate( inPosition.getX() - this->boxCorner.getX() ));
host.setY( getTreeCoordinate( inPosition.getY() - this->boxCorner.getY() ));
host.setZ( getTreeCoordinate( inPosition.getZ() - this->boxCorner.getZ() ));
return host;
return FCoordinateComputer::GetCoordinateFromPositionAndCorner<FReal>(this->boxCorner, this->boxWidth, height, inPosition);
}
/**
......@@ -94,12 +88,7 @@ class FOctree : public FNoCopyable {
* @return the box num at the leaf level that contains inRelativePosition
*/
int getTreeCoordinate(const FReal inRelativePosition) const {
FAssertLF( (inRelativePosition >= 0 && inRelativePosition <= this->boxWidth), "inRelativePosition : ",inRelativePosition );
if(inRelativePosition == this->boxWidth){
return FMath::pow2(height-1)-1;
}
const FReal indexFReal = inRelativePosition / this->boxWidthAtLevel[this->leafIndex];
return static_cast<int>(indexFReal);
return FCoordinateComputer::GetTreeCoordinate<FReal>(inRelativePosition, this->boxWidth, this->boxWidthAtLevel[this->leafIndex], height);
}
public:
......
......@@ -25,7 +25,7 @@
#include "FFmmAlgorithmThread.hpp"
#include "FFmmAlgorithmPeriodic.hpp"
#ifdef ScalFMM_USE_MPI
#ifdef SCALFMM_USE_MPI
#include "../Utils/FMpi.hpp"
#include "FFmmAlgorithmThreadProc.hpp"
#include "FFmmAlgorithmThreadProcPeriodic.hpp"
......@@ -86,7 +86,7 @@ public:
static FAbstractAlgorithm* BuildAlgorithm(OctreeClass*const tree, KernelClass*const kernel,
const MPI_Comm mpiComm = (MPI_Comm)0, const bool isPeriodic = false,
const int periodicUpperlevel = 0){
#ifdef ScalFMM_USE_MPI
#ifdef SCALFMM_USE_MPI
if(isPeriodic == false){
return new FFmmAlgorithmThreadProc<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>(FMpi::FComm(mpiComm), tree, kernel);
}
......
......@@ -27,6 +27,8 @@
#include "../BalanceTree/FLeafBalance.hpp"
#include "../BalanceTree/FEqualize.hpp"
#include "../Containers/FCoordinateComputer.hpp"
/**
* This class manage the loading of particles for the mpi version.
* It work in several steps.
......@@ -45,19 +47,6 @@ private:
FSize startingPoint;
};
/**
* This method has been taken from the octree class,
* it computes a tree coordinate (x or y or z) from real cartesian position
*/
static int GetTreeCoordinate(const FReal inRelativePosition, const FReal boxWidthAtLeafLevel, const FReal boxWidth, const int height) {
FAssertLF( (inRelativePosition >= 0 && inRelativePosition <= boxWidth), "inRelativePosition : ",inRelativePosition );
if(inRelativePosition == boxWidth){
return FMath::pow2(height-1)-1;
}
const FReal indexFReal = inRelativePosition / boxWidthAtLeafLevel;
return static_cast<int>(indexFReal);
}
public:
/** What sorting algorithm to use */
enum SortingType{
......@@ -101,12 +90,12 @@ public:
// Fill the array and compute the morton index
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
loader.fillParticle(originalParticlesUnsorted[idxPart].particle);
host.setX( GetTreeCoordinate( originalParticlesUnsorted[idxPart].particle.getPosition().getX() - boxCorner.getX(), boxWidthAtLeafLevel,
loader.getBoxWidth(), TreeHeight ));
host.setY( GetTreeCoordinate( originalParticlesUnsorted[idxPart].particle.getPosition().getY() - boxCorner.getY(), boxWidthAtLeafLevel,
loader.getBoxWidth(), TreeHeight ));
host.setZ( GetTreeCoordinate( originalParticlesUnsorted[idxPart].particle.getPosition().getZ() - boxCorner.getZ(), boxWidthAtLeafLevel,
loader.getBoxWidth(), TreeHeight ));
host.setX( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesUnsorted[idxPart].particle.getPosition().getX() - boxCorner.getX(), loader.getBoxWidth(), boxWidthAtLeafLevel,
TreeHeight ));
host.setY( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesUnsorted[idxPart].particle.getPosition().getY() - boxCorner.getY(), loader.getBoxWidth(), boxWidthAtLeafLevel,
TreeHeight ));
host.setZ( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesUnsorted[idxPart].particle.getPosition().getZ() - boxCorner.getZ(), loader.getBoxWidth(), boxWidthAtLeafLevel,
TreeHeight ));
originalParticlesUnsorted[idxPart].index = host.getMortonIndex(TreeHeight - 1);
}
......@@ -138,12 +127,12 @@ public:
// Fill the array and compute the morton index
for(int idxPart = 0 ; idxPart < originalNbParticles ; ++idxPart){
originalParticlesUnsorted[idxPart].particle = inOriginalParticles[idxPart];
host.setX( GetTreeCoordinate( originalParticlesUnsorted[idxPart].particle.getPosition().getX() - boxCorner.getX(), boxWidthAtLeafLevel,
boxWidth, TreeHeight ));
host.setY( GetTreeCoordinate( originalParticlesUnsorted[idxPart].particle.getPosition().getY() - boxCorner.getY(), boxWidthAtLeafLevel,
boxWidth, TreeHeight ));
host.setZ( GetTreeCoordinate( originalParticlesUnsorted[idxPart].particle.getPosition().getZ() - boxCorner.getZ(), boxWidthAtLeafLevel,
boxWidth, TreeHeight ));
host.setX( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesUnsorted[idxPart].particle.getPosition().getX() - boxCorner.getX(), boxWidth, boxWidthAtLeafLevel,
TreeHeight ));
host.setY( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesUnsorted[idxPart].particle.getPosition().getY() - boxCorner.getY(), boxWidth, boxWidthAtLeafLevel,
TreeHeight ));
host.setZ( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesUnsorted[idxPart].particle.getPosition().getZ() - boxCorner.getZ(), boxWidth, boxWidthAtLeafLevel,
TreeHeight ));
originalParticlesUnsorted[idxPart].index = host.getMortonIndex(TreeHeight - 1);
}
......@@ -493,7 +482,7 @@ public:
delete[] particlesArrayInLeafOrder;
delete[] leavesOffsetInParticles;
#ifdef ScalFMM_USE_LOG
#ifdef SCALFMM_USE_LOG
/** To produce stats after the Equalize phase */
{
const int finalNbParticles = particleSaver->getSize();
......
......@@ -16,13 +16,14 @@
#ifndef FTREEBUILDER_H
#define FTREEBUILDER_H
#include "ScalFmmConfig.h"
#include "../Utils/FGlobal.hpp"
#include "../Utils/FLog.hpp"
#include "../Utils/FQuickSort.hpp"
#include "../Utils/FTic.hpp"
#include "../Utils/FAssert.hpp"
#include "../Containers/FOctree.hpp"
#include "../Containers/FTreeCoordinate.hpp"
#include "../Components/FBasicParticleContainer.hpp"
......@@ -47,20 +48,6 @@
template<class FReal, class OctreeClass, class LeafClass>
class FTreeBuilder{
private:
/**
* This method has been taken from the octree class,
* it computes a tree coordinate (x or y or z) from real cartesian position
*/
static int GetTreeCoordinate(const FReal inRelativePosition, const FReal boxWidthAtLeafLevel,
const FReal boxWidth, const int height) {
FAssertLF( (inRelativePosition >= 0 && inRelativePosition <= boxWidth), "inRelativePosition : ",inRelativePosition );
if(inRelativePosition == boxWidth){
return FMath::pow2(height-1)-1;
}
const FReal indexFReal = inRelativePosition / boxWidthAtLeafLevel;
return static_cast<int>(indexFReal);
}
/** This class is the relation between particles and their morton idx */
struct IndexedParticle{
MortonIndex mindex;
......@@ -112,12 +99,12 @@ public:
for(int idxParts=0; idxParts<numberOfParticle ; ++idxParts ){
// Get the Morton Index
const FTreeCoordinate host(
GetTreeCoordinate(particlesContainers.getPositions()[0][idxParts] - boxCorner.getX(),
boxWidthAtLeafLevel, boxWidth, NbLevels),
GetTreeCoordinate(particlesContainers.getPositions()[1][idxParts] - boxCorner.getY(),
boxWidthAtLeafLevel, boxWidth, NbLevels ),
GetTreeCoordinate(particlesContainers.getPositions()[2][idxParts] - boxCorner.getZ(),
boxWidthAtLeafLevel, boxWidth, NbLevels )
FCoordinateComputer::GetTreeCoordinate<FReal>(particlesContainers.getPositions()[0][idxParts] - boxCorner.getX(),
boxWidth,boxWidthAtLeafLevel, NbLevels),
FCoordinateComputer::GetTreeCoordinate<FReal>(particlesContainers.getPositions()[1][idxParts] - boxCorner.getY(),
boxWidth,boxWidthAtLeafLevel, NbLevels ),
FCoordinateComputer::GetTreeCoordinate<FReal>(particlesContainers.getPositions()[2][idxParts] - boxCorner.getZ(),
boxWidth,boxWidthAtLeafLevel, NbLevels )
);
// Store morton index and original idx
particleIndexes[idxParts].mindex = host.getMortonIndex(NbLevels-1);
......
......@@ -24,7 +24,7 @@
#ifdef STARPU_USE_CPU
#include "../StarPUUtils/FStarPUCpuWrapper.hpp"
#endif
#ifdef ScalFMM_ENABLE_CUDA_KERNEL
#ifdef SCALFMM_ENABLE_CUDA_KERNEL
#include "../StarPUUtils/FStarPUCudaWrapper.hpp"
#include "../Cuda/FCudaEmptyKernel.hpp"
#include "../Cuda/FCudaGroupAttachedLeaf.hpp"
......@@ -32,28 +32,28 @@
#include "../Cuda/FCudaGroupOfCells.hpp"