OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR > Class Template Referencefinal

#include <superPorousElementEmbeddingO.h>

+ Collaboration diagram for olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >:

Public Member Functions

 SuperPorousElementEmbeddingO (SuperLattice< T, DESCRIPTOR > &sLattice)
 
template<concepts::PorosityElementF PorosityF>
void registerElementType (FunctorPtr< SuperIndicatorF< T, DESCRIPTOR::d > > &&indicatorF)
 
template<concepts::Parameters PARAMETERS>
void add (PARAMETERS &element)
 
void initialize ()
 
template<typename FIELD >
FieldD< T, DESCRIPTOR, FIELD > getField (std::size_t iElement) const
 
template<typename FIELD >
void setField (std::size_t iElement, FieldD< T, DESCRIPTOR, FIELD > data)
 
template<typename FIELD_TYPE >
void setProcessingContext (ProcessingContext context)
 
void apply ()
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >

Definition at line 47 of file superPorousElementEmbeddingO.h.

Constructor & Destructor Documentation

◆ SuperPorousElementEmbeddingO()

template<typename T , typename DESCRIPTOR >
olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::SuperPorousElementEmbeddingO ( SuperLattice< T, DESCRIPTOR > & sLattice)
inline

Definition at line 68 of file superPorousElementEmbeddingO.h.

68 :
69 _sLattice(sLattice),
70 _elementsD(makeSharedData<
71 T,descriptors::fsi::ELEMENTS<DESCRIPTOR::d>>(sLattice.getLoadBalancer(), 0))
72 {
73 OstreamManager clout(std::cout, "SuperPorousElementEmbeddingO");
74
75 //clout << "Expose physical cell locations" << std::endl;
76
77 auto& load = _sLattice.getLoadBalancer();
78 for (int iC=0; iC < load.size(); ++iC) {
79 auto& block = _sLattice.getBlock(iC);
81 block.forCoreSpatialLocations([&](LatticeR<DESCRIPTOR::d> loc) {
82 auto latticeR = loc.withPrefix(load.glob(iC));
83 auto physR = _sLattice.getCuboidDecomposition().getPhysR(latticeR);
84 block.get(loc).template setField<descriptors::LOCATION>(physR);
85 });
86 }
88
89 _exposeElementTypeParametersO[typeid(SuperPorousElementEmbeddingO)] = [this](std::size_t nElements){
91 using field_t = typename decltype(field)::type;
92 auto& fieldArrayD = _elementsD->template get<Array<field_t>>();
93 fieldArrayD.resize(nElements);
94 _sLattice.template setParameter<fields::array_of<field_t>>(fieldArrayD);
95 });
96 };
97 }
SuperPorousElementEmbeddingO(SuperLattice< T, DESCRIPTOR > &sLattice)
void setProcessingContext(ProcessingContext context)
FieldD< T, DESCRIPTOR, FIELD > getField(std::size_t iElement) const
void setField(std::size_t iElement, FieldD< T, DESCRIPTOR, FIELD > data)
std::enable_if_t< DESCRIPTOR::d==2, std::shared_ptr< SuperF2D< T > > > field(SuperLattice< T, DESCRIPTOR > &sLattice)
Returns external field functor.
@ Simulation
Data available on host for e.g. functor evaluation.
std::unique_ptr< Data< T, DESCRIPTOR > > makeSharedData(LoadBalancer< T > &loadBalancer, ARGS &&... args)
Constructs Data accessible on all locally used platforms.
Definition data.h:539
Vector< std::int32_t, D > LatticeR
Type for spatial block-local lattice coordinates.
static constexpr void for_each(F f)
Definition meta.h:331

