/usr/include/trilinos/fei_Dof.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
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 | /*--------------------------------------------------------------------*/
/* Copyright 2009 Sandia Corporation. */
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
/* non-exclusive license for use of this work by or on behalf */
/* of the U.S. Government. Export of this program may require */
/* a license from the United States Government. */
/*--------------------------------------------------------------------*/
#ifndef _fei_Dof_hpp_
#define _fei_Dof_hpp_
#include <fei_macros.hpp>
namespace fei {
/** Dof - mesh-degree-of-freedom.
*
* A mesh-dof is the triple (rank, id, field).
* - Rank is an integer type used to label different 'kinds' of mesh-dofs,
* e.g. node vs face, etc.
* - Id identifies a particular instance of a rank, e.g., node 97.
* - Field is an integer type used to label solution fields such as
* temperature or displacement, etc.
*
* Thus if the user chooses to give nodes a rank of 0 and the temperature
* field a label of 4, then the temperature at node 97 can be represented
* as the dof (0, 97, 4).
*
* Notes:
*
* 1. The Dof class is templated on the two integer types LocalOrdinal
* and GlobalOrdinal. Ranks and Fields have type LocalOrdinal, while
* ids have type GlobalOrdinal. The distinction is somewhat arbitrary,
* but the assumption is that there may be billions (or more?) ids, but
* probably far fewer distinct ranks or fields. So in extreme cases a
* user may wish to use a different type (larger) for ids than for the
* rank or field.
*/
template<class LocalOrdinal, class GlobalOrdinal>
class Dof {
public:
/** constructor */
Dof(LocalOrdinal rank, GlobalOrdinal id, LocalOrdinal field)
: m_rank(rank), m_id(id), m_field(field) {}
/** destructor */
~Dof(){}
LocalOrdinal rank() const { return m_rank; }
GlobalOrdinal id() const { return m_id; }
LocalOrdinal field() const { return m_field; }
private:
LocalOrdinal m_rank;
GlobalOrdinal m_id;
LocalOrdinal m_field;
};//class Dof
/** Less operator which will order Dofs by rank first, then id then field.
*/
template<class LocalOrdinal, class GlobalOrdinal>
struct less_rank_id_field {
bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>& dof1,
const Dof<LocalOrdinal,GlobalOrdinal>& dof2) const
{
if (dof1.rank()==dof2.rank()) {
if (dof1.id() == dof2.id()) return dof1.field() < dof2.field();
else return dof1.id() < dof2.id();
}
else {
return dof1.rank() < dof2.rank();
}
}
bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>* dof1,
const Dof<LocalOrdinal,GlobalOrdinal>* dof2) const
{
if (dof1->rank()==dof2->rank()) {
if (dof1->id() == dof2->id()) return dof1->field() < dof2->field();
else return dof1->id() < dof2->id();
}
else {
return dof1->rank() < dof2->rank();
}
}
};
/** Less operator which will order Dofs by field first, then rank then id.
*/
template<class LocalOrdinal, class GlobalOrdinal>
struct less_field_rank_id {
bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>& dof1,
const Dof<LocalOrdinal,GlobalOrdinal>& dof2) const
{
if (dof1.field()==dof2.field()) {
if (dof1.rank() == dof2.rank()) return dof1.id() < dof2.id();
else return dof1.rank() < dof2.rank();
}
else {
return dof1.field() < dof2.field();
}
}
bool operator()(const Dof<LocalOrdinal,GlobalOrdinal>* dof1,
const Dof<LocalOrdinal,GlobalOrdinal>* dof2) const
{
if (dof1->field()==dof2->field()) {
if (dof1->rank() == dof2->rank()) return dof1->id() < dof2->id();
else return dof1->rank() < dof2->rank();
}
else {
return dof1->field() < dof2->field();
}
}
};
}//namespace fei
#endif
|