Page MenuHomec4science

iterator_akantu.hh
No OneTemporary

File Metadata

Created
Sat, Nov 16, 18:42

iterator_akantu.hh

/**
* @file iterator_akantu.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Tue Jul 29 17:03:26 2014
*
* @brief This is the generic iterator over Akantu DOFs
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_ITERATOR_AKANTU_HH__
#define __LIBMULTISCALE_ITERATOR_AKANTU_HH__
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <UInt Dim>
class ContainerElemsAkantu<Dim>::iterator :
public ContainerElemsAkantu<Dim>::iterator_base// ,
// public AkantuDOFWrapper<Dim>
{
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
iterator(ContainerElemsAkantu<Dim> &c);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
//! get fist item
RefElemAkantu<Dim> & getFirst();
//! get next item in course
RefElemAkantu<Dim> & getNext();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
private:
//! ref object that will be returned by the iterator
RefElemAkantu<Dim> ref;
//! actual number of nodes
UInt actual_nb_elem;
};
/* -------------------------------------------------------------------------- */
template <UInt Dim>
inline RefElemAkantu<Dim> & ContainerElemsAkantu<Dim>::iterator::getNext(){
if (ref.index+1 == actual_nb_elem) {
this->end_flag = true;
}
else{
++ref.index;
}
return ref;
}
/* -------------------------------------------------------------------------- */
template <UInt _Dim>
class ContainerNodesAkantu<_Dim>::iterator :
public ContainerNodesAkantu<_Dim>::iterator_base// ,
// public AkantuDOFWrapper<_Dim>
{
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
iterator(ContainerNodesAkantu<Dim> &c, DOFType dt);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
//! get fist item
RefNodeAkantu<_Dim> & getFirst();
//! get next item in course
RefNodeAkantu<_Dim> & getNext();
private:
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
//! reference object that will be returned during iterations
RefNodeAkantu<Dim> ref;
//! actual number of nodes
UInt actual_nb_elem;
//! the degrees of freedom type to iterate on
DOFType dt;
};
/* -------------------------------------------------------------------------- */
template <UInt _Dim>
inline RefNodeAkantu<_Dim> & ContainerNodesAkantu<_Dim>::iterator::getNext(){
if (ref.index+1 == actual_nb_elem) {
this->end_flag = true;
}
else{
++ref.index;
while (! (this->dt & ref.getDOFType())){
if (ref.index+1 == actual_nb_elem){
this->end_flag = true;
break;
}
++ref.index;
}
}
return ref;
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_ITERATOR_AKANTU_HH__ */

Event Timeline