OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
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.
 
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 platform.h:88
Platform
OpenLB execution targets.
Definition platform.h:36

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 }

◆ 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 311 of file superLatticeCoupling.h.

312 {
313 return *_block[iC];
314 }

◆ 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 320 of file superLatticeCoupling.h.

322 {
323 using DESCRIPTOR = typename COUPLEES::values_t::template get<0>::descriptor_t;
324 auto& load = _lattices.template get<0>()->getLoadBalancer();
325 for (int iC = 0; iC < load.size(); ++iC) {
326 const auto& blockL = _lattices.template get<0>()->getBlock(iC);
327 auto& blockI = indicator->getBlockIndicatorF(iC);
328 blockL.forCoreSpatialLocations([&](LatticeR<DESCRIPTOR::d> latticeR) {
329 _block[iC]->set(blockL.getCellId(latticeR), blockI(latticeR));
330 });
331 }
332 }

◆ 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: