Commit 17ef1694 authored by Michael Turner's avatar Michael Turner

clean top level vert curve surf

parent 37d98272
......@@ -36,15 +36,22 @@
#ifndef NEKMESHUTILS_CADSYSTEM_CADCURVE
#define NEKMESHUTILS_CADSYSTEM_CADCURVE
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <NekMeshUtils/CADSystem/CADObject.h>
#include <NekMeshUtils/CADSystem/CADSurf.h>
#include <NekMeshUtils/CADSystem/CADVert.h>
namespace Nektar
{
namespace NekMeshUtils
{
// forward declarations
class CADVert;
typedef std::shared_ptr<CADVert> CADVertSharedPtr;
class CADSurf;
typedef std::shared_ptr<CADSurf> CADSurfSharedPtr;
/**
* @brief base class for CAD curves.
*
......@@ -174,19 +181,7 @@ public:
* @brief Returns the orientation of the curve with respect to a given
* surface by id surf
*/
CADOrientation::Orientation GetOrienationWRT(int surf)
{
for (int i = 0; i < m_adjSurfs.size(); i++)
{
if (m_adjSurfs[i].first->GetId() == surf)
{
return m_adjSurfs[i].second;
}
}
ASSERTL0(false, "surf not in adjecency list");
return CADOrientation::eUnknown;
}
CADOrientation::Orientation GetOrienationWRT(int surf);
/**
* @brief Returns the normal to the curve which is orientate with respect
......
......@@ -51,15 +51,15 @@ namespace NekMeshUtils
{
void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
vector<CADSystem::EdgeLoopSharedPtr> &ein)
vector<EdgeLoopSharedPtr> &ein)
{
// this piece of code orientates the surface,
// it used to be face mesh but its easier to have it here
int np = 20;
vector<vector<Array<OneD, NekDouble> > > loopt;
vector<vector<Array<OneD, NekDouble>>> loopt;
for (int i = 0; i < ein.size(); i++)
{
vector<Array<OneD, NekDouble> > loop;
vector<Array<OneD, NekDouble>> loop;
for (int j = 0; j < ein[i]->edges.size(); j++)
{
Array<OneD, NekDouble> bnds = ein[i]->edges[j]->GetBounds();
......@@ -69,7 +69,7 @@ void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
for (int k = 0; k < np - 1; k++)
{
NekDouble t = bnds[0] + dt * k;
Array<OneD, NekDouble> l = ein[i]->edges[j]->P(t);
Array<OneD, NekDouble> l = ein[i]->edges[j]->P(t);
Array<OneD, NekDouble> uv(2);
surf->locuv(l, uv);
loop.push_back(uv);
......@@ -80,7 +80,7 @@ void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
for (int k = np - 1; k > 0; k--)
{
NekDouble t = bnds[0] + dt * k;
Array<OneD, NekDouble> l = ein[i]->edges[j]->P(t);
Array<OneD, NekDouble> l = ein[i]->edges[j]->P(t);
Array<OneD, NekDouble> uv(2);
surf->locuv(l, uv);
loop.push_back(uv);
......@@ -90,7 +90,7 @@ void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
loopt.push_back(loop);
}
vector<bg::model::polygon<point_xy, false, true> > polygons;
vector<bg::model::polygon<point_xy, false, true>> polygons;
for (int i = 0; i < loopt.size(); i++)
{
......@@ -109,7 +109,7 @@ void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
ein[i]->area = area;
point_xy cen(0.0,0.0);
point_xy cen(0.0, 0.0);
bg::centroid(polygon, cen);
ein[i]->center = Array<OneD, NekDouble>(2);
......@@ -163,7 +163,8 @@ void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
p = point_xy(P[0], P[1]);
ASSERTL0(boost::geometry::within(p, polygons[i]), "point is not side loop");
ASSERTL0(boost::geometry::within(p, polygons[i]),
"point is not side loop");
}
}
}
......
......@@ -36,9 +36,10 @@
#ifndef NekMeshUtils_CADSYSTEM_CADSURF
#define NekMeshUtils_CADSYSTEM_CADSURF
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <NekMeshUtils/CADSystem/CADObject.h>
#include <NekMeshUtils/CADSystem/CADSystem.h>
#include <NekMeshUtils/CADSystem/CADVert.h>
namespace Nektar
{
......@@ -47,6 +48,22 @@ namespace NekMeshUtils
class CADCurve;
typedef std::shared_ptr<CADCurve> CADCurveSharedPtr;
class CADSurf;
typedef std::shared_ptr<CADSurf> CADSurfSharedPtr;
/**
* @brief struct which descibes a collection of cad edges which are a
* loop on the cad surface
*/
struct EdgeLoop
{
std::vector<CADCurveSharedPtr> edges;
std::vector<CADOrientation::Orientation> edgeo;
Array<OneD, NekDouble> center;
NekDouble area;
};
typedef std::shared_ptr<EdgeLoop> EdgeLoopSharedPtr;
/**
* @brief base class for a cad surface
......@@ -74,12 +91,12 @@ public:
* @brief Static function which orientates the edge loop on a surface
*/
static void OrientateEdges(
CADSurfSharedPtr surf, std::vector<CADSystem::EdgeLoopSharedPtr> &ein);
CADSurfSharedPtr surf, std::vector<EdgeLoopSharedPtr> &ein);
/**
* @brief Get the loop structures which bound the cad surface
*/
std::vector<CADSystem::EdgeLoopSharedPtr> GetEdges()
std::vector<EdgeLoopSharedPtr> GetEdges()
{
return m_edges;
}
......@@ -87,7 +104,7 @@ public:
/**
* @brief Set the edge loop
*/
void SetEdges(std::vector<CADSystem::EdgeLoopSharedPtr> ein)
void SetEdges(std::vector<EdgeLoopSharedPtr> ein)
{
m_edges = ein;
}
......@@ -165,7 +182,7 @@ public:
protected:
/// List of bounding edges in loops with orientation.
std::vector<CADSystem::EdgeLoopSharedPtr> m_edges;
std::vector<EdgeLoopSharedPtr> m_edges;
/// Function which tests the the value of uv used is within the surface
virtual void Test(Array<OneD, NekDouble> uv) = 0;
......
......@@ -69,20 +69,6 @@ class CADSystem
public:
friend class MemoryManager<CADSystem>;
/**
* @brief struct which descibes a collection of cad edges which are a
* loop on the cad surface
*/
struct EdgeLoop
{
std::vector<CADCurveSharedPtr> edges;
std::vector<CADOrientation::Orientation> edgeo;
Array<OneD, NekDouble> center;
NekDouble area;
};
typedef std::shared_ptr<EdgeLoop> EdgeLoopSharedPtr;
/**
* @brief Default constructor.
*/
......
......@@ -33,7 +33,6 @@
//
////////////////////////////////////////////////////////////////////////////////
#include "CADVert.h"
#include "CADSurf.h"
#include <NekMeshUtils/MeshElements/Node.h>
using namespace std;
......
......@@ -37,7 +37,6 @@
#define NEKMESHUTILS_CADSYSTEM_CADVERT
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/Memory/NekMemoryManager.hpp>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <NekMeshUtils/CADSystem/CADObject.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment