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 #include "ColPackHeaders.h" 00022 00023 using namespace std; 00024 00025 namespace ColPack 00026 { 00027 RecoveryCore::RecoveryCore() { 00028 //formatType = "UNKNOWN"; 00029 00030 //for ADOL-C Format (AF) 00031 AF_available = false; 00032 i_AF_rowCount = 0; 00033 dp2_AF_Value = NULL; 00034 00035 //for Sparse Solvers Format (SSF) 00036 SSF_available = false; 00037 i_SSF_rowCount = 0; 00038 ip_SSF_RowIndex = NULL; 00039 ip_SSF_ColumnIndex = NULL; 00040 dp_SSF_Value = NULL; 00041 00042 //for Coordinate Format (CF) 00043 CF_available = false; 00044 i_CF_rowCount = 0; 00045 ip_CF_RowIndex = NULL; 00046 ip_CF_ColumnIndex = NULL; 00047 dp_CF_Value = NULL; 00048 } 00049 00050 void RecoveryCore::reset() { 00051 00052 //for ADOL-C Format (AF) 00053 if (AF_available) { 00054 free_2DMatrix(dp2_AF_Value, i_AF_rowCount); 00055 dp2_AF_Value = NULL; 00056 AF_available = false; 00057 i_AF_rowCount = 0; 00058 } 00059 00060 //for Sparse Solvers Format (SSF) 00061 if (SSF_available) { 00062 delete[] ip_SSF_RowIndex; 00063 ip_SSF_RowIndex = NULL; 00064 delete[] ip_SSF_ColumnIndex; 00065 ip_SSF_ColumnIndex = NULL; 00066 delete[] dp_SSF_Value; 00067 dp_SSF_Value = NULL; 00068 SSF_available = false; 00069 i_SSF_rowCount = 0; 00070 } 00071 00072 //for Coordinate Format (CF) 00073 if (CF_available) { 00074 //do something 00075 delete[] ip_CF_RowIndex; 00076 ip_CF_RowIndex = NULL; 00077 delete[] ip_CF_ColumnIndex; 00078 ip_CF_ColumnIndex = NULL; 00079 delete[] dp_CF_Value; 00080 dp_CF_Value = NULL; 00081 CF_available = false; 00082 i_CF_rowCount = 0; 00083 } 00084 00085 //formatType = "UNKNOWN"; 00086 } 00087 00088 RecoveryCore::~RecoveryCore() { 00089 00090 //for ADOL-C Format (AF) 00091 if (AF_available) { 00092 //do something 00093 free_2DMatrix(dp2_AF_Value, i_AF_rowCount); 00094 } 00095 00096 //for Sparse Solvers Format (SSF) 00097 if (SSF_available) { 00098 //do something 00099 delete[] ip_SSF_RowIndex; 00100 delete[] ip_SSF_ColumnIndex; 00101 delete[] dp_SSF_Value; 00102 } 00103 00104 //for Coordinate Format (CF) 00105 if (CF_available) { 00106 //do something 00107 delete[] ip_CF_RowIndex; 00108 delete[] ip_CF_ColumnIndex; 00109 delete[] dp_CF_Value; 00110 } 00111 } 00112 }