Commit b8eec341 authored by COULAUD Olivier's avatar COULAUD Olivier

Add periodic boundary conditions in Exemples ; Check periodic boundary conditions.

parent e089d8b5
// ==== CMAKE =====
// @FUSE_BLAS
// ================
// Keep in private GIT
//
//
/** \brief Chebyshev FMM example
*
* \file
* \authors O. Coulaud
*
* This program runs the FMM Algorithm with the interpolation kernel based on
* Chebyshev (grid points) interpolation (1/r kernel). It then compares the
* results with a direct computation.
*/
#include <string>
#include "Kernels/Chebyshev/FChebCell.hpp"
#include "Kernels/Chebyshev/FChebSymKernel.hpp"
//
template<typename FReal, int ORDER>
using FInterpolationCell = FChebCell<FReal, ORDER>;
template<typename FReal, typename GroupCellClass,
typename GroupContainerClass,
typename MatrixKernelClass, int ORDER>
using FInterpolationKernel = FChebSymKernel<FReal,
GroupCellClass,
GroupContainerClass,
MatrixKernelClass,
ORDER> ;
const std::string interpolationType("Chebyshev interpolation");
#include "MPIInterpolationFMM.hpp"
This diff is collapsed.
// ==== CMAKE =====
// @FUSE_BLAS
// @FUSE_FFT
// ================
// Keep in private GIT
//
//
/** \brief Uniform FMM example
*
* \file
* \authors B. Bramas, O. Coulaud
*
* This program runs the FMM Algorithm with the interpolation kernel based on
* uniform (grid points) interpolation (1/r kernel). It then compares the
* results with a direct computation.
*/
#include <string>
#include "Kernels/Uniform/FUnifCell.hpp"
#include "Kernels/Uniform/FUnifKernel.hpp"
//
template<typename FReal, int ORDER>
using FInterpolationCell = FUnifCell<FReal, ORDER>;
template<typename FReal, typename GroupCellClass,
typename GroupContainerClass,
typename MatrixKernelClass, int ORDER>
using FInterpolationKernel = FUnifKernel<FReal,
GroupCellClass,
GroupContainerClass,
MatrixKernelClass,
ORDER> ;
const std::string interpolationType("Uniform interpolation");
#include "MPIInterpolationFMM.hpp"
......@@ -280,7 +280,7 @@ int main(int argc, char *argv[]) {
std::string outputFile(FParameters::getStr(argc,argv,FParameterDefinitions::OutputFile.options, "outputMPIFMA"));
FMpiFmaGenericWriter<FReal> paraWriter(outputFile,FMpiComm);
paraWriter.writeDistributionOfParticlesFromOctree(*computeOnGroupTree,loader.getNumberOfParticles(),mortonCellDistribution);
paraWriter.writeDistributionOfParticlesFromGroupedOctree(*computeOnGroupTree,loader.getNumberOfParticles(),mortonCellDistribution);
}
return 0;
}
......@@ -60,7 +60,14 @@ struct EwalParticle {
// Simply create particles and try the kernels
int main(int argc, char ** argv){
FHelpDescribeAndExit(argc, argv, "Please read the code to know more, sorry");
FHelpDescribeAndExit(argc, argv, "Please read the code to know more, sorry",
FParameterDefinitions::OctreeHeight,
FParameterDefinitions::OctreeSubHeight,
FParameterDefinitions::InputFile,
FParameterDefinitions::OutputFile,
FParameterDefinitions::NbThreads,
FParameterDefinitions::EnabledVerbose,
FParameterDefinitions::PeriodicityNbLevels);
typedef double FReal;
typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
......@@ -69,7 +76,7 @@ int main(int argc, char ** argv){
#ifdef SCALFMM_USE_BLAS
// begin Chebyshev kernel
// accuracy
const unsigned int ORDER = 13;
const unsigned int ORDER = 6;
// typedefs
typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
typedef FChebCell<FReal,ORDER> CellClass;
......@@ -102,8 +109,8 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 4);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 2);
const int PeriodicDeep = FParameters::getValue(argc,argv,"-per", 3);
const char* const filename = FParameters::getStr(argc,argv,FParameterDefinitions::InputFile.options, "../Data/EwalTest_Periodic.run");
const int PeriodicDeep = FParameters::getValue(argc,argv,FParameterDefinitions::PeriodicityNbLevels.options, 3);
const std::string filename = FParameters::getStr(argc,argv,FParameterDefinitions::InputFile.options, "../Data/EwalTest_Periodic.run");
// file for -saveError option
std::ofstream errorfile("outputEwaldError.txt",std::ios::out);
......@@ -117,11 +124,11 @@ int main(int argc, char ** argv){
// -----------------------------------------------------
std::cout << "Opening : " << filename << "\n";
FDlpolyLoader<FReal> *loader = nullptr ;
if(FParameters::existParameter(argc, argv, "-bin")){
loader = new FDlpolyBinLoader<FReal>(filename);
if( filename.find(".bin") != std::string::npos ){
loader = new FDlpolyBinLoader<FReal>(filename.c_str());
}
else {
loader = new FDlpolyAsciiLoader<FReal>(filename);
loader = new FDlpolyAsciiLoader<FReal>(filename.c_str());
}
if(! loader->isOpen()){
......@@ -232,7 +239,7 @@ int main(int argc, char ** argv){
FTreeCoordinate min{0,0,0} , max{0,0,0};
if( FParameters::existParameter(argc, argv, "-noper") ){
if( ! FParameters::existParameter(argc, argv, FParameterDefinitions::PeriodicityNbLevels.options) ){
#ifndef SCALFMM_USE_BLAS
KernelClass kernels( DevP, NbLevels, loader->getBoxWidth(), loader->getCenterOfBox());
#else
......@@ -498,6 +505,7 @@ int main(int argc, char ** argv){
}
});
energy *= 0.5*scaleEnergy ;
std::cout << " Energy before correction " << energy << " Correction: " <<coeffCorrectionDLPOLY*dipoleNorm*scaleEnergy <<std::endl;
if(scale){
energy -= coeffCorrectionDLPOLY*dipoleNorm*scaleEnergy ;
}
......
......@@ -6,28 +6,28 @@
#include <cstdio>
#include <cstdlib>
#include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Utils/FTic.hpp"
#include "Utils/FParameters.hpp"
#include "Utils/FTic.hpp"
#include "../../Src/Files/FRandomLoader.hpp"
#include "Files/FRandomLoader.hpp"
#include "../../Src/Files/FPerLeafLoader.hpp"
#include "Files/FPerLeafLoader.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "Containers/FOctree.hpp"
#include "Containers/FVector.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FTestParticleContainer.hpp"
#include "Components/FTestParticleContainer.hpp"
#include "../../Src/Utils/FPoint.hpp"
#include "Utils/FPoint.hpp"
#include "../../Src/Components/FTestCell.hpp"
#include "../../Src/Components/FTestKernels.hpp"
#include "Components/FTestCell.hpp"
#include "Components/FTestKernels.hpp"
#include "../../Src/Core/FFmmAlgorithmPeriodic.hpp"
#include "Core/FFmmAlgorithmPeriodic.hpp"
#include "../../Src/Utils/FParameterNames.hpp"
#include "Utils/FParameterNames.hpp"
/** This program show an example of use of
* the fmm basic algo
......
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