swh:1:snp:f521c49ab17ef7db6ec70b2430e1ed203f50383f
Raw File
Tip revision: 42130a52ce276e3cbc79338aeacf28716d696c15 authored by rinkk on 20 April 2021, 09:26:52 UTC
local scopes for geo-objects
Tip revision: 42130a5
EdgeReturn.cpp
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "EdgeReturn.h"

#include "BaseLib/Logging.h"
#include "Element.h"
#include "Line.h"
#include "MeshLib/Node.h"

namespace MeshLib
{
const Element* LinearEdgeReturn::getEdge(const Element* e, unsigned i)
{
    if (i < e->getNumberOfEdges())
    {
        auto** nodes = new Node*[2];
        nodes[0] = const_cast<Node*>(e->getEdgeNode(i, 0));
        nodes[1] = const_cast<Node*>(e->getEdgeNode(i, 1));
        return new Line(nodes, e->getID());
    }
    ERR("Error in MeshLib::Element::getEdge() - Index does not exist.");
    return nullptr;
}

const Element* QuadraticEdgeReturn::getEdge(const Element* e, unsigned i)
{
    if (i < e->getNumberOfEdges())
    {
        auto** nodes = new Node*[3];
        nodes[0] = const_cast<Node*>(e->getEdgeNode(i, 0));
        nodes[1] = const_cast<Node*>(e->getEdgeNode(i, 1));
        nodes[2] = const_cast<Node*>(e->getEdgeNode(i, 2));
        return new Line3(nodes, e->getID());
    }
    ERR("Error in MeshLib::Element::getEdge() - Index does not exist.");
    return nullptr;
}

}  // namespace MeshLib
back to top