Skip to content
Snippets Groups Projects
Commit f6e782f8 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

update public api to conform to our coding style

parent 488a02ce
No related branches found
No related tags found
No related merge requests found
...@@ -50,8 +50,8 @@ public: ...@@ -50,8 +50,8 @@ public:
template <class EntityType> template <class EntityType>
void printEntity(const EntityType& entity, const std::string name = Common::Typename<EntityType>::value(), void print_entity(const EntityType& entity, const std::string name = Common::Typename<EntityType>::value(),
std::ostream& out = std::cout, const std::string prefix = "") std::ostream& out = std::cout, const std::string prefix = "")
{ {
if (!name.empty()) if (!name.empty())
out << prefix << name << ":\n"; out << prefix << name << ":\n";
...@@ -59,7 +59,7 @@ void printEntity(const EntityType& entity, const std::string name = Common::Type ...@@ -59,7 +59,7 @@ void printEntity(const EntityType& entity, const std::string name = Common::Type
for (auto ii : Common::value_range(geometry.corners())) for (auto ii : Common::value_range(geometry.corners()))
out << prefix + " " out << prefix + " "
<< "corner " + Common::to_string(ii) << " = " << geometry.corner(ii) << "\n"; << "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> template <int codim, int worlddim, class GridImp, template <int, int, class> class EntityImp>
......
...@@ -65,7 +65,7 @@ struct Statistics ...@@ -65,7 +65,7 @@ struct Statistics
/** \brief grid statistic output to given stream /** \brief grid statistic output to given stream
*/ */
template <class GridViewType> template <class GridViewType>
void printInfo(const GridViewType& gridView, std::ostream& out) void print_info(const GridViewType& gridView, std::ostream& out)
{ {
const Statistics st(gridView); const Statistics st(gridView);
out << "found " << st.numberOfEntities << " entities," << std::endl; out << "found " << st.numberOfEntities << " entities," << std::endl;
...@@ -73,13 +73,13 @@ void printInfo(const GridViewType& gridView, std::ostream& out) ...@@ -73,13 +73,13 @@ void printInfo(const GridViewType& gridView, std::ostream& out)
out << " " << st.numberOfInnerIntersections << " intersections inside and" << std::endl; out << " " << st.numberOfInnerIntersections << " intersections inside and" << std::endl;
out << " " << st.numberOfBoundaryIntersections << " intersections on the boundary." << std::endl; out << " " << st.numberOfBoundaryIntersections << " intersections on the boundary." << std::endl;
out << " maxGridWidth is " << st.maxGridWidth << std::endl; out << " maxGridWidth is " << st.maxGridWidth << std::endl;
} // printGridInformation } // ... print_info(...)
/** /**
* \attention Not optimal, does a whole grid walk! * \attention Not optimal, does a whole grid walk!
**/ **/
template <class GridViewType> template <class GridViewType>
size_t maxNumberOfNeighbors(const GridViewType& gridView) size_t max_number_of_neighbors(const GridViewType& gridView)
{ {
size_t maxNeighbours = 0; size_t maxNeighbours = 0;
for (auto&& entity : elements(gridView)) { for (auto&& entity : elements(gridView)) {
...@@ -90,7 +90,7 @@ size_t maxNumberOfNeighbors(const GridViewType& gridView) ...@@ -90,7 +90,7 @@ size_t maxNumberOfNeighbors(const GridViewType& gridView)
maxNeighbours = std::max(maxNeighbours, neighbours); maxNeighbours = std::max(maxNeighbours, neighbours);
} }
return maxNeighbours; return maxNeighbours;
} // size_t maxNumberOfNeighbors(const GridPartType& gridPart) } // ... max_number_of_neighbors(...)
//! Provide min/max coordinates for all space dimensions of a GridView //! Provide min/max coordinates for all space dimensions of a GridView
template <class GridViewType> template <class GridViewType>
...@@ -135,7 +135,7 @@ struct Dimensions ...@@ -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; 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 ...@@ -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("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() 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; s << std::endl;
return s; return s;
} }
......
...@@ -65,15 +65,15 @@ public: ...@@ -65,15 +65,15 @@ public:
std::ostream, into which the information is printed std::ostream, into which the information is printed
**/ **/
template <class IntersectionType> template <class IntersectionType>
void printIntersection(const IntersectionType& intersection, std::ostream& out = std::cout, void print_intersection(const IntersectionType& intersection, std::ostream& out = std::cout,
const std::string prefix = "") const std::string prefix = "")
{ {
out << prefix << Common::Typename<IntersectionType>::value() << std::endl; out << prefix << Common::Typename<IntersectionType>::value() << std::endl;
const auto& geometry = intersection.geometry(); const auto& geometry = intersection.geometry();
for (auto ii : Common::value_range(geometry.corners())) for (auto ii : Common::value_range(geometry.corners()))
out << prefix << " corner " + Common::to_string(ii) << " = " << geometry.corner(ii) out << prefix << " corner " + Common::to_string(ii) << " = " << geometry.corner(ii)
<< " (local: " << geometry.local(geometry.corner(ii)) << ")\n"; << " (local: " << geometry.local(geometry.corner(ii)) << ")\n";
} // ... printIntersection(...) } // ... print_intersection(...)
/** /**
......
...@@ -99,10 +99,10 @@ class PgfEntityFunctorIntersections : public Functor::Codim0And1<GridViewType> ...@@ -99,10 +99,10 @@ class PgfEntityFunctorIntersections : public Functor::Codim0And1<GridViewType>
public: public:
PgfEntityFunctorIntersections(const GridViewType& grid_view, std::ostream& file, const std::string color = "black", PgfEntityFunctorIntersections(const GridViewType& grid_view, std::ostream& file, const std::string color = "black",
const bool printEntityIndex = false) const bool print_entityIndex = false)
: file_(file) : file_(file)
, color_(color) , color_(color)
, printEntityIndex_(printEntityIndex) , print_entityIndex_(print_entityIndex)
, grid_view_(grid_view) , grid_view_(grid_view)
{ {
} }
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
void maybePrintEntityIndex(const typename BaseType::EntityType& entity, const int idx) void maybePrintEntityIndex(const typename BaseType::EntityType& entity, const int idx)
{ {
if (!printEntityIndex_) if (!print_entityIndex_)
return; return;
PgfCoordWrapper center(entity.geometry().center()); PgfCoordWrapper center(entity.geometry().center());
char buffer[50] = {'\0'}; char buffer[50] = {'\0'};
...@@ -145,7 +145,7 @@ public: ...@@ -145,7 +145,7 @@ public:
protected: protected:
std::ostream& file_; std::ostream& file_;
const std::string color_; const std::string color_;
const bool printEntityIndex_; const bool print_entityIndex_;
const GridViewType& grid_view_; const GridViewType& grid_view_;
}; };
...@@ -166,8 +166,8 @@ class PgfEntityFunctorIntersectionsWithShift : public PgfEntityFunctorIntersecti ...@@ -166,8 +166,8 @@ class PgfEntityFunctorIntersectionsWithShift : public PgfEntityFunctorIntersecti
public: public:
PgfEntityFunctorIntersectionsWithShift(const GridViewType& grid_view, std::ostream& file, PgfEntityFunctorIntersectionsWithShift(const GridViewType& grid_view, std::ostream& file,
const std::string color = "black", const int level = 0, const std::string color = "black", const int level = 0,
bool printEntityIndex = false) bool print_entityIndex = false)
: BaseType(grid_view, file, color, printEntityIndex) : BaseType(grid_view, file, color, print_entityIndex)
, level_(level) , level_(level)
{ {
} }
......
...@@ -41,7 +41,7 @@ struct GridInfoTest : public ::testing::Test ...@@ -41,7 +41,7 @@ struct GridInfoTest : public ::testing::Test
EXPECT_DOUBLE_EQ(1.0 / double(entities), dim.entity_volume.min()); 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.max());
EXPECT_DOUBLE_EQ(dim.entity_volume.min(), dim.entity_volume.average()); 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; const auto& dl = dim.coord_limits;
for (auto i : value_range(griddim)) { for (auto i : value_range(griddim)) {
EXPECT_DOUBLE_EQ(dl[i].max(), 1.0); EXPECT_DOUBLE_EQ(dl[i].max(), 1.0);
...@@ -62,13 +62,13 @@ struct GridInfoTest : public ::testing::Test ...@@ -62,13 +62,13 @@ struct GridInfoTest : public ::testing::Test
EXPECT_EQ(line * (griddim), st.numberOfBoundaryIntersections); EXPECT_EQ(line * (griddim), st.numberOfBoundaryIntersections);
EXPECT_EQ(entities * (2 * griddim), st.numberOfIntersections); EXPECT_EQ(entities * (2 * griddim), st.numberOfIntersections);
EXPECT_EQ(st.numberOfIntersections - st.numberOfBoundaryIntersections, st.numberOfInnerIntersections); 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) void print(std::ostream& out)
{ {
const auto& gv = grid_prv.grid().leafGridView(); const auto& gv = grid_prv.grid().leafGridView();
printInfo(gv, out); print_info(gv, out);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment