sequence_vector getSequence( unsigned int offset ) const {
//        if( row_count() == 0 ) {
//            return std::make_pair( m_data, 0 );
//        } else {
            return std::make_pair( begin_row(offset), m_bpr );
//        }
    }
    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"));
    }
Ejemplo n.º 3
0
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);
  
}  
Ejemplo n.º 4
0
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);;
    
}
Ejemplo n.º 5
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;
  }
  
}
 raw_block_pointer end_row( const size_t & idx ) const {
     return begin_row( idx ) + getSoftSize( idx );
 }