References olb::meta::list< FIELDS... >::for_each(), olb::SuperLattice< T, DESCRIPTOR >::getBlock(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::getField(), olb::SuperStructure< T, D >::getLoadBalancer(), olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::setField(), olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::setProcessingContext(), olb::Simulation, olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::SuperPorousElementEmbeddingO(), and olb::Vector< T, Size >::withPrefix().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ add()

template<typename T , typename DESCRIPTOR >
template<concepts::Parameters PARAMETERS>
void olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::add ( PARAMETERS & element)
inline

Definition at line 126 of file superPorousElementEmbeddingO.h.

126 {
127 std::size_t iElement = getElementCount();
128 setElementCount(iElement+1);
129 const std::size_t nElements = getElementCount();
130
131 PARAMETERS::fields_t::for_each([&](auto field) {
132 using field_t = typename decltype(field)::type;
133 if (_elementsD->template provides<Array<field_t>>()) {
134 _elementsD->template get<Array<field_t>>().set(
135 iElement, element.template get<field_t>());
136 }
137 });
138
139 if constexpr (PARAMETERS::fields_t::template contains<fields::fsi::ELEMENT_LOWER>()) {
140 if constexpr (PARAMETERS::fields_t::template contains<fields::fsi::ELEMENT_UPPER>()) {
141 _elementsD->template get<Array<fields::fsi::ELEMENT_UPPER>>().set(
142 iElement, element.template get<fields::fsi::ELEMENT_UPPER>());
143 } else {
144 auto upper = element.template get<fields::fsi::ELEMENT_LOWER>()
145 + element.template get<fields::fsi::ELEMENT_REFERENCE_DELTA_X>()
146 * element.template get<fields::fsi::ELEMENT_REFERENCE_EXTENT>();
147 _elementsD->template get<Array<fields::fsi::ELEMENT_UPPER>>().set(iElement, upper);
148 }
149 }
150
151 if constexpr (PARAMETERS::fields_t::template contains<fields::fsi::ELEMENT_REFERENCE_DELTA_X>()) {
152 _elementsD->template get<Array<fields::fsi::ELEMENT_REFERENCE_DELTA_X>>().set(
153 iElement, element.template get<fields::fsi::ELEMENT_REFERENCE_DELTA_X>());
154 _elementsD->template get<Array<fields::fsi::ELEMENT_REFERENCE_POROSITY>>().set(
155 iElement, element.template get<fields::fsi::ELEMENT_REFERENCE_POROSITY>());
156 auto extent = element.template get<fields::fsi::ELEMENT_REFERENCE_EXTENT>();
158 if constexpr (DESCRIPTOR::d == 3) {
159 projection = {extent[1]*extent[2], extent[2], 1};
160 } else {
161 projection = {extent[1], 1};
162 }
163 _elementsD->template get<Array<fields::fsi::ELEMENT_REFERENCE_PROJECTION>>().set(iElement, projection);
164 }
165
166 _elementsD->setProcessingContext(ProcessingContext::Simulation);
167 _sLattice.template setParameter<fields::fsi::ELEMENTS_COUNT>(nElements);
168 }
void set(BlockLattice< T, DESCRIPTOR > &block, BlockIndicatorF< T, DESCRIPTOR::d > &boundaryI, BlockIndicatorF< T, DESCRIPTOR::d > &fluidI, BlockIndicatorF< T, DESCRIPTOR::d > &outsideI)
Definition setBoundary.h:80
Vector< typename FIELD::template value_type< T >, DESCRIPTOR::template size< FIELD >() > FieldD
Vector storing a single field instance.
Definition vector.h:480

References olb::Simulation.

◆ apply()

template<typename T , typename DESCRIPTOR >
void olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::apply ( )
inline

Definition at line 191 of file superPorousElementEmbeddingO.h.

191 {
192 _sLattice.executePostProcessors(stage::fsi::DistributeToFluid{});
193 }

References olb::SuperLattice< T, DESCRIPTOR >::executePostProcessors().

+ Here is the call graph for this function:

◆ getField()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
FieldD< T, DESCRIPTOR, FIELD > olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::getField ( std::size_t iElement) const
inline

Definition at line 177 of file superPorousElementEmbeddingO.h.

177 {
178 return _elementsD->template get<Array<FIELD>>().get(iElement);
179 }
int get()
Get current device.
Definition device.hh:71
+ Here is the caller graph for this function:

◆ initialize()

template<typename T , typename DESCRIPTOR >
void olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::initialize ( )
inline

Definition at line 170 of file superPorousElementEmbeddingO.h.

170 {
171 setElementCount(getElementCount());
172 _elementsD->setProcessingContext(ProcessingContext::Simulation);
173 _sLattice.executePostProcessors(stage::fsi::Initialize{});
174 }

References olb::SuperLattice< T, DESCRIPTOR >::executePostProcessors(), and olb::Simulation.

+ Here is the call graph for this function:

◆ registerElementType()

template<typename T , typename DESCRIPTOR >
template<concepts::PorosityElementF PorosityF>
void olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::registerElementType ( FunctorPtr< SuperIndicatorF< T, DESCRIPTOR::d > > && indicatorF)
inline

Definition at line 100 of file superPorousElementEmbeddingO.h.

100 {
101 PorosityF::data::for_each([&](auto field) {
102 using field_t = typename decltype(field)::type;
103 if (!_elementsD->template provides<Array<field_t>>()) {
104 _elementsD->template allocate<Array<field_t>>(getElementCount());
105 }
106 });
107
108 _sLattice.template addPostProcessor<stage::fsi::Initialize>(
109 std::forward<decltype(indicatorF)>(indicatorF),
110 meta::id<InitializePorosityO<PorosityF>>{});
111 _sLattice.template addPostProcessor<stage::fsi::DistributeToFluid>(
112 std::forward<decltype(indicatorF)>(indicatorF),
113 meta::id<UpdatePorosityO<PorosityF>>{});
114
115 _exposeElementTypeParametersO[typeid(PorosityF)] = [this](std::size_t nElements){
116 PorosityF::data::for_each([this,nElements](auto field) {
117 using field_t = typename decltype(field)::type;
118 auto& fieldArrayD = _elementsD->template get<Array<field_t>>();
119 fieldArrayD.resize(nElements);
120 _sLattice.template setParameter<fields::array_of<field_t>>(fieldArrayD);
121 });
122 };
123 }

◆ setField()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
void olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::setField ( std::size_t iElement,
FieldD< T, DESCRIPTOR, FIELD > data )
inline

Definition at line 182 of file superPorousElementEmbeddingO.h.

182 {
183 _elementsD->template get<Array<FIELD>>().set(iElement, data);
184 }
+ Here is the caller graph for this function:

◆ setProcessingContext()

template<typename T , typename DESCRIPTOR >
template<typename FIELD_TYPE >
void olb::SuperPorousElementEmbeddingO< T, DESCRIPTOR >::setProcessingContext ( ProcessingContext context)
inline

Definition at line 187 of file superPorousElementEmbeddingO.h.

187 {
188 _elementsD->template get<FIELD_TYPE>().setProcessingContext(context);
189 }
+ Here is the caller graph for this function:

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