diff --git a/examples/fmm_source_target.cpp b/examples/fmm_source_target.cpp index c898f90223deb7b501a3c312b68d6a72144cd698..9cf7354cbea7e8a947ad364a29ff8ca21db7f93d 100644 --- a/examples/fmm_source_target.cpp +++ b/examples/fmm_source_target.cpp @@ -12,6 +12,7 @@ // #include "scalfmm/algorithms/fmm.hpp" #include "scalfmm/algorithms/full_direct.hpp" +#include "scalfmm/interpolation/grid_storage.hpp" #include "scalfmm/interpolation/interpolation.hpp" #include "scalfmm/lists/lists.hpp" #include "scalfmm/matrix_kernels/laplace.hpp" @@ -19,13 +20,8 @@ #include "scalfmm/operators/fmm_operators.hpp" // // Tree -#include "scalfmm/interpolation/grid_storage.hpp" #include "scalfmm/tools/tree_io.hpp" -#include "scalfmm/tree/box.hpp" -#include "scalfmm/tree/cell.hpp" -#include "scalfmm/tree/group_tree_view.hpp" -#include "scalfmm/tree/leaf_view.hpp" -#include "scalfmm/tree/utils.hpp" +#include "scalfmm/tree/tree.hpp" // #include "scalfmm/meta/utils.hpp" @@ -110,10 +106,16 @@ namespace local_args std::string description = "Output particle file (with extension .fma (ascii) or bfma (binary)."; using type = std::string; }; - struct newmatrix_kernel : public laplace::args::matrix_kernel + struct newmatrix_kernel //: public laplace::args::matrix_kernel { - std::string description = "Matrix kernels: \n 0 1/r, 1) grad(1/r), 2) p & grad(1/r) 3) shift grad,\n" - "4) 1/r^2 5) ln in 2d "; + cpp_tools::cl_parser::str_vec flags = {"--kernel", "-k"}; + std::string description = "Matrix kernels: \n 0 1/r, 1) grad(1/r)\n"; + // , 2) p & grad(1/r) 3) shift grad,\n" + // "4) 1/r^2 5) ln in 2d "; + // const char* description = "Matrix kernels: \n 0) 1/r, 1) grad(1/r), 2) p & grad(1/r) 3) shift(1/r)-> " + // "grad 4) shift(1/r)-> p & grad. "; + using type = int; + type def = 0; }; struct dimension : cpp_tools::cl_parser::required_tag { @@ -380,36 +382,40 @@ auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int // // Parameter handling - auto parser = cpp_tools::cl_parser::make_parser( - cpp_tools::cl_parser::help{}, local_args::input_source_file(), local_args::input_target_file(), - args::tree_height{}, args::block_size{}, args::order{}, local_args::output_file(), local_args::newmatrix_kernel{}, - local_args::dimension{}, local_args::check{}); + auto parser = + cpp_tools::cl_parser::make_parser(cpp_tools::cl_parser::help{}, local_args::input_source_file(), + local_args::input_target_file(), args::tree_height{}, args::block_size{}, + args::order{}, local_args::output_file(), //local_args::newmatrix_kernel{}, + local_args::dimension{}, local_args::check{}); parser.parse(argc, argv); const std::string input_source_file{parser.get<local_args::input_source_file>()}; const std::string input_target_file{parser.get<local_args::input_target_file>()}; if(!input_source_file.empty()) { - std::cout << cpp_tools::colors::blue << "<params> Input source file : " << input_source_file + std::cout << cpp_tools::colors::blue << "<params> Input source file: " << input_source_file << cpp_tools::colors::reset << '\n'; } const int tree_height{parser.get<args::tree_height>()}; - std::cout << cpp_tools::colors::blue << "<params> Tree height : " << tree_height << cpp_tools::colors::reset - << '\n'; + std::cout << cpp_tools::colors::blue << "<params> Tree height: " << tree_height << cpp_tools::colors::reset << '\n'; const int group_size{parser.get<args::block_size>()}; const auto order{parser.get<args::order>()}; + std::cout << cpp_tools::colors::blue << "<params> Runtime order: " << order << cpp_tools::colors::reset << '\n'; - std::cout << cpp_tools::colors::blue << "<params> Group Size : " << group_size << cpp_tools::colors::reset << '\n'; + // std::cout << cpp_tools::colors::blue << "<params> Group Size: " << group_size << cpp_tools::colors::reset << '\n'; const auto output_file{parser.get<local_args::output_file>()}; bool check_direct{parser.exists<local_args::check>()}; if(!output_file.empty()) { - std::cout << cpp_tools::colors::blue << "<params> Output file : " << output_file << cpp_tools::colors::reset + std::cout << cpp_tools::colors::blue << "<params> Output file: " << output_file << cpp_tools::colors::reset << '\n'; } - const int matrix_type = parser.get<local_args::newmatrix_kernel>(); + const int matrix_type{0}; // = parser.get<local_args::newmatrix_kernel>(); const int dimension = parser.get<local_args::dimension>(); + std::cout << cpp_tools::colors::blue << "<params> kernel type : " << matrix_type << cpp_tools::colors::reset + << '\n'; + // switch(matrix_type) { @@ -451,60 +457,9 @@ auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int order, check_direct, output_file); } break; - // case 1: - // using options_case1 = scalfmm::options::uniform_<scalfmm::options::fft_>; - // using far_matrix_kernel_type = scalfmm::matrix_kernels::laplace::one_over_r; - - // if(dimension == 1) - // { - // using interpolation_type = - // scalfmm::interpolation::interpolator<value_type, 1, far_matrix_kernel_type, options_case1>; - // using far_field_type = scalfmm::operators::far_field_operator<interpolation_type, true>; - // using fmm_operators_type = scalfmm::operators::fmm_operators<near_field_type, far_field_type>; - // fmm_run<1, value_type, fmm_operators_type>(input_source_file, input_target_file, tree_height, group_size, - // order, check_direct, output_file); - // } - // else if(dimension == 2) - // { - // using interpolation_type = - // scalfmm::interpolation::interpolator<value_type, 2, far_matrix_kernel_type, options>; - // using far_field_type = scalfmm::operators::far_field_operator<interpolation_type, true>; - // using near_matrix_kernel_type = scalfmm::matrix_kernels::laplace::grad_one_over_r<2>; - // using near_field_type = scalfmm::operators::near_field_operator<near_matrix_kernel_type>; - - // using fmm_operators_type = scalfmm::operators::fmm_operators<near_field_type, far_field_type>; - - // fmm_run<2, value_type, fmm_operators_type>(input_source_file, input_target_file, tree_height, group_size, - // order, check_direct, output_file); - // } - // else - // { - // using interpolation_type = - // scalfmm::interpolation::interpolator<value_type, 3, far_matrix_kernel_type, options>; - // using far_field_type = scalfmm::operators::far_field_operator<interpolation_type, true>; - // using near_field_type = scalfmm::matrix_kernels::laplace::grad_one_over_r<3>; - - // using fmm_operators_type = scalfmm::operators::fmm_operators<near_field_type, far_field_type>; - - // fmm_run<3, value_type, fmm_operators_type>(input_source_file, input_target_file, tree_height, group_size, - // order, check_direct, output_file); - // } - // break; - // case 2: - // fmm_run<3, value_type, scalfmm::matrix_kernels::laplace::val_grad_one_over_r<3>>(input_file, output_file, - // postreat); break; - // case 3: - // fmm_run<3, value_type, scalfmm::matrix_kernels::laplace::like_mrhs>(input_file, output_file, postreat); - // break; - // case 4: - // test_one_over_r2<value_type>(dimension, input_file, output_file, postreat); - // break; - // case 5: - // fmm_run<2, value_type, scalfmm::matrix_kernels::laplace::ln_2d>(input_file, output_file, postreat); - // break; default: - std::cout << "Kernel not implemented. values are\n Laplace kernels: 0) 1/r, 1) grad(1/r)," - // << " 2) p + grad(1/r) 3) like_mrhs." << std::endl + std::cout << "Kernel not implemented. values are\n Laplace kernels: 0) 1/r" + // << " , 1) grad(1/r),2) p + grad(1/r) 3) like_mrhs." << std::endl // << "Scalar kernels 4) 1/r^2 5) ln in 2d" << std::endl; }