Skip to content
Snippets Groups Projects
Commit b15b0364 authored by René Fritze's avatar René Fritze
Browse files

example usage of boost::format

parent d8f3569f
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <cmath> #include <cmath>
#include <boost/format.hpp>
#include <dune/stuff/functions.hh> #include <dune/stuff/functions.hh>
#include <dune/stuff/parametercontainer.hh> #include <dune/stuff/parametercontainer.hh>
...@@ -84,7 +85,7 @@ void printSparseRowMatrixMatlabStyle(const T& arg, const std::string name, strea ...@@ -84,7 +85,7 @@ void printSparseRowMatrixMatlabStyle(const T& arg, const std::string name, strea
{ {
const int I = arg.rows(); const int I = arg.rows();
const int J = arg.cols(); const int J = arg.cols();
out << "\n" << name << " = sparse( " << I << ", " << J << ");" << std::endl; out << boost::format("\n%s =sparse( %d, %d );") % name % I % J << std::endl;
for (int row = 0; row < arg.rows(); row++) { for (int row = 0; row < arg.rows(); row++) {
for (int col = 0; col < arg.cols(); col++) { for (int col = 0; col < arg.cols(); col++) {
if (arg(row, col) > eps) if (arg(row, col) > eps)
......
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