/usr/include/psurface/NodeBundle.h is in libpsurface-dev 2.0.0-2+b1.
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 | #ifndef NODE_BUNDLE_H
#define NODE_BUNDLE_H
#include <vector>
#include "GlobalNodeIdx.h"
namespace psurface {
/** \brief Set of graph nodes */
class NodeBundle : public std::vector<GlobalNodeIdx> {
public:
NodeBundle()
{}
NodeBundle(size_t size)
: std::vector<GlobalNodeIdx>(size)
{}
NodeBundle(const NodeBundle& other)
{
(*this).resize(other.size());
for (size_t i=0; i<other.size(); i++)
(*this)[i] = other[i];
}
/** \brief Get the index of that node of the bundle that is on triangle 'tri'
\return -1 if none of the nodes is on triangle 'tri'
*/
NodeIdx triToIdx(int tri) const {
for (size_t i=0; i<size(); i++)
if ((*this)[i].tri == tri)
return (*this)[i].idx;
return -1;
}
/** \brief Print the content for debugging */
void print() const {
for (size_t i=0; i<size(); i++)
printf("triangle: %d, index: %d\n", (*this)[i].tri, (*this)[i].idx);
}
/** \brief Assignment operator */
NodeBundle& operator=(const NodeBundle& other) {
(*this).resize(other.size());
for (size_t i=0; i<other.size(); i++)
(*this)[i] = other[i];
return *this;
}
/** \brief Two NodeBundles are equal if they consist of the same nodes in the same order */
int operator==(const NodeBundle& other) const {
if (size()!=other.size())
return false;
for (size_t i=0; i<size(); i++)
if ((*this)[i].tri!=other[i].tri || (*this)[i].idx!=other[i].idx )
return false;
return true;
}
/** \brief Inequality */
int operator!=(const NodeBundle& other) const {
return !( (*this)==other);
}
};
} // namespace psurface
#endif
|