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

Fix compiler errors

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