From f6e782f8ce6c5933d5fa29008ddcebe9d4d38f9e Mon Sep 17 00:00:00 2001 From: Felix Schindler <felix.schindler@wwu.de> Date: Wed, 20 Jan 2016 10:35:11 +0100 Subject: [PATCH] update public api to conform to our coding style --- dune/xt/grid/entity.hh | 6 +++--- dune/xt/grid/information.hh | 12 ++++++------ dune/xt/grid/intersection.hh | 6 +++--- dune/xt/grid/output/pgf.hh | 12 ++++++------ dune/xt/test/grid_information.cc | 6 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/dune/xt/grid/entity.hh b/dune/xt/grid/entity.hh index 86e40d741..24b8ae070 100644 --- a/dune/xt/grid/entity.hh +++ b/dune/xt/grid/entity.hh @@ -50,8 +50,8 @@ public: template <class EntityType> -void printEntity(const EntityType& entity, const std::string name = Common::Typename<EntityType>::value(), - std::ostream& out = std::cout, const std::string prefix = "") +void print_entity(const EntityType& entity, const std::string name = Common::Typename<EntityType>::value(), + std::ostream& out = std::cout, const std::string prefix = "") { if (!name.empty()) out << prefix << name << ":\n"; @@ -59,7 +59,7 @@ void printEntity(const EntityType& entity, const std::string name = Common::Type for (auto ii : Common::value_range(geometry.corners())) out << prefix + " " << "corner " + Common::to_string(ii) << " = " << geometry.corner(ii) << "\n"; -} // ... printEntity(...) +} // ... print_entity(...) template <int codim, int worlddim, class GridImp, template <int, int, class> class EntityImp> diff --git a/dune/xt/grid/information.hh b/dune/xt/grid/information.hh index d88bc60b0..8f1039a90 100644 --- a/dune/xt/grid/information.hh +++ b/dune/xt/grid/information.hh @@ -65,7 +65,7 @@ struct Statistics /** \brief grid statistic output to given stream */ template <class GridViewType> -void printInfo(const GridViewType& gridView, std::ostream& out) +void print_info(const GridViewType& gridView, std::ostream& out) { const Statistics st(gridView); out << "found " << st.numberOfEntities << " entities," << std::endl; @@ -73,13 +73,13 @@ void printInfo(const GridViewType& gridView, std::ostream& out) out << " " << st.numberOfInnerIntersections << " intersections inside and" << std::endl; out << " " << st.numberOfBoundaryIntersections << " intersections on the boundary." << std::endl; out << " maxGridWidth is " << st.maxGridWidth << std::endl; -} // printGridInformation +} // ... print_info(...) /** * \attention Not optimal, does a whole grid walk! **/ template <class GridViewType> -size_t maxNumberOfNeighbors(const GridViewType& gridView) +size_t max_number_of_neighbors(const GridViewType& gridView) { size_t maxNeighbours = 0; for (auto&& entity : elements(gridView)) { @@ -90,7 +90,7 @@ size_t maxNumberOfNeighbors(const GridViewType& gridView) maxNeighbours = std::max(maxNeighbours, neighbours); } return maxNeighbours; -} // size_t maxNumberOfNeighbors(const GridPartType& gridPart) +} // ... max_number_of_neighbors(...) //! Provide min/max coordinates for all space dimensions of a GridView template <class GridViewType> @@ -135,7 +135,7 @@ struct Dimensions } // () }; - double volumeRelation() const + double volume_relation() const { return entity_volume.min() != 0.0 ? entity_volume.max() / entity_volume.min() : -1; } @@ -187,7 +187,7 @@ inline std::ostream& operator<<(std::ostream& s, const Dune::XT::Grid::Dimension s << boost::format("x%d\tmin: %e\tavg: %e\tmax: %e\n") % k % mma.min() % mma.average() % mma.max(); } s << boost::format("Entity vol min: %e\tavg: %e\tmax: %e\tQout: %e") % d.entity_volume.min() - % d.entity_volume.average() % d.entity_volume.max() % d.volumeRelation(); + % d.entity_volume.average() % d.entity_volume.max() % d.volume_relation(); s << std::endl; return s; } diff --git a/dune/xt/grid/intersection.hh b/dune/xt/grid/intersection.hh index 70cb4a773..20ac198ed 100644 --- a/dune/xt/grid/intersection.hh +++ b/dune/xt/grid/intersection.hh @@ -65,15 +65,15 @@ public: std::ostream, into which the information is printed **/ template <class IntersectionType> -void printIntersection(const IntersectionType& intersection, std::ostream& out = std::cout, - const std::string prefix = "") +void print_intersection(const IntersectionType& intersection, std::ostream& out = std::cout, + const std::string prefix = "") { out << prefix << Common::Typename<IntersectionType>::value() << std::endl; const auto& geometry = intersection.geometry(); for (auto ii : Common::value_range(geometry.corners())) out << prefix << " corner " + Common::to_string(ii) << " = " << geometry.corner(ii) << " (local: " << geometry.local(geometry.corner(ii)) << ")\n"; -} // ... printIntersection(...) +} // ... print_intersection(...) /** diff --git a/dune/xt/grid/output/pgf.hh b/dune/xt/grid/output/pgf.hh index a3b023c95..d2739aae9 100644 --- a/dune/xt/grid/output/pgf.hh +++ b/dune/xt/grid/output/pgf.hh @@ -99,10 +99,10 @@ class PgfEntityFunctorIntersections : public Functor::Codim0And1<GridViewType> public: PgfEntityFunctorIntersections(const GridViewType& grid_view, std::ostream& file, const std::string color = "black", - const bool printEntityIndex = false) + const bool print_entityIndex = false) : file_(file) , color_(color) - , printEntityIndex_(printEntityIndex) + , print_entityIndex_(print_entityIndex) , grid_view_(grid_view) { } @@ -134,7 +134,7 @@ public: void maybePrintEntityIndex(const typename BaseType::EntityType& entity, const int idx) { - if (!printEntityIndex_) + if (!print_entityIndex_) return; PgfCoordWrapper center(entity.geometry().center()); char buffer[50] = {'\0'}; @@ -145,7 +145,7 @@ public: protected: std::ostream& file_; const std::string color_; - const bool printEntityIndex_; + const bool print_entityIndex_; const GridViewType& grid_view_; }; @@ -166,8 +166,8 @@ class PgfEntityFunctorIntersectionsWithShift : public PgfEntityFunctorIntersecti public: PgfEntityFunctorIntersectionsWithShift(const GridViewType& grid_view, std::ostream& file, const std::string color = "black", const int level = 0, - bool printEntityIndex = false) - : BaseType(grid_view, file, color, printEntityIndex) + bool print_entityIndex = false) + : BaseType(grid_view, file, color, print_entityIndex) , level_(level) { } diff --git a/dune/xt/test/grid_information.cc b/dune/xt/test/grid_information.cc index 1f26f61e4..674828fb8 100644 --- a/dune/xt/test/grid_information.cc +++ b/dune/xt/test/grid_information.cc @@ -41,7 +41,7 @@ struct GridInfoTest : public ::testing::Test EXPECT_DOUBLE_EQ(1.0 / double(entities), dim.entity_volume.min()); EXPECT_DOUBLE_EQ(dim.entity_volume.min(), dim.entity_volume.max()); EXPECT_DOUBLE_EQ(dim.entity_volume.min(), dim.entity_volume.average()); - EXPECT_DOUBLE_EQ(1.0, dim.volumeRelation()); + EXPECT_DOUBLE_EQ(1.0, dim.volume_relation()); const auto& dl = dim.coord_limits; for (auto i : value_range(griddim)) { EXPECT_DOUBLE_EQ(dl[i].max(), 1.0); @@ -62,13 +62,13 @@ struct GridInfoTest : public ::testing::Test EXPECT_EQ(line * (griddim), st.numberOfBoundaryIntersections); EXPECT_EQ(entities * (2 * griddim), st.numberOfIntersections); EXPECT_EQ(st.numberOfIntersections - st.numberOfBoundaryIntersections, st.numberOfInnerIntersections); - EXPECT_EQ(griddim * 2, maxNumberOfNeighbors(gv)); + EXPECT_EQ(griddim * 2, max_number_of_neighbors(gv)); } void print(std::ostream& out) { const auto& gv = grid_prv.grid().leafGridView(); - printInfo(gv, out); + print_info(gv, out); } }; -- GitLab