/** * \file fmm_cheb.hpp * \author Dhairya Malhotra, dhairya.malhotra@gmail.com * \date 3-07-2011 * \brief This file contains the definition of the FMM_Cheb class. * This handles all the translations through matrix multiplications. */ #include #include #include #include #include #include #include #include #include #include #ifndef _PVFMM_FMM_CHEB_HPP_ #define _PVFMM_FMM_CHEB_HPP_ namespace pvfmm{ template class FMM_Cheb: public FMM_Pts{ public: typedef typename FMM_Pts::FMMTree_t FMMTree_t; typedef typename FMMNode::Real_t Real_t; typedef FMMNode FMMNode_t; /** * \brief This class contains FMM specific data that each node contains * along with the functions functions for manipulating the data. */ class FMMData: public FMM_Pts::FMMData{ public: virtual FMM_Data* NewData(){ return new FMMData;} //FMM specific node data. Vector cheb_out; }; /** * \brief Constructor. */ FMM_Cheb(mem::MemoryManager* mem_mgr=NULL){}; /** * \brief Virtual destructor. */ virtual ~FMM_Cheb(); /** * \brief Initialize all the translation matrices (or load from file). * \param[in] mult_order Order of multipole expansion. * \param[in] cheb_deg Degree of Chebyshev polynomials. * \param[in] kernel Kernel functions and related data. */ void Initialize(int mult_order, int cheb_deg, const MPI_Comm& comm, const Kernel* kernel); /** * \brief Number of source points per box (or the parameter describing the * order of approximation of source distribution). */ int& ChebDeg(){return cheb_deg;} virtual void CollectNodeData(FMMTree_t* tree, std::vector& nodes, std::vector >& buff, std::vector >& n_list, std::vector* > > vec_list = std::vector* > >(0)); /** * \brief Initialize multipole expansions for the given array of leaf nodes * at a given level. */ virtual void Source2UpSetup(SetupData& setup_data, FMMTree_t* tree, std::vector >& node_data, std::vector >& n_list, int level, bool device); virtual void Source2Up (SetupData& setup_data, bool device=false); /** * \brief Compute X-List intractions. */ virtual void X_ListSetup(SetupData& setup_data, FMMTree_t* tree, std::vector >& node_data, std::vector >& n_list, int level, bool device); virtual void X_List (SetupData& setup_data, bool device=false); /** * \brief Compute target potential from the local expansion. */ virtual void Down2TargetSetup(SetupData& setup_data, FMMTree_t* tree, std::vector >& node_data, std::vector >& n_list, int level, bool device); virtual void Down2Target (SetupData& setup_data, bool device=false); /** * \brief Compute W-List intractions. */ virtual void W_ListSetup(SetupData& setup_data, FMMTree_t* tree, std::vector >& node_data, std::vector >& n_list, int level, bool device); virtual void W_List (SetupData& setup_data, bool device=false); /** * \brief Compute U-List intractions. */ virtual void U_ListSetup(SetupData& setup_data, FMMTree_t* tree, std::vector >& node_data, std::vector >& n_list, int level, bool device); virtual void U_List (SetupData& setup_data, bool device=false); virtual void PostProcessing(std::vector& nodes); /** * \brief For each node, copy FMM output from FMM_Data to the node. */ virtual void CopyOutput(FMMNode** nodes, size_t n){ for(size_t i=0;iDataDOF()=this->kernel->ker_dim[1]; if(nodes[i]->IsLeaf() && !nodes[i]->IsGhost()){ Vector& cheb_data=nodes[i]->ChebData(); Vector& cheb_out =((FMMData*)nodes[i]->FMMData())->cheb_out; if(cheb_data.Dim()!=cheb_out.Dim()) cheb_data.ReInit(0); cheb_data = cheb_out; } } FMM_Pts::CopyOutput(nodes,n); } protected: virtual Permutation& PrecompPerm(Mat_Type type, Perm_Type perm_indx); virtual Matrix& Precomp(int level, Mat_Type type, size_t mat_indx); private: int cheb_deg; //Order of Cheb. approx. }; }//end namespace #include #endif //_PVFMM_FMM_CHEB_HPP_