MFEM v2.0
|
00001 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at 00002 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights 00003 // reserved. See file COPYRIGHT for details. 00004 // 00005 // This file is part of the MFEM library. For more information and source code 00006 // availability see http://mfem.googlecode.com. 00007 // 00008 // MFEM is free software; you can redistribute it and/or modify it under the 00009 // terms of the GNU Lesser General Public License (as published by the Free 00010 // Software Foundation) version 2.1 dated February 1999. 00011 00012 #include <iostream> 00013 #include <iomanip> 00014 00015 #include "vector.hpp" 00016 #include "operator.hpp" 00017 00018 void Operator::PrintMatlab (ostream & out, int n, int m) 00019 { 00020 if (n == 0) n = size; 00021 if (m == 0) m = size; 00022 00023 Vector x(n), y(m); 00024 x = 0.0; 00025 00026 int i, j; 00027 out << setiosflags(ios::scientific | ios::showpos); 00028 for(i = 0; i < n; i++) { 00029 if (i != 0) 00030 x(i-1) = 0.0; 00031 x(i) = 1.0; 00032 Mult(x,y); 00033 for (j = 0; j < m; j++) 00034 if (y(j)) 00035 out << j+1 << " " << i+1 << " " << y(j) << endl; 00036 } 00037 }