OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::SuperStructure< T, D > Class Template Reference

#include <superStructure.h>

+ Inheritance diagram for olb::SuperStructure< T, D >:
+ Collaboration diagram for olb::SuperStructure< T, D >:

Public Types

using value_t = T
 

Public Member Functions

virtual ~SuperStructure ()
 Virtual Destructor for inheritance.
 
 SuperStructure (CuboidDecomposition< T, D > &cuboidDecomposition, LoadBalancer< T > &loadBalancer, int overlap=2)
 Construction of a super structure.
 
CuboidDecomposition< T, D > & getCuboidDecomposition ()
 Read and write access to cuboid geometry.
 
const CuboidDecomposition< T, D > & getCuboidDecomposition () const
 Read only access to cuboid geometry.
 
int getOverlap ()
 Read and write access to the overlap.
 
int getOverlap () const
 Read only access to the overlap.
 
LoadBalancer< T > & getLoadBalancer ()
 Read and write access to the load balancer.
 
LoadBalancer< T > const & getLoadBalancer () const
 Read only access to the load balancer.
 
virtual void communicate ()
 
template<typename F >
void forCorePhysLocations (F f) const
 Iterate over discrete physical locations.
 
template<typename F >
void forCorePhysLocations (PhysR< T, D > min, PhysR< T, D > max, F f) const
 Iterate over discrete physical locations between min and max.
 
template<typename F >
void forCoreSpatialLocations (F f) const
 Iterate over spatial locations NOTE: Based on physical locations (as opposed to its blockStructure version)
 
template<typename F >
void forCoreSpatialLocations (PhysR< T, D > min, PhysR< T, D > max, F f) const
 Iterate over spatial locations between min and max NOTE: Based on physical locations (as opposed to its blockStructure version)
 

Protected Attributes

CuboidDecomposition< T, D > & _cuboidDecomposition
 The grid structure is referenced here.
 
LoadBalancer< T > & _loadBalancer
 Distribution of the cuboids of the cuboid structure.
 
int _overlap
 Size of ghost cell layer (must be greater than 1 and greater_overlapBC, default =1)
 
OstreamManager clout
 class specific output stream
 

Detailed Description

template<typename T, unsigned D>
class olb::SuperStructure< T, D >

Definition at line 38 of file superStructure.h.

Member Typedef Documentation

◆ value_t

template<typename T , unsigned D>
using olb::SuperStructure< T, D >::value_t = T

Definition at line 51 of file superStructure.h.

Constructor & Destructor Documentation

◆ ~SuperStructure()

template<typename T , unsigned D>
virtual olb::SuperStructure< T, D >::~SuperStructure ( )
inlinevirtual

Virtual Destructor for inheritance.

Definition at line 54 of file superStructure.h.

54{};

◆ SuperStructure()

template<typename T , unsigned D>
olb::SuperStructure< T, D >::SuperStructure ( CuboidDecomposition< T, D > & cuboidDecomposition,
LoadBalancer< T > & loadBalancer,
int overlap = 2 )

Construction of a super structure.

Definition at line 34 of file superStructure.hh.

37 : _cuboidDecomposition(cuboidDecomposition),
38 _loadBalancer(loadBalancer),
39 _overlap(overlap),
40 clout(std::cout, "SuperStructure" + std::to_string(D) + "D")
41{
42}
CuboidDecomposition< T, D > & _cuboidDecomposition
The grid structure is referenced here.
int _overlap
Size of ghost cell layer (must be greater than 1 and greater_overlapBC, default =1)
OstreamManager clout
class specific output stream
LoadBalancer< T > & _loadBalancer
Distribution of the cuboids of the cuboid structure.

Member Function Documentation

◆ communicate()

◆ forCorePhysLocations() [1/2]

template<typename T , unsigned D>
template<typename F >
void olb::SuperStructure< T, D >::forCorePhysLocations ( F f) const

Iterate over discrete physical locations.

Definition at line 82 of file superStructure.hh.

83{
84 using loc = typename PhysR<T,D>::value_t;
85 Vector<loc,D> minPhysR = _cuboidDecomposition.getMinPhysR();
86 Vector<loc,D> maxPhysR = _cuboidDecomposition.getMaxPhysR();
87 const loc L = _cuboidDecomposition.getMotherCuboid().getDeltaR();
88 for (loc iX=minPhysR[0]; iX < maxPhysR[0]; iX+=L) {
89 for (loc iY=minPhysR[1]; iY < maxPhysR[1]; iY+=L) {
90 if constexpr (D == 3) {
91 for (loc iZ=minPhysR[2]; iZ < maxPhysR[2]; iZ+=L) {
92 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
93 f({iX,iY,iZ});
94 } else {
95 f(iX,iY,iZ);
96 }
97 }
98 } else {
99 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
100 f({iX,iY});
101 } else {
102 f(iX,iY);
103 }
104 }
105 }
106 }
107};

◆ forCorePhysLocations() [2/2]

template<typename T , unsigned D>
template<typename F >
void olb::SuperStructure< T, D >::forCorePhysLocations ( PhysR< T, D > min,
PhysR< T, D > max,
F f ) const

Iterate over discrete physical locations between min and max.

Definition at line 111 of file superStructure.hh.

112{
113 using loc = typename PhysR<T,D>::value_t;
114 Vector<loc,D> minPhysR = _cuboidDecomposition.getMinPhysR();
115 Vector<loc,D> maxPhysR = _cuboidDecomposition.getMaxPhysR();
116 const loc L = _cuboidDecomposition.getDeltaR();
117 for (loc iX=std::max(minPhysR[0],min[0]); iX < std::min(maxPhysR[0],max[0]+L); iX+=L) {
118 for (loc iY=std::max(minPhysR[1],min[1]); iY < std::min(maxPhysR[1],max[1]+L); iY+=L) {
119 if constexpr (D == 3) {
120 for (loc iZ=std::max(minPhysR[2],min[2]); iZ < std::min(maxPhysR[2],max[2]+L); iZ+=L) {
121 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
122 f({iX,iY,iZ});
123 } else {
124 f(iX,iY,iZ);
125 }
126 }
127 } else {
128 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
129 f({iX,iY});
130 } else {
131 f(iX,iY);
132 }
133 }
134 }
135 }
136};

◆ forCoreSpatialLocations() [1/2]

template<typename T , unsigned D>
template<typename F >
void olb::SuperStructure< T, D >::forCoreSpatialLocations ( F f) const

Iterate over spatial locations NOTE: Based on physical locations (as opposed to its blockStructure version)

Definition at line 140 of file superStructure.hh.

141{
142 forCorePhysLocations([&](PhysR<T,D> physLoc){
143 auto latticeR = _cuboidDecomposition.getLatticeR(physLoc);
144 if (latticeR) {
145 if constexpr (std::is_invocable_v<F, LatticeR<D+1>>) {
146 f(*latticeR);
147 } else {
148 auto lR = *latticeR;
149 if constexpr (D == 3) {
150 f(lR[0],lR[1],lR[2],lR[3]);
151 } else {
152 f(lR[0],lR[1],lR[2]);
153 }
154 }
155 }
156 });
157};
void forCorePhysLocations(F f) const
Iterate over discrete physical locations.
Vector< T, D > PhysR
Type for spatial (physical) coordinates.

◆ forCoreSpatialLocations() [2/2]

template<typename T , unsigned D>
template<typename F >
void olb::SuperStructure< T, D >::forCoreSpatialLocations ( PhysR< T, D > min,
PhysR< T, D > max,
F f ) const

Iterate over spatial locations between min and max NOTE: Based on physical locations (as opposed to its blockStructure version)

Definition at line 161 of file superStructure.hh.

162{
163 forCorePhysLocations(min, max, [&](PhysR<T,D> physLoc){
164 auto latticeR = _cuboidDecomposition.getLatticeR(physLoc.data());
165 if (latticeR) {
166 if constexpr (std::is_invocable_v<F, LatticeR<D+1>>) {
167 f(*latticeR);
168 } else {
169 auto lR = *latticeR;
170 if constexpr (D == 3) {
171 f(lR[0],lR[1],lR[2],lR[3]);
172 } else {
173 f(lR[0],lR[1],lR[2]);
174 }
175 }
176 }
177 });
178};

References olb::Vector< T, Size >::data().

+ Here is the call graph for this function:

◆ getCuboidDecomposition() [1/2]

template<typename T , unsigned D>
CuboidDecomposition< T, D > & olb::SuperStructure< T, D >::getCuboidDecomposition ( )

Read and write access to cuboid geometry.

Definition at line 45 of file superStructure.hh.

46{
48}
+ Here is the caller graph for this function:

◆ getCuboidDecomposition() [2/2]

template<typename T , unsigned D>
CuboidDecomposition< T, D > const & olb::SuperStructure< T, D >::getCuboidDecomposition ( ) const

Read only access to cuboid geometry.

Definition at line 51 of file superStructure.hh.

52{
54}

◆ getLoadBalancer() [1/2]

template<typename T , unsigned D>
LoadBalancer< T > & olb::SuperStructure< T, D >::getLoadBalancer ( )

Read and write access to the load balancer.

Definition at line 69 of file superStructure.hh.

70{
71 return _loadBalancer;
72}

◆ getLoadBalancer() [2/2]

template<typename T , unsigned D>
LoadBalancer< T > const & olb::SuperStructure< T, D >::getLoadBalancer ( ) const

Read only access to the load balancer.

Definition at line 75 of file superStructure.hh.

76{
77 return _loadBalancer;
78}

◆ getOverlap() [1/2]

template<typename T , unsigned D>
int olb::SuperStructure< T, D >::getOverlap ( )

Read and write access to the overlap.

Definition at line 57 of file superStructure.hh.

58{
59 return _overlap;
60}
+ Here is the caller graph for this function:

◆ getOverlap() [2/2]

template<typename T , unsigned D>
int olb::SuperStructure< T, D >::getOverlap ( ) const

Read only access to the overlap.

Definition at line 63 of file superStructure.hh.

64{
65 return _overlap;
66}

Member Data Documentation

◆ _cuboidDecomposition

template<typename T , unsigned D>
CuboidDecomposition<T,D>& olb::SuperStructure< T, D >::_cuboidDecomposition
protected

The grid structure is referenced here.

Definition at line 41 of file superStructure.h.

◆ _loadBalancer

template<typename T , unsigned D>
LoadBalancer<T>& olb::SuperStructure< T, D >::_loadBalancer
protected

Distribution of the cuboids of the cuboid structure.

Definition at line 43 of file superStructure.h.

◆ _overlap

template<typename T , unsigned D>
int olb::SuperStructure< T, D >::_overlap
protected

Size of ghost cell layer (must be greater than 1 and greater_overlapBC, default =1)

Definition at line 46 of file superStructure.h.

◆ clout

template<typename T , unsigned D>
OstreamManager olb::SuperStructure< T, D >::clout
mutableprotected

class specific output stream

Definition at line 48 of file superStructure.h.


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