コード例 #1
0
    void check_ranges(size_type begin_r, size_type end_r, size_type begin_c, size_type end_c) const
    {
	MTL_DEBUG_THROW_IF(begin_r < begin_row(), range_error("begin_row out of range"));
	// if (end_r > end_row()) std::cout << "end_row out of range\n";
	MTL_DEBUG_THROW_IF(end_r > end_row(), range_error("end_row out of range"));
			      
	MTL_DEBUG_THROW_IF(begin_c < begin_col(), range_error("begin_col out of range"));
	MTL_DEBUG_THROW_IF(end_c > end_col(), range_error("end_col out of range"));
    }
コード例 #2
0
ファイル: ESMCI_WMat.C プロジェクト: xunzhang/ESMF_Regridding
void WMat::clear() {
  
  // Loop weightmap; swap each row out
  WeightMap::iterator wi = begin_row(), we = end_row();
  
  for (; wi != we; ++wi)
    std::vector<Entry>().swap(wi->second);
  
  WeightMap().swap(weights);
  
}  
コード例 #3
0
ファイル: ESMCI_WMat.C プロジェクト: xunzhang/ESMF_Regridding
std::pair<int, int> WMat::count_matrix_entries() const {
  
  int n_s = 0;
  int max_idx = 0;
  
  WMat::WeightMap::const_iterator wi = begin_row(), we = end_row();
  
  for (; wi != we; ++wi) {
    n_s += wi->second.size();
    if (wi->first.idx > max_idx) max_idx = wi->first.idx;
  }
  
  return std::make_pair(n_s, max_idx);;
    
}
コード例 #4
0
void IWeights::Prune(const Mesh &mesh, const MEField<> &mask) {

  WeightMap::iterator wi = begin_row(), we = end_row(), wn;
  
  for (; wi != we;) {
    
    wn = wi; ++wn;
    UInt gid = wi->first.id;
    
    Mesh::MeshObjIDMap::const_iterator mi = mesh.map_find(MeshObj::NODE, gid);
    
    ThrowRequire(mi != mesh.map_end(MeshObj::NODE));
    
    double *mval = mask.data(*mi);
    
    if (*mval < 0.5 || !GetMeshObjContext(*mi).is_set(Attr::OWNED_ID))
      weights.erase(wi);
    
    wi = wn;
  }
  
}