outputField(): Parametrise number of items per line

This is in preparation of leveraging the outputField() helper for
printing COORD and ZCORN too.
This commit is contained in:
Bård Skaflestad committed 2013-11-13 20:29:47 +01:00
1 parent b59ec1639a
commit 608d4c1a11
1 file changed
+3 -2
+3 -2
View File
@@ -338,7 +338,8 @@ namespace Opm
template <typename T> template <typename T>
void outputField(std::ostream& os, void outputField(std::ostream& os,
const std::vector<T>& field, const std::vector<T>& field,
const std::string& keyword) const std::string& keyword,
const typename std::vector<T>::size_type nl = 20)
{ {
if (field.empty()) return; if (field.empty()) return;
@@ -346,7 +347,7 @@ namespace Opm
int sz = field.size(); int sz = field.size();
//int num_new_zcorn = new_ZCORN_.size(); //int num_new_zcorn = new_ZCORN_.size();
//assert(sz%20 == 0); //assert(sz%20 == 0);
const int nel_per_row = 20; int nel_per_row = int(nl);
int num_full_rows=sz/nel_per_row; int num_full_rows=sz/nel_per_row;
int num_extra_entries=sz%nel_per_row; int num_extra_entries=sz%nel_per_row;
for (int i = 0; i < num_full_rows; ++i) { for (int i = 0; i < num_full_rows; ++i) {