/usr/include/trilinos/snl_fei_Constraint.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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | /*--------------------------------------------------------------------*/
/* 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 _snl_fei_Constraint_hpp_
#define _snl_fei_Constraint_hpp_
#include <fei_macros.hpp>
#include <fei_fwd.hpp>
#include <fei_VectorSpace.hpp>
#include <snl_fei_RecordCollection.hpp>
#include <vector>
namespace snl_fei {
/** container for constraint attributes */
template<class RecordType>
class Constraint {
public:
/** constructor */
Constraint(int id=0, bool isPenaltyConstr=false);
/** constructor */
Constraint(int id,
int constraintIDType,
bool isSlave,
bool isPenaltyConstr,
int numIDs,
const int* idTypes,
const int* IDs,
const int* fieldIDs,
int offsetOfSlave,
int offsetIntoSlaveField,
const double* weights,
double rhsValue,
fei::VectorSpace* vspace);
/** destructor */
virtual ~Constraint();
/** get constraint identifier */
int getConstraintID() const { return( constraintID_ ); }
/** set constraint identifier. power-users only */
void setConstraintID(int id) { constraintID_ = id; }
/** get the identifier-type that the fei uses to reference constraints */
int getIDType() const { return( idType_ ); }
/** set the identifier-type that the fei uses to reference constraints.
power-users only, this is a dangerous function with side-effects */
void setIDType(int idType) { idType_ = idType; }
/** query whether constraint is a penalty constraint */
bool isPenalty() const { return( isPenalty_ ); }
/** set whether constraint is a penalty constraint. Another dangerous
function for power-users. */
void setIsPenalty(bool isPenaltyConstr) { isPenalty_ = isPenaltyConstr; }
/** get equation-number of constraint. (only valid if lagrange-multiplier)
*/
int getEqnNumber() const { return( eqnNumber_ ); }
/** set equation-number of constraint. (only valid if lagrange-multiplier)
*/
void setEqnNumber(int eqn) { eqnNumber_ = eqn; }
/** get block-equation number of constraint. (only valid if
lagrange-multiplier */
int getBlkEqnNumber() const { return( blkEqnNumber_ ); }
/** set block-equation number of constraint. (only valid if
lagrange-multiplier */
void setBlkEqnNumber(int blkEqn) { blkEqnNumber_ = blkEqn; }
/** intended for fei-implementation use only */
RecordType getSlave() { return( slave_ ); }
/** intended for fei-implementation use only */
void setSlave(const RecordType& slv) { slave_ = slv; }
/** if slave constraint, return constrained field-identifier of
slaved mesh-object */
int getSlaveFieldID() const { return( slaveField_ ); }
/** if slave constraint, set constrained field-identifier of
slaved mesh-object */
void setSlaveFieldID(int f) { slaveField_ = f; }
/** get offset of slaved field-component */
int getOffsetIntoSlaveField() const { return( offsetIntoSlaveField_ ); }
/** set offset of slaved field-component */
void setOffsetIntoSlaveField(int offset) { offsetIntoSlaveField_ = offset; }
/** get master mesh-objects */
std::vector<RecordType>& getMasters() { return( masters_ ); }
/** get identifier-types of master mesh-objects */
std::vector<int>& getMasterIDTypes() { return( masterIDTypes_ ); }
/** get field-identifiers of master mesh-objects */
std::vector<int>& getMasterFieldIDs() { return( masterFields_ ); }
/** get weight-coefficients of master mesh-objects */
std::vector<double>& getMasterWeights() { return( masterWeights_ ); }
/** get right-hand-side value of constraint */
double getRHSValue() const { return( rhsValue_ ); }
/** set right-hand-side value of constraint */
void setRHSValue(double rhs) { rhsValue_ = rhs; }
/** operator!= */
bool operator!=(const Constraint<RecordType>& rhs);
/** query whether connectivity is the same as specified constraint */
bool structurallySame(const Constraint<RecordType>& rhs);
private:
Constraint(const Constraint<RecordType>& src);
Constraint<RecordType>& operator=(const Constraint<RecordType>& src)
{
return(*this);
}
int constraintID_;
int idType_;
bool isPenalty_;
int eqnNumber_;
int blkEqnNumber_;
RecordType slave_;
int slaveField_;
int offsetIntoSlaveField_;
std::vector<RecordType> masters_;
std::vector<int> masterIDTypes_;
std::vector<int> masterFields_;
std::vector<double> masterWeights_;
double rhsValue_;
};//class Constraint
} //namespace snl_fei
#include <snl_fei_Constraint.hpp>
//----------------------------------------------------------------------------
template<class RecordType>
inline snl_fei::Constraint<RecordType>::Constraint(int id, bool isPenaltyConstr)
: constraintID_(id),
idType_(0),
isPenalty_(isPenaltyConstr),
eqnNumber_(-1),
blkEqnNumber_(-1),
slave_(),
slaveField_(0),
offsetIntoSlaveField_(0),
masters_(),
masterIDTypes_(),
masterFields_(),
masterWeights_(),
rhsValue_(0.0)
{
}
//----------------------------------------------------------------------------
template<class RecordType>
inline snl_fei::Constraint<RecordType>::Constraint(int id,
int constraintIDType,
bool isSlave,
bool isPenaltyConstr,
int numIDs,
const int* idTypes,
const int* IDs,
const int* fieldIDs,
int offsetOfSlave,
int offsetIntoSlaveField,
const double* weights,
double rhsValue,
fei::VectorSpace* vspace)
: constraintID_(id),
idType_(constraintIDType),
isPenalty_(isPenaltyConstr),
eqnNumber_(-1),
blkEqnNumber_(-1),
slave_(),
slaveField_(0),
offsetIntoSlaveField_(offsetIntoSlaveField),
masters_(),
masterIDTypes_(),
masterFields_(),
masterWeights_(),
rhsValue_(rhsValue)
{
}
//----------------------------------------------------------------------------
namespace snl_fei {
template<>
inline snl_fei::Constraint<fei::Record<int>*>::Constraint(int id,
int constraintIDType,
bool isSlave,
bool isPenaltyConstr,
int numIDs,
const int* idTypes,
const int* IDs,
const int* fieldIDs,
int offsetOfSlave,
int offsetIntoSlaveField,
const double* weights,
double rhsValue,
fei::VectorSpace* vspace)
: constraintID_(id),
idType_(constraintIDType),
isPenalty_(isPenaltyConstr),
eqnNumber_(-1),
blkEqnNumber_(-1),
slave_(),
slaveField_(0),
offsetIntoSlaveField_(offsetIntoSlaveField),
masters_(),
masterIDTypes_(),
masterFields_(),
masterWeights_(),
rhsValue_(rhsValue)
{
int weightsOffset = 0;
for(int i=0; i<numIDs; ++i) {
snl_fei::RecordCollection* recordCollection = NULL;
vspace->getRecordCollection(idTypes[i],recordCollection);
vspace->addDOFs(fieldIDs[i], 1, idTypes[i], 1, &(IDs[i]));
fei::Record<int>* rec = recordCollection->getRecordWithID(IDs[i]);
unsigned fieldSize = vspace->getFieldSize(fieldIDs[i]);
if (isSlave && i == offsetOfSlave) {
rec->hasSlaveDof(true);
setSlave(rec);
setSlaveFieldID(fieldIDs[i]);
setOffsetIntoSlaveField(offsetIntoSlaveField);
weightsOffset += fieldSize;
}
else {
getMasters().push_back(rec);
getMasterIDTypes().push_back(idTypes[i]);
getMasterFieldIDs().push_back(fieldIDs[i]);
if (weights != NULL) {
for(unsigned j=0; j<fieldSize; ++j) {
masterWeights_.push_back(weights[weightsOffset++]);
}
}
}
}
}
}//namespace snl_fei
//----------------------------------------------------------------------------
template<class RecordType>
inline snl_fei::Constraint<RecordType>::Constraint(const Constraint<RecordType>& src)
: constraintID_(-1),
idType_(0),
isPenalty_(false),
eqnNumber_(-1),
blkEqnNumber_(-1),
slave_(),
slaveField_(0),
offsetIntoSlaveField_(0),
masters_(),
masterIDTypes_(),
masterFields_(),
masterWeights_(),
rhsValue_(0.0)
{
}
//----------------------------------------------------------------------------
template<class RecordType>
inline snl_fei::Constraint<RecordType>::~Constraint()
{
}
//----------------------------------------------------------------------------
template<class RecordType>
inline bool snl_fei::Constraint<RecordType>::operator!=(const snl_fei::Constraint<RecordType>& rhs)
{
if (constraintID_ != rhs.constraintID_ ||
idType_ != rhs.idType_ ||
isPenalty_ != rhs.isPenalty_ ||
eqnNumber_ != rhs.eqnNumber_ ||
blkEqnNumber_ != rhs.blkEqnNumber_ ||
slaveField_ != rhs.slaveField_ ||
offsetIntoSlaveField_ != rhs.offsetIntoSlaveField_ ||
rhsValue_ != rhs.rhsValue_) {
return( true );
}
if (masters_ != rhs.masters_) return(true);
if (masterIDTypes_ != rhs.masterIDTypes_) return(true);
if (masterFields_ != rhs.masterFields_) return(true);
if (masterWeights_ != rhs.masterWeights_) return(true);
return(false);
}
//----------------------------------------------------------------------------
template<class RecordType>
inline bool snl_fei::Constraint<RecordType>::structurallySame(const Constraint<RecordType>& rhs)
{
if (constraintID_ != rhs.constraintID_ ||
idType_ != rhs.idType_ ||
isPenalty_ != rhs.isPenalty_ ||
eqnNumber_ != rhs.eqnNumber_ ||
blkEqnNumber_ != rhs.blkEqnNumber_ ||
slaveField_ != rhs.slaveField_ ||
offsetIntoSlaveField_ != rhs.offsetIntoSlaveField_) {
return( false );
}
if (masters_ != rhs.masters_) return(false);
if (masterIDTypes_ != rhs.masterIDTypes_) return(false);
if (masterFields_ != rhs.masterFields_) return(false);
return(true);
}
#endif // _snl_fei_Constraint_hpp_
|