116 lines
1.8 KiB
C++
116 lines
1.8 KiB
C++
#include "Node.h"
|
|
|
|
std::unique_ptr<Node> Node::Create(const Point& p, unsigned index)
|
|
{
|
|
return std::make_unique<Node>(p, index);
|
|
}
|
|
|
|
Node::~Node()
|
|
{
|
|
|
|
}
|
|
|
|
Node::Node(const Point& p, unsigned index)
|
|
: mPoint(p),
|
|
mIndex(index)
|
|
{
|
|
|
|
}
|
|
|
|
unsigned Node::getIndex() const
|
|
{
|
|
return mIndex;
|
|
}
|
|
|
|
void Node::updateIndex(unsigned index)
|
|
{
|
|
mIndex = index;
|
|
}
|
|
|
|
void Node::addVectorAttribute(const std::string& tag, const std::vector<double>& values)
|
|
{
|
|
mVectorAttributes[tag] = values;
|
|
}
|
|
|
|
std::vector<double> Node::getVectorAttribute(const std::string& tag) const
|
|
{
|
|
auto iter = mVectorAttributes.find(tag);
|
|
if (iter != mVectorAttributes.end())
|
|
{
|
|
return iter->second;
|
|
}
|
|
return {};
|
|
}
|
|
|
|
const Point& Node::getPoint() const
|
|
{
|
|
return mPoint;
|
|
}
|
|
|
|
void Node::scale(double x, double y)
|
|
{
|
|
mPoint.scale(x, y);
|
|
}
|
|
|
|
void Node::translate(double x, double y, double z)
|
|
{
|
|
mPoint.translate(x, y, z);
|
|
}
|
|
|
|
bool Node::isCoincident(Node* node) const
|
|
{
|
|
return node->getPoint() == mPoint;
|
|
}
|
|
|
|
void Node::setState(State state)
|
|
{
|
|
mState = state;
|
|
}
|
|
|
|
Node::State Node::getState() const
|
|
{
|
|
return mState;
|
|
}
|
|
|
|
void Node::clearConnectivity()
|
|
{
|
|
mAssociatedEdgeIds.clear();
|
|
mAssociatedFaceIds.clear();
|
|
}
|
|
|
|
unsigned Node::getNumConnectedEdges() const
|
|
{
|
|
return mAssociatedEdgeIds.size();
|
|
}
|
|
|
|
unsigned Node::getNumConnectedFaces() const
|
|
{
|
|
return mAssociatedFaceIds.size();
|
|
}
|
|
|
|
void Node::associateEdge(unsigned edgeId)
|
|
{
|
|
mAssociatedEdgeIds.push_back(edgeId);
|
|
}
|
|
|
|
void Node::associateFace(unsigned faceId)
|
|
{
|
|
mAssociatedFaceIds.push_back(faceId);
|
|
}
|
|
|
|
unsigned Node::getConnectedEdgeId(std::size_t idx) const
|
|
{
|
|
return mAssociatedEdgeIds[idx];
|
|
}
|
|
|
|
unsigned Node::getConnectedFaceId(std::size_t idx) const
|
|
{
|
|
return mAssociatedFaceIds[idx];
|
|
}
|
|
|
|
void Node::setIndex(std::size_t idx)
|
|
{
|
|
mIndex = idx;
|
|
}
|
|
|
|
|