QCErrorManager.cpp

Go to the documentation of this file.
00001 //*****************************************************************************//
00002 //                                                                             //
00003 //   Copyright (c) 2001                                                        //
00004 //      INRIA                                                                  //
00005 //      54600 VILLERS LES NANCY                                                //
00006 //      France                                                                 //
00007 //                                                                             //
00008 //*****************************************************************************//
00009 //                                                                             //
00010 //               *** NOTICE OF PROPRIETARY INFORMATION ***                     //
00011 //                                                                             //
00012 // The information contained in this file is considered proprietary and the    //
00013 // exclusive property of  INRIA. This information may not be disclosed,        //
00014 // duplicated or used, in whole or in part, for  any purpose  whatsoever       //
00015 // without express written authorization from INRIA                            //
00016 //                                                                             //
00017 //*****************************************************************************//
00018 
00019 
00020 #include "QCCommon.hpp"
00021 #include "QCErrorManager.hpp"
00022 
00023 
00024 
00028 const char*      QCErrorManager::ERROR = "Error: ";
00029 
00033 const char*      QCErrorManager::WARNING = "Warning: ";
00034 
00038 const char*      QCErrorManager::NONE = "";
00039 
00043 const char*      QCErrorManager::BAD_PARAM = 
00044 "The parameter type '%s' is incompatible with the model '%s'.\n";
00045 
00046 const char*      QCErrorManager::NO_FILE = 
00047 "The file %s doesn't exist. Create it.\n";
00048 
00049 const char*      QCErrorManager::NO_INFO_READ = 
00050 "The reader doesn't read the requested informations "
00051 "on the line after '%s' in the file %s.\n";
00052 
00053 const char*      QCErrorManager::NO_INFO_READ2 = 
00054 "The reader doesn't read the requested information after "
00055 "the char* of characters '%s' in the file %s.\n";
00056 
00057 const char*      QCErrorManager::NO_MARK_CSTR = 
00058 "The Reader can't find the mark string of characters '%s' in the "
00059 "file %s. Create it or put it at the right place.\n";
00060 
00061 const char*      QCErrorManager::NO_DIGIT = 
00062 "The Reader can't find any digit in the string the line after '%s'"
00063 " in the parameters file.\n";
00064 
00065 const char*      QCErrorManager::NO_LINE_OF_FORMAT = 
00066 "The Reader can't find a line of format '%s' in the file %s.\n";
00067 
00068 const char*      QCErrorManager::PB_ON_PARAM_TYPE_NUMBER = 
00069 "Problem on the parameter type number %d.\n";
00070 
00071 const char*      QCErrorManager::NO_COORD_LINE = 
00072 "The Reader doesn't find the line with the following keywords :"
00073 " ATOM, 'X COORD', 'Y COORD', 'Z COORD', NUMBER, GROUP in the"
00074 " specified order in the file %s.\n";
00075 
00076 const char*      QCErrorManager::NOT_ENOUGH_VALUE = 
00077 "The Reader can't find enougth values on the coord line in the"
00078 " file %s.\n";
00079 
00080 const char*      QCErrorManager::PB_AT_COORD_NUMBER = 
00081 "Problem while reading the atomic coordinates number %d.\n";
00082 
00083 const char*      QCErrorManager::NUMBER_ALREADY_USED = 
00084 "%d is already used as an atom number in the file %s.\n";
00085 
00086 const char*      QCErrorManager::UNDEFINED_ATOM_TYPE = 
00087 "The atom type `%s' mentioned for the atom number `%d' in the"
00088 " file `%s' is undefined.\n";
00089 
00090 const char*      QCErrorManager::UNKNOWN_KEYWORD = 
00091 "The %s `%s' is unknown.";
00092 
00093 const char*      QCErrorManager::CALC_NOT_AVAILABLE = 
00094 "The calculation type %s is not available for the model %s using "
00095 "%s as parameters.\n";
00096 
00097 const char*      QCErrorManager::DIAGO_FAILS = 
00098 "The diagonalisation calculation fails at the iteration number %d."
00099 " Its error code is %d.\n";
00100 
00101 const char*      QCErrorManager::BAD_ALLOC = 
00102 "The system can't allocate the amount of memory that you request.\n";
00103 
00104 const char*      QCErrorManager::LBFGS_INPUT = 
00105 "The Lbfgs algorithm detects an error in its input arguments :"
00106 " the output variable 'task' holds %s. Please, check your data.\n";
00107 
00108 const char*      QCErrorManager::LBFGS_ABNO = 
00109 "The Lbfgs algorithm has terminated abnormally :"
00110 " the output variable 'task' holds %s.\n";
00111 
00112 const char*      QCErrorManager::LBFGS_WARN = 
00113 "The geometry optimisation algorithm is not able to satisfy the"
00114 " convergence conditions: the output variable 'task' holds %s.\n";
00115 
00116 const char*      QCErrorManager::TOO_MANY_ORBITALS = 
00117 "The number of atomic orbitals is %d and exceeds the maximum"
00118 " allowed number : %d.\n";
00119 
00120 const char*      QCErrorManager::TMP_MEMORY = 
00121 "Incorrect use of the temporary memory manager.\n";
00122 
00123 const char*      QCErrorManager::UNOPTIMAL_TMP_MEM = 
00124 "Unoptimal use of the temporary memory manager. Write other calls to"
00125 " the CQCMemory::updateBlockTmpMem method in the source code.\n";
00126 
00127 const char*      QCErrorManager::OPEN_FILE_FAILS = 
00128 "File opening for the repulsion integrals storage fails.\n";
00129 
00130 const char*      QCErrorManager::BAD_ELEC_ENERGY = 
00131 "The electronic energy calculation fails. The result is no longer"
00132 " a finite value.\n";
00133 
00134 const char*      QCErrorManager::PARTITIONER_FAILS = 
00135 "The partitioner fails to divide the overall atomic system in %d"
00136 " sub-domains.\n";
00137 
00138 const char*      QCErrorManager::READ_PARTITION_FILE_FAILS = 
00139 "QC++ fails to read the partition file because the number of sub-domains"
00140 " %d is different from the number written in the generalities file.\n";
00141 
00142 const char*      QCErrorManager::RENUMEROTATION_FAILS = 
00143 "The renumerotation fails because there are at least two minimal"
00144 " identical eigenvalues in absolute value : %d.\n";
00145 
00146 const char*      QCErrorManager::TOO_MANY_ATOMS = 
00147 "The number of atoms is %d and exceeds the maximum allowed number: %d.\n";
00148 
00149 const char*      QCErrorManager::EMPTY_OR_FULL_SUBDOMAIN = 
00150 "There is either a sub-domain empty of electrons, or a sub-domain"
00151 " full of electrons. That threatens to compromises the stability "
00152 "of calculations.\n";
00153 
00154 const char*      QCErrorManager::TOO_MANY_SUBDOMAINS = 
00155 "The partitioner fails to divide the overall atomic system in %d "
00156 "sub-domains because the number of subdomains is higher than the "
00157 "number of atoms : %d.\n";
00158 
00159 const char*      QCErrorManager::TOO_MANY_SUBDOMAINS_TWO = 
00160 "The partitioner fails to divide the overall atomic system in %d "
00161 "sub-domains because the number of subdomains is too important and"
00162 " the diameter of overlap regions is too small.\n";
00163 
00164 const char*      QCErrorManager::PURIFICATION_FAILS = 
00165 "The purification process which tends to return the matrix idempotent, "
00166 "has reached its maximum number of %d iterations. It lets the "
00167 "purification value to %f.\n";
00168 
00169 const char*      QCErrorManager::SAME_POSITION = 
00170 "The atoms number %d and number %d are at the same position.\n";
00171 
00172 
00173 
00177 bool
00178 QCErrorManager::writeMsg (const string& kindOfMsg, char* fmtOfArgs, ...) const 
00179 {
00180   FILE* streamErr = NULL;
00182   va_list       listOfArgs;
00183   bool          retVal = false;
00184   
00191   if ( (streamErr = fopen(QCCommon::ErrorFile.c_str(), "a") ) ) {
00192     
00193     // On affiche dans le fichier d erreur.
00194     fprintf(streamErr, "%s", kindOfMsg.c_str() );
00195     
00196     // On colle la liste des args dans une variable.  
00197     va_start(listOfArgs, fmtOfArgs);
00198     vfprintf(streamErr, fmtOfArgs, listOfArgs);
00199     
00200     // On clot l'examen de la liste des arguments.
00201     va_end(listOfArgs);
00202     retVal = true; 
00203     fclose(streamErr);
00204   } else {
00205     
00212     // On affiche dans le fichier d erreur.
00213     printf("%s", kindOfMsg.c_str() );
00214     
00215     //On colle la liste des args dans une variable.  
00216     va_start(listOfArgs, fmtOfArgs);
00217     vprintf(fmtOfArgs, listOfArgs);
00218     
00219     //On clot l examen de la liste des arguments.
00220     va_end(listOfArgs);
00221     retVal = true;
00222   }
00223   
00224   return retVal;
00225 }
00226 

Generated on Sat Jan 28 21:07:26 2006 for QC++ by  doxygen 1.4.4