10 #ifndef STOKHOS_SPARSE_3_TENSOR_PARTITION_HPP
11 #define STOKHOS_SPARSE_3_TENSOR_PARTITION_HPP
20 template <
typename TupleType>
25 typedef typename TupleType::id_type
id_type;
30 bool operator() (
const TupleType& a,
const TupleType& b)
const {
57 if (y < ymin) ymin = y;
58 if (z < zmin) zmin = z;
59 if (x > xmax) xmax = x;
60 if (y > ymax) ymax = y;
61 if (z > zmax) zmax = z;
113 coords(coords_.begin(), coords_.end()) {
137 part_ids[ box->
coords[i].ID() ] = part;
196 template <
typename ordinal_type,
typename scalar_type>
205 if (d == 0)
return i;
206 if (d == 1)
return j;
207 if (d == 2)
return k;
220 template <
typename ordinal_type,
typename scalar_type>
226 typedef typename Cijk_type::k_iterator k_iterator;
227 typedef typename Cijk_type::kj_iterator kj_iterator;
228 typedef typename Cijk_type::kji_iterator kji_iterator;
234 k_iterator k_begin = Cijk.
k_begin();
235 k_iterator k_end = Cijk.
k_end();
236 for (k_iterator k_it=k_begin; k_it!=k_end; ++k_it) {
238 kj_iterator j_begin = Cijk.
j_begin(k_it);
239 kj_iterator j_end = Cijk.
j_end(k_it);
240 for (kj_iterator j_it = j_begin; j_it != j_end; ++j_it) {
242 kji_iterator i_begin = Cijk.
i_begin(j_it);
243 kji_iterator i_end = Cijk.
i_end(j_it);
244 for (kji_iterator i_it = i_begin; i_it != i_end; ++i_it) {
247 coordinate_list[idx].i = i;
248 coordinate_list[idx].j =
j;
249 coordinate_list[idx].k = k;
250 coordinate_list[idx].c = value(i_it);
251 coordinate_list[idx].gid = idx;
255 coordinate_list[idx].i = i;
256 coordinate_list[idx].j =
j;
257 coordinate_list[idx].k = k;
259 coordinate_list[idx].c = 0.5*value(i_it);
261 coordinate_list[idx].c = value(i_it);
262 coordinate_list[idx].gid = idx;
266 coordinate_list[idx].i = i;
267 coordinate_list[idx].j =
j;
268 coordinate_list[idx].k = k;
269 if (i == j && j == k)
270 coordinate_list[idx].c = (1.0/6.0)*value(i_it);
272 coordinate_list[idx].c = value(i_it);
273 coordinate_list[idx].gid = idx;
279 coordinate_list.
resize(idx);
281 return coordinate_list;
286 #endif // STOKHOS_SPARSE_3_TENSOR_PARTITION_HPP
void computeBoundingBox()
k_iterator k_begin() const
Iterator pointing to first k entry.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
Teuchos::Array< TupleType > coords
ArrayView< T > view(size_type offset, size_type size)
kj_iterator j_begin(const k_iterator &k) const
Iterator pointing to first j entry for given k.
size_type get_num_parts() const
Get number of parts.
Teuchos::ArrayRCP< id_type > get_part_IDs() const
void partition()
Partition.
kj_iterator j_end(const k_iterator &k) const
Iterator pointing to last j entry for given k.
void resize(const size_type n, const T &val=T())
Teuchos::RCP< Box > get_partition_root() const
Get root of partition.
Teuchos::RCP< Teuchos::Array< Teuchos::RCP< Box > > > parts
TupleType::value_type coord_type
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Box(const Teuchos::ArrayView< TupleType > &c)
bool operator()(const TupleType &a, const TupleType &b) const
Teuchos::Array< TupleType > coords
void computeSplittingDimension()
k_iterator k_end() const
Iterator pointing to last k entry.
Stokhos::Sparse3Tensor< int, double > Cijk_type
Teuchos::RCP< Teuchos::Array< Teuchos::RCP< Box > > > get_parts() const
Get parts array.
void push_back(const value_type &x)
Teuchos::RCP< Box > right
TupleType::id_type id_type
CoordCompare(const size_type &d_)
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::ArrayView< TupleType >::size_type size_type
Teuchos::ArrayRCP< CijkData< ordinal_type, scalar_type > > build_cijk_coordinate_list(const Sparse3Tensor< ordinal_type, scalar_type > &Cijk, CijkSymmetryType symmetry_type)
kji_iterator i_begin(const kj_iterator &j) const
Iterator pointing to first i entry for given j and k.
kji_iterator i_end(const kj_iterator &j) const
Iterator pointing to last i entry for given j and k.
RCB(const coord_type &max_length_, const size_type &max_parts_, const Teuchos::ArrayView< TupleType > &coords_)
Constructor.
ordinal_type operator()(ordinal_type d) const
ordinal_type num_entries() const
Return number of non-zero entries.