reinit (v, true);
thread_loop_partitioner = v.thread_loop_partitioner;
- dealii::internal::VectorOperations::Vector_copy<Number,Number> copier(v.val, val);
- internal::VectorOperations::parallel_for(copier, 0, partitioner->local_size(),
- thread_loop_partitioner);
+
+ const size_type this_size = local_size();
+ if (this_size>0)
+ {
+ dealii::internal::VectorOperations::Vector_copy<Number,Number> copier(v.val, val);
+ internal::VectorOperations::parallel_for(copier, 0, partitioner->local_size(),
+ thread_loop_partitioner);
+ }
}
must_update_ghost_values |= vector_is_ghosted;
thread_loop_partitioner = c.thread_loop_partitioner;
- dealii::internal::VectorOperations::Vector_copy<Number,Number2> copier(c.val, val);
- internal::VectorOperations::parallel_for(copier, 0, partitioner->local_size(),
- thread_loop_partitioner);
+
+ const size_type this_size = local_size();
+ if (this_size>0)
+ {
+ dealii::internal::VectorOperations::Vector_copy<Number,Number2> copier(c.val, val);
+ internal::VectorOperations::parallel_for(copier, 0, this_size,
+ thread_loop_partitioner);
+ }
if (must_update_ghost_values)
update_ghost_values();
Vector<Number> &
Vector<Number>::operator = (const Number s)
{
- internal::VectorOperations::Vector_set<Number> setter(s, val);
+ const size_type this_size = local_size();
+ if (this_size>0)
+ {
+ internal::VectorOperations::Vector_set<Number> setter(s, val);
- internal::VectorOperations::parallel_for(setter, 0, partitioner->local_size(),
- thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(setter, 0, this_size,
+ thread_loop_partitioner);
+ }
// if we call Vector::operator=0, we want to zero out all the entries
// plus ghosts.
Assert(s==static_cast<Number>(0), ExcMessage("Only 0 can be assigned to a vector."));
(void)s;
- dealii::internal::VectorOperations::Vector_set<Number> setter(Number(), val);
- dealii::internal::VectorOperations::parallel_for(setter, 0, n_elements(), thread_loop_partitioner);
+ const size_type this_size = n_elements();
+ if (this_size>0)
+ {
+ dealii::internal::VectorOperations::Vector_set<Number> setter(Number(), val);
+ dealii::internal::VectorOperations::parallel_for(setter, 0, this_size, thread_loop_partitioner);
+ }
return *this;
}
if (vec_size != v.vec_size)
reinit (v, true);
- dealii::internal::VectorOperations::Vector_copy<Number,Number> copier(v.val, val);
- internal::VectorOperations::parallel_for(copier,0,vec_size,thread_loop_partitioner);
+ if (vec_size>0)
+ {
+ dealii::internal::VectorOperations::Vector_copy<Number,Number> copier(v.val, val);
+ internal::VectorOperations::parallel_for(copier,0,vec_size,thread_loop_partitioner);
+ }
return *this;
}
if (s != Number())
Assert (vec_size!=0, ExcEmptyObject());
- internal::VectorOperations::Vector_set<Number> setter(s, val);
-
- internal::VectorOperations::parallel_for(setter,0,vec_size,thread_loop_partitioner);
+ if (vec_size>0)
+ {
+ internal::VectorOperations::Vector_set<Number> setter(s, val);
+ internal::VectorOperations::parallel_for(setter,0,vec_size,thread_loop_partitioner);
+ }
return *this;
}
:
value(value),
dst(dst)
- {}
+ {
+ Assert(dst != nullptr, ExcInternalError());
+ }
void operator() (const size_type begin, const size_type end) const
{
+ Assert (end>=begin, ExcInternalError());
+
if (value == Number())
std::memset (dst+begin,0,(end-begin)*sizeof(Number));
else
std::fill (dst+begin, dst+end, value);
}
- Number value;
- Number *dst;
+ const Number value;
+ Number *const dst;
};
template <typename Number, typename OtherNumber>
:
src(src),
dst(dst)
- {}
+ {
+ Assert(src!=nullptr, ExcInternalError());
+ Assert(dst!=nullptr, ExcInternalError());
+ }
void operator() (const size_type begin, const size_type end) const
{
+ Assert (end>=begin, ExcInternalError());
+
if (std::is_same<Number,OtherNumber>::value)
std::memcpy(dst+begin, src+begin, (end-begin)*sizeof(Number));
else
}
}
- const OtherNumber *src;
- Number *dst;
+ const OtherNumber *const src;
+ Number *const dst;
};
template <typename Number>