Skip to content

Commit

Permalink
fix -Wextra in Mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 23, 2016
1 parent c48a9bf commit b980cf3
Show file tree
Hide file tree
Showing 33 changed files with 680 additions and 608 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Mesh/App/Core/Algorithm.cpp
Expand Up @@ -173,7 +173,7 @@ bool MeshAlgorithm::NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::
}

bool MeshAlgorithm::RayNearestField (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, const std::vector<unsigned long> &raulFacets,
Base::Vector3f &rclRes, unsigned long &rulFacet, float fMaxAngle) const
Base::Vector3f &rclRes, unsigned long &rulFacet, float /*fMaxAngle*/) const
{
Base::Vector3f clProj, clRes;
bool bSol = false;
Expand Down
7 changes: 7 additions & 0 deletions src/Mod/Mesh/App/Core/Approximation.h
Expand Up @@ -415,6 +415,7 @@ class FunctionContainer
double &rfCurv0, double &rfCurv1,
Wm4::Vector3<double> &rkDir0, Wm4::Vector3<double> &rkDir1, double &dDistance)
{
(void)dDistance;
return pImplSurf->ComputePrincipalCurvatureInfo( Wm4::Vector3<double>(x, y, z),rfCurv0, rfCurv1, rkDir0, rkDir1 );
}

Expand Down Expand Up @@ -482,26 +483,32 @@ class FunctionContainer
//+++++++++ 2. derivations ++++++++++++++++++++++++++++++++
double Fxx( double x, double y, double z )
{
(void)x; (void)y; (void)z;
return( 2.0f*dKoeff[4] );
}
double Fxy( double x, double y, double z )
{
(void)x; (void)y; (void)z;
return( dKoeff[7] );
}
double Fxz( double x, double y, double z )
{
(void)x; (void)y; (void)z;
return( dKoeff[8] );
}
double Fyy( double x, double y, double z )
{
(void)x; (void)y; (void)z;
return( 2.0f*dKoeff[5] );
}
double Fyz( double x, double y, double z )
{
(void)x; (void)y; (void)z;
return( dKoeff[9] );
}
double Fzz( double x, double y, double z )
{
(void)x; (void)y; (void)z;
return( 2.0f*dKoeff[6] );
}

Expand Down
8 changes: 6 additions & 2 deletions src/Mod/Mesh/App/Core/Evaluation.cpp
Expand Up @@ -50,9 +50,11 @@ MeshOrientationVisitor::MeshOrientationVisitor() : _nonuniformOrientation(false)
{
}

