Page MenuHomec4science

iterator_paradis.hh
No OneTemporary

File Metadata

Created
Mon, Aug 5, 01:42

iterator_paradis.hh

/**
* @file iterator_paradis.hh
*
* @author Till Junge <till.junge@epfl.ch>
* @author Jaehyun Cho <jaehyun.cho@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief ParaDiS iterator over 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_PARADIS_HH__
#define __LIBMULTISCALE_ITERATOR_PARADIS_HH__
/* -------------------------------------------------------------------------- */
// ParaDiS includes
#define PARALLEL
extern "C" {
#include "Home.h"
#include "Typedefs.h"
}
#undef PARALLEL
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/**
* Class IteratorParaDiSNode
*
*/
class ContainerParaDiSNode::iterator
: public ContainerParaDiSNode::iterator_base {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
iterator(ContainerParaDiSNode &c, UInt index_node = 0)
: ContainerParaDiSNode::iterator_base(c), index_node(index_node) {
node.setHome(c.paradis_ptr);
node.index_node = index_node;
};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
virtual void operator++();
virtual RefParaDiSNode &operator*();
virtual bool operator!=(const iterator_base &) const;
virtual bool operator==(const iterator_base &) const;
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
RefParaDiSNode node;
private:
UInt index_node;
};
/* -------------------------------------------------------------------------- */
inline RefParaDiSNode &ContainerParaDiSNode::iterator::operator*() {
return node;
}
/* -------------------------------------------------------------------------- */
inline void ContainerParaDiSNode::iterator::operator++() {
++index_node;
node.index_node = index_node;
}
/* -------------------------------------------------------------------------- */
inline bool ContainerParaDiSNode::iterator::
operator!=(const iterator_base &it) const {
return !(*this == it);
}
/* -------------------------------------------------------------------------- */
inline bool ContainerParaDiSNode::iterator::
operator==(const iterator_base &it) const {
return index_node ==
static_cast<const typename ContainerParaDiSNode::iterator &>(it)
.index_node;
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_ITERATOR_PARADIS_HH__ */

Event Timeline