Commit dd33372b authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

Changes relative to int -> FSize propagated inside API

parent f309715a
......@@ -16,6 +16,8 @@
#ifndef CKERNELAPI_H
#define CKERNELAPI_H
typedef long long int FSize;
/**
* @file
* This file defines the API for the C USER. The objective is to
......@@ -362,7 +364,7 @@ void scalfmm_algorithm_config(scalfmm_handle Handle,scalfmm_algorithm config);
* @param particleIndexes indexes of particles currently computed
* @param userData datas specific to the user's kernel
*/
typedef void (*Callback_P2M)(void* leafCell, FSize nbParticles, const int* particleIndexes, void* userData);
typedef void (*Callback_P2M)(void* leafCell, FSize nbParticles, const FSize* particleIndexes, void* userData);
/**
* @brief Function to be filled by user's M2M
......@@ -411,7 +413,7 @@ typedef void (*Callback_L2L)(int level, void* parentCell, int childPosition, voi
* @param particleIndexes indexes of particles currently computed
* @param userData datas specific to the user's kernel
*/
typedef void (*Callback_L2P)(void* leafCell, FSize nbParticles,const int* particleIndexes, void* userData);
typedef void (*Callback_L2P)(void* leafCell, FSize nbParticles,const FSize* particleIndexes, void* userData);
/**
* @brief Function to be filled by user's P2P
......@@ -421,7 +423,7 @@ typedef void (*Callback_L2P)(void* leafCell, FSize nbParticles,const int* partic
* @param sourceParticleIndexes indexes of cource particles currently computed
* @param userData datas specific to the user's kernel
*/
typedef void (*Callback_P2P)(FSize nbParticles, const int* particleIndexes, int nbSourceParticles, const int* sourceParticleIndexes, void* userData);
typedef void (*Callback_P2P)(FSize nbParticles, const FSize* particleIndexes, FSize nbSourceParticles, const FSize* sourceParticleIndexes, void* userData);
/**
* @brief Function to be filled by user's P2P
......@@ -432,8 +434,8 @@ typedef void (*Callback_P2P)(FSize nbParticles, const int* particleIndexes, int
* @param sourceNbPart array containing the number of part in each neighbors
* @param userData datas specific to the user's kernel
*/
typedef void (*Callback_P2PFull)(FSize nbParticles, const int* particleIndexes,
const int * sourceParticleIndexes[27],int sourceNbPart[27], void* userData);
typedef void (*Callback_P2PFull)(FSize nbParticles, const FSize* particleIndexes,
const FSize * sourceParticleIndexes[27],FSize sourceNbPart[27], void* userData);
/**
......@@ -442,7 +444,7 @@ typedef void (*Callback_P2PFull)(FSize nbParticles, const int* particleIndexes,
* @param particleIndexes indexes of particles currently computed
* @param userData datas specific to the user's kernel
*/
typedef void (*Callback_P2PInner)(FSize nbParticles, const int* particleIndexes, void* userData);
typedef void (*Callback_P2PInner)(FSize nbParticles, const FSize* particleIndexes, void* userData);
......
This diff is collapsed.
......@@ -222,8 +222,8 @@ struct ScalFmmCoreHandle {
struct ScalFmmCoreConfig {
// Read/Write parameter
int treeHeight; // Number of level in the octree
FReal boxWidth; // Simulation box size (root level)
FPoint<FReal> boxCenter; // Center position of the box simulation(FReal[3])
double boxWidth; // Simulation box size (root level)
FPoint<double> boxCenter; // Center position of the box simulation(FReal[3])
};
ScalFmmCoreConfig config;
......@@ -391,5 +391,27 @@ extern "C" void scalfmm_user_kernel_config(scalfmm_handle Handle, Scalfmm_Kernel
((ScalFmmCoreHandle * ) Handle)->engine->user_kernel_config(userKernel,userDatas);
}
/**
* These functions are just translating functions.
*/
//< This function fill the childFullPosition[3] with [-1;1] to know the position of a child relatively to
//< its position from its parent
extern "C" void scalfmm_utils_parentChildPosition(int childPosition, int* childFullPosition){
childFullPosition[2] = (childPosition%2 ? 1 : -1);
childFullPosition[1] = ((childPosition/2)%2 ? 1 : -1);
childFullPosition[0] = ((childPosition/4)%2 ? 1 : -1);
}
//< This function fill the childFullPosition[3] with [-3;3] to know the position of a interaction
//< cell relatively to its position from the target
extern "C" void scalfmm_utils_interactionPosition(int interactionPosition, int* srcPosition){
srcPosition[2] = interactionPosition%7 - 3;
srcPosition[1] = (interactionPosition/7)%7 - 3;
srcPosition[0] = (interactionPosition/49)%7 - 3;
}
#endif
This diff is collapsed.
......@@ -87,6 +87,7 @@ Scalfmm_Cell_Descriptor CoreCell::user_cell_descriptor;
*/
template< class CellClass, class ContainerClass>
class CoreKernel : public FAbstractKernels<CellClass,ContainerClass> {
Scalfmm_Kernel_Descriptor kernel;
void* userData;
......@@ -165,8 +166,8 @@ public:
if(kernel.p2p_full){
//Create the arrays of size and indexes
int nbPartPerNeighbors[27];
const int * indicesPerNeighbors[27];
FSize nbPartPerNeighbors[27];
const FSize * indicesPerNeighbors[27];
for(int idx=0 ; idx<27 ; ++idx){
if(neighbors[idx]){
nbPartPerNeighbors[idx] = neighbors[idx]->getNbParticles();
......@@ -277,7 +278,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
positionsToFill[indexes[idxPart]*3+0] = sources->getPositions()[0][idxPart];
positionsToFill[indexes[idxPart]*3+1] = sources->getPositions()[1][idxPart];
......@@ -290,7 +291,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
int iterPart = 0;
bool notFoundYet = true;
......@@ -313,7 +314,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
X[indexes[idxPart]] = sources->getPositions()[0][idxPart];
Y[indexes[idxPart]] = sources->getPositions()[1][idxPart];
......@@ -326,7 +327,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
int iterPart = 0;
bool notFoundYet = true;
......@@ -353,7 +354,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] += updatedXYZ[indexes[idxPart]*3+0];
sources->getWPositions()[1][idxPart] += updatedXYZ[indexes[idxPart]*3+1];
......@@ -366,7 +367,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] += X[indexes[idxPart]];
sources->getWPositions()[1][idxPart] += Y[indexes[idxPart]];
......@@ -380,7 +381,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] = updatedXYZ[indexes[idxPart]*3+0];
sources->getWPositions()[1][idxPart] = updatedXYZ[indexes[idxPart]*3+1];
......@@ -393,7 +394,7 @@ public:
octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc();
const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles();
FSize nbPartThere = sources->getNbParticles();
for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] = X[indexes[idxPart]];
sources->getWPositions()[1][idxPart] = Y[indexes[idxPart]];
......
......@@ -11,6 +11,7 @@
#include "../../Src/Kernels/Chebyshev/FChebInterface.h"
/**
* This file is an example of the user defined kernel API, with link
* to our Chebyshev Kernel
......@@ -34,7 +35,7 @@ void cheb_free_cell(void * inCell){
* @brief Wrapper to FMM operators (refer to CScalfmmApi.h to get the
* detailed descriptions)
*/
void cheb_p2m(void* cellData, FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
void cheb_p2m(void* cellData, FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
ChebKernel_P2M(cellData,nbParticlesInLeaf,particleIndexes,userData);
}
void cheb_m2m(int level, void* parentCell, int childPosition, void* childCell, void* userData){
......@@ -46,11 +47,11 @@ void cheb_m2l_full(int level, void* targetCell, void* sourceCell[343], void* use
void cheb_l2l(int level, void* parentCell, int childPosition, void* childCell, void* userData){
ChebKernel_L2L( level, parentCell, childPosition, childCell, userData);
}
void cheb_l2p(void* leafCell, FSize nbParticles, const int* particleIndexes, void* userData){
void cheb_l2p(void* leafCell, FSize nbParticles, const FSize* particleIndexes, void* userData){
ChebKernel_L2P( leafCell, nbParticles, particleIndexes, userData);
}
void cheb_p2pFull(FSize nbParticles, const int* particleIndexes,
const int * sourceParticleIndexes[27], int sourceNbPart[27],void* userData) {
void cheb_p2pFull(FSize nbParticles, const FSize* particleIndexes,
const FSize * sourceParticleIndexes[27], FSize sourceNbPart[27],void* userData) {
ChebKernel_P2P(nbParticles, particleIndexes, sourceParticleIndexes, sourceNbPart, userData);
}
......@@ -276,15 +277,15 @@ int main(int argc, char ** av){
nbPartOkay++;
}
else{
printf("id : %d : %e, %e, %e\n",idxPart,diffX,diffY,diffZ);
printf("id : %lld : %e, %e, %e\n",idxPart,diffX,diffY,diffZ);
}
//That part is to verify with our usual exec' if everything is alright
if(idxPart == 0 || idxPart == nbPart/2 || idxPart == nbPart-1){
printf("User one's id : %d : %e, %e, %e\n",idxPart,
printf("User one's id : %lld : %e, %e, %e\n",idxPart,
forcesToStore[0][idxPart*3+0],
forcesToStore[0][idxPart*3+1],
forcesToStore[0][idxPart*3+2]);
printf("Chebyshev one's id : %d : %e, %e, %e\n",idxPart,
printf("Chebyshev one's id : %lld : %e, %e, %e\n",idxPart,
forcesRef[idxPart*3+0],
forcesRef[idxPart*3+1],
forcesRef[idxPart*3+2]);
......
......@@ -48,13 +48,13 @@ ChebKernelStruct * ChebKernelStruct_create(int inTreeHeight,
void ChebKernelStruct_free(void * kernel);
//To access kernel member function
void ChebKernel_P2M(void * leafCell, FSize nbParticles,const int* particleIndexes, void* kernel);
void ChebKernel_P2M(void * leafCell, FSize nbParticles,const FSize* particleIndexes, void* kernel);
void ChebKernel_M2M(int level, void* parentCell, int childPosition, void* childCell, void* kernel);
void ChebKernel_M2L(int level, void* targetCell, void* sourceCell[343], void* kernel);
void ChebKernel_L2L(int level, void* parentCell, int childPosition, void* childCell, void* kernel);
void ChebKernel_L2P(void* leafCell, FSize nbParticles, const int* particleIndexes, void* kernel);
void ChebKernel_P2P(FSize nbParticles, const int* particleIndexes,
const int * sourceParticleIndexes[27], int sourceNbPart[27],void* userData);
void ChebKernel_L2P(void* leafCell, FSize nbParticles, const FSize* particleIndexes, void* kernel);
void ChebKernel_P2P(FSize nbParticles, const FSize* particleIndexes,
const FSize * sourceParticleIndexes[27], FSize sourceNbPart[27],void* userData);
typedef struct myUserDatas{
ChebKernelStruct * kernelStruct;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment