FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_Dof.hpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2009 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _fei_Dof_hpp_
10 #define _fei_Dof_hpp_
11 
12 #include <fei_macros.hpp>
13 
14 namespace fei {
15 
39 template<class LocalOrdinal, class GlobalOrdinal>
40 class Dof {
41  public:
43  Dof(LocalOrdinal rank, GlobalOrdinal id, LocalOrdinal field)
44  : m_rank(rank), m_id(id), m_field(field) {}
45 
47  ~Dof(){}
48 
49  LocalOrdinal rank() const { return m_rank; }
50  GlobalOrdinal id() const { return m_id; }
51  LocalOrdinal field() const { return m_field; }
52 
53  private:
54  LocalOrdinal m_rank;
55  GlobalOrdinal m_id;
56  LocalOrdinal m_field;
57 };//class Dof
58 
61 template<class LocalOrdinal, class GlobalOrdinal>
63  bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>& dof1,
64  const Dof<LocalOrdinal,GlobalOrdinal>& dof2) const
65  {
66  if (dof1.rank()==dof2.rank()) {
67  if (dof1.id() == dof2.id()) return dof1.field() < dof2.field();
68  else return dof1.id() < dof2.id();
69  }
70  else {
71  return dof1.rank() < dof2.rank();
72  }
73  }
74 
75  bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>* dof1,
76  const Dof<LocalOrdinal,GlobalOrdinal>* dof2) const
77  {
78  if (dof1->rank()==dof2->rank()) {
79  if (dof1->id() == dof2->id()) return dof1->field() < dof2->field();
80  else return dof1->id() < dof2->id();
81  }
82  else {
83  return dof1->rank() < dof2->rank();
84  }
85  }
86 };
87 
90 template<class LocalOrdinal, class GlobalOrdinal>
92  bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>& dof1,
93  const Dof<LocalOrdinal,GlobalOrdinal>& dof2) const
94  {
95  if (dof1.field()==dof2.field()) {
96  if (dof1.rank() == dof2.rank()) return dof1.id() < dof2.id();
97  else return dof1.rank() < dof2.rank();
98  }
99  else {
100  return dof1.field() < dof2.field();
101  }
102  }
103 
104  bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>* dof1,
105  const Dof<LocalOrdinal,GlobalOrdinal>* dof2) const
106  {
107  if (dof1->field()==dof2->field()) {
108  if (dof1->rank() == dof2->rank()) return dof1->id() < dof2->id();
109  else return dof1->rank() < dof2->rank();
110  }
111  else {
112  return dof1->field() < dof2->field();
113  }
114  }
115 };
116 
117 }//namespace fei
118 #endif
119 
Dof(LocalOrdinal rank, GlobalOrdinal id, LocalOrdinal field)
Definition: fei_Dof.hpp:43