OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::IntegratePorousElementFieldsO< FIELDS >::type< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > > Struct Template Reference

#include <integral.h>

+ Collaboration diagram for olb::IntegratePorousElementFieldsO< FIELDS >::type< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >:

Public Member Functions

void setup (ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > &blockLattice)
 
void apply (ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > &blockLattice)
 

Detailed Description

template<typename... FIELDS>
template<typename T, typename DESCRIPTOR>
struct olb::IntegratePorousElementFieldsO< FIELDS >::type< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >

Definition at line 33 of file integral.h.

Member Function Documentation

◆ apply()

template<typename... FIELDS>
template<typename T , typename DESCRIPTOR >
void olb::IntegratePorousElementFieldsO< FIELDS >::type< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::apply ( ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > & blockLattice)

Definition at line 127 of file integral.hh.

129{
130 auto& tag = blockLattice.template getField<fields::fsi::REDUCED_ELEMENT_TAG>();
131
132 auto begin = thrust::make_zip_iterator(gpu::cuda::thrust_tuple_cat(
135 blockLattice.template getField<FIELDS>())...
136 ));
137 auto end = thrust::partition(thrust::device,
138 begin,
139 begin + blockLattice.getNcells(),
140 gpu::cuda::first_tuple_element_non_zero{});
141 std::size_t nActiveCells = end - begin;
142
143 if (nActiveCells > 0) {
144 // Group per-cell field values by FSI tag
145 thrust::sort_by_key(thrust::device,
146 tag[0].deviceData(),
147 tag[0].deviceData() + nActiveCells,
148 thrust::make_zip_iterator(gpu::cuda::thrust_tuple_cat(
150 blockLattice.template getField<FIELDS>())...
151 )));
152 }
153
154 // Sum up grouped force values
155 auto& parameters = blockLattice.template getData<OperatorParameters<IntegratePorousElementFieldsO>>().parameters;
156 if (nActiveCells > 0) {
157 auto reducedElementTag = parameters.template get<fields::array_of<fields::fsi::REDUCED_ELEMENT_TAG>>();
158 const std::size_t nKeys = thrust::reduce_by_key(
159 thrust::device,
160 tag[0].deviceData(),
161 tag[0].deviceData() + nActiveCells,
162 thrust::make_zip_iterator(gpu::cuda::thrust_tuple_cat(
164 blockLattice.template getField<FIELDS>())...
165 )),
166 reducedElementTag,
167 thrust::make_zip_iterator(gpu::cuda::thrust_tuple_cat(
169 )),
170 thrust::equal_to<T>{},
171 gpu::cuda::sum_of_thrust_tuple{}
172 ).first - reducedElementTag;
173 parameters.template set<fields::fsi::REDUCED_ELEMENTS_COUNT>(nKeys);
174 } else {
175 parameters.template set<fields::fsi::REDUCED_ELEMENTS_COUNT>(0);
176 }
177
178 if (nActiveCells > 0) {
179 thrust::fill(thrust::device,
180 tag[0].deviceData(),
181 tag[0].deviceData() + nActiveCells,
182 0);
183 }
184}
descriptors::POINTER_FIELD_BASE< FIELD > array_of
Definition fields.h:60
auto thrust_tuple_cat(A &a, std::index_sequence< AIs... >)
Definition integral.hh:51
auto make_thrust_tuple_of_device_data(VECTOR &f)
Definition integral.hh:87
auto make_thrust_tuple_of(Vector< T, D > &f)
Definition integral.hh:75
meta::list< fields::array_of< fields::fsi::REDUCED_ELEMENT_TAG >, fields::array_of< FIELDS >..., fields::fsi::REDUCED_ELEMENTS_COUNT > parameters
Definition integral.h:36

References olb::BlockStructureD< D >::getNcells(), olb::gpu::cuda::make_thrust_tuple_of(), olb::gpu::cuda::make_thrust_tuple_of_device_data(), and olb::gpu::cuda::thrust_tuple_cat().

+ Here is the call graph for this function:

◆ setup()

template<typename... FIELDS>
template<typename T , typename DESCRIPTOR >
void olb::IntegratePorousElementFieldsO< FIELDS >::type< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::setup ( ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > & blockLattice)

Definition at line 119 of file integral.hh.

121{
122 blockLattice.template getData<OperatorParameters<IntegratePorousElementFieldsO>>();
123}

The documentation for this struct was generated from the following files: