AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

AllocError.C

Go to the documentation of this file.
00001 
00006 #ifndef AMROC_ALLOC_ERROR_C
00007 #define AMROC_ALLOC_ERROR_C
00008 
00009 #include "DAGH.h"    
00010 #include "string_CompConf.h"
00011 
00012 string AllocError::ClassName;
00013 string AllocError::Position;
00014 
00015 void AllocError::SetTexts(const char* name, const char* pos) { 
00016   ClassName = name; 
00017   Position = pos; 
00018 }
00019 
00020 void AllocError::Init() {
00021   SetTexts("<Undefined>","<Undefined>");
00022   set_new_handler(ReportAllocError);
00023 }
00024 
00025 void AllocError::ReportAllocError() {
00026   char Proc[32];
00027 #ifndef DAGH_NO_MPI
00028   sprintf(Proc,"On Processor %d: ",comm_service::proc_me());
00029 #else
00030   Proc[0] = '\0';
00031 #endif 
00032   string ErrorText = "\n";
00033   ErrorText += Proc;
00034   ErrorText += "Memory exceeded in " + ClassName + 
00035     " at " + Position + ".\nAborting programm...\n";
00036   cerr << ErrorText << flush;
00037   cout << ErrorText << flush;
00038 #ifdef DEBUG_PRINT
00039   ( comm_service::log() << ErrorText ).flush();
00040 #endif
00041   assert(0);
00042 } 
00043 
00044 
00045 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 6/1/04