OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::SuperLatticeCoupling< COUPLER, COUPLEES > Class Template Reference

Coupling operator COUPLER on named COUPLEES. More...

#include <superLatticeCoupling.h>

+ Collaboration diagram for olb::SuperLatticeCoupling< COUPLER, COUPLEES >:

Public Member Functions

template<typename... MAP>
 SuperLatticeCoupling (COUPLER, MAP &&... args)
 
void execute ()
 Execute coupling operation on all blocks.
 
template<typename FIELD >
void setParameter (typename AbstractCouplingO< COUPLEES >::template FieldD< FIELD > &&field)
 Set coupling parameter FIELD.
 
template<typename FIELD >
auto getParameter () const -> typename AbstractCouplingO< COUPLEES >::template FieldD< FIELD >
 Get coupling parameter FIELD for block 0.
 
AbstractCouplingO< COUPLEES > & getBlock (int iC)
 Return block-level abstract coupling operator.
 
void restrictTo (FunctorPtr< SuperIndicatorF< typename AbstractCouplingO< COUPLEES >::value_t, AbstractCouplingO< COUPLEES >::descriptor_t::d > > &&indicator)
 Restrict coupling operation to indicated locations.
 

Detailed Description

template<typename COUPLER, typename COUPLEES>
class olb::SuperLatticeCoupling< COUPLER, COUPLEES >

Coupling operator COUPLER on named COUPLEES.

Definition at line 232 of file superLatticeCoupling.h.

Constructor & Destructor Documentation

◆ SuperLatticeCoupling()

template<typename COUPLER , typename COUPLEES >
template<typename... MAP>
olb::SuperLatticeCoupling< COUPLER, COUPLEES >::SuperLatticeCoupling ( COUPLER ,
MAP &&... args )
inline

Definition at line 259 of file superLatticeCoupling.h.

260 {
261 auto map = std::make_tuple(&args...);
262 COUPLEES::keys_t::for_each([&](auto id) {
263 using name_t = typename decltype(id)::type;
264 constexpr unsigned idx = COUPLEES::keys_t::template index<name_t>();
265 _lattices.template set<name_t>(std::get<2*idx+1>(map));
266 });
267
268 auto& load = _lattices.template get<0>()->getLoadBalancer();
269 for (int iC = 0; iC < load.size(); ++iC) {
270 Platform reference = _lattices.template get<0>()->getBlock(iC).getPlatform();
271 _lattices.for_each([&](auto name, auto lattice) {
272 if (lattice->getBlock(iC).getPlatform() != reference) {
273 throw std::runtime_error("Platforms of coupled block lattices must match");
274 }
275 });
277 [&](auto platform) {
278 _block.emplace_back(constructConcreteBlockCoupling<platform.value>(iC));
279 });
280 }
281 }
plain_map< typename unzip_flattened_keys< KVs... >::type, typename unzip_flattened_values< KVs... >::type > map
Map of types.
Definition typeMap.h:88
auto callUsingConcretePlatform(Platform platform, typename CONCRETIZABLE::base_t *ptr, F f)
Dispatcher for concrete platform access.
Definition dispatch.h:41
Platform
OpenLB execution targets.
Definition platform.h:35
constexpr void for_each(F f) any_platform
Calls f(name, value) for all pairs.

References olb::callUsingConcretePlatform().

+ Here is the call graph for this function:

Member Function Documentation

◆ execute()

template<typename COUPLER , typename COUPLEES >
void olb::SuperLatticeCoupling< COUPLER, COUPLEES >::execute ( )
inline

Execute coupling operation on all blocks.

Definition at line 284 of file superLatticeCoupling.h.

285 {
286 auto& load = _lattices.template get<0>()->getLoadBalancer();
287 #ifdef PARALLEL_MODE_OMP
288 #pragma omp taskloop
289 #endif
290 for (int iC = 0; iC < load.size(); ++iC) {
291 _block[iC]->execute();
292 }
293 }
+ Here is the caller graph for this function:

◆ getBlock()

template<typename COUPLER , typename COUPLEES >
AbstractCouplingO< COUPLEES > & olb::SuperLatticeCoupling< COUPLER, COUPLEES >::getBlock ( int iC)
inline

Return block-level abstract coupling operator.

e.g. to set block-wise mask or parameter:

superCoupling.getBlock(iC).set(latticeR, false);

Definition at line 318 of file superLatticeCoupling.h.

319 {
320 return *_block[iC];
321 }

◆ getParameter()

template<typename COUPLER , typename COUPLEES >
template<typename FIELD >
auto olb::SuperLatticeCoupling< COUPLER, COUPLEES >::getParameter ( ) const -> typename AbstractCouplingO<COUPLEES>::template FieldD<FIELD>
inline

Get coupling parameter FIELD for block 0.

Definition at line 307 of file superLatticeCoupling.h.

308 {
309 return _block[0]->getParameters().template get<FIELD>();
310 }

◆ restrictTo()

template<typename COUPLER , typename COUPLEES >
void olb::SuperLatticeCoupling< COUPLER, COUPLEES >::restrictTo ( FunctorPtr< SuperIndicatorF< typename AbstractCouplingO< COUPLEES >::value_t, AbstractCouplingO< COUPLEES >::descriptor_t::d > > && indicator)
inline

Restrict coupling operation to indicated locations.

By default the entire (non-overlap) lattice area is coupled.

Definition at line 327 of file superLatticeCoupling.h.

329 {
330 using DESCRIPTOR = typename COUPLEES::values_t::template get<0>::descriptor_t;
331 auto& load = _lattices.template get<0>()->getLoadBalancer();
332 for (int iC = 0; iC < load.size(); ++iC) {
333 const auto& blockL = _lattices.template get<0>()->getBlock(iC);
334 auto& blockI = indicator->getBlockIndicatorF(iC);
335 blockL.forCoreSpatialLocations([&](LatticeR<DESCRIPTOR::d> latticeR) {
336 _block[iC]->set(blockL.getCellId(latticeR), blockI(latticeR));
337 });
338 }
339 }
Vector< std::int32_t, D > LatticeR
Type for spatial block-local lattice coordinates.

◆ setParameter()

template<typename COUPLER , typename COUPLEES >
template<typename FIELD >
void olb::SuperLatticeCoupling< COUPLER, COUPLEES >::setParameter ( typename AbstractCouplingO< COUPLEES >::template FieldD< FIELD > && field)
inline

Set coupling parameter FIELD.

Definition at line 297 of file superLatticeCoupling.h.

298 {
299 auto& load = _lattices.template get<0>()->getLoadBalancer();
300 for (int iC = 0; iC < load.size(); ++iC) {
301 _block[iC]->getParameters().template set<FIELD>(std::forward<decltype(field)>(field));
302 }
303 }

The documentation for this class was generated from the following file: