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

#include <fvstg.h>

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

Public Types

using self_type = nDim_citerator
 
using iterator_category = std::random_access_iterator_tag
 
using value_type = MInt
 
using difference_type = MInt
 
using pointer = MInt *
 
using reference = MInt &
 

Public Member Functions

 nDim_citerator ()=default
 
 nDim_citerator (const AccessorStructured *parent, const MInt *start, const MInt *end)
 
value_type getCellId () const
 
value_type getStgId () const
 
value_type getijk (MInt dim) const
 
pointer getijk () const
 
value_type getNghbr (MInt dir) const
 
value_type getNghbrStg (MInt dir) const
 
self_type operator++ (MInt)
 
self_typeoperator++ ()
 
const MIntoperator* ()
 
const MIntoperator* () const
 
const self_typeoperator-> ()
 
MBool operator== (const self_type &rhs) const
 
MBool operator!= (const self_type &rhs) const
 

Private Attributes

const AccessorStructuredp {}
 
value_type stgId {}
 
pointer ijk {}
 
const MInt *const ijk_start = nullptr
 
const MInt *const ijk_end = nullptr
 
MBool flag_last = false
 

Detailed Description

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

Iterator, to iterate over a certain ijk-range; it internally keeps track of the current ijk values, while iterating over lists containing stg ids

Definition at line 415 of file fvstg.h.

Member Typedef Documentation

◆ difference_type

template<class SolverType >
using AccessorStructured< SolverType >::nDim_citerator::difference_type = MInt

Definition at line 420 of file fvstg.h.

◆ iterator_category

template<class SolverType >
using AccessorStructured< SolverType >::nDim_citerator::iterator_category = std::random_access_iterator_tag

Definition at line 418 of file fvstg.h.

◆ pointer

template<class SolverType >
using AccessorStructured< SolverType >::nDim_citerator::pointer = MInt*

Definition at line 421 of file fvstg.h.

◆ reference

template<class SolverType >
using AccessorStructured< SolverType >::nDim_citerator::reference = MInt&

Definition at line 422 of file fvstg.h.

◆ self_type

template<class SolverType >
using AccessorStructured< SolverType >::nDim_citerator::self_type = nDim_citerator

Definition at line 417 of file fvstg.h.

◆ value_type

template<class SolverType >
using AccessorStructured< SolverType >::nDim_citerator::value_type = MInt

Definition at line 419 of file fvstg.h.

Constructor & Destructor Documentation

◆ nDim_citerator() [1/2]

template<class SolverType >
AccessorStructured< SolverType >::nDim_citerator::nDim_citerator ( )
default

◆ nDim_citerator() [2/2]

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

Definition at line 426 of file fvstg.h.

427 : p(parent), ijk_start(start), ijk_end(end) {
428 // std::copy_n(&start[0], m_nDim, &ijk_start[0]);
429 // std::copy_n(&end[0], m_nDim, &ijk_end[0]);
430 std::copy_n(&start[0], m_nDim, &ijk[0]);
431 stgId = p->cellIndexBC(ijk[0], ijk[1], ijk[2]);
432 }
const MInt *const ijk_end
Definition: fvstg.h:521
const MInt *const ijk_start
Definition: fvstg.h:520
const AccessorStructured * p
Definition: fvstg.h:514
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
MInt start(MInt dim) const
Definition: fvstg.h:407

Member Function Documentation

◆ getCellId()

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

Definition at line 437 of file fvstg.h.

437{ return p->cellIndex(ijk); }
MInt cellIndex(const MInt i, const MInt j, const MInt k) const
Definition: fvstg.h:399

◆ getijk() [1/2]

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

Definition at line 440 of file fvstg.h.

440{ return ijk; }

◆ getijk() [2/2]

template<class SolverType >
value_type AccessorStructured< SolverType >::nDim_citerator::getijk ( MInt  dim) const
inline

Definition at line 439 of file fvstg.h.

439{ return ijk[dim]; }

◆ getNghbr()

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

Definition at line 442 of file fvstg.h.

442 {
443 return p->cellIndex(ijk[0] + map_[dir][0], ijk[1] + map_[dir][1], ijk[2] + map_[dir][2]);
444 }
static constexpr const MInt map_[6][3]
Definition: fvstg.h:591

◆ getNghbrStg()

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

Definition at line 445 of file fvstg.h.

445 {
446 return p->cellIndexBC(ijk[0] + map_[dir][0], ijk[1] + map_[dir][1], ijk[2] + map_[dir][2]);
447 }

◆ getStgId()

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

Definition at line 438 of file fvstg.h.

438{ return stgId; }

◆ operator!=()

template<class SolverType >
MBool AccessorStructured< SolverType >::nDim_citerator::operator!= ( const self_type rhs) const
inline

Definition at line 510 of file fvstg.h.

510{ return !(*this == rhs); }

◆ operator*() [1/2]

template<class SolverType >
const MInt & AccessorStructured< SolverType >::nDim_citerator::operator* ( )
inline

Definition at line 504 of file fvstg.h.

504{ return stgId; } // emulate as if it was a iterator

◆ operator*() [2/2]

template<class SolverType >
const MInt & AccessorStructured< SolverType >::nDim_citerator::operator* ( ) const
inline

Definition at line 505 of file fvstg.h.

505{ return stgId; } // emulate as if it was a iterator

◆ operator++() [1/2]

template<class SolverType >
self_type & AccessorStructured< SolverType >::nDim_citerator::operator++ ( )
inline

Definition at line 480 of file fvstg.h.

480 {
481 if(ijk[0] < ijk_end[0]) {
482 ijk[0]++;
483 ++stgId;
484 return *this;
485 }
486
487 if(ijk[1] < ijk_end[1]) {
488 ijk[0] = ijk_start[0];
489 ijk[1]++;
490 stgId = p->cellIndexBC(ijk[0], ijk[1], ijk[2]);
491 return *this;
492 }
493
494 if(ijk[2] < ijk_end[2]) {
495 ijk[0] = ijk_start[0];
496 ijk[1] = ijk_start[1];
497 ijk[2]++;
498 stgId = p->cellIndexBC(ijk[0], ijk[1], ijk[2]);
499 return *this;
500 }
501 return const_cast<AccessorStructured*>(p)->nDim_citerator_invalid;
502 }
nDim_citerator nDim_citerator_invalid
Definition: fvstg.h:589

◆ operator++() [2/2]

template<class SolverType >
self_type AccessorStructured< SolverType >::nDim_citerator::operator++ ( MInt  )
inline

Definition at line 450 of file fvstg.h.

450 {
451 self_type temp = *this;
452 if(ijk[0] < ijk_end[0]) {
453 stgId++;
454 ijk[0]++;
455 return temp;
456 }
457
458 if(ijk[1] < ijk_end[1]) {
459 ijk[0] = ijk_start[0];
460 ijk[1]++;
461 stgId = p->cellIndexBC(ijk[0], ijk[1], ijk[2]);
462 return temp;
463 }
464
465 if(ijk[2] < ijk_end[2]) {
466 ijk[0] = ijk_start[0];
467 ijk[1] = ijk_start[1];
468 ijk[2]++;
469 stgId = p->cellIndexBC(ijk[0], ijk[1], ijk[2]);
470 return temp;
471 }
472 if(flag_last) {
474 }
475 flag_last = true;
476 return temp;
477 }

◆ operator->()

template<class SolverType >
const self_type * AccessorStructured< SolverType >::nDim_citerator::operator-> ( )
inline

Definition at line 506 of file fvstg.h.

506{ return this; } // emulate as if it was a iterator

◆ operator==()

template<class SolverType >
MBool AccessorStructured< SolverType >::nDim_citerator::operator== ( const self_type rhs) const
inline

Definition at line 507 of file fvstg.h.

507 {
508 return (stgId == *rhs && getijk(0) == rhs.getijk(0) && getijk(1) == rhs.getijk(1) && getijk(2) == rhs.getijk(2));
509 }

Member Data Documentation

◆ flag_last

template<class SolverType >
MBool AccessorStructured< SolverType >::nDim_citerator::flag_last = false
private

Definition at line 522 of file fvstg.h.

◆ ijk

template<class SolverType >
pointer AccessorStructured< SolverType >::nDim_citerator::ijk {}
private

Definition at line 518 of file fvstg.h.

◆ ijk_end

template<class SolverType >
const MInt* const AccessorStructured< SolverType >::nDim_citerator::ijk_end = nullptr
private

Definition at line 521 of file fvstg.h.

◆ ijk_start

template<class SolverType >
const MInt* const AccessorStructured< SolverType >::nDim_citerator::ijk_start = nullptr
private

Definition at line 520 of file fvstg.h.

◆ p

template<class SolverType >
const AccessorStructured* AccessorStructured< SolverType >::nDim_citerator::p {}
private

Definition at line 514 of file fvstg.h.

◆ stgId

template<class SolverType >
value_type AccessorStructured< SolverType >::nDim_citerator::stgId {}
private

Definition at line 516 of file fvstg.h.


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