* @return An ArrayView of the properties of this particle.
*/
ArrayView<double>
- get_properties();
+ get_properties()
+ {
+ // The implementation is up here inside the class declaration because
+ // NVCC (at least in 12.5 and 12.6) otherwise produce a compile error:
+ //
+ // error: no declaration matches ‘dealii::ArrayView<__remove_cv(const
+ // double)> dealii::Particles::ParticleAccessor<dim,
+ // spacedim>::get_properties()’
+ //
+ // See https://github.com/dealii/dealii/issues/17148
+ Assert(state() == IteratorState::valid, ExcInternalError());
+
+ return property_pool->get_properties(get_handle());
+ }
+
/**
* Get read-access to properties of this particle.
- template <int dim, int spacedim>
- inline ArrayView<double>
- ParticleAccessor<dim, spacedim>::get_properties()
- {
- Assert(state() == IteratorState::valid, ExcInternalError());
-
- return property_pool->get_properties(get_handle());
- }
+ // template <int dim, int spacedim>
+ // inline ArrayView<double>
+ // ParticleAccessor<dim, spacedim>::get_properties()
* Return an ArrayView to the properties that correspond to the given
* handle @p handle.
*/
- ArrayView<double>
- get_properties(const Handle handle);
+ ArrayView<double, dealii::MemorySpace::Host>
+ get_properties(const Handle handle)
+ {
+ // The implementation is up here inside the class declaration because
+ // NVCC (at least in 12.5 and 12.6) otherwise produce a compile error:
+ //
+ // error: no declaration matches ‘dealii::ArrayView<__remove_cv(const
+ // double)> dealii::Particles::PropertyPool<dim,
+ // spacedim>::get_properties(Handle)’
+ //
+ // See https://github.com/dealii/dealii/issues/17148
+
+ const std::vector<double>::size_type data_index =
+ (handle != invalid_handle) ? handle * n_properties : 0;
+
+ // Ideally we would need to assert that 'handle' has not been deallocated
+ // by searching through 'currently_available_handles'. However, this
+ // is expensive and this function is performance critical, so instead
+ // just check against the array range, and rely on the fact
+ // that handles are invalidated when handed over to
+ // deallocate_properties_array().
+ Assert(data_index <= properties.size() - n_properties,
+ ExcMessage(
+ "Invalid property handle. This can happen if the "
+ "handle was duplicated and then one copy was deallocated "
+ "before trying to access the properties."));
+
+ return ArrayView<double>(properties.data() + data_index, n_properties);
+ }
+
/**
* Reserve the dynamic memory needed for storing the properties of
- template <int dim, int spacedim>
- inline ArrayView<double>
- PropertyPool<dim, spacedim>::get_properties(const Handle handle)
- {
- const std::vector<double>::size_type data_index =
- (handle != invalid_handle) ? handle * n_properties : 0;
-
- // Ideally we would need to assert that 'handle' has not been deallocated
- // by searching through 'currently_available_handles'. However, this
- // is expensive and this function is performance critical, so instead
- // just check against the array range, and rely on the fact
- // that handles are invalidated when handed over to
- // deallocate_properties_array().
- Assert(data_index <= properties.size() - n_properties,
- ExcMessage("Invalid property handle. This can happen if the "
- "handle was duplicated and then one copy was deallocated "
- "before trying to access the properties."));
-
- return ArrayView<double>(properties.data() + data_index, n_properties);
- }
+ // template <int dim, int spacedim>
+ // inline ArrayView<double, dealii::MemorySpace::Host>
+ // PropertyPool<dim, spacedim>::get_properties(const Handle handle)