diff --git a/GeoLib/Polygon.cpp b/GeoLib/Polygon.cpp index bda531c7a2dc856867b19c868daa4e987ef6090c..2975a07484c4587b51a5870fa525236ee672dca5 100644 --- a/GeoLib/Polygon.cpp +++ b/GeoLib/Polygon.cpp @@ -70,7 +70,7 @@ bool Polygon::initialise () return false; } -bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const +bool Polygon::isPntInPolygon(GeoLib::Point const& pnt) const { MathLib::Point3d const& min_aabb_pnt(_aabb.getMinPoint()); MathLib::Point3d const& max_aabb_pnt(_aabb.getMaxPoint()); @@ -81,24 +81,29 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const return false; } - if (_simple_polygon_list.size() == 1) { + if (_simple_polygon_list.size() == 1) + { std::size_t n_intersections(0); - const std::size_t n_nodes (getNumberOfPoints() - 1); - for (std::size_t k(0); k < n_nodes; k++) { - if (((*(getPoint(k)))[1] <= pnt[1] && pnt[1] <= (*(getPoint(k + 1)))[1]) || - ((*(getPoint(k + 1)))[1] <= pnt[1] && pnt[1] <= (*(getPoint(k)))[1])) { + const std::size_t n_nodes(getNumberOfPoints() - 1); + for (std::size_t k(0); k < n_nodes; k++) + { + if (((*(getPoint(k)))[1] <= pnt[1] && + pnt[1] <= (*(getPoint(k + 1)))[1]) || + ((*(getPoint(k + 1)))[1] <= pnt[1] && + pnt[1] <= (*(getPoint(k)))[1])) + { switch (getEdgeType(k, pnt)) { - case EdgeType::TOUCHING: - return true; - case EdgeType::CROSSING: - n_intersections++; - break; - case EdgeType::INESSENTIAL: - break; - default: - // do nothing - ; + case EdgeType::TOUCHING: + return true; + case EdgeType::CROSSING: + n_intersections++; + break; + case EdgeType::INESSENTIAL: + break; + default: + // do nothing + ; } } } @@ -106,7 +111,9 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const { return true; } - } else { + } + else + { for (auto it(_simple_polygon_list.begin()++); it != _simple_polygon_list.end(); ++it) @@ -116,7 +123,6 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const return true; } } - return false; } return false; } @@ -124,7 +130,7 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const bool Polygon::isPntInPolygon(double x, double y, double z) const { const GeoLib::Point pnt(x,y,z); - return isPntInPolygon (pnt); + return isPntInPolygon(pnt); } std::vector<GeoLib::Point> Polygon::getAllIntersectionPoints( @@ -265,7 +271,7 @@ bool Polygon::getNextIntersectionPointPolygonLine( return false; } -EdgeType Polygon::getEdgeType (std::size_t k, GeoLib::Point const & pnt) const +EdgeType Polygon::getEdgeType(std::size_t k, GeoLib::Point const& pnt) const { switch (getLocationOfPoint(k, pnt)) { diff --git a/MathLib/LinAlg/PETSc/PETScVector.cpp b/MathLib/LinAlg/PETSc/PETScVector.cpp index 23de689e9546a55f3e1a17b276c9a8dac7cbbb8d..8d7518dc0602ceb45f5c7a872c4e36c62841b35c 100644 --- a/MathLib/LinAlg/PETSc/PETScVector.cpp +++ b/MathLib/LinAlg/PETSc/PETScVector.cpp @@ -5,7 +5,7 @@ * * Note: the return message of PETSc routines is ommited in * the source code. If it is really needed, it can be activated by - * adding a PetscErrorCode type variable before each PETSc fucntion + * adding a PetscErrorCode type variable before each PETSc function * * \author Wenqing Wang * \date Nov 2011 - Sep 2013 diff --git a/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h b/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h index ca1ca0571ad0646734a9129326feb093b3852b09..a713ae7166beca58cae847105ba035da13259e50 100644 --- a/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h +++ b/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h @@ -38,18 +38,19 @@ std::vector<bool> markNodesOutSideOfPolygon( rotated_nodes.push_back(new GeoLib::Point(*node, node->getID())); } // 2 rotate the Points - MathLib::DenseMatrix<double> rot_mat(3,3); + MathLib::DenseMatrix<double> rot_mat(3, 3); GeoLib::computeRotationMatrixToXY(normal, rot_mat); GeoLib::rotatePoints(rot_mat, rotated_nodes); // 3 set z coord to zero std::for_each(rotated_nodes.begin(), rotated_nodes.end(), - [] (GeoLib::Point* p) { (*p)[2] = 0.0; } - ); + [](GeoLib::Point* p) { (*p)[2] = 0.0; }); // *** mark rotated nodes std::vector<bool> outside(rotated_nodes.size(), true); - for (std::size_t k(0); k<rotated_nodes.size(); k++) { - if (rot_polygon.isPntInPolygon(*(rotated_nodes[k]))) { + for (std::size_t k(0); k < rotated_nodes.size(); k++) + { + if (rot_polygon.isPntInPolygon(*(rotated_nodes[k]))) + { outside[k] = false; } } @@ -59,11 +60,8 @@ std::vector<bool> markNodesOutSideOfPolygon( delete rotated_node; } - std::vector<GeoLib::Point*> & rot_polygon_pnts( - const_cast<std::vector<GeoLib::Point*> &>( - rot_polygon.getPointsVec() - ) - ); + std::vector<GeoLib::Point*>& rot_polygon_pnts( + const_cast<std::vector<GeoLib::Point*>&>(rot_polygon.getPointsVec())); for (auto& rot_polygon_pnt : rot_polygon_pnts) { delete rot_polygon_pnt; @@ -72,4 +70,4 @@ std::vector<bool> markNodesOutSideOfPolygon( return outside; } -} // end namespace MeshGeoToolsLib +} // end namespace MeshGeoToolsLib diff --git a/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h b/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h index a78800cf70ee209c950f1bec333ec5df921a524c..2c7038e1722f1f70d42ed548683edbe46cc5df20 100644 --- a/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h +++ b/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h @@ -68,8 +68,8 @@ void resetMeshElementProperty(MeshLib::Mesh& mesh, { MeshLib::Element const* const elem(mesh.getElements()[j]); if (std::all_of(elem->getNodes(), - elem->getNodes() + elem->getNumberOfNodes(), - is_node_outside)) + elem->getNodes() + elem->getNumberOfNodes(), + is_node_outside)) { continue; } diff --git a/ProcessLib/LocalAssemblerTraits.h b/ProcessLib/LocalAssemblerTraits.h index 8ed068b00e1bed33c21b345e85789deed312117c..cd5ed43b8bb922ffb5e9c5061cc4b3fbbf0479f5 100644 --- a/ProcessLib/LocalAssemblerTraits.h +++ b/ProcessLib/LocalAssemblerTraits.h @@ -48,7 +48,7 @@ public: using MatrixDimDim = Matrix<Dim, Dim>; // TODO That only works if all process variables are single component - // and use the same shape fucntions. + // and use the same shape functions. //! Local matrix for the given number of d.o.f.\ per node and number of //! integration points using LocalMatrix = Matrix<NNodes*NodalDOF, NNodes*NodalDOF>;