utils.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * \file utils.hpp
  3. * \author Dhairya Malhotra, dhairya.malhotra88@gmail.com
  4. * \date 1-1-2011
  5. */
  6. #ifndef _UTILS_
  7. #define _UTILS_
  8. #include <vector>
  9. #include <mpi.h>
  10. #include <cheb_utils.hpp>
  11. #include <fmm_tree.hpp>
  12. template <class FMM_Mat_t>
  13. void CheckFMMOutput(FMM_Tree<FMM_Mat_t>* mytree, Kernel<typename FMM_Mat_t::Real_t>* mykernel);
  14. template <class Real_t>
  15. struct TestFn;
  16. template <>
  17. struct TestFn<double>{
  18. typedef void (*Fn_t)(double* c, int n, double* out);
  19. };
  20. template <>
  21. struct TestFn<float>{
  22. typedef void (*Fn_t)(float* c, int n, float* out);
  23. };
  24. template <class FMMTree_t>
  25. void CheckChebOutput(FMMTree_t* mytree, typename TestFn<typename FMMTree_t::Real_t>::Fn_t fn_poten, int fn_dof, std::string t_name="");
  26. enum DistribType{
  27. UnifGrid,
  28. RandUnif,
  29. RandGaus,
  30. RandElps,
  31. RandSphr
  32. };
  33. template <class Real_t>
  34. std::vector<Real_t> point_distrib(DistribType, size_t N, MPI_Comm comm);
  35. void commandline_option_start(int argc, char** argv, const char* help_text=NULL);
  36. const char* commandline_option(int argc, char** argv, const char* opt, const char* def_val, bool required, const char* err_msg);
  37. void commandline_option_end(int argc, char** argv);
  38. #include <utils.txx>
  39. #endif