/usr/include/trilinos/fei_FillableVec.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 | /*--------------------------------------------------------------------*/
/* 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_FillableVec_hpp_
#define _fei_FillableVec_hpp_
#include "fei_macros.hpp"
#include "fei_Pool_alloc.hpp"
#include <map>
namespace fei {
class FillableVec {
public:
FillableVec();
virtual ~FillableVec();
void addEntry(int index, double coef);
void addEntries(unsigned numEntries,
const double* coefs,
const int* indices);
void putEntry(int index, double coef);
void putEntries(unsigned numEntries,
const double* coefs,
const int* indices);
void setValues(double value);
unsigned size() const;
bool hasEntry(int index) const;
/** Return coef for index if index is present, otherwise throw.
*/
double getEntry(int index) const;
void removeEntry(int index);
void clear();
typedef
std::map<int,double,std::less<int>,
fei_Pool_alloc<std::pair<const int,int> > > feipoolmap;
typedef feipoolmap::iterator iterator;
typedef feipoolmap::const_iterator const_iterator;
iterator begin() {return vecdata_.begin();}
iterator end() {return vecdata_.end();}
const_iterator begin() const {return vecdata_.begin();}
const_iterator end() const {return vecdata_.end();}
bool operator==(const FillableVec& rhs) const;
bool operator!=(const FillableVec& rhs) const;
private:
feipoolmap vecdata_;
};//class FillableVec
inline void
FillableVec::addEntry(int index, double coef)
{
feipoolmap::iterator iter = vecdata_.lower_bound(index);
if (iter == vecdata_.end() || iter->first != index) {
vecdata_.insert(iter, std::make_pair(index, coef));
}
else {
iter->second += coef;
}
}
inline void
FillableVec::putEntry(int index, double coef)
{
feipoolmap::iterator iter = vecdata_.lower_bound(index);
if (iter == vecdata_.end() || iter->first != index) {
vecdata_.insert(iter, std::make_pair(index, coef));
}
else {
iter->second = coef;
}
}
inline
bool
FillableVec::operator==(const FillableVec& rhs) const
{
return vecdata_ == rhs.vecdata_;
}
inline
bool
FillableVec::operator!=(const FillableVec& rhs) const
{
return vecdata_ != rhs.vecdata_;
}
}//namespace fei
#endif
|