5 #ifndef DUNE_PLOCALINDEX_HH
6 #define DUNE_PLOCALINDEX_HH
36 std::ostream& operator<<(std::ostream& os, const ParallelLocalIndex<T>& index)
38 os<<
"{local="<<index.localIndex_<<
", attr="<<T(index.attribute_)<<
", public="
39 <<(index.public_ ?
true :
false)<<
"}";
47 class ParallelLocalIndex
119 inline size_t local()
const;
124 inline operator size_t()
const;
175 if(p1.local()!=p2.local())
177 if(p1.attribute()!=p2.attribute())
179 if(p1.isPublic()!=p2.isPublic())
196 return t1.attribute()<t2.attribute();
210 static MPI_Datatype type;
218 : localIndex_(0), attribute_(static_cast<char>(attribute)),
219 public_(static_cast<char>(isPublic)), state_(static_cast<char>(
VALID))
225 : localIndex_(local), attribute_(static_cast<char>(attribute)),
226 public_(static_cast<char>(isPublic)), state_(static_cast<char>(
VALID))
231 : localIndex_(0), attribute_(), public_(static_cast<char>(false)),
232 state_(static_cast<char>(
VALID))
238 return T(attribute_);
245 attribute_ = attribute;
271 return static_cast<bool>(public_);
283 state_=
static_cast<char>(state);
292 if(type==MPI_DATATYPE_NULL) {
297 length[0]=length[1]=length[2]=1;
298 MPI_Address(rep, disp);
299 MPI_Address(&(rep[0].attribute_), disp+1);
300 MPI_Address(rep+1, disp+2);
301 for(
int i=2; i >= 0; --i)
303 MPI_Type_struct(3, length, disp, types, &type);
304 MPI_Type_commit(&type);
size_t local() const
get the local index.
Definition: plocalindex.hh:249
T Attribute
The type of the attributes. Normally this will be an enumeration like.
Definition: plocalindex.hh:63
LocalIndexState
The states avaiable for the local indices.
Definition: localindex.hh:27
void setAttribute(const Attribute &attribute)
Set the attribute of the index.
Definition: plocalindex.hh:243
ParallelLocalIndex< Attribute > & operator=(size_t index)
Assign a new local index.
Definition: plocalindex.hh:262
Provides a map between global and local indices.
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:253
void setState(const LocalIndexState &state)
Set the state.
Definition: plocalindex.hh:281
ParallelLocalIndex()
Parameterless constructor.
Definition: plocalindex.hh:230
const Attribute attribute() const
Get the attribute of the index.
Definition: plocalindex.hh:236
static bool compare(const ParallelLocalIndex< T > &t1, const ParallelLocalIndex< T > &t2)
Definition: plocalindex.hh:194
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:231
An index present on the local process with an additional attribute flag.
Definition: plocalindex.hh:28
Provides classes for use as the local index in ParallelIndexSet.
static MPI_Datatype getType()
Definition: parallel/mpitraits.hh:44
LocalIndexState state() const
Get the state.
Definition: plocalindex.hh:275
A traits class describing the mapping of types onto MPI_Datatypes.
Definition: bigunsignedint.hh:29
Definition: localindex.hh:27
Definition: indexset.hh:614
bool isPublic() const
Check whether the index might also be known other processes.
Definition: plocalindex.hh:269
Traits classes for mapping types onto MPI_Datatype.