MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
AccessorStructured< SolverType > Class Template Reference

#include <fvstg.h>

Inheritance diagram for AccessorStructured< SolverType >:
[legend]
Collaboration diagram for AccessorStructured< SolverType >:
[legend]

Classes

class  nDim_citerator
 

Public Member Functions

 AccessorStructured (const MInt *const start, const MInt *const end, const MInt *const nCells, const MInt *const stgBoxSize, MInt noGhostLayers, FvStructuredSolver< 3 > *solver, const MPI_Comm commStg)
 
MInt cellIndex (const MInt i, const MInt j, const MInt k) const
 
MInt cellIndex (const MInt *const ijk_) const
 
MInt cellIndexBC (const MInt i, const MInt j, const MInt k) const
 
MInt cellIndexBC (const MInt *const ijk_) const
 
MInt start (MInt dim) const
 
MInt end (MInt dim) const
 
MInt domainId () const
 
MInt domainId (MInt, MInt) const override
 
nDim_citerator nDim_citerator_begin (const MInt *start, const MInt *end) const
 
nDim_citerator nDim_citerator_begin () const
 
nDim_citerator nDim_citerator_end () const
 
nDim_citerator iterateSlopes ()
 Solver specific implementations of the interface defined in base class. More...
 
nDim_citerator iterateSlopes_nDim_citerator_end ()
 
nDim_citerator iterateB1 ()
 
nDim_citerator iterateB1_nDim_citerator_end ()
 
nDim_citerator iterateAll ()
 
nDim_citerator iterateAll_nDim_citerator_end ()
 
MInt getCellId (const nDim_citerator &it_) const
 Helper functions for nDim_citerator as declared in base class. More...
 
MInt getStgId (const nDim_citerator &it_) const
 
MInt getNghbr (const nDim_citerator &it_, MInt dir) const
 
MInt getNghbrStg (const nDim_citerator &it_, MInt dir) const
 
MFloat a_coordinate (MInt cellId, MInt dim) const override
 
MFloata_pvariable (MInt cellId, MInt varId) override
 
MFloatUInfinity () const override
 
MFloatPInfinity () const override
 
MFloatrhoInfinity () const override
 
- Public Member Functions inherited from Accessor< AccessorStructured< SolverType >, SolverType >
AccessorStructured< SolverType > * d ()
 
virtual MFloat a_coordinate (MInt, MInt) const=0
 
virtual MInt domainId (MInt, MInt) const=0
 
virtual MFloata_pvariable (MInt, MInt)=0
 
virtual MFloatUInfinity () const=0
 
virtual MFloatPInfinity () const=0
 
virtual MFloatrhoInfinity () const=0
 
MInt sizeBC () const
 
MInt sizeStg () const
 
nDim_citerator iterateSlopes ()
 
nDim_citerator iterateSlopes_nDim_citerator_end ()
 
nDim_citerator iterateB1 ()
 
nDim_citerator iterateB1_nDim_citerator_end ()
 
nDim_citerator iterateAll ()
 
nDim_citerator iterateAll_nDim_citerator_end ()
 
MInt getCellId (const nDim_citerator &it_) const
 
MInt getStgId (const nDim_citerator &it_) const
 
MInt getNghbr (const nDim_citerator &it_, MInt dir) const
 
MInt getNghbrStg (const nDim_citerator &it_, MInt dir) const
 

Private Attributes

const MInt *const m_start
 
const MInt *const m_end
 
const MInt *const m_nCells
 
const MInt *const m_stgBoxSize
 
const MInt m_noGhostLayers
 
nDim_citerator nDim_citerator_invalid
 

Static Private Attributes

static constexpr const MInt map_ [6][3] = {{-1, 0, 0}, {1, 0, 0}, {0, -1, 0}, {0, 1, 0}, {0, 0, -1}, {0, 0, 1}}
 

Additional Inherited Members

- Public Types inherited from Accessor< AccessorStructured< SolverType >, SolverType >
using nDim_citerator = nDim_iterator_t< std::vector< MInt >::const_iterator, SolverType >
 
- Public Attributes inherited from Accessor< AccessorStructured< SolverType >, SolverType >
SolverType *const m_solver
 
MPI_Comm m_commStg
 
Storage m_stgToCellId
 
Storage m_bcStgId
 
Storage m_stgId
 
MInt m_noBcCells
 
MInt m_stgSize
 
- Static Public Attributes inherited from Accessor< AccessorStructured< SolverType >, SolverType >
static constexpr const MInt m_nDim
 
- Protected Types inherited from Accessor< AccessorStructured< SolverType >, SolverType >
using Storage = std::vector< MInt >
 
using iterator = std::vector< MInt >::iterator
 
using const_iterator = std::vector< MInt >::const_iterator
 

Detailed Description

template<class SolverType>
class AccessorStructured< SolverType >

Definition at line 333 of file fvstg.h.

Constructor & Destructor Documentation

◆ AccessorStructured()

template<class SolverType >
AccessorStructured< SolverType >::AccessorStructured ( const MInt *const  start,
const MInt *const  end,
const MInt *const  nCells,
const MInt *const  stgBoxSize,
MInt  noGhostLayers,
FvStructuredSolver< 3 > *  solver,
const MPI_Comm  commStg 
)
inlineexplicit

Definition at line 348 of file fvstg.h.

352 m_start(start),
353 m_end(end),
354 m_nCells(nCells),
355 m_stgBoxSize(stgBoxSize),
356 m_noGhostLayers(noGhostLayers) {
357 /* if (m_nDim==2) {
358 m_nCells[2] = m_nCells[1];
359 m_nCells[1] = m_nCells[0];
360 m_nCells[0] = 1;
361 }*/
362
363 m_stgSize = 1;
364 for(MInt d = 0; d < m_nDim; ++d) {
366 }
367
368 m_noBcCells = 1;
369 for(MInt d = 0; d < m_nDim; d++) {
370 const MInt nDims = m_end[d] - m_start[d];
371 m_noBcCells *= nDims;
372 }
373
374 m_stgToCellId.resize(m_stgSize);
375 MInt cnt = 0;
376 for(MInt k = 0; k < m_stgBoxSize[2]; ++k) {
377 for(MInt j = 0; j < m_stgBoxSize[1]; ++j) {
378 for(MInt i = 0; i < m_stgBoxSize[0]; ++i) {
379 m_stgToCellId[cnt++] = cellIndex(i, j, k);
380 }
381 }
382 }
383
384 m_bcStgId.resize(m_noBcCells);
385 cnt = 0;
386 for(MInt k = m_start[2]; k < m_end[2]; ++k) {
387 for(MInt j = m_start[1]; j < m_end[1]; ++j) {
388 for(MInt i = m_start[0]; i < m_end[0]; ++i) {
389 m_bcStgId[cnt++] = cellIndexBC(i, j, k);
390 }
391 }
392 }
393
394 m_stgId.resize(m_stgSize);
395 std::iota(std::begin(m_stgId), std::end(m_stgId), 0); // Fill with 0, 1, ..., m_stgSize-1
396 } // Constructor ends
Definition: fvstg.h:88
AccessorStructured< SolverType > * d()
Definition: fvstg.h:106
const MInt m_noGhostLayers
Definition: fvstg.h:587
const MInt *const m_stgBoxSize
Definition: fvstg.h:586
const MInt *const m_nCells
Definition: fvstg.h:584
const MInt *const m_end
Definition: fvstg.h:582
MInt end(MInt dim) const
Definition: fvstg.h:408
MInt cellIndexBC(const MInt i, const MInt j, const MInt k) const
Definition: fvstg.h:401
const MInt *const m_start
Definition: fvstg.h:580
MInt cellIndex(const MInt i, const MInt j, const MInt k) const
Definition: fvstg.h:399
MInt start(MInt dim) const
Definition: fvstg.h:407
SolverType
Definition: enums.h:22
int32_t MInt
Definition: maiatypes.h:62

Member Function Documentation

◆ a_coordinate()

template<class SolverType >
MFloat AccessorStructured< SolverType >::a_coordinate ( MInt  cellId,
MInt  dim 
) const
inlineoverridevirtual

Implements Accessor< AccessorStructured< SolverType >, SolverType >.

Definition at line 572 of file fvstg.h.

572{ return m_solver->m_cells->coordinates[dim][cellId]; }
void const MInt cellId
Definition: collector.h:239

◆ a_pvariable()

template<class SolverType >
MFloat & AccessorStructured< SolverType >::a_pvariable ( MInt  cellId,
MInt  varId 
)
inlineoverridevirtual

