Commit 953a3dd9 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files
parents 78a1905a faaf232f
...@@ -24,16 +24,16 @@ extern "C" scalfmm_handle scalfmm_init(/*int TreeHeight,double BoxWidth,double* ...@@ -24,16 +24,16 @@ extern "C" scalfmm_handle scalfmm_init(/*int TreeHeight,double BoxWidth,double*
handle->engine = new FInterEngine<ChebCell,ChebKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); handle->engine = new FInterEngine<ChebCell,ChebKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType);
break; break;
// case 2: // case 2:
// //TODO typedefs // //TODO typedefs
// typedef FP2PParticleContainerIndexed<> ContainerClass; // typedef FP2PParticleContainerIndexed<> ContainerClass;
// typedef FUnifCell<7> UnifCell; // typedef FUnifCell<7> UnifCell;
// typedef FInterpMatrixKernelR MatrixKernelClass; // typedef FInterpMatrixKernelR MatrixKernelClass;
// typedef FUnifKernel<UnifCell,ContainerClass,MatrixKernelClass,7> UnifKernel; // typedef FUnifKernel<UnifCell,ContainerClass,MatrixKernelClass,7> UnifKernel;
// handle->engine = new FInterEngine<UnifCell,UnifKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); // handle->engine = new FInterEngine<UnifCell,UnifKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType);
// break; // break;
default: default:
std::cout<< "Kernel type unsupported" << std::endl; std::cout<< "Kernel type unsupported" << std::endl;
...@@ -168,8 +168,8 @@ extern "C" void ChebKernel_M2M(int level, void* parentCell, int childPosition, ...@@ -168,8 +168,8 @@ extern "C" void ChebKernel_M2M(int level, void* parentCell, int childPosition,
//Get the kernel //Get the kernel
ChebKernelStruct * inKernelStruct = reinterpret_cast<UserData*>(inKernel)->kernelStruct; ChebKernelStruct * inKernelStruct = reinterpret_cast<UserData*>(inKernel)->kernelStruct;
inKernelStruct->kernel[id_thread]->getPtrToInterpolator()->applyM2M(childPosition, inKernelStruct->kernel[id_thread]->getPtrToInterpolator()->applyM2M(childPosition,
childChebCell->getMultipole(0), childChebCell->getMultipole(0),
parentChebCell->getMultipole(0)); parentChebCell->getMultipole(0));
} }
extern "C" void ChebKernel_M2L(int level, void* targetCell, void* sourceCell[343], void* inKernel){ extern "C" void ChebKernel_M2L(int level, void* targetCell, void* sourceCell[343], void* inKernel){
...@@ -198,7 +198,7 @@ extern "C" void ChebKernel_M2L(int level, void* targetCell, void* sourceCell[34 ...@@ -198,7 +198,7 @@ extern "C" void ChebKernel_M2L(int level, void* targetCell, void* sourceCell[34
} }
extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, void* childCell, void* inKernel){ extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, void* childCell, void* inKernel){
//Get our structures //Get our structures
ChebCellStruct * parentCellStruct = reinterpret_cast<ChebCellStruct *>(parentCell); ChebCellStruct * parentCellStruct = reinterpret_cast<ChebCellStruct *>(parentCell);
ChebCellStruct * childCellStruct = reinterpret_cast<ChebCellStruct *>(childCell); ChebCellStruct * childCellStruct = reinterpret_cast<ChebCellStruct *>(childCell);
//get real cheb cell //get real cheb cell
...@@ -211,8 +211,8 @@ extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, v ...@@ -211,8 +211,8 @@ extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, v
//Get the kernel //Get the kernel
ChebKernelStruct * inKernelStruct = reinterpret_cast<UserData*>(inKernel)->kernelStruct; ChebKernelStruct * inKernelStruct = reinterpret_cast<UserData*>(inKernel)->kernelStruct;
inKernelStruct->kernel[id_thread]->getPtrToInterpolator()->applyL2L(childPosition, inKernelStruct->kernel[id_thread]->getPtrToInterpolator()->applyL2L(childPosition,
parentChebCell->getLocal(0), parentChebCell->getLocal(0),
childChebCell->getLocal(0)); childChebCell->getLocal(0));
} }
extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* particleIndexes, void* inKernel){ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* particleIndexes, void* inKernel){
...@@ -221,12 +221,12 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -221,12 +221,12 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
tempContainer->reserve(nbParticles); tempContainer->reserve(nbParticles);
FPoint pos; FPoint pos;
for(int i=0 ; i<nbParticles ; ++i){ for(int i=0 ; i<nbParticles ; ++i){
pos = FPoint(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ], pos = FPoint(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1], reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]); reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]);
double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]]; double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]];
tempContainer->push(pos,particleIndexes[i],Phi); tempContainer->push(pos,particleIndexes[i],Phi);
} }
//Get our structures //Get our structures
ChebCellStruct * leafCellStruct = reinterpret_cast<ChebCellStruct *>(leafCell); ChebCellStruct * leafCellStruct = reinterpret_cast<ChebCellStruct *>(leafCell);
//get real cheb cell //get real cheb cell
...@@ -244,17 +244,17 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -244,17 +244,17 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
double * forcesToFill = reinterpret_cast<UserData *>(inKernel)->forcesComputed[id_thread]; double * forcesToFill = reinterpret_cast<UserData *>(inKernel)->forcesComputed[id_thread];
const FVector<int>& indexes = tempContainer->getIndexes(); const FVector<int>& indexes = tempContainer->getIndexes();
for(int idxPart = 0 ; idxPart<nbParticles ; ++idxPart){ for(int idxPart = 0 ; idxPart<nbParticles ; ++idxPart){
forcesToFill[indexes[idxPart]*3+0] += tempContainer->getForcesX()[idxPart]; forcesToFill[indexes[idxPart]*3+0] += tempContainer->getForcesX()[idxPart];
forcesToFill[indexes[idxPart]*3+1] += tempContainer->getForcesY()[idxPart]; forcesToFill[indexes[idxPart]*3+1] += tempContainer->getForcesY()[idxPart];
forcesToFill[indexes[idxPart]*3+2] += tempContainer->getForcesZ()[idxPart]; forcesToFill[indexes[idxPart]*3+2] += tempContainer->getForcesZ()[idxPart];
} }
delete tempContainer; delete tempContainer;
tempContainer=nullptr; tempContainer=nullptr;
} }
void ChebKernel_P2P(int nbParticles, const int* particleIndexes, void ChebKernel_P2P(int nbParticles, const int* particleIndexes,
const int * sourceParticleIndexes[27],int sourceNbPart[27],void* inKernel){ const int * sourceParticleIndexes[27],int sourceNbPart[27],void* inKernel){
//Create temporary FSimpleLeaf for target //Create temporary FSimpleLeaf for target
......
...@@ -119,14 +119,16 @@ int main(int argc, char ** av){ ...@@ -119,14 +119,16 @@ int main(int argc, char ** av){
int treeHeight = atoi(av[2]); int treeHeight = atoi(av[2]);
} }
double* particleXYZ = malloc(sizeof(double)*3*nbPart);
double* physicalValues = malloc(sizeof(double)*nbPart);
double boxWidth = 1.0; double boxWidth = 1.0;
double boxCenter[3]; double boxCenter[3];
boxCenter[0] = boxCenter[1] = boxCenter[2] = 0.0; boxCenter[0] = boxCenter[1] = boxCenter[2] = 0.0;
//Allocation of the positions and physical values
double* particleXYZ = malloc(sizeof(double)*3*nbPart);
double* physicalValues = malloc(sizeof(double)*nbPart);
{ {
printf("Creating Particles:\n"); printf("Creating Particles:\n");
int idxPart; int idxPart;
...@@ -274,7 +276,7 @@ int main(int argc, char ** av){ ...@@ -274,7 +276,7 @@ int main(int argc, char ** av){
nbPartOkay++; nbPartOkay++;
} }
else{ else{
//printf("id : %d : %e, %e, %e\n",idxPart,diffX,diffY,diffZ); printf("id : %d : %e, %e, %e\n",idxPart,diffX,diffY,diffZ);
} }
//That part is to verify with our usual exec' if everything is alright //That part is to verify with our usual exec' if everything is alright
if(idxPart == 0 || idxPart == nbPart/2 || idxPart == nbPart-1){ if(idxPart == 0 || idxPart == nbPart/2 || idxPart == nbPart-1){
......
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