/usr/include/dune/common/parallel/localindex.hh is in libdune-common-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | // $Id$
#ifndef DUNE_COMMON_LOCALINDEX_HH
#define DUNE_COMMON_LOCALINDEX_HH
#include<cstddef>
namespace Dune
{
/** @addtogroup Common_Parallel
*
* @{
*/
/**
* @file
* @brief Provides classes for use as the local index in ParallelIndexSet.
* @author Markus Blatt
*/
/**
* @brief The states avaiable for the local indices.
* @see LocalIndex::state()
*/
enum LocalIndexState {VALID, DELETED};
/**
* @brief An index present on the local process.
*/
class LocalIndex
{
public:
/**
* @brief Constructor.
* known to other processes.
*/
LocalIndex() :
localIndex_(0), state_(VALID){}
/**
* @brief Constructor.
* @param index The value of the index.
*/
LocalIndex(std::size_t index) :
localIndex_(index), state_(VALID){}
/**
* @brief get the local index.
* @return The local index.
*/
inline const std::size_t& local() const;
/**
* @brief Convert to the local index represented by an int.
*/
inline operator std::size_t() const;
/**
* @brief Assign a new local index.
*
* @param index The new local index.
*/
inline LocalIndex& operator=(std::size_t index);
/**
* @brief Get the state.
* @return The state.
*/
inline LocalIndexState state() const;
/**
* @brief Set the state.
* @param state The state to set.
*/
inline void setState(LocalIndexState state);
private:
/** @brief The local index. */
std::size_t localIndex_;
/**
* @brief The state of the index.
*
* Has to be one of LocalIndexState!
* @see LocalIndexState.
*/
char state_;
};
inline const std::size_t& LocalIndex::local() const{
return localIndex_;
}
inline LocalIndex::operator std::size_t() const{
return localIndex_;
}
inline LocalIndex& LocalIndex::operator=(std::size_t index){
localIndex_ = index;
return *this;
}
inline LocalIndexState LocalIndex::state() const{
return static_cast<LocalIndexState>(state_);
}
inline void LocalIndex::setState(LocalIndexState state){
state_ = static_cast<char>(state);
}
/** @} */
} // namespace Dune
#endif
|