/usr/include/trilinos/fei_FieldMask.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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | /*--------------------------------------------------------------------*/
/* Copyright 2005 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_FieldMask_hpp_
#define _fei_FieldMask_hpp_
#include "fei_macros.hpp"
#include <vector>
namespace fei {
/** Internal implementation class.
A FieldMask describes the layout of the fields associated with an
identifier.
Each identifier Record should have a pointer to a FieldMask.
Each FieldMask will generally be shared by a large number of identifier
records. (i.e., the number of field-mask objects in memory will be
small -- it will be the number of distinct fields-per-node combinations
in the mesh. Example: If a problem has two fields (say temperature and
displacement) and some nodes have 1 field, some have the other, and some
have both, then there would be a total of 3 field-masks.
*/
class FieldMask {
public:
/** Default Constructor */
FieldMask();
/** Copy Constructor */
FieldMask(const FieldMask& fm);
/** Construct with initial fields */
FieldMask(int numFields,
const int* fieldIDs,
const int* fieldSizes,
const int* numInstancesOfThisFieldPerID);
/** Destructor */
virtual ~FieldMask();
/** Return the mask-id for this object. */
int getMaskID() { return( maskID_ ); }
/** Return the mask-id that corresponds to the specified data. */
static int calculateMaskID(int numFields,
const int* fieldIDs,
const int* numInstancesPerID);
/** Return the mask-id that corresponds to the specified data. */
static int calculateMaskID(const FieldMask& fm,
int fieldID,
int numInstances);
/** Add a field-id to this object. */
void addField(int fieldID,
int fieldSize,
int numInstances=1);
/** Query whether the specified field is contained in this field-mask.*/
bool hasFieldID(int fieldID) const;
/** Return the number of fields in this field-mask. */
size_t getNumFields() const { return(fieldIDs_.size()); }
/** Return the number of global indices corresponding to the set of fields
represented by this mask. This is sum(fieldSizes[i]*fieldInstances[i]).
*/
int getNumIndices() const { return( numIndices_ ); }
/** Set the number of global indices corresponding to the set of fields
represented by this mask.
*/
void setNumIndices(int numInd) { numIndices_ = numInd; }
/** Return an array of the fields in this field-mask. */
std::vector<int>& getFieldIDs() { return(fieldIDs_); }
/** Return an array of the fields in this field-mask. */
const std::vector<int>& getFieldIDs() const { return(fieldIDs_); }
/** Return an array of the fieldSizes in this field-mask. */
std::vector<int>& getFieldSizes() { return(fieldSizes_); }
/** Return an array of the fieldSizes in this field-mask. */
const std::vector<int>& getFieldSizes() const { return(fieldSizes_); }
/** Return an array of the number-of-field-instances for the fields
in this field-mask. */
std::vector<int>& getFieldInstances() { return(fieldInstances_); }
/** Given a field-id, return the offset of the corresponding equation-
number in a record's list of equation-numbers.
*/
void getFieldEqnOffset(int fieldID, int& offset, int& numInstancesPerID) const;
/** Test equality of field-masks. */
bool operator==(const FieldMask& fm) const
{ return( maskID_ == fm.maskID_ ); }
/** Test inequality of field-masks. */
bool operator!=(const FieldMask& fm) const
{ return( maskID_ != fm.maskID_ ); }
/** Query whether 'this' is a subset of the input argument. i.e., query
* whether all of the fields in 'this' field-mask occur in the input
* field-mask.
*/
bool isSubSetOf(const FieldMask& fm) const
{
for(unsigned i=0; i<fieldIDs_.size(); ++i) {
if (!fm.hasFieldID(fieldIDs_[i])) return(false);
}
return(true);
}
private:
FieldMask& operator=(const FieldMask& src);
int calculateMaskID();
int maskID_;
std::vector<int> fieldIDs_;
std::vector<int> fieldSizes_;
std::vector<int> fieldInstances_;
std::vector<int> fieldEqnOffsets_;
int numFields_;
int numIndices_;
int* fieldIDsPtr_;
int* fieldInstancesPtr_;
int* fieldEqnOffsetsPtr_;
};
} //namespace fei
#endif // _fei_FieldMask_hpp_
|