ColPack
Recovery/RecoveryCore.cpp
Go to the documentation of this file.
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                         for( int i=0; i < i_AF_rowCount; i++ ) {
00056                             free( dp2_AF_Value[i] );
00057                         }
00058                         free( dp2_AF_Value );
00059 
00060                         dp2_AF_Value = NULL;
00061                         AF_available = false;
00062                         i_AF_rowCount = 0;
00063                 }
00064                 
00065                 //for Sparse Solvers Format (SSF)
00066                 if (SSF_available) {
00067                         //delete[] ip_SSF_RowIndex;
00068                         free(ip_SSF_RowIndex);
00069                         ip_SSF_RowIndex = NULL;
00070                         //delete[] ip_SSF_ColumnIndex;
00071                         free(ip_SSF_ColumnIndex);
00072                         ip_SSF_ColumnIndex = NULL;
00073                         //delete[] dp_SSF_Value;
00074                         free(dp_SSF_Value);
00075                         dp_SSF_Value = NULL;
00076                         SSF_available = false;
00077                         i_SSF_rowCount = 0;
00078                 }
00079                 
00080                 //for Coordinate Format (CF)
00081                 if (CF_available) {
00082                         //do something
00083                         //delete[] ip_CF_RowIndex;
00084                         free(ip_CF_RowIndex);
00085                         ip_CF_RowIndex = NULL;
00086                         //delete[] ip_CF_ColumnIndex;
00087                         free(ip_CF_ColumnIndex);
00088                         ip_CF_ColumnIndex = NULL;
00089                         //delete[] dp_CF_Value;
00090                         free(dp_CF_Value);
00091                         dp_CF_Value = NULL;
00092                         CF_available = false;
00093                         i_CF_rowCount = 0;
00094                 }
00095                 
00096                 //formatType = "UNKNOWN";
00097         }
00098         
00099         RecoveryCore::~RecoveryCore() {
00100                 
00101                 //for ADOL-C Format (AF)
00102                 if (AF_available) {
00103                         //do something
00104                         //free_2DMatrix(dp2_AF_Value, i_AF_rowCount);
00105                         
00106                         for( int i=0; i < i_AF_rowCount; i++ ) {
00107                             free( dp2_AF_Value[i] );
00108                         }
00109                         free( dp2_AF_Value );
00110                 }
00111                 
00112                 //for Sparse Solvers Format (SSF)
00113                 if (SSF_available) {
00114                         //do something
00115                         //delete[] ip_SSF_RowIndex;
00116                         free(ip_SSF_RowIndex);
00117                         //delete[] ip_SSF_ColumnIndex;
00118                         free(ip_SSF_ColumnIndex);
00119                         //delete[] dp_SSF_Value;
00120                         free(dp_SSF_Value);
00121                 }
00122                 
00123                 //for Coordinate Format (CF)
00124                 if (CF_available) {
00125                         //do something
00126                         //delete[] ip_CF_RowIndex;
00127                         free(ip_CF_RowIndex);
00128                         //delete[] ip_CF_ColumnIndex;
00129                         free(ip_CF_ColumnIndex);
00130                         //delete[] dp_CF_Value;
00131                         free(dp_CF_Value);
00132                 }
00133         }
00134 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines