Commit 0b799111 authored by mike turner's avatar mike turner
Browse files

clean up nekmeshutils

parent eaabcd09
......@@ -99,7 +99,7 @@ void ProcessAddCompositeID::Process(po::variables_map &vm)
m_f->m_graph->GetComposites();
SpatialDomains::CompositeMapConstIter it;
NekDouble compid;
NekDouble compid=0;
// loop over elements
for (int n = 0; n < exp->GetNumElmts(); ++n)
......
......@@ -862,7 +862,6 @@ void Iso::GlobalCondense(vector<IsoSharedPtr> &iso, bool verbose)
//Find neipghbours
int unique_index = 0;
bool unique_index_found = false;
int prog;
for(i = 0; i < m_nvert; ++i)
{
......@@ -871,7 +870,7 @@ void Iso::GlobalCondense(vector<IsoSharedPtr> &iso, bool verbose)
prog = LibUtilities::PrintProgressbar(i,m_nvert,
"Nearest verts",prog);
}
BPoint queryPoint = inPoints[i].first;
......@@ -882,7 +881,7 @@ void Iso::GlobalCondense(vector<IsoSharedPtr> &iso, bool verbose)
}
else
{
// find nearest 10 points within the distance box
std::vector<PointPair> result;
rtree.query(bgi::nearest(queryPoint, 10), std::back_inserter(result));
......@@ -898,7 +897,7 @@ void Iso::GlobalCondense(vector<IsoSharedPtr> &iso, bool verbose)
{
id2 = result[id1].second;
samept.insert(id2);
if(global_to_unique_map[id2] <unique_index)
{
new_index = global_to_unique_map[id2];
......@@ -919,7 +918,7 @@ void Iso::GlobalCondense(vector<IsoSharedPtr> &iso, bool verbose)
}
}
}
if(verbose)
{
cout << endl;
......
......@@ -89,7 +89,11 @@ void TetGenInterface::InitialMesh(map<int, NodeSharedPtr> tgidton,
surface.facetmarkerlist[i] = 0;
}
tetrahedralize("pYzqQ", &surface, &output);
string cmd = "pYzqQ";
char *cstr = new char[cmd.length() + 1];
strcpy(cstr, cmd.c_str());
tetrahedralize(cstr, &surface, &output);
}
void TetGenInterface::GetNewPoints(int num,
......@@ -118,7 +122,11 @@ void TetGenInterface::RefineMesh(std::map<int, NekDouble> delta)
input.pointmtrlist[i] = delta[i];
}
tetrahedralize("pYrmzq1.1/0QO2/7", &input, &output);
string cmd = "pYrmzq1.1/0QO2/7";
char *cstr = new char[cmd.length() + 1];
strcpy(cstr, cmd.c_str());
tetrahedralize(cstr, &input, &output);
}
vector<Array<OneD, int> > TetGenInterface::Extract()
......
......@@ -114,14 +114,19 @@ void TriangleInterface::Mesh(bool Quality)
dt.in.holelist[(i - 1) * 2 + 1] = m_centers[i][1];
}
string cmd;
if (Quality)
{
dt.triangulate("pqY");
cmd = "pqY";
}
else if (!Quality)
{
dt.triangulate("pY");
cmd = "pY";
}
char *cstr = new char[cmd.length() + 1];
strcpy(cstr, cmd.c_str());
dt.triangulate(cstr);
}
void TriangleInterface::SetUp()
......
......@@ -58,6 +58,8 @@ inline OctantFace GetReverseFace(OctantFace f)
case eRight:
return eLeft;
}
return eUp;
}
Octant::Octant(int i, OctantSharedPtr p, Array<OneD, OctantFace> dir)
......@@ -496,14 +498,9 @@ void Octant::RemoveNeigbour(int id, OctantFace f)
{
vector<OctantSharedPtr> tmp = m_neigbours[f];
m_neigbours[f].clear();
bool found = false;
for (int i = 0; i < tmp.size(); i++)
{
if (tmp[i]->GetId() == id)
{
found = true;
}
else
if (tmp[i]->GetId() != id)
{
m_neigbours[f].push_back(tmp[i]);
}
......
......@@ -249,6 +249,7 @@ public:
return m_loc[2] - m_hd;
break;
}
return 0.0;
}
/**
......
......@@ -92,7 +92,7 @@ bool BGFSUpdate(OptiObjSharedPtr opti, DNekMat &J, DNekMat &B, DNekMat &H)
Array<OneD, NekDouble> xci(xi.num_elements());
bool hitbounded = false;
//bool hitbounded = false;
for (int i = 0; i < xci.num_elements(); i++)
{
......@@ -100,7 +100,7 @@ bool BGFSUpdate(OptiObjSharedPtr opti, DNekMat &J, DNekMat &B, DNekMat &H)
{
xci[i] = li[i];
Fset.erase(i);
hitbounded = true;
//hitbounded = true;
continue;
}
else
......@@ -112,7 +112,7 @@ bool BGFSUpdate(OptiObjSharedPtr opti, DNekMat &J, DNekMat &B, DNekMat &H)
{
xci[i] = ui[i];
Fset.erase(i);
hitbounded = true;
//hitbounded = true;
continue;
}
else
......
......@@ -124,11 +124,11 @@ void HOSurfaceMesh::Process()
FaceSharedPtr f = m_mesh->m_element[2][i]->GetFaceLink();
bool d2 = false;
//bool d2 = false;
if(!f)
{
d2 = true;
//d2 = true;
f = boost::shared_ptr<Face>(new Face(m_mesh->m_element[2][i]->GetVertexList(),
vector<NodeSharedPtr>(),
m_mesh->m_element[2][i]->GetEdgeList(),
......
......@@ -3719,7 +3719,7 @@ void DelaunayTriangle::testtriangle(struct mesh *m, struct behavior *b, struct o
double dxod2, dyod2, dxda2, dyda2, dxao2, dyao2;
double apexlen, orglen, destlen, minedge;
double angle;
double area;
double area=0.0;
double dist1, dist2;
subseg sptr; /* Temporary variable used by tspivot(). */
triangle ptr; /* Temporary variable used by oprev() and dnext(). */
......@@ -4684,7 +4684,7 @@ enum insertvertexresult DelaunayTriangle::insertvertex(struct mesh *m,
vertex leftvertex, rightvertex, botvertex, topvertex, farvertex;
vertex segmentorg, segmentdest;
double attrib;
double area;
//double area;
enum insertvertexresult success;
enum locateresult intersect;
int doflip;
......@@ -6585,7 +6585,7 @@ void DelaunayTriangle::segmentintersection(struct mesh *m,
vertex leftvertex, rightvertex;
vertex newvertex;
enum insertvertexresult success;
enum finddirectionresult collinear;
//enum finddirectionresult collinear;
double ex, ey;
double tx, ty;
double etx, ety;
......@@ -6657,7 +6657,7 @@ void DelaunayTriangle::segmentintersection(struct mesh *m,
/* Inserting the vertex may have caused edge flips. We wish to rediscover
*/
/* the edge connecting endpoint1 to the new intersection vertex. */
collinear = finddirection(m, b, splittri, endpoint1);
finddirection(m, b, splittri, endpoint1);
dest(*splittri, rightvertex);
apex(*splittri, leftvertex);
if ((leftvertex[0] == endpoint1[0]) && (leftvertex[1] == endpoint1[1]))
......@@ -7770,7 +7770,7 @@ void DelaunayTriangle::carveholes(struct mesh *m,
int regions)
{
struct otri searchtri;
struct otri triangleloop;
//struct otri triangleloop;
struct otri *regiontris;
triangle **holetri;
triangle **regiontri;
......@@ -7940,7 +7940,7 @@ void DelaunayTriangle::carveholes(struct mesh *m,
void DelaunayTriangle::tallyencs(struct mesh *m, struct behavior *b)
{
struct osub subsegloop;
int dummy;
//int dummy;
traversalinit(&m->subsegs);
subsegloop.ssorient = 0;
......@@ -7948,7 +7948,7 @@ void DelaunayTriangle::tallyencs(struct mesh *m, struct behavior *b)
while (subsegloop.ss != (subseg *)NULL)
{
/* If the segment is encroached, add it to the list. */
dummy = checkseg4encroach(m, b, &subsegloop);
checkseg4encroach(m, b, &subsegloop);
subsegloop.ss = subsegtraverse(m);
}
}
......@@ -7998,7 +7998,7 @@ void DelaunayTriangle::splitencsegs(struct mesh *m, struct behavior *b, int trif
double split;
double multiplier, divisor;
int acuteorg, acuteorg2, acutedest, acutedest2;
int dummy;
//int dummy;
int i;
triangle ptr; /* Temporary variable used by stpivot(). */
subseg sptr; /* Temporary variable used by snext(). */
......@@ -8199,9 +8199,9 @@ void DelaunayTriangle::splitencsegs(struct mesh *m, struct behavior *b, int trif
}
/* Check the two new subsegments to see if they're encroached.
*/
dummy = checkseg4encroach(m, b, &currentenc);
checkseg4encroach(m, b, &currentenc);
snextself(currentenc);
dummy = checkseg4encroach(m, b, &currentenc);
checkseg4encroach(m, b, &currentenc);
}
badsubsegdealloc(m, encloop);
......@@ -8911,4 +8911,3 @@ void DelaunayTriangle::triangulate(char *triswitches)
}
}
......@@ -147,11 +147,11 @@ void VolumeMesh::Process()
set<int> cIds;
vector<EdgeLoopSharedPtr> e =
m_mesh->m_cad->GetSurf(symsurfs[i])->GetEdges();
for (int i = 0; i < e.size(); i++)
for (int k = 0; k < e.size(); k++)
{
for (int j = 0; j < e[i]->edges.size(); j++)
for (int j = 0; j < e[k]->edges.size(); j++)
{
cIds.insert(e[i]->edges[j]->GetId());
cIds.insert(e[k]->edges[j]->GetId());
}
}
......
......@@ -48,38 +48,38 @@
//#include <boost/progress.hpp>
//
//#include <sstream>
//
//#define CHECK_CLOSE_ABS_EXP(lhs, rhs, tol, BType, Nmodes, PType, Npoints) \
//if(fabs(lhs-rhs)>tol) \
//{ \
// std::ostringstream error_message; \
// error_message << "difference between " \
// << BOOST_TEST_STRINGIZE(lhs)<<"{"<<lhs<<"} and " \
// << BOOST_TEST_STRINGIZE(rhs)<<"{"<<rhs<<"} exceeds " \
// << tol << " for the case: " \
// << "BasisType = " << LibUtilities::BasisTypeMap[BType] << "; " \
// << "NumModes = " << Nmodes << "; " \
// << "PointsType = " << LibUtilities::PointsTypeMap[PType] << "; " \
// << "NumPoints = " << Npoints << "." ; \
// BOOST_ERROR(error_message.str());\
//}
//
//#define CHECK_CLOSE_ARR_ABS_EXP(lhs, rhs, index, tol, BType, Nmodes, PType, Npoints) \
//if(fabs(lhs-rhs)>tol) \
//{ \
// std::ostringstream error_message; \
// error_message << "difference between " \
// << BOOST_TEST_STRINGIZE(lhs)<<"{"<<lhs<<"} and " \
// << BOOST_TEST_STRINGIZE(rhs)<<"{"<<rhs<<"} with " \
// << BOOST_TEST_STRINGIZE(index) << " = " << index \
// << ", exceeds " << tol <<" for the case: " \
// << "BasisType = " << LibUtilities::BasisTypeMap[BType] << "; " \
// << "NumModes = " << Nmodes << "; " \
// << "PointsType = " << LibUtilities::PointsTypeMap[PType] << "; " \
// << "NumPoints = " << Npoints << "." ; \
// BOOST_ERROR(error_message.str());\
//}
//
/*#define CHECK_CLOSE_ABS_EXP(lhs, rhs, tol, BType, Nmodes, PType, Npoints) \
if(fabs(lhs-rhs)>tol) \
{ \
std::ostringstream error_message; \
error_message << "difference between " \
<< BOOST_TEST_STRINGIZE(lhs)<<"{"<<lhs<<"} and " \
<< BOOST_TEST_STRINGIZE(rhs)<<"{"<<rhs<<"} exceeds " \
<< tol << " for the case: " \
<< "BasisType = " << LibUtilities::BasisTypeMap[BType] << "; " \
<< "NumModes = " << Nmodes << "; " \
<< "PointsType = " << LibUtilities::PointsTypeMap[PType] << "; " \
<< "NumPoints = " << Npoints << "." ; \
BOOST_ERROR(error_message.str());\
}*/
/*#define CHECK_CLOSE_ARR_ABS_EXP(lhs, rhs, index, tol, BType, Nmodes, PType, Npoints) \
if(fabs(lhs-rhs)>tol) \
{ \
std::ostringstream error_message; \
error_message << "difference between " \
<< BOOST_TEST_STRINGIZE(lhs)<<"{"<<lhs<<"} and " \
<< BOOST_TEST_STRINGIZE(rhs)<<"{"<<rhs<<"} with " \
<< BOOST_TEST_STRINGIZE(index) << " = " << index \
<< ", exceeds " << tol <<" for the case: " \
<< "BasisType = " << LibUtilities::BasisTypeMap[BType] << "; " \
<< "NumModes = " << Nmodes << "; " \
<< "PointsType = " << LibUtilities::PointsTypeMap[PType] << "; " \
<< "NumPoints = " << Npoints << "." ; \
BOOST_ERROR(error_message.str());\
}*/
//
//namespace Nektar
//{ // IS THIS THE CORRECT NAMESPACE (or should it be StdRegionsUnitTests)
......@@ -127,7 +127,7 @@
// //LibUtilities::eGaussRadauMAlpha0Beta2,
// //LibUtilities::ePolyEvenlySpaced};
//
//
//
//
// BOOST_AUTO_TEST_CASE(testMassMatrix)
// {
......@@ -164,7 +164,7 @@
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)(2.0*(nummodes-1.0)+1.0)};
//
//
// for(int i = 0; i < num_BasisTypes; i++)
// {
// LibUtilities::BasisType btype = TestedBasisTypes[i];
......@@ -172,12 +172,12 @@
// for(int j = 0; j < num_PointsTypes; j++)
// {
// LibUtilities::PointsType Qtype = TestedPointsTypes[j];
//
//
// for(int nq = nq_min[j] ; nq <= max_nq; nq++)
// {
// const LibUtilities::PointsKey Pkey(nq,Qtype);
// const LibUtilities::BasisKey Bkey(btype,nummodes,Pkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
//
// DNekMatSharedPtr matrix = E->GenMatrix(StdRegions::eMass);
// NekDouble *result = &((*matrix).GetPtr())[0];
......@@ -185,12 +185,12 @@
//
// NekDouble epsilon = 1e-12;
// for(int k = 0; k < 36; k++)
// {
// {
// CHECK_CLOSE_ARR_ABS_EXP(result[k], expected_result[k], k, epsilon, btype, nummodes, Qtype, nq);
// }
// }
// }
// }
// }
// }
// }
//
// BOOST_AUTO_TEST_CASE(testLapMatrix)
......@@ -228,7 +228,7 @@
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)(2.0*(nummodes-1.0)+1.0)};
//
//
// for(int i = 0; i < num_BasisTypes; i++)
// {
// LibUtilities::BasisType btype = TestedBasisTypes[i];
......@@ -236,12 +236,12 @@
// for(int j = 0; j < num_PointsTypes; j++)
// {
// LibUtilities::PointsType Qtype = TestedPointsTypes[j];
//
//
// for(int nq = nq_min[j] ; nq <= max_nq; nq++)
// {
// const LibUtilities::PointsKey Pkey(nq,Qtype);
// const LibUtilities::BasisKey Bkey(btype,nummodes,Pkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
//
// DNekMatSharedPtr matrix = E->GenMatrix(StdRegions::eLaplacian);
// NekDouble *result = &((*matrix).GetPtr())[0];
......@@ -249,12 +249,12 @@
//
// NekDouble epsilon = 1e-122;
// for(int k = 0; k < 36; k++)
// {
// {
// CHECK_CLOSE_ARR_ABS_EXP(result[k], expected_result[k], k, epsilon, btype, nummodes, Qtype, nq);
// }
// }
// }
// }
// }
// }
// }
//
// BOOST_AUTO_TEST_CASE(testIntegration)
......@@ -273,7 +273,7 @@
// (int)ceil((order_f+2.0)/2.0),
// (int)ceil((order_f+2.0)/2.0),
// (int)(order_f+1.0)};
//
//
// for(int i = 0; i < num_BasisTypes; i++)
// {
// LibUtilities::BasisType btype = TestedBasisTypes[i];
......@@ -284,12 +284,12 @@
//
// for(int nummodes = 2; nummodes <= max_nummodes; nummodes++)
// {
//
//
// for(int nq = nq_min[j] ; nq <= max_nq; nq++)
// {
// const LibUtilities::PointsKey Pkey(nq,Qtype);
// const LibUtilities::BasisKey Bkey(btype,nummodes,Pkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
//
// Array<OneD, NekDouble> z = Array<OneD, NekDouble>(nq);
// Array<OneD, NekDouble> f = Array<OneD, NekDouble>(nq);
......@@ -303,22 +303,22 @@
// CHECK_CLOSE_ABS_EXP(result, expected_result, epsilon, btype, nummodes, Qtype, nq);
// }
// }
// }
// }
// }
// }
// }
//
// BOOST_AUTO_TEST_CASE(testDifferentiation)
// {
// // NekDouble expected_result = -4.0;
// //
// //
// // for(int i = 0; i < num_BasisTypes; i++)
// // {
// // LibUtilities::BasisType btype = TestedBasisTypes[i];
// //
// //
// // for(int j = 0; j < num_PointsTypes; j++)
// // {
// // LibUtilities::PointsType Qtype = TestedPointsTypes[j];
// //
// //
// // Array<OneD, NekDouble> z = Array<OneD, NekDouble>(nq);
// // Array<OneD, NekDouble> f = Array<OneD, NekDouble>(nq);
// // Array<OneD, NekDouble> df = Array<OneD, NekDouble>(nq);
......@@ -333,8 +333,8 @@
// // CHECK_CLOSE_ABS_EXP(result, expected_result, epsilon, btype, nummodes, Qtype, nq);
// // }
// // }
// // }
// // }
// // }
// // }
// }
//
// BOOST_AUTO_TEST_CASE(testIProductWRTBase)
......@@ -357,7 +357,7 @@
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)(2.0*(nummodes-1.0)+1.0)};
//
//
// for(int i = 0; i < num_BasisTypes; i++)
// {
// LibUtilities::BasisType btype = TestedBasisTypes[i];
......@@ -365,7 +365,7 @@
// for(int j = 0; j < num_PointsTypes; j++)
// {
// LibUtilities::PointsType Qtype = TestedPointsTypes[j];
//
//
// for(int nq = nq_min[j] ; nq <= max_nq; nq++)
// {
// const LibUtilities::PointsKey Pkey(nq,Qtype);
......@@ -378,19 +378,19 @@
// for(int r = 0; r < nq; r++)
// {
// f[r] = 3*pow(z[r],5)-5*pow(z[r],3)+pow(z[r],2)-1;
// }
// }
// Array<OneD, NekDouble> result = Array<OneD, NekDouble>(6);
// E->IProductWRTBase(f,result);
// NekDouble *expected_result = exactmatrices[i];
//
// NekDouble epsilon = 1e-12;
//
// NekDouble epsilon = 1e-12;
// for(int k = 0; k < 6; k++)
// {
// {
// CHECK_CLOSE_ARR_ABS_EXP(result[k], expected_result[k], k, epsilon, btype, nummodes, Qtype, nq);
// }
// }
// }
// }
// }
// }
// }
//
// BOOST_AUTO_TEST_CASE(testFwdTrans)
......@@ -413,7 +413,7 @@
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)(2.0*(nummodes-1.0)+1.0)};
//
//
// for(int i = 0; i < num_BasisTypes; i++)
// {
// LibUtilities::BasisType btype = TestedBasisTypes[i];
......@@ -421,7 +421,7 @@
// for(int j = 0; j < num_PointsTypes; j++)
// {
// LibUtilities::PointsType Qtype = TestedPointsTypes[j];
//
//
// for(int nq = nq_min[j] ; nq <= max_nq; nq++)
// {
// const LibUtilities::PointsKey Pkey(nq,Qtype);
......@@ -434,23 +434,23 @@
// for(int r = 0; r < nq; r++)
// {
// f[r] = 3*pow(z[r],5)-5*pow(z[r],3)+pow(z[r],2)-1;
// }
// Array<OneD, NekDouble> result = Array<OneD, NekDouble>(nummodes);
// }
// Array<OneD, NekDouble> result = Array<OneD, NekDouble>(nummodes);
// E->FwdTrans(f,result);
// NekDouble *expected_result = exactmatrices[i];
//
// NekDouble epsilon = 1e-12;
// NekDouble epsilon = 1e-12;
// for(int k = 0; k < 6; k++)
// {
// {
// CHECK_CLOSE_ARR_ABS_EXP(result[k], expected_result[k], k, epsilon, btype, nummodes, Qtype, nq);
// }
// }
// }
// }
// }
// }
// }
//
// BOOST_AUTO_TEST_CASE(testBwdTrans)
// {
// {
// for(int i = 0; i < num_BasisTypes; i++)
// {
// LibUtilities::BasisType btype = TestedBasisTypes[i];
......@@ -472,12 +472,12 @@
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)ceil((2*(nummodes-1.0)+2.0)/2.0),
// (int)(2.0*(nummodes-1.0)+1.0)};
//
//
// for(int nq = nq_min[j] ; nq <= max_nq; nq++)
// {
// const LibUtilities::PointsKey Pkey(nq,Qtype);
// const LibUtilities::BasisKey Bkey(btype,nummodes,Pkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
// StdRegions::StdSegExp *E = new StdRegions::StdSegExp(Bkey);
//
// Array<OneD, NekDouble> z = Array<OneD, NekDouble>(nq);
// Array<OneD, NekDouble> f = Array<OneD, NekDouble>(nq);
......@@ -492,21 +492,21 @@
// E->BwdTrans(tmp,result);
// NekDouble *expected_result = f.get();
//
// NekDouble epsilon = 1e-12;
// NekDouble epsilon = 1e-12;
// for(int k = 0; k < nq; k++)
// {
// {
// CHECK_CLOSE_ARR_ABS_EXP(result[k], expected_result[k], k, epsilon, btype, nummodes, Qtype, nq);
// }
// }
// }
// }
// }
// }
// }
// }
//