FChebInterface.h 3.73 KB
Newer Older
1
// See LICENCE file at project root
2 3 4 5 6 7 8 9 10

/**
 * This file provide an interface to the Chebyshev kernel, in order to
 * call it from C code (and thus use it through API's user defined
 * kernel feature).
 */

#ifndef FCHEBINTERFACE_H
#define FCHEBINTERFACE_H
11
#include "Utils/FGlobal.hpp"
12

13 14 15
//To access leaf datas
struct FChebLeaf_struct;
typedef struct FChebLeaf_struct ChebLeafStruct;
16 17 18 19 20 21 22

//To access a cell
struct FChebCell_struct;
typedef struct FChebCell_struct ChebCellStruct;
ChebCellStruct * ChebCellStruct_create(long long int index,int * tree_position);
void ChebCellStruct_free(ChebCellStruct * cell);

23 24 25 26 27 28 29 30 31 32
//To manage leaves
ChebLeafStruct * ChebLeafStruct_create(FSize nbPart);
void ChebLeafStruct_free(void * leafData);
void ChebLeafStruct_fill(FSize nbPart, const FSize * idxPart,
                         long long morton_index, void * leafData,
                         void * userData);

void ChebLeafStruct_get_back_results(void * leafData,
                                     double ** forceXptr,  double ** forceYptr,  double ** forceZptr,
                                     double ** potentialsptr);
33 34 35 36 37 38 39 40 41 42 43

//To access the kernel
struct FChebKernel_struct;
typedef struct FChebKernel_struct ChebKernelStruct;
ChebKernelStruct * ChebKernelStruct_create(int inTreeHeight,
                                           double inBoxWidth,
                                           double* inBoxCenter);

void ChebKernelStruct_free(void * kernel);
//To access kernel member function

44
void ChebKernel_P2M(void * leafCell, void * leafData, FSize nbParticles,const FSize* particleIndexes, void* kernel);
45
void ChebKernel_M2M(int level, void* parentCell, int childPosition, void* childCell, void* kernel);
46 47
//Change here to somethong nearer M2L defined in Src/Components/FAbstractKernels.hpp
void ChebKernel_M2L(int level, void* targetCell,const int*neighborPositions,int size, void** sourceCell, void* kernel);
48
void ChebKernel_L2L(int level, void* parentCell, int childPosition, void* childCell, void* kernel);
49 50 51
void ChebKernel_L2P(void* leafCell, void * leafData, FSize nbParticles, const FSize* particleIndexes, void* kernel);
void ChebKernel_P2P(void * targetLeaf, FSize nbParticles, const FSize* particleIndexes,
                    void ** sourceLeaves,
52 53
                    const FSize ** sourceParticleIndexes, FSize * sourceNbPart,
                    const int * sourcePosition,const int size,void* userData);
54 55 56 57 58 59 60 61 62
void ChebKernel_P2P_old(void * targetLeaf, FSize nbParticles, const FSize* particleIndexes,
                        void ** sourceLeaves,
                        const FSize ** sourceParticleIndexes,FSize* sourceNbPart,
                        const int * sourcePosition,const int size, void* inKernel);

void ChebKernel_P2PRemote(void * targetLeaf,FSize nbParticles, const FSize* particleIndexes,
                          void ** sourceLeaves,
                          const FSize ** sourceParticleIndexes,FSize * sourceNbPart,
                          const int * sourcePosition, const int size, void* inKernel);
63

64
void ChebCell_reset(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell, void * kernel);
65

66
FSize ChebCell_getSize(int level, long long morton_index);
67 68 69 70 71

void ChebCell_copy(void * userDatas, FSize size, void * memoryAllocated);

void* ChebCell_restore(int level, void * arrayTobeRead);

72 73 74 75 76 77
FSize ChebLeaf_getSize(FSize nbPart);

void ChebLeaf_copy(FSize nbPart,void * userdata, void * memAllocated);

void * ChebLeaf_restore(FSize nbPart,void * memToRead);

78 79 80 81
typedef struct myUserDatas{
    ChebKernelStruct * kernelStruct;
    double * insertedPositions;
    double * myPhyValues;
PIACIBELLO Cyrille's avatar
PIACIBELLO Cyrille committed
82
    double ** forcesComputed;
83 84
    //In the same way we store multiples forces array.
    double ** potentials;
85
    double totalEnergy;
86 87 88 89
}UserData;


#endif //FCHEBINTERFACE_H