#include "AbstractMesh.h" void AbstractMesh::addConstantNodeVectorAttribute(const std::string&, const std::vector&) { } AbstractMesh::~AbstractMesh() { } std::vector > AbstractMesh::getNodeVectorAttributes(const std::string&) { std::vector > attribs(mNodes.size()); return attribs; } void AbstractMesh::addVectorAttribute(const std::string& tag, const std::vector& values) { mVectorAttributes[tag] = values; } bool AbstractMesh::hasVectorAttribute(const std::string& tag) const { return mVectorAttributes.find(tag) != mVectorAttributes.end(); } unsigned AbstractMesh::getNumNodes() const { return unsigned(mNodes.size()); } const VecNodes& AbstractMesh::getNodes() const { return mNodes; } std::vector AbstractMesh::getVectorAttribute(const std::string& tag) const { auto iter = mVectorAttributes.find(tag); if (iter != mVectorAttributes.end()) { return iter->second; } return {}; } void AbstractMesh::scale(double scaleX, double scaleY) { Transform transform({ 0.0, 0.0 }, scaleX, scaleY); for (auto& node : mNodes) { node->apply(transform); } } void AbstractMesh::transform(const Transform& transform) { for (auto& node : mNodes) { node->apply(transform); } } void AbstractMesh::translate(double offsetX, double offsetY, double offsetZ) { const Point loc {-offsetX, -offsetY, -offsetZ}; Transform transform(loc); for (auto& node : mNodes) { node->apply(transform); } } void AbstractMesh::translate(const Point& offset) { translate(offset.getX(), offset.getY(), offset.getZ()); }