Skip to content
Snippets Groups Projects
Commit 68949b01 authored by Jean Benezech's avatar Jean Benezech
Browse files

make storeMatrixMarket able to choose the decimal precision

parent ea9f0c4c
No related branches found
No related tags found
No related merge requests found
......@@ -1115,13 +1115,17 @@ namespace Dune
* @param matrix The matrix/vector to store.
* @param filename the name of the filename (without suffix and rank!)
* rank i will write the file filename_i.mm
* @param prec Set the decimal precision to be used
*/
template<typename M>
void storeMatrixMarket(const M& matrix,
std::string filename)
std::string filename,
int prec=0)
{
std::ofstream file(filename.c_str());
file.setf(std::ios::scientific,std::ios::floatfield);
if(prec>0)
file.precision(prec);
writeMatrixMarket(matrix, file);
file.close();
}
......@@ -1139,12 +1143,14 @@ namespace Dune
* @param comm The information about the data distribution.
* @param storeIndices Whether to store the parallel index information.
* If true rank i writes the index information to file filename_i.idx.
* @param prec Set the decimal precision to be used
*/
template<typename M, typename G, typename L>
void storeMatrixMarket(const M& matrix,
std::string filename,
const OwnerOverlapCopyCommunication<G,L>& comm,
bool storeIndices=true)
bool storeIndices=true,
int prec=0)
{
// Get our rank
int rank = comm.communicator().rank();
......@@ -1154,6 +1160,8 @@ namespace Dune
dverb<< rfilename.str()<<std::endl;
std::ofstream file(rfilename.str().c_str());
file.setf(std::ios::scientific,std::ios::floatfield);
if(prec>0)
file.precision(prec);
writeMatrixMarket(matrix, file);
file.close();
......
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