Commit 68c0d50b authored by Dave Moxey's avatar Dave Moxey

Fix compiler errors

parent 63f24494
......@@ -777,9 +777,10 @@ void InputNek::Process()
// m_mesh->condition. This is currently a linear search and should
// probably be made faster!
bool found = false;
for (auto &it : m_mesh->m_condition)
auto it = m_mesh->m_condition.begin();
for (; it != m_mesh->m_condition.end(); ++it)
{
if (c == it.second)
if (c == it->second)
{
found = true;
break;
......
......@@ -707,7 +707,7 @@ void OutputNekpp::WriteXmlCurves(TiXmlElement *pRoot)
f->SetAttribute(
"TYPE",
LibUtilities::kPointsTypeStr[face->m_curveType]);
TiXmlText *t0 = new TiXmlText(fave->GetXmlCurveString());
TiXmlText *t0 = new TiXmlText(face->GetXmlCurveString());
f->LinkEndChild(t0);
curved->LinkEndChild(f);
}
......
......@@ -241,7 +241,7 @@ void ProcessExtractSurf::Process()
continue;
}
m_mesh->m_composite.insert(*it);
m_mesh->m_composite.insert(it);
// Figure out the maximum ID so if we need to create new
// composites we can give them a unique ID.
......@@ -276,7 +276,7 @@ void ProcessExtractSurf::Process()
// composite, otherwise we create a new composite and store
// it in newComps.
string tag = el[i]->GetTag();
it2 = newComps.find(tag);
auto it2 = newComps.find(tag);
if (it2 == newComps.end())
{
CompositeSharedPtr newComp(new Composite());
......@@ -298,14 +298,16 @@ void ProcessExtractSurf::Process()
}
// Insert new composites.
for (i = 0, it2 = newComps.begin(); it2 != newComps.end(); ++it2, ++i)
i = 0;
for (auto &it2 : newComps)
{
if (m_mesh->m_verbose && newComps.size() > 1)
{
cout << (i > 0 ? ", " : " ") << it2->second->m_id << "("
<< it2->second->m_tag << ")";
cout << (i > 0 ? ", " : " ") << it2.second->m_id << "("
<< it2.second->m_tag << ")";
}
m_mesh->m_composite[it2->second->m_id] = it2->second;
m_mesh->m_composite[it2.second->m_id] = it2.second;
++i;
}
if (m_mesh->m_verbose && newComps.size() > 1)
......
......@@ -313,7 +313,7 @@ void ProcessOptiExtract::Process()
for (auto &node : inp_mesh->m_vertexSet)
{
nmap[node->m_id] = *nit;
nmap[node->m_id] = node;
}
// for all the nodes in the main mesh see if they are in nmap, if so
// update the node
......
......@@ -209,6 +209,7 @@ void ProcessPerAlign::Process()
}
centroid /= (NekDouble)c1->m_items[i]->GetVertexCount();
bool found = false;
for (auto &it : centroidMap)
{
if (elmtDone.count(it.first) > 0)
......@@ -302,11 +303,12 @@ void ProcessPerAlign::Process()
perFaces[id2] =
make_pair(c1->m_items[i]->GetFaceLink(), perVertsInv);
}
found = true;
break;
}
}
if (it == centroidMap.end())
if (!found)
{
cerr << "WARNING: Could not find matching edge for surface "
<< "element " << c1->m_items[i]->GetId() << ". "
......
......@@ -224,7 +224,9 @@ void ProcessSpherigon::SuperBlend(vector<double> &r,
void ProcessSpherigon::FindNormalFromPlyFile(MeshSharedPtr &plymesh,
map<int,NodeSharedPtr> &surfverts)
{
int cnt = 0, j = 0, prog = 0, n_neighbs = 5, cntmin;
int cnt = 0;
int j = 0;
int prog=0,cntmin;
typedef bg::model::point<NekDouble, 3, bg::cs::cartesian> Point;
typedef pair<Point, unsigned int> PointI;
......@@ -234,10 +236,10 @@ void ProcessSpherigon::FindNormalFromPlyFile(MeshSharedPtr &plymesh,
map<int,int> TreeidtoPlyid;
//Fill vertex array into tree format
vector<PointI> dataPts;
for (auto &it : plymesh->m_vertexSet)
{
dataPts.push_back(
make_pair(Point(it->m_x, it->m_y, it->m_z), j));
dataPts.push_back(make_pair(Point(it->m_x, it->m_y, it->m_z), j));
TreeidtoPlyid[j++] = it->m_id;
}
......@@ -250,8 +252,8 @@ void ProcessSpherigon::FindNormalFromPlyFile(MeshSharedPtr &plymesh,
{
if(m_mesh->m_verbose)
{
prog = LibUtilities::PrintProgressbar(
cnt, surfverts.size(), "Nearest ply verts", prog);
prog = LibUtilities::PrintProgressbar(cnt,surfverts.size(),
"Nearest ply verts",prog);
}
Point queryPt(vIt.second->m_x, vIt.second->m_y, vIt.second->m_z);
......@@ -264,20 +266,22 @@ void ProcessSpherigon::FindNormalFromPlyFile(MeshSharedPtr &plymesh,
ASSERTL1(cntmin < plymesh->m_vertexNormals.size(),
"cntmin is out of range");
m_mesh->m_vertexNormals[vIt.first] = plymesh->m_vertexNormals[cntmin];
m_mesh->m_vertexNormals[vIt.first] =
plymesh->m_vertexNormals[cntmin];
++cnt;
}
}
/**
* @brief Generate a set of approximate vertex normals to a surface represented
* by line segments in 2D and a hybrid triangular/quadrilateral mesh in 3D.
* @brief Generate a set of approximate vertex normals to a surface
* represented by line segments in 2D and a hybrid
* triangular/quadrilateral mesh in 3D.
*
* This routine approximates the true vertex normals to a surface by averaging
* the normals of all edges/faces which connect to the vertex. It is better to
* use the exact surface normals which can be set in Mesh::vertexNormals, but
* where they are not supplied this routine calculates an approximation for the
* spherigon implementation.
* This routine approximates the true vertex normals to a surface by
* averaging the normals of all edges/faces which connect to the
* vertex. It is better to use the exact surface normals which can be
* set in Mesh::vertexNormals, but where they are not supplied this
* routine calculates an approximation for the spherigon implementation.
*
* @param el Vector of elements denoting the surface mesh.
*/
......@@ -341,8 +345,9 @@ void ProcessSpherigon::GenerateNormals(std::vector<ElementSharedPtr> &el,
}
// Normalize resulting vectors.
for (auto &n : mesh->m_vertexNormals)
for (auto &nIt : mesh->m_vertexNormals)
{
Node &n = nIt.second;
n /= sqrt(n.abs2());
}
......@@ -375,6 +380,7 @@ void ProcessSpherigon::Process()
{
// Full 2D or 3D case - iterate over stored edges/faces and
// create segments/triangles representing those edges/faces.
set<pair<int, int> >::iterator it;
vector<int> t;
t.push_back(0);
......@@ -443,11 +449,13 @@ void ProcessSpherigon::Process()
if (m_mesh->m_expDim == 3)
{
for (auto &it : m_mesh->m_spherigonSurfs)
for (it = m_mesh->m_spherigonSurfs.begin();
it != m_mesh->m_spherigonSurfs.end();
++it)
{
FaceSharedPtr f =
m_mesh->m_element[m_mesh->m_expDim][it.first]->GetFace(
it.second);
m_mesh->m_element[m_mesh->m_expDim][it->first]->GetFace(
it->second);
vector<NodeSharedPtr> nodes = f->m_vertexList;
LibUtilities::ShapeType eType =
(LibUtilities::ShapeType)(nodes.size());
......@@ -472,11 +480,13 @@ void ProcessSpherigon::Process()
}
else
{
for (auto &it : m_mesh->m_spherigonSurfs)
for (it = m_mesh->m_spherigonSurfs.begin();
it != m_mesh->m_spherigonSurfs.end();
++it)
{
EdgeSharedPtr edge =
m_mesh->m_element[m_mesh->m_expDim][it.first]->GetEdge(
it.second);
m_mesh->m_element[m_mesh->m_expDim][it->first]->GetEdge(
it->second);
vector<NodeSharedPtr> nodes;
LibUtilities::ShapeType eType = LibUtilities::eSegment;
ElmtConfig conf(eType, 1, false, false);
......@@ -493,8 +503,8 @@ void ProcessSpherigon::Process()
elmt->SetVertex(1, nodes[1]);
elmt->SetEdge(
0,
m_mesh->m_element[m_mesh->m_expDim][it.first]->GetEdge(
it.second));
m_mesh->m_element[m_mesh->m_expDim][it->first]->GetEdge(
it->second));
el.push_back(elmt);
}
}
......@@ -545,6 +555,8 @@ void ProcessSpherigon::Process()
// finally find nearest vertex and set normal to mesh surface file
// normal. probably should have a hex tree search ?
Node minx(0, 0.0, 0.0, 0.0), tmp, tmpsav;
NodeSet::iterator it;
map<int, NodeSharedPtr>::iterator vIt;
map<int, NodeSharedPtr> surfverts;
// make a map of normal vertices to visit based on elements el
......@@ -600,6 +612,7 @@ void ProcessSpherigon::Process()
cout << endl;
}
map<int, NodeSharedPtr>::iterator vIt;
map<int, NodeSharedPtr> surfverts;
// make a map of normal vertices to visit based on elements el
......@@ -614,7 +627,7 @@ void ProcessSpherigon::Process()
}
}
for (auto &vIt : surfverts)
for (vIt = surfverts.begin(); vIt != surfverts.end(); ++vIt)
{
bool AddNoise = false;
......@@ -625,8 +638,8 @@ void ProcessSpherigon::Process()
{
case 1:
{
if ((vIt.second->m_x > values[2 * i + 1]) &&
(vIt.second->m_x < values[2 * i + 2]))
if (((vIt->second)->m_x > values[2 * i + 1]) &&
((vIt->second)->m_x < values[2 * i + 2]))
{
AddNoise = true;
}
......@@ -634,10 +647,10 @@ void ProcessSpherigon::Process()
break;
case 2:
{
if ((vIt.second->m_x > values[2 * i + 1]) &&
(vIt.second->m_x < values[2 * i + 2]) &&
(vIt.second->m_y > values[2 * i + 3]) &&
(vIt.second->m_y < values[2 * i + 4]))
if (((vIt->second)->m_x > values[2 * i + 1]) &&
((vIt->second)->m_x < values[2 * i + 2]) &&
((vIt->second)->m_y > values[2 * i + 3]) &&
((vIt->second)->m_y < values[2 * i + 4]))
{
AddNoise = true;
}
......@@ -645,12 +658,12 @@ void ProcessSpherigon::Process()
break;
case 3:
{
if ((vIt.second->m_x > values[2 * i + 1]) &&
(vIt.second->m_x < values[2 * i + 2]) &&
(vIt.second->m_y > values[2 * i + 3]) &&
(vIt.second->m_y < values[2 * i + 4]) &&
(vIt.second->m_z > values[2 * i + 5]) &&
(vIt.second->m_z < values[2 * i + 6]))
if (((vIt->second)->m_x > values[2 * i + 1]) &&
((vIt->second)->m_x < values[2 * i + 2]) &&
((vIt->second)->m_y > values[2 * i + 3]) &&
((vIt->second)->m_y < values[2 * i + 4]) &&
((vIt->second)->m_z > values[2 * i + 5]) &&
((vIt->second)->m_z < values[2 * i + 6]))
{
AddNoise = true;
......@@ -665,12 +678,12 @@ void ProcessSpherigon::Process()
Node rvec(0, rand(), rand(), rand());
rvec *= values[0] / sqrt(rvec.abs2());
Node normal = m_mesh->m_vertexNormals[vIt.first];
Node normal = m_mesh->m_vertexNormals[vIt->first];
normal += rvec;
normal /= sqrt(normal.abs2());
m_mesh->m_vertexNormals[vIt.first] = normal;
m_mesh->m_vertexNormals[vIt->first] = normal;
}
}
}
......
......@@ -350,7 +350,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
// check if volume nodes are in boundary or ignored nodes, otherwise add to VOLUME remain nodes
for (int i = 0; i < m_mesh->m_element[m_mesh->m_expDim].size(); i++)
{
vector<NodeSharedPtr> &ns =
vector<NodeSharedPtr> ns =
m_mesh->m_element[m_mesh->m_expDim][i]->GetVolumeNodes();
for (int j = 0; j < ns.size(); j++)
{
......
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