24#ifndef SET_BOUNDARY_2D_H
25#define SET_BOUNDARY_2D_H
32template<
typename T,
typename DESCRIPTOR>
39 auto cell = block.
get(iX,iY);
42 if (postProcessor && !block.
isPadding({iX,iY})) {
47template<
typename T,
typename DESCRIPTOR>
53 auto cell = block.
get(iX,iY);
59template<
typename T,
typename DESCRIPTOR>
74 communicator.template requestField<descriptors::POPULATION>();
77 for (
int iCloc = 0; iCloc < sLattice.
getLoadBalancer().size(); ++iCloc) {
81 for (
int iX = -_overlap; iX < nX+_overlap; ++iX) {
82 for (
int iY = -_overlap; iY < nY+_overlap; ++iY) {
83 if (iX < 0 || iX > nX - 1 ||
84 iY < 0 || iY > nY - 1 ) {
87 for (
int iXo = -_overlap; iXo <= _overlap && !found; ++iXo) {
88 for (
int iYo = -_overlap; iYo <= _overlap && !found; ++iYo) {
89 const int nextX = iXo + iX;
90 const int nextY = iYo + iY;
91 if (indicator->getBlockIndicatorF(iCloc)(nextX, nextY)) {
92 communicator.requestCell({iCloc, iX, iY});
103 communicator.exchangeRequests();
107namespace boundaryhelper {
111 typename T,
typename DESCRIPTOR,
112 template<
int...>
typename DYNAMICS
129 throw std::runtime_error(
"Could not set Boundary.");
135 typename T,
typename DESCRIPTOR,
136 template<
int...>
typename DYNAMICS
143 else if (n[0] == -1) {
146 else if (n[1] == 1) {
149 else if (n[1] == -1) {
153 throw std::runtime_error(
"Could not set Boundary.");
159 typename T,
typename DESCRIPTOR,
160 template <
typename,
typename,
typename>
typename DYNAMICS,
161 template <
int,
int>
typename MOMENTA
164 template <
int x,
int y>
168 return constructConcreteDynamicsForDirectionOrientation<T,DESCRIPTOR,ConcreteDynamics>(n);
174 typename T,
typename DESCRIPTOR,
175 template <
typename,
typename,
typename,
typename>
typename DYNAMICS,
177 template <
int,
int>
typename MOMENTA
180 template <
int x,
int y>
184 return constructConcreteDynamicsForDirectionOrientation<T,DESCRIPTOR,ConcreteDynamics>(n);
190 typename T,
typename DESCRIPTOR,
191 template <
typename,
typename,
typename,
typename,
int,
int>
typename DYNAMICS,
193 template <
int,
int>
typename MOMENTA
196 template <
int x,
int y>
200 return constructConcreteDynamicsForDirectionOrientation<T,DESCRIPTOR,ConcreteDynamics>(n);
206 typename T,
typename DESCRIPTOR,
208 template <
int,
int>
typename MOMENTA
211 template <
int x,
int y>
215 return constructConcreteDynamicsForDirectionOrientation<T,DESCRIPTOR,ConcreteDynamics>(n);
221 typename T,
typename DESCRIPTOR,
222 template <
typename,
typename,
typename>
typename DYNAMICS,
223 template <
int,
int>
typename MOMENTA
226 template <
int x,
int y>
230 return constructConcreteDynamicsForNormal<T,DESCRIPTOR,ConcreteDynamics>(n);
236 typename T,
typename DESCRIPTOR,
237 template <
typename,
typename,
typename,
int,
int>
typename DYNAMICS,
238 template <
int,
int>
typename MOMENTA
241 template <
int x,
int y>
245 return constructConcreteDynamicsForNormal<T,DESCRIPTOR,ConcreteDynamics>(n);
251 typename T,
typename DESCRIPTOR,
252 template <
typename,
typename,
typename,
typename,
int,
int>
typename DYNAMICS,
254 template <
int,
int>
typename MOMENTA
257 template <
int x,
int y>
261 return constructConcreteDynamicsForNormal<T,DESCRIPTOR,ConcreteDynamics>(n);
268 typename RESULT,
typename T,
typename DESCRIPTOR,
269 template <
typename,
typename,
int,
int>
typename TYPE,
275 return new TYPE<T,DESCRIPTOR,1,1>(std::forward<
decltype(args)>(args)...);
278 return new TYPE<T,DESCRIPTOR,1,-1>(std::forward<decltype(args)>(args)...);
281 return new TYPE<T,DESCRIPTOR,-1,1>(std::forward<decltype(args)>(args)...);
284 return new TYPE<T,DESCRIPTOR,-1,-1>(std::forward<decltype(args)>(args)...);
287 throw std::runtime_error(
"Could not set Boundary.");
292 typename RESULT,
typename T,
typename DESCRIPTOR,
293 template <
typename,
typename,
int,
int>
typename TYPE
301 return meta::id<TYPE<T,DESCRIPTOR,1,-1>>();
304 return meta::id<TYPE<T,DESCRIPTOR,-1,1>>();
307 return meta::id<TYPE<T,DESCRIPTOR,-1,-1>>();
310 return meta::id<TYPE<T,DESCRIPTOR,-1,0>>();
316 return meta::id<TYPE<T,DESCRIPTOR,0,-1>>();
322 throw std::runtime_error(
"Invalid normal");
328 typename T,
typename DESCRIPTOR,
329 template <
typename,
typename,
int,
int>
typename TYPE,
334 return constructForNormal<PostProcessorGenerator2D<T,DESCRIPTOR>,T,DESCRIPTOR,TYPE>(n, std::forward<decltype(args)>(args)...);
338 typename T,
typename DESCRIPTOR,
339 template<
typename,
typename,
int,
int>
typename TYPE
343 return promiseForNormal<PostProcessorPromise<T,DESCRIPTOR>,T,DESCRIPTOR,TYPE>(n);
349 typename RESULT,
typename T,
typename DESCRIPTOR,
350 template <
typename,
typename,
int,
int>
typename TYPE,
356 return new TYPE<T,DESCRIPTOR,0,1>(std::forward<
decltype(args)>(args)...);
358 else if (n[0] == -1) {
359 return new TYPE<T,DESCRIPTOR,0,-1>(std::forward<decltype(args)>(args)...);
361 else if (n[1] == 1) {
362 return new TYPE<T,DESCRIPTOR,1,1>(std::forward<
decltype(args)>(args)...);
364 else if (n[1] == -1) {
365 return new TYPE<T,DESCRIPTOR,1,-1>(std::forward<decltype(args)>(args)...);
368 throw std::runtime_error(
"Could not set Boundary.");
374 typename T,
typename DESCRIPTOR,
375 template <
typename,
typename,
int,
int>
typename TYPE
382 else if (n[0] == -1) {
383 return meta::id<TYPE<T,DESCRIPTOR,0,-1>>();
385 else if (n[1] == 1) {
388 else if (n[1] == -1) {
389 return meta::id<TYPE<T,DESCRIPTOR,1,-1>>();
392 throw std::runtime_error(
"Invalid normal");
398 typename T,
typename DESCRIPTOR,
399 template <
typename,
typename,
int,
int>
typename TYPE,
404 return constructForDirectionOrientation<PostProcessorGenerator2D<T,DESCRIPTOR>,T,DESCRIPTOR,TYPE>(n, std::forward<decltype(args)>(args)...);
408 typename T,
typename DESCRIPTOR,
409 template <
typename,
typename,
int,
int>
typename TYPE
413 return promiseForDirectionOrientation<PostProcessorPromise<T,DESCRIPTOR>,T,DESCRIPTOR,TYPE>(n);
Platform-abstracted block lattice for external access and inter-block interaction.
virtual void addPostProcessor(std::type_index stage, LatticeR< DESCRIPTOR::d > latticeR, PostProcessorPromise< T, DESCRIPTOR > &&promise)=0
Schedule post processor for application to latticeR in stage.
void defineDynamics(LatticeR< DESCRIPTOR::d > latticeR, DynamicsPromise< T, DESCRIPTOR > &&promise)
Assign promised DYNAMICS to latticeR.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
bool isPadding(LatticeR< D > latticeR) const
Return whether location is valid.
Factory for instances of a specific Dynamics type.
Smart pointer for managing the various ways of passing functors around.
Factory for instances of a specific POST_PROCESSOR type.
Representation of a statistic for a parallel 2D geometry.
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
Super class maintaining block lattices for a cuboid decomposition.
SuperCommunicator< T, SuperLattice > & getCommunicator(STAGE stage=STAGE())
Return communicator for given communication stage.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
DynamicsPromise< T, DESCRIPTOR > constructConcreteDynamicsForDirectionOrientation(Vector< int, 2 > n)
PostProcessorGenerator2D< T, DESCRIPTOR > * constructPostProcessorForNormal(Vector< int, 2 > n, ARGS &&... args)
PROMISE promiseForDirectionOrientation(Vector< int, 2 > n)
RESULT * constructForNormal(Vector< int, 2 > n, ARGS &&... args)
PostProcessorPromise< T, DESCRIPTOR > promisePostProcessorForNormal(Vector< int, 2 > n)
RESULT * constructForDirectionOrientation(Vector< int, 2 > n, ARGS &&... args)
RESULT promiseForNormal(Vector< int, 2 > n)
DynamicsPromise< T, DESCRIPTOR > constructConcreteDynamicsForNormal(Vector< int, 2 > n)
PostProcessorGenerator2D< T, DESCRIPTOR > * constructPostProcessorForDirectionOrientation(Vector< int, 2 > n, ARGS &&... args)
PostProcessorPromise< T, DESCRIPTOR > promisePostProcessorForDirectionOrientation(Vector< int, 2 > n)
Top level namespace for all of OpenLB.
void addPoints2CommBC(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperIndicatorF2D< T > > &&indicator, int _overlap)
Adds needed Cells to the Communicator _commBC in SuperLattice.
DynamicsPromise(meta::id< DYNAMICS >) -> DynamicsPromise< typename DYNAMICS::value_t, typename DYNAMICS::descriptor_t >
void setBoundary(BlockLattice< T, DESCRIPTOR > &block, int iX, int iY, Dynamics< T, DESCRIPTOR > *dynamics, PostProcessorGenerator2D< T, DESCRIPTOR > *postProcessor)
Interface for per-cell dynamics.
virtual void initialize(Cell< T, DESCRIPTOR > &cell)
Initialize dynamics-specific data for cell.
DYNAMICS< T, DESCRIPTOR, MIXIN, MOMENTA< x, y >, x, y > ConcreteDynamics
static auto construct(Vector< int, 2 > n)
typename MIXIN::template exchange_momenta< MOMENTA< x, y > > ConcreteDynamics
static auto construct(Vector< int, 2 > n)
DYNAMICS< T, DESCRIPTOR, MOMENTA< x, y >, x, y > ConcreteDynamics
static auto construct(Vector< int, 2 > n)
DYNAMICS< T, DESCRIPTOR, MIXIN, MOMENTA< x, y >, x, y > ConcreteDynamics
static auto construct(Vector< int, 2 > n)
DYNAMICS< T, DESCRIPTOR, MOMENTA< x, y > > ConcreteDynamics
static auto construct(Vector< int, 2 > n)
static auto construct(Vector< int, 2 > n)
DYNAMICS< T, DESCRIPTOR, MOMENTA< x, y > > ConcreteDynamics
static auto construct(Vector< int, 2 > n)
DYNAMICS< T, DESCRIPTOR, MIXIN, MOMENTA< x, y > > ConcreteDynamics
Communication after propagation.