Browse Source

Bug fix for volume FMM

Dhairya Malhotra 10 năm trước cách đây
mục cha
commit
515a6a08fd
3 tập tin đã thay đổi với 5 bổ sung6 xóa
  1. 1 2
      include/fmm_cheb.txx
  2. 2 4
      include/fmm_pts.txx
  3. 2 0
      include/fmm_tree.txx

+ 1 - 2
include/fmm_cheb.txx

@@ -825,13 +825,12 @@ void FMM_Cheb<FMMNode>::CollectNodeData(FMMTree_t* tree, std::vector<FMMNode*>&
       }
     }
   }
-  FMM_Pts<FMMNode_t>::CollectNodeData(tree, node, buff, n_list, vec_list);
-
   #pragma omp parallel for
   for(size_t i=0;i<node.size();i++){
     node[i]->pt_cnt[0]+=2*n_coeff;
     node[i]->pt_cnt[1]+=2*n_coeff;
   }
+  FMM_Pts<FMMNode_t>::CollectNodeData(tree, node, buff, n_list, vec_list);
 }
 
 

+ 2 - 4
include/fmm_pts.txx

@@ -1060,10 +1060,9 @@ void FMM_Pts<FMMNode>::CollectNodeData(FMMTree_t* tree, std::vector<FMMNode*>& n
       FMMNode_t* r_node=NULL;
       for(size_t i=0;i<node.size();i++){
         if(!node[i]->IsLeaf()){
-          node[i]->pt_cnt[0] =0;
           node_lst_[node[i]->Depth()].push_back(node[i]);
         }else{
-          node[i]->pt_cnt[0] =node[i]-> src_coord.Dim()/COORD_DIM;
+          node[i]->pt_cnt[0]+=node[i]-> src_coord.Dim()/COORD_DIM;
           node[i]->pt_cnt[0]+=node[i]->surf_coord.Dim()/COORD_DIM;
           if(node[i]->IsGhost()) node[i]->pt_cnt[0]++; // TODO: temporary fix, pt_cnt not known for ghost nodes
         }
@@ -1115,10 +1114,9 @@ void FMM_Pts<FMMNode>::CollectNodeData(FMMTree_t* tree, std::vector<FMMNode*>& n
       FMMNode_t* r_node=NULL;
       for(size_t i=0;i<node.size();i++){
         if(!node[i]->IsLeaf()){
-          node[i]->pt_cnt[1]=0;
           node_lst_[node[i]->Depth()].push_back(node[i]);
         }else{
-          node[i]->pt_cnt[1]=node[i]->trg_coord.Dim()/COORD_DIM;
+          node[i]->pt_cnt[1]+=node[i]->trg_coord.Dim()/COORD_DIM;
         }
         if(node[i]->Depth()==0) r_node=node[i];
       }

+ 2 - 0
include/fmm_tree.txx

@@ -103,6 +103,8 @@ void FMM_Tree<FMM_Mat_t>::SetupFMM(FMM_Mat_t* fmm_mat_) {
   Node_t* n=dynamic_cast<Node_t*>(this->PostorderFirst());
   std::vector<Node_t*> all_nodes;
   while(n!=NULL){
+    n->pt_cnt[0]=0;
+    n->pt_cnt[1]=0;
     all_nodes.push_back(n);
     n=static_cast<Node_t*>(this->PostorderNxt(n));
   }