Implements Accessor< AccessorStructured< SolverType >, SolverType >.

Definition at line 573 of file fvstg.h.

573{ return m_solver->m_cells->pvariables[varId][cellId]; }

◆ cellIndex() [1/2]

template<class SolverType >
MInt AccessorStructured< SolverType >::cellIndex ( const MInt *const  ijk_) const
inline

Definition at line 400 of file fvstg.h.

400{ return ijk_[0] + (ijk_[1] + ijk_[2] * m_nCells[1]) * m_nCells[2]; }

◆ cellIndex() [2/2]

template<class SolverType >
MInt AccessorStructured< SolverType >::cellIndex ( const MInt  i,
const MInt  j,
const MInt  k 
) const
inline

Definition at line 399 of file fvstg.h.

399{ return i + (j + k * m_nCells[1]) * m_nCells[2]; }

◆ cellIndexBC() [1/2]

template<class SolverType >
MInt AccessorStructured< SolverType >::cellIndexBC ( const MInt *const  ijk_) const
inline

Definition at line 404 of file fvstg.h.

404 {
405 return ijk_[0] + (ijk_[1] + ijk_[2] * m_stgBoxSize[1]) * m_stgBoxSize[2];
406 }

◆ cellIndexBC() [2/2]

template<class SolverType >
MInt AccessorStructured< SolverType >::cellIndexBC ( const MInt  i,
const MInt  j,
const MInt  k 
) const
inline

Definition at line 401 of file fvstg.h.

401 {
402 return i + (j + k * m_stgBoxSize[1]) * m_stgBoxSize[2];
403 }

◆ domainId() [1/2]

template<class SolverType >
MInt AccessorStructured< SolverType >::domainId ( ) const
inline

Definition at line 410 of file fvstg.h.

410{ return m_solver->domainId(); }

◆ domainId() [2/2]

template<class SolverType >
MInt AccessorStructured< SolverType >::domainId ( MInt  ,
MInt   
) const
inlineoverridevirtual

Implements Accessor< AccessorStructured< SolverType >, SolverType >.

Definition at line 411 of file fvstg.h.

411{ TERMM(-1, "Invalid call!"); }

◆ end()

template<class SolverType >
MInt AccessorStructured< SolverType >::end ( MInt  dim) const
inline

Definition at line 408 of file fvstg.h.

408{ return m_end[dim]; }

◆ getCellId()

template<class SolverType >
MInt AccessorStructured< SolverType >::getCellId ( const nDim_citerator it_) const
inline

Definition at line 558 of file fvstg.h.

558 {
559 assert(m_stgToCellId[*it_] == cellIndex(it_.getijk()));
560 return m_stgToCellId[*it_];
561 }

◆ getNghbr()

template<class SolverType >
MInt AccessorStructured< SolverType >::getNghbr ( const nDim_citerator it_,
MInt  dir 
) const
inline

Definition at line 565 of file fvstg.h.

565 {
566 return cellIndex(it_.getijk(0) + map_[dir][0], it_.getijk(1) + map_[dir][1], it_.getijk(2) + map_[dir][2]);
567 }
static constexpr const MInt map_[6][3]
Definition: fvstg.h:591

◆ getNghbrStg()

template<class SolverType >
MInt AccessorStructured< SolverType >::getNghbrStg ( const nDim_citerator it_,
MInt  dir 
) const
inline

Definition at line 568 of file fvstg.h.

568 {
569 return cellIndexBC(it_.getijk(0) + map_[dir][0], it_.getijk(1) + map_[dir][1], it_.getijk(2) + map_[dir][2]);
570 }

◆ getStgId()

template<class SolverType >
MInt AccessorStructured< SolverType >::getStgId ( const nDim_citerator it_) const
inline

Definition at line 562 of file fvstg.h.

562{ return *it_; }

◆ iterateAll()

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::iterateAll ( )
inline

Definition at line 550 of file fvstg.h.

550 {
551 MInt start_[3] = {0, 0, 0};
552 return {this, &start_[0], m_stgBoxSize};
553 }

◆ iterateAll_nDim_citerator_end()

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::iterateAll_nDim_citerator_end ( )
inline

Definition at line 555 of file fvstg.h.

555{ return nDim_citerator_invalid; }
nDim_citerator nDim_citerator_invalid
Definition: fvstg.h:589

◆ iterateB1()

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::iterateB1 ( )
inline

Definition at line 541 of file fvstg.h.

541 {
542 MInt ii = m_noGhostLayers - 1;
543 MInt start_[3] = {ii, m_start[1], m_start[2]};
544 MInt end_[3] = {ii + 1, m_end[1], m_end[2]};
545 return {this, &start_[0], &end_[0]};
546 }

◆ iterateB1_nDim_citerator_end()

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::iterateB1_nDim_citerator_end ( )
inline

Definition at line 548 of file fvstg.h.

548{ return nDim_citerator_invalid; }

◆ iterateSlopes()

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::iterateSlopes ( )
inline

Definition at line 532 of file fvstg.h.

532 {
533 MInt ii = 1;
534 MInt start_[3] = {ii, m_start[1] + 1, m_start[2] + 1};
535 MInt end_[3] = {ii + 1, m_end[1] - 1, m_end[2] - 1};
536 return {this, &start_[0], &end_[0]};
537 }

◆ iterateSlopes_nDim_citerator_end()

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::iterateSlopes_nDim_citerator_end ( )
inline

Definition at line 539 of file fvstg.h.

539{ return nDim_citerator_invalid; }

◆ nDim_citerator_begin() [1/2]

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::nDim_citerator_begin ( ) const
inline

Definition at line 527 of file fvstg.h.

527{ return {this, m_start, m_end}; }

◆ nDim_citerator_begin() [2/2]

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::nDim_citerator_begin ( const MInt start,
const MInt end 
) const
inline

Definition at line 526 of file fvstg.h.

526{ return {this, start, end}; }

◆ nDim_citerator_end()

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::nDim_citerator_end ( ) const
inline

Definition at line 528 of file fvstg.h.

528{ return nDim_citerator_invalid; }

◆ PInfinity()

template<class SolverType >
MFloat & AccessorStructured< SolverType >::PInfinity ( ) const
inlineoverridevirtual

Implements Accessor< AccessorStructured< SolverType >, SolverType >.

Definition at line 575 of file fvstg.h.

575{ return m_solver->PV->PInfinity; }

◆ rhoInfinity()

template<class SolverType >
MFloat & AccessorStructured< SolverType >::rhoInfinity ( ) const
inlineoverridevirtual

Implements Accessor< AccessorStructured< SolverType >, SolverType >.

Definition at line 576 of file fvstg.h.

576{ return m_solver->CV->rhoInfinity; }

◆ start()

template<class SolverType >
MInt AccessorStructured< SolverType >::start ( MInt  dim) const
inline

Definition at line 407 of file fvstg.h.

407{ return m_start[dim]; }

◆ UInfinity()

template<class SolverType >
MFloat & AccessorStructured< SolverType >::UInfinity ( ) const
inlineoverridevirtual

Implements Accessor< AccessorStructured< SolverType >, SolverType >.

Definition at line 574 of file fvstg.h.

574{ return m_solver->PV->UInfinity; }

Member Data Documentation

◆ m_end

template<class SolverType >
const MInt* const AccessorStructured< SolverType >::m_end
private

Definition at line 582 of file fvstg.h.

◆ m_nCells

template<class SolverType >
const MInt* const AccessorStructured< SolverType >::m_nCells
private

Definition at line 584 of file fvstg.h.

◆ m_noGhostLayers

template<class SolverType >
const MInt AccessorStructured< SolverType >::m_noGhostLayers
private

Definition at line 587 of file fvstg.h.

◆ m_start

template<class SolverType >
const MInt* const AccessorStructured< SolverType >::m_start
private

Definition at line 580 of file fvstg.h.

◆ m_stgBoxSize

template<class SolverType >
const MInt* const AccessorStructured< SolverType >::m_stgBoxSize
private

Definition at line 586 of file fvstg.h.

◆ map_

template<class SolverType >
constexpr const MInt AccessorStructured< SolverType >::map_[6][3] = {{-1, 0, 0}, {1, 0, 0}, {0, -1, 0}, {0, 1, 0}, {0, 0, -1}, {0, 0, 1}}
staticconstexprprivate

Definition at line 591 of file fvstg.h.

◆ nDim_citerator_invalid

template<class SolverType >
nDim_citerator AccessorStructured< SolverType >::nDim_citerator_invalid
private

Definition at line 589 of file fvstg.h.


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