bool MeshOrientationVisitor::Visit (const MeshFacet &rclFacet, const MeshFacet &rclFrom,
bool MeshOrientationVisitor::Visit (const MeshFacet &rclFacet, const MeshFacet &rclFrom,
unsigned long ulFInd, unsigned long ulLevel)
{
(void)ulFInd;
(void)ulLevel;
if (!rclFrom.HasSameOrientation(rclFacet)) {
_nonuniformOrientation = true;
return false;
Expand All @@ -71,9 +73,10 @@ MeshOrientationCollector::MeshOrientationCollector(std::vector<unsigned long>& a
{
}

bool MeshOrientationCollector::Visit (const MeshFacet &rclFacet, const MeshFacet &rclFrom,
bool MeshOrientationCollector::Visit (const MeshFacet &rclFacet, const MeshFacet &rclFrom,
unsigned long ulFInd, unsigned long ulLevel)
{
(void)ulLevel;
// different orientation of rclFacet and rclFrom
if (!rclFacet.HasSameOrientation(rclFrom)) {
// is not marked as false oriented
Expand Down Expand Up @@ -109,6 +112,7 @@ bool MeshSameOrientationCollector::Visit (const MeshFacet &rclFacet, const MeshF
unsigned long ulFInd, unsigned long ulLevel)
{
// different orientation of rclFacet and rclFrom
(void)ulLevel;
if (rclFacet.HasSameOrientation(rclFrom)) {
_aulIndices.push_back(ulFInd);
}
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Mesh/App/Core/Grid.cpp
Expand Up @@ -994,6 +994,7 @@ MeshPointGrid::MeshPointGrid (const MeshKernel &rclM, float fGridLen)

void MeshPointGrid::AddPoint (const MeshPoint &rclPt, unsigned long ulPtIndex, float fEpsilon)
{
(void)fEpsilon;
unsigned long ulX, ulY, ulZ;
Pos(Base::Vector3f(rclPt.x, rclPt.y, rclPt.z), ulX, ulY, ulZ);
if ( (ulX < _ulCtGridsX) && (ulY < _ulCtGridsY) && (ulZ < _ulCtGridsZ) )
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Mesh/App/Core/Grid.h
Expand Up @@ -434,7 +434,7 @@ inline void MeshFacetGrid::PosWithCheck (const Base::Vector3f &rclPoint, unsigne
assert((rulX < _ulCtGridsX) && (rulY < _ulCtGridsY) && (rulZ < _ulCtGridsZ));
}

inline void MeshFacetGrid::AddFacet (const MeshGeomFacet &rclFacet, unsigned long ulFacetIndex, float fEpsilon)
inline void MeshFacetGrid::AddFacet (const MeshGeomFacet &rclFacet, unsigned long ulFacetIndex, float /*fEpsilon*/)
{
#if 0
unsigned long i, ulX, ulY, ulZ, ulX1, ulY1, ulZ1, ulX2, ulY2, ulZ2;
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Mesh/App/Core/MeshIO.cpp
Expand Up @@ -2583,7 +2583,7 @@ bool MeshOutput::SaveNastran (std::ostream &rstrOut) const
}

/** Writes a Cadmould FE file. */
bool MeshOutput::SaveCadmouldFE (std::ostream &rstrOut) const
bool MeshOutput::SaveCadmouldFE (std::ostream & /*rstrOut*/) const
{
return false;
}
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Mesh/App/Core/MeshKernel.cpp
Expand Up @@ -925,6 +925,7 @@ void MeshKernel::Transform (const Base::Matrix4D &rclMat)

void MeshKernel::Smooth(int iterations, float stepsize)
{
(void)stepsize;
LaplaceSmoothing(*this).Smooth(iterations);
}

Expand Down
222 changes: 115 additions & 107 deletions src/Mod/Mesh/App/Core/SetOperations.cpp
Expand Up @@ -492,121 +492,129 @@ void SetOperations::CollectFacets (int side, float mult)
// MeshDefinitions::SetMinPointDistance(distSave);
}

SetOperations::CollectFacetVisitor::CollectFacetVisitor (const MeshKernel& mesh, std::vector<unsigned long>& facets, std::map<Edge, EdgeInfo>& edges, int side, float mult , Base::Builder3D& builder )
: _facets(facets),
_mesh(mesh),
_edges(edges),
_side(side),
_mult(mult),
_addFacets(-1)
SetOperations::CollectFacetVisitor::CollectFacetVisitor (const MeshKernel& mesh, std::vector<unsigned long>& facets,
std::map<Edge, EdgeInfo>& edges, int side, float mult,
Base::Builder3D& builder)
: _facets(facets)
, _mesh(mesh)
, _edges(edges)
, _side(side)
, _mult(mult)
, _addFacets(-1)
,_builder(builder)
{
}

bool SetOperations::CollectFacetVisitor::Visit (const MeshFacet &rclFacet, const MeshFacet &rclFrom, unsigned long ulFInd, unsigned long ulLevel)
bool SetOperations::CollectFacetVisitor::Visit (const MeshFacet &rclFacet, const MeshFacet &rclFrom,
unsigned long ulFInd, unsigned long ulLevel)
{
_facets.push_back(ulFInd);
return true;
(void)rclFacet;
(void)rclFrom;
(void)ulLevel;
_facets.push_back(ulFInd);
return true;
}

//static int matchCounter = 0;
bool SetOperations::CollectFacetVisitor::AllowVisit (const MeshFacet& rclFacet, const MeshFacet& rclFrom, unsigned long ulFInd, unsigned long ulLevel, unsigned short neighbourIndex)
bool SetOperations::CollectFacetVisitor::AllowVisit (const MeshFacet& rclFacet, const MeshFacet& rclFrom,
unsigned long ulFInd, unsigned long ulLevel,
unsigned short neighbourIndex)
{
if (rclFacet.IsFlag(MeshFacet::MARKED) && rclFrom.IsFlag(MeshFacet::MARKED))
{ // facet connected to an edge
unsigned long pt0 = rclFrom._aulPoints[neighbourIndex], pt1 = rclFrom._aulPoints[(neighbourIndex+1)%3];
Edge edge(_mesh.GetPoint(pt0), _mesh.GetPoint(pt1));

std::map<Edge, EdgeInfo>::iterator it = _edges.find(edge);

if (it != _edges.end())
{
if (_addFacets == -1)
{ // detemine if the facets shoud add or not only once
MeshGeomFacet facet = _mesh.GetFacet(rclFrom); // triangulated facet
MeshGeomFacet facetOther = it->second.facets[1-_side][0]; // triangulated facet from same edge and other mesh
Vector3f normalOther = facetOther.GetNormal();
//Vector3f normal = facet.GetNormal();

Vector3f edgeDir = it->first.pt1 - it->first.pt2;
Vector3f ocDir = (edgeDir % (facet.GetGravityPoint() - it->first.pt1)) % edgeDir;
ocDir.Normalize();
Vector3f ocDirOther = (edgeDir % (facetOther.GetGravityPoint() - it->first.pt1)) % edgeDir;
ocDirOther.Normalize();

//Vector3f dir = ocDir % normal;
//Vector3f dirOther = ocDirOther % normalOther;

bool match = ((ocDir * normalOther) * _mult) < 0.0f;

//if (matchCounter == 1)
//{
// // _builder.addSingleArrow(it->second.pt1, it->second.pt1 + edgeDir, 3, 0.0, 1.0, 0.0);

// _builder.addSingleTriangle(facet._aclPoints[0], facet._aclPoints[1], facet._aclPoints[2], true, 3.0, 1.0, 0.0, 0.0);
// // _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + ocDir, 3, 1.0, 0.0, 0.0);
// _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + normal, 3, 1.0, 0.5, 0.0);
// // _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + dir, 3, 1.0, 1.0, 0.0);

// _builder.addSingleTriangle(facetOther._aclPoints[0], facetOther._aclPoints[1], facetOther._aclPoints[2], true, 3.0, 0.0, 0.0, 1.0);
// // _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + ocDirOther, 3, 0.0, 0.0, 1.0);
// _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + normalOther, 3, 0.0, 0.5, 1.0);
// // _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + dirOther, 3, 0.0, 1.0, 1.0);

//}

// float scalar = dir * dirOther * _mult;
// bool match = scalar > 0.0f;


//MeshPoint pt0 = it->first.pt1;
//MeshPoint pt1 = it->first.pt2;

//int i, n0 = -1, n1 = -1, m0 = -1, m1 = -1;
//for (i = 0; i < 3; i++)
//{
// if ((n0 == -1) && (facet._aclPoints[i] == pt0))
// n0 = i;
// if ((n1 == -1) && (facet._aclPoints[i] == pt1))
// n1 = i;
// if ((m0 == -1) && (facetOther._aclPoints[i] == pt0))
// m0 = i;
// if ((m1 == -1) && (facetOther._aclPoints[i] == pt1))
// m1 = i;
//}

//if ((n0 != -1) && (n1 != -1) && (m0 != -1) && (m1 != -1))
//{
// bool orient_n = n1 > n0;
// bool orient_m = m1 > m0;

// Vector3f dirN = facet._aclPoints[n1] - facet._aclPoints[n0];
// Vector3f dirM = facetOther._aclPoints[m1] - facetOther._aclPoints[m0];

// if (matchCounter == 1)
// {
// _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + dirN, 3, 1.0, 1.0, 0.0);
// _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + dirM, 3, 0.0, 1.0, 1.0);
// }

// if (_mult > 0.0)
// match = orient_n == orient_m;
// else
// match = orient_n != orient_m;
//}

if (match)
_addFacets = 0;
else
_addFacets = 1;

//matchCounter++;
}

return false;
}
}
(void)ulFInd;
(void)ulLevel;
if (rclFacet.IsFlag(MeshFacet::MARKED) && rclFrom.IsFlag(MeshFacet::MARKED)) {
// facet connected to an edge
unsigned long pt0 = rclFrom._aulPoints[neighbourIndex], pt1 = rclFrom._aulPoints[(neighbourIndex+1)%3];
Edge edge(_mesh.GetPoint(pt0), _mesh.GetPoint(pt1));

std::map<Edge, EdgeInfo>::iterator it = _edges.find(edge);

if (it != _edges.end()) {
if (_addFacets == -1) {
// detemine if the facets shoud add or not only once
MeshGeomFacet facet = _mesh.GetFacet(rclFrom); // triangulated facet
MeshGeomFacet facetOther = it->second.facets[1-_side][0]; // triangulated facet from same edge and other mesh
Vector3f normalOther = facetOther.GetNormal();
//Vector3f normal = facet.GetNormal();

Vector3f edgeDir = it->first.pt1 - it->first.pt2;
Vector3f ocDir = (edgeDir % (facet.GetGravityPoint() - it->first.pt1)) % edgeDir;
ocDir.Normalize();
Vector3f ocDirOther = (edgeDir % (facetOther.GetGravityPoint() - it->first.pt1)) % edgeDir;
ocDirOther.Normalize();

//Vector3f dir = ocDir % normal;
//Vector3f dirOther = ocDirOther % normalOther;

bool match = ((ocDir * normalOther) * _mult) < 0.0f;

//if (matchCounter == 1)
//{
// // _builder.addSingleArrow(it->second.pt1, it->second.pt1 + edgeDir, 3, 0.0, 1.0, 0.0);

// _builder.addSingleTriangle(facet._aclPoints[0], facet._aclPoints[1], facet._aclPoints[2], true, 3.0, 1.0, 0.0, 0.0);
// // _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + ocDir, 3, 1.0, 0.0, 0.0);
// _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + normal, 3, 1.0, 0.5, 0.0);
// // _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + dir, 3, 1.0, 1.0, 0.0);

// _builder.addSingleTriangle(facetOther._aclPoints[0], facetOther._aclPoints[1], facetOther._aclPoints[2], true, 3.0, 0.0, 0.0, 1.0);
// // _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + ocDirOther, 3, 0.0, 0.0, 1.0);
// _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + normalOther, 3, 0.0, 0.5, 1.0);
// // _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + dirOther, 3, 0.0, 1.0, 1.0);

//}

// float scalar = dir * dirOther * _mult;
// bool match = scalar > 0.0f;


//MeshPoint pt0 = it->first.pt1;
//MeshPoint pt1 = it->first.pt2;

//int i, n0 = -1, n1 = -1, m0 = -1, m1 = -1;
//for (i = 0; i < 3; i++)
//{
// if ((n0 == -1) && (facet._aclPoints[i] == pt0))
// n0 = i;
// if ((n1 == -1) && (facet._aclPoints[i] == pt1))
// n1 = i;
// if ((m0 == -1) && (facetOther._aclPoints[i] == pt0))
// m0 = i;
// if ((m1 == -1) && (facetOther._aclPoints[i] == pt1))
// m1 = i;
//}

//if ((n0 != -1) && (n1 != -1) && (m0 != -1) && (m1 != -1))
//{
// bool orient_n = n1 > n0;
// bool orient_m = m1 > m0;

// Vector3f dirN = facet._aclPoints[n1] - facet._aclPoints[n0];
// Vector3f dirM = facetOther._aclPoints[m1] - facetOther._aclPoints[m0];

// if (matchCounter == 1)
// {
// _builder.addSingleArrow(facet.GetGravityPoint(), facet.GetGravityPoint() + dirN, 3, 1.0, 1.0, 0.0);
// _builder.addSingleArrow(facetOther.GetGravityPoint(), facetOther.GetGravityPoint() + dirM, 3, 0.0, 1.0, 1.0);
// }

// if (_mult > 0.0)
// match = orient_n == orient_m;
// else
// match = orient_n != orient_m;
//}

if (match)
_addFacets = 0;
else
_addFacets = 1;

//matchCounter++;
}

return false;
}
}

return true;
return true;
}

0 comments on commit b980cf3

Please sign in to comment.