ColPack
|
00001 /************************************************************************************ 00002 Copyright (C) 2005-2008 Assefaw H. Gebremedhin, Arijit Tarafdar, Duc Nguyen, 00003 Alex Pothen 00004 00005 This file is part of ColPack. 00006 00007 ColPack is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published 00009 by the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 ColPack is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with ColPack. If not, see <http://www.gnu.org/licenses/>. 00019 ************************************************************************************/ 00020 00021 #ifndef GRAPHINPUTOUTPUT_H 00022 #define GRAPHINPUTOUTPUT_H 00023 00024 using namespace std; 00025 00026 namespace ColPack 00027 { 00035 class GraphInputOutput : public GraphCore 00036 { 00037 public: 00038 00040 00047 int BuildGraphFromRowCompressedFormat(unsigned int ** uip2_HessianSparsityPattern, int i_RowCount); 00048 00050 00070 int ReadAdjacencyGraph(string s_InputFile, string s_fileFormat="AUTO_DETECTED"); 00071 00072 // !!! NEED TO BE FIXED 00074 00081 int ReadMatrixMarketAdjacencyGraph(string s_InputFile, bool b_getStructureOnly = false); 00082 00084 00089 int WriteMatrixMarket(string s_OutputFile = "-ColPack_debug.mtx", bool b_getStructureOnly = false); 00090 00091 private: 00092 00093 // ??? Wonder if this function is useful any more 00094 int ParseWidth(string FortranFormat); 00095 00096 void CalculateVertexDegrees(); 00097 00098 public: 00099 00100 GraphInputOutput(); 00101 00102 ~GraphInputOutput(); 00103 00104 virtual void Clear(); 00105 00106 string GetInputFile(); 00107 00109 00113 int ReadHarwellBoeingAdjacencyGraph(string s_InputFile); 00114 00116 int ReadMeTiSAdjacencyGraph(string s_InputFile); 00117 00118 // TO BE DOCUMENTED 00119 // ??? When do I need ReadMeTiSAdjacencyGraph2() instead of ReadMeTiSAdjacencyGraph() ? 00120 // probably need ReadMeTiSAdjacencyGraph2() when I need to read from a variant of MeTiS format 00121 int ReadMeTiSAdjacencyGraph2(string s_InputFile); 00122 00123 int PrintGraph(); 00124 00125 int PrintGraphStructure(); 00126 int PrintGraphStructure2(); 00127 00128 int PrintMatrix(); 00129 00130 int PrintMatrix(vector<int> &, vector<int> &, vector<double> &); 00131 00132 void PrintVertexDegrees(); 00133 }; 00134 } 00135 #endif 00136