/*! Deallocates the members of the data structure of the known system matrix provided they are not 0. @param[in] A the known system matrix */ inline void DeleteMatrix(SparseMatrix & A) { #ifndef HPCG_CONTIGUOUS_ARRAYS for (local_int_t i = 0; i< A.localNumberOfRows; ++i) { delete [] A.matrixValues[i]; delete [] A.mtxIndG[i]; delete [] A.mtxIndL[i]; } #else delete [] A.matrixValues[0]; delete [] A.mtxIndG[0]; delete [] A.mtxIndL[0]; #endif if (A.title) delete [] A.title; if (A.nonzerosInRow) delete [] A.nonzerosInRow; if (A.mtxIndG) delete [] A.mtxIndG; if (A.mtxIndL) delete [] A.mtxIndL; if (A.matrixValues) delete [] A.matrixValues; if (A.matrixDiagonal) delete [] A.matrixDiagonal; #ifndef HPCG_NO_MPI if (A.elementsToSend) delete [] A.elementsToSend; if (A.neighbors) delete [] A.neighbors; if (A.receiveLength) delete [] A.receiveLength; if (A.sendLength) delete [] A.sendLength; if (A.sendBuffer) delete [] A.sendBuffer; #endif if (A.geom!=0) { DeleteGeometry(*A.geom); delete A.geom; A.geom = 0;} if (A.Ac!=0) { DeleteMatrix(*A.Ac); delete A.Ac; A.Ac = 0;} // Delete coarse matrix if (A.mgData!=0) { DeleteMGData(*A.mgData); delete A.mgData; A.mgData = 0;} // Delete MG data return; }
UserInterface::~UserInterface() { // All buffers are removed via gl later. just send a warning for now? if (isBuffered) std::cout<<"\nWARNING: UserInterface buffered while deallocating it?"; if (isGeometryCreated) DeleteGeometry(); assert(!isGeometryCreated); if (root != NULL) delete root; root = NULL; userInterfaces.RemoveItemUnsorted(this); }