OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
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 (CuboidGeometry< T, D > &cuboidGeometry, LoadBalancer< T > &loadBalancer, int overlap=2)
 Construction of a super structure.
 
 SuperStructure (int overlap=1)
 Default Constructor for empty SuperStructure.
 
CuboidGeometry< T, D > & getCuboidGeometry ()
 Read and write access to cuboid geometry.
 
CuboidGeometry< T, D > const & getCuboidGeometry () 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

CuboidGeometry< T, D > & _cuboidGeometry
 The grid structure is stored 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 39 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 52 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 55 of file superStructure.h.

55{};

◆ SuperStructure() [1/2]

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

Construction of a super structure.

Definition at line 34 of file superStructure.hh.

37 : _cuboidGeometry(cuboidGeometry),
38 _loadBalancer(loadBalancer),
39 _overlap(overlap),
40 clout(std::cout, "SuperGeometry" + std::to_string(D) + "D")
41{
42}
CuboidGeometry< T, D > & _cuboidGeometry
The grid structure is stored 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.

◆ SuperStructure() [2/2]

template<typename T , unsigned D>
olb::SuperStructure< T, D >::SuperStructure ( int overlap = 1)

Default Constructor for empty SuperStructure.

Definition at line 45 of file superStructure.hh.

46 : SuperStructure(*(new CuboidGeometry<T,D> ()),
47 *(new LoadBalancer<T> ()),
48 overlap)
49{ }
SuperStructure(CuboidGeometry< T, D > &cuboidGeometry, LoadBalancer< T > &loadBalancer, int overlap=2)
Construction of a super structure.

Member Function Documentation

◆ communicate()

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

◆ 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 89 of file superStructure.hh.

90{
91 using loc = typename PhysR<T,D>::value_t;
92 Vector<loc,D> minPhysR = _cuboidGeometry.getMinPhysR();
93 Vector<loc,D> maxPhysR = _cuboidGeometry.getMaxPhysR();
94 const loc L = _cuboidGeometry.getMotherCuboid().getDeltaR();
95 for (loc iX=minPhysR[0]; iX < maxPhysR[0]; iX+=L) {
96 for (loc iY=minPhysR[1]; iY < maxPhysR[1]; iY+=L) {
97 if constexpr (D == 3) {
98 for (loc iZ=minPhysR[2]; iZ < maxPhysR[2]; iZ+=L) {
99 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
100 f({iX,iY,iZ});
101 } else {
102 f(iX,iY,iZ);
103 }
104 }
105 } else {
106 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
107 f({iX,iY});
108 } else {
109 f(iX,iY);
110 }
111 }
112 }
113 }
114};

◆ 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 118 of file superStructure.hh.

119{
120 using loc = typename PhysR<T,D>::value_t;
121 Vector<loc,D> minPhysR = _cuboidGeometry.getMinPhysR();
122 Vector<loc,D> maxPhysR = _cuboidGeometry.getMaxPhysR();
123 const loc L = _cuboidGeometry.getMotherCuboid().getDeltaR();
124 for (loc iX=std::max(minPhysR[0],min[0]); iX < std::min(maxPhysR[0],max[0]+L); iX+=L) {
125 for (loc iY=std::max(minPhysR[1],min[1]); iY < std::min(maxPhysR[1],max[1]+L); iY+=L) {
126 if constexpr (D == 3) {
127 for (loc iZ=std::max(minPhysR[2],min[2]); iZ < std::min(maxPhysR[2],max[2]+L); iZ+=L) {
128 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
129 f({iX,iY,iZ});
130 } else {
131 f(iX,iY,iZ);
132 }
133 }
134 } else {
135 if constexpr (std::is_invocable_v<F, PhysR<T,D>>) {
136 f({iX,iY});
137 } else {
138 f(iX,iY);
139 }
140 }
141 }
142 }
143};

◆ 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 147 of file superStructure.hh.

148{
149 forCorePhysLocations([&](PhysR<T,D> physLoc){
150 LatticeR<D+1> latticeR;
151 _cuboidGeometry.getLatticeR( latticeR.data(), physLoc.data() );
152 if constexpr (std::is_invocable_v<F, LatticeR<D+1>>) {
153 f(latticeR);
154 } else {
155 if constexpr (D == 3) {
156 f(latticeR[0],latticeR[1],latticeR[2],latticeR[3]);
157 } else {
158 f(latticeR[0],latticeR[1],latticeR[2]);
159 }
160 }
161 });
162};
void forCorePhysLocations(F f) const
Iterate over discrete physical locations.

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

+ Here is the call graph for this function:

◆ 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 166 of file superStructure.hh.

167{
168 forCorePhysLocations(min, max, [&](PhysR<T,D> physLoc){
169 LatticeR<D+1> latticeR;
170 _cuboidGeometry.getLatticeR( latticeR.data(), physLoc.data() );
171 if constexpr (std::is_invocable_v<F, LatticeR<D+1>>) {
172 f(latticeR);
173 } else {
174 if constexpr (D == 3) {
175 f(latticeR[0],latticeR[1],latticeR[2],latticeR[3]);
176 } else {
177 f(latticeR[0],latticeR[1],latticeR[2]);
178 }
179 }
180 });
181};

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

+ Here is the call graph for this function:

◆ getCuboidGeometry() [1/2]

template<typename T , unsigned D>
CuboidGeometry< T, D > & olb::SuperStructure< T, D >::getCuboidGeometry ( )

Read and write access to cuboid geometry.

Definition at line 52 of file superStructure.hh.

53{
54 return _cuboidGeometry;
55}
+ Here is the caller graph for this function:

◆ getCuboidGeometry() [2/2]

template<typename T , unsigned D>
CuboidGeometry< T, D > const & olb::SuperStructure< T, D >::getCuboidGeometry ( ) const

Read only access to cuboid geometry.

Definition at line 58 of file superStructure.hh.

59{
60 return _cuboidGeometry;
61}

◆ 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 76 of file superStructure.hh.

77{
78 return _loadBalancer;
79}

◆ 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 82 of file superStructure.hh.

83{
84 return _loadBalancer;
85}

◆ getOverlap() [1/2]

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

Read and write access to the overlap.

Definition at line 64 of file superStructure.hh.

65{
66 return _overlap;
67}
+ 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 70 of file superStructure.hh.

71{
72 return _overlap;
73}

Member Data Documentation

◆ _cuboidGeometry

template<typename T , unsigned D>
CuboidGeometry<T,D>& olb::SuperStructure< T, D >::_cuboidGeometry
protected

The grid structure is stored here.

Definition at line 42 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 44 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 47 of file superStructure.h.

◆ clout

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

class specific output stream

Definition at line 49 of file superStructure.h.


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