/** It should be compiled with C export */ extern "C" { #include "CScalfmmApi.h" } #include "FInterEngine.hpp" #include "FUserKernelEngine.hpp" extern "C" scalfmm_handle scalfmm_init(/*int TreeHeight,double BoxWidth,double* BoxCenter, */scalfmm_kernel_type KernelType){ ScalFmmCoreHandle * handle = new ScalFmmCoreHandle(); switch(KernelType){ case 0: handle->engine = new FUserKernelEngine(/*TreeHeight, BoxWidth, BoxCenter, */KernelType); break; case 1: //TODO typedefs typedef FP2PParticleContainerIndexed<> ContainerClass; typedef FChebCell<7> ChebCell; typedef FInterpMatrixKernelR MatrixKernelClass; typedef FChebSymKernel ChebKernel; handle->engine = new FInterEngine(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); break; case 2: //TODO typedefs typedef FP2PParticleContainerIndexed<> ContainerClass; typedef FUnifCell<7> UnifCell; typedef FInterpMatrixKernelR MatrixKernelClass; typedef FUnifKernel UnifKernel; handle->engine = new FInterEngine(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); break; default: std::cout<< "Kernel type unsupported" << std::endl; exit(0); break; } return handle; } extern "C" void scalfmm_dealloc_handle(scalfmm_handle handle, Callback_free_cell userDeallocator){ ((ScalFmmCoreHandle *) handle)->engine->intern_dealloc_handle(userDeallocator); delete ((ScalFmmCoreHandle *) handle)->engine ; delete (ScalFmmCoreHandle *) handle; }