repositories structure
In the scalfmm directory, you can locate several folders and the directory structure is as follows:
-
Src sources folder
-
Arranger:
-
Components: Basic components.
-
Containers: The containers used in ScalFMM
-
Core: The different kind of parallel algorithms: Threads means OpenMP (fork-join, task, ...) while Proc is for MPI.
-
Extensions: classes or methods to extend the FMM.
-
Files: our different loaders/wrtiters for particule (csvn vtk, FMA, ...)
-
GroupTree: A grouped octreed used with runtime system to improve the granularity.
-
Kernels: The different kernels available ins ScalFMM. One forlder per kernel.
-
Utils: All classes used inside the Library that are not specific to the FFM method.
-
Examples Main drivers: distribution generation, FMM drivers (Rotation (1/r), Interpolation (Uniform/Lagrange and Chebyschev)
-
Tests. Other examples (prototpes) to understand how you can use the different features of ScalFMM.
-
UTests unit tests (CTEST)
-
Addons folder that contains one sub-folder per addon
-
Doc the documentation directory use Doxygen to generate it)
-
Data folder which contains particles files or any other data needed per the simulation examples.
Here we focus mainly on the Tests and UTests folders, and we encourage users to look directly in the code file to see how things are made.
How to use
The parameters system
Most of the examples need some user parameters or let the user shows some values. This is done with the FParameters class. You can open an example and find the parameters directives, like in the Tests/Utils/testStatsTree.cpp:
This means that in the console, you can tape:
./Tests/Release/testStatsTree -depth [an height] -subdepth [a sub height] -f [a file to load]
A Concrete example : Spherical Harmonics FMM
In this part we will run a simulation with Spherical Harmonics and rotation optimization: ./Examples/Release/RotationFMM .
Create a particles file
In the test file we can read:
It means, that the test file is reading FMA file (see FMA format) which can be changed but here we still use this format. We can pass a file in parameter with the -fin option. So let first create with generateDistributions 2.000.000 particles in a unit cube and store the particle in a file with the FMA format:
./Examples/Release/generateDistributions -N 2000000 -unitcube -fout my2kkpartfile.fma
Which create a file called my2kkpartfile.fma.
Running the Simulation
With the Spherical harmonic expansion kernel we can choose the P=4 accuracy parameter for this kernel. RotationFMM
./Examples/Release/RotationFMM -f my2kkpartfile.fma -depth 5 -subdepth 3
Drivers
From Examples repository
Examples from Tests
From Tests/Utils
From Tests/Kernels
Examples from UTests
In this folder you will find the unit tests. There are some related to data structures (like vector or list) and some others related to real FMM.
-
FUTester.hpp : this is the main class for unit test.
-
utestParameters.cpp : this tests the FParameters class which allow a quick access to application command line parameter.
-
utestQuicksort.cpp : this tests the quick sort in sequential and shared memory.
-
utestRotationDirect.cpp : this tests the rotation FMM.
-
utestBoolArray.cpp : this tests the boolean array which is a data structure that enable bit bool value.
-
utestRotationDirectPeriodic.cpp : this tests the rotation kernel with periodicity.
-
utestBuffer.cpp : this tests the buffer used in the serialization of data in the MPI FMM.
-
utestSphericalDirect.cpp : this tests the Spherical Harmonic kernel.
-
utestChebyshevDirect.cpp : this tests the Chebyshev kernel.
-
utestSphericalDirectPeriodic.cpp : this tests the Chebyshev kernel with periodicity.
-
utestChebyshevDirectPeriodic.cpp : this tests the Spherical Harmonic kernel with periodicity.
-
utestSphericalWithPrevious.cpp : this tests the Spherical Harmonic kernel with a previous run.
-
utestList.cpp : this tests our home made linked list.
-
utestTest.cpp : this tests the unit test main class (this is just an example of how to use).
-
utestMorton.cpp : this tests the Morton indexing tools.
-
utestVector.cpp : this tests our home made vector.
-
utestOctree.cpp : this tests the octree validation.
Create your own application using ScalFMM
In you compile ScalFMM and enabled the Tests (by passing a parameter to CMake or by using ccmake) any cpp file that will put into the Tests/ directories will be compiled and linked to ScalFMM. Therefore it can be a quick way to create and test with scalfmm without creating your own project and thinking about the compilation and link stages. Put your file in the test directories, enable the Tests in the cmake, be sure that the CMake is generated (type cmake.. again in the build dir), and then make your_cpp_file_without_extension