diff --git a/extras/Hadrons/Application.cc b/extras/Hadrons/Application.cc index 4c7e71f2..f409d8eb 100644 --- a/extras/Hadrons/Application.cc +++ b/extras/Hadrons/Application.cc @@ -114,12 +114,12 @@ void Application::parseParameterFile(const std::string parameterFileName) setPar(par); if (!push(reader, "modules")) { - HADRON_ERROR(Parsing, "Cannot open node 'modules' in parameter file '" + HADRONS_ERROR(Parsing, "Cannot open node 'modules' in parameter file '" + parameterFileName + "'"); } if (!push(reader, "module")) { - HADRON_ERROR(Parsing, "Cannot open node 'modules/module' in parameter file '" + HADRONS_ERROR(Parsing, "Cannot open node 'modules/module' in parameter file '" + parameterFileName + "'"); } do @@ -177,7 +177,7 @@ void Application::saveSchedule(const std::string filename) if (!scheduled_) { - HADRON_ERROR(Definition, "Computation not scheduled"); + HADRONS_ERROR(Definition, "Computation not scheduled"); } for (auto address: program_) @@ -208,7 +208,7 @@ void Application::printSchedule(void) { if (!scheduled_) { - HADRON_ERROR(Definition, "Computation not scheduled"); + HADRONS_ERROR(Definition, "Computation not scheduled"); } auto peak = vm().memoryNeeded(program_); LOG(Message) << "Schedule (memory needed: " << sizeString(peak) << "):" diff --git a/extras/Hadrons/EigenPack.hpp b/extras/Hadrons/EigenPack.hpp index 5f403595..976fba7b 100644 --- a/extras/Hadrons/EigenPack.hpp +++ b/extras/Hadrons/EigenPack.hpp @@ -123,7 +123,7 @@ protected: binReader.readScidacFieldRecord(evec[k], vecRecord); if (vecRecord.index != k) { - HADRON_ERROR(Io, "Eigenvector " + std::to_string(k) + " has a" + HADRONS_ERROR(Io, "Eigenvector " + std::to_string(k) + " has a" + " wrong index (expected " + std::to_string(vecRecord.index) + ") in file '" + filename + "'"); } diff --git a/extras/Hadrons/Environment.cc b/extras/Hadrons/Environment.cc index 35bb4648..990a717e 100644 --- a/extras/Hadrons/Environment.cc +++ b/extras/Hadrons/Environment.cc @@ -35,7 +35,7 @@ using namespace QCD; using namespace Hadrons; #define ERROR_NO_ADDRESS(address)\ -HADRON_ERROR(Definition, "no object with address " + std::to_string(address)); +HADRONS_ERROR(Definition, "no object with address " + std::to_string(address)); /****************************************************************************** * Environment implementation * @@ -85,7 +85,7 @@ void Environment::createCoarseGrid(const std::vector &blockSize, coarseDim[d] = fineDim[d]/blockSize[d]; if (coarseDim[d]*blockSize[d] != fineDim[d]) { - HADRON_ERROR(Size, "Fine dimension " + std::to_string(d) + HADRONS_ERROR(Size, "Fine dimension " + std::to_string(d) + " (" + std::to_string(fineDim[d]) + ") not divisible by coarse dimension (" + std::to_string(coarseDim[d]) + ")"); @@ -96,7 +96,7 @@ void Environment::createCoarseGrid(const std::vector &blockSize, cLs = Ls/blockSize[nd]; if (cLs*blockSize[nd] != Ls) { - HADRON_ERROR(Size, "Fine Ls (" + std::to_string(Ls) + HADRONS_ERROR(Size, "Fine Ls (" + std::to_string(Ls) + ") not divisible by coarse Ls (" + std::to_string(cLs) + ")"); } @@ -128,7 +128,7 @@ GridCartesian * Environment::getGrid(const unsigned int Ls) const } catch(std::out_of_range &) { - HADRON_ERROR(Definition, "no grid with Ls= " + std::to_string(Ls)); + HADRONS_ERROR(Definition, "no grid with Ls= " + std::to_string(Ls)); } } @@ -147,7 +147,7 @@ GridRedBlackCartesian * Environment::getRbGrid(const unsigned int Ls) const } catch(std::out_of_range &) { - HADRON_ERROR(Definition, "no red-black grid with Ls= " + std::to_string(Ls)); + HADRONS_ERROR(Definition, "no red-black grid with Ls= " + std::to_string(Ls)); } } @@ -171,7 +171,7 @@ GridCartesian * Environment::getCoarseGrid( } catch(std::out_of_range &) { - HADRON_ERROR(Definition, "no coarse grid with Ls= " + std::to_string(Ls)); + HADRONS_ERROR(Definition, "no coarse grid with Ls= " + std::to_string(Ls)); } } @@ -221,7 +221,7 @@ void Environment::addObject(const std::string name, const int moduleAddress) } else { - HADRON_ERROR(Definition, "object '" + name + "' already exists"); + HADRONS_ERROR(Definition, "object '" + name + "' already exists"); } } @@ -244,7 +244,7 @@ unsigned int Environment::getObjectAddress(const std::string name) const } else { - HADRON_ERROR(Definition, "no object with name '" + name + "'"); + HADRONS_ERROR(Definition, "no object with name '" + name + "'"); } } diff --git a/extras/Hadrons/Environment.hpp b/extras/Hadrons/Environment.hpp index f624f36e..a9c3c724 100644 --- a/extras/Hadrons/Environment.hpp +++ b/extras/Hadrons/Environment.hpp @@ -245,7 +245,7 @@ void Environment::createDerivedObject(const std::string name, (object_[address].type != &typeid(B)) or (object_[address].derivedType != &typeid(T))) { - HADRON_ERROR(Definition, "object '" + name + "' already allocated"); + HADRONS_ERROR(Definition, "object '" + name + "' already allocated"); } } @@ -279,7 +279,7 @@ T * Environment::getDerivedObject(const unsigned int address) const } else { - HADRON_ERROR(Definition, "object with address " + std::to_string(address) + + HADRONS_ERROR(Definition, "object with address " + std::to_string(address) + " cannot be casted to '" + typeName(&typeid(T)) + "' (has type '" + typeName(&typeid(h->get())) + "')"); } @@ -287,20 +287,20 @@ T * Environment::getDerivedObject(const unsigned int address) const } else { - HADRON_ERROR(Definition, "object with address " + std::to_string(address) + + HADRONS_ERROR(Definition, "object with address " + std::to_string(address) + " does not have type '" + typeName(&typeid(B)) + "' (has type '" + getObjectType(address) + "')"); } } else { - HADRON_ERROR(Definition, "object with address " + std::to_string(address) + + HADRONS_ERROR(Definition, "object with address " + std::to_string(address) + " is empty"); } } else { - HADRON_ERROR(Definition, "no object with address " + std::to_string(address)); + HADRONS_ERROR(Definition, "no object with address " + std::to_string(address)); } } @@ -338,7 +338,7 @@ bool Environment::isObjectOfType(const unsigned int address) const } else { - HADRON_ERROR(Definition, "no object with address " + std::to_string(address)); + HADRONS_ERROR(Definition, "no object with address " + std::to_string(address)); } } diff --git a/extras/Hadrons/Exceptions.hpp b/extras/Hadrons/Exceptions.hpp index adf2340f..3eb1c25f 100644 --- a/extras/Hadrons/Exceptions.hpp +++ b/extras/Hadrons/Exceptions.hpp @@ -34,10 +34,10 @@ See the full license in the file "LICENSE" in the top level distribution directo #include #endif -#define SRC_LOC std::string(__FUNCTION__) + " at " + std::string(__FILE__) + ":"\ - + std::to_string(__LINE__) -#define HADRON_ERROR(exc, msg)\ -throw(Exceptions::exc(msg, SRC_LOC)); +#define HADRONS_SRC_LOC std::string(__FUNCTION__) + " at " \ + + std::string(__FILE__) + ":" + std::to_string(__LINE__) +#define HADRONS_ERROR(exc, msg)\ +throw(Exceptions::exc(msg, HADRONS_SRC_LOC)); #define DECL_EXC(name, base) \ class name: public base\ diff --git a/extras/Hadrons/Factory.hpp b/extras/Hadrons/Factory.hpp index 705a639e..07516640 100644 --- a/extras/Hadrons/Factory.hpp +++ b/extras/Hadrons/Factory.hpp @@ -94,7 +94,7 @@ std::unique_ptr Factory::create(const std::string type, } catch (std::out_of_range &) { - HADRON_ERROR(Argument, "object of type '" + type + "' unknown"); + HADRONS_ERROR(Argument, "object of type '" + type + "' unknown"); } return func(name); diff --git a/extras/Hadrons/Global.hpp b/extras/Hadrons/Global.hpp index 5e729579..433dcd21 100644 --- a/extras/Hadrons/Global.hpp +++ b/extras/Hadrons/Global.hpp @@ -110,7 +110,7 @@ public: }; #define LOG(channel) std::cout << HadronsLog##channel -#define DEBUG_VAR(var) LOG(Debug) << #var << "= " << (var) << std::endl; +#define HADRONS_DEBUG_VAR(var) LOG(Debug) << #var << "= " << (var) << std::endl; extern HadronsLogger HadronsLogError; extern HadronsLogger HadronsLogWarning; diff --git a/extras/Hadrons/Graph.hpp b/extras/Hadrons/Graph.hpp index 67694aa8..ad84e7e0 100644 --- a/extras/Hadrons/Graph.hpp +++ b/extras/Hadrons/Graph.hpp @@ -184,7 +184,7 @@ void Graph::removeVertex(const T &value) } else { - HADRON_ERROR(Range, "vertex does not exists"); + HADRONS_ERROR(Range, "vertex does not exists"); } // remove all edges containing the vertex @@ -213,7 +213,7 @@ void Graph::removeEdge(const Edge &e) } else { - HADRON_ERROR(Range, "edge does not exists"); + HADRONS_ERROR(Range, "edge does not exists"); } } @@ -259,7 +259,7 @@ void Graph::mark(const T &value, const bool doMark) } else { - HADRON_ERROR(Range, "vertex does not exists"); + HADRONS_ERROR(Range, "vertex does not exists"); } } @@ -297,7 +297,7 @@ bool Graph::isMarked(const T &value) const } else { - HADRON_ERROR(Range, "vertex does not exists"); + HADRONS_ERROR(Range, "vertex does not exists"); return false; } @@ -543,7 +543,7 @@ std::vector Graph::topoSort(void) { if (tmpMarked.at(v)) { - HADRON_ERROR(Range, "cannot topologically sort a cyclic graph"); + HADRONS_ERROR(Range, "cannot topologically sort a cyclic graph"); } if (!isMarked(v)) { @@ -602,7 +602,7 @@ std::vector Graph::topoSort(Gen &gen) { if (tmpMarked.at(v)) { - HADRON_ERROR(Range, "cannot topologically sort a cyclic graph"); + HADRONS_ERROR(Range, "cannot topologically sort a cyclic graph"); } if (!isMarked(v)) { diff --git a/extras/Hadrons/Module.cc b/extras/Hadrons/Module.cc index 54978f93..faf01d5a 100644 --- a/extras/Hadrons/Module.cc +++ b/extras/Hadrons/Module.cc @@ -49,7 +49,7 @@ std::string ModuleBase::getName(void) const // get factory registration name if available std::string ModuleBase::getRegisteredName(void) { - HADRON_ERROR(Definition, "module '" + getName() + "' has no registered type" + HADRONS_ERROR(Definition, "module '" + getName() + "' has no registered type" + " in the factory"); } diff --git a/extras/Hadrons/Module.hpp b/extras/Hadrons/Module.hpp index 656aacef..7f8b7796 100644 --- a/extras/Hadrons/Module.hpp +++ b/extras/Hadrons/Module.hpp @@ -126,7 +126,7 @@ if (env().getGrid()->IsBoss())\ \ if (mkdir(_dirname))\ {\ - HADRON_ERROR(Io, "cannot create directory '" + _dirname + "'");\ + HADRONS_ERROR(Io, "cannot create directory '" + _dirname + "'");\ }\ {\ ResultWriter _writer(RESULT_FILE_NAME(ioStem));\ diff --git a/extras/Hadrons/Modules/MContraction/WardIdentity.hpp b/extras/Hadrons/Modules/MContraction/WardIdentity.hpp index f1ca6c2b..e529d7a2 100644 --- a/extras/Hadrons/Modules/MContraction/WardIdentity.hpp +++ b/extras/Hadrons/Modules/MContraction/WardIdentity.hpp @@ -119,7 +119,7 @@ void TWardIdentity::setup(void) Ls_ = env().getObjectLs(par().q); if (Ls_ != env().getObjectLs(par().action)) { - HADRON_ERROR(Size, "Ls mismatch between quark action and propagator"); + HADRONS_ERROR(Size, "Ls mismatch between quark action and propagator"); } envTmpLat(PropagatorField, "tmp"); envTmpLat(PropagatorField, "vector_WI"); diff --git a/extras/Hadrons/Modules/MFermion/GaugeProp.hpp b/extras/Hadrons/Modules/MFermion/GaugeProp.hpp index 9a359427..ee21cba9 100644 --- a/extras/Hadrons/Modules/MFermion/GaugeProp.hpp +++ b/extras/Hadrons/Modules/MFermion/GaugeProp.hpp @@ -177,7 +177,7 @@ void TGaugeProp::execute(void) { if (Ls_ != env().getObjectLs(par().source)) { - HADRON_ERROR(Size, "Ls mismatch between quark action and source"); + HADRONS_ERROR(Size, "Ls mismatch between quark action and source"); } else { diff --git a/extras/Hadrons/Modules/MScalarSUN/Div.hpp b/extras/Hadrons/Modules/MScalarSUN/Div.hpp index d1f6df26..1b59fbed 100644 --- a/extras/Hadrons/Modules/MScalarSUN/Div.hpp +++ b/extras/Hadrons/Modules/MScalarSUN/Div.hpp @@ -112,7 +112,7 @@ void TDiv::setup(void) { if (par().op.size() != env().getNd()) { - HADRON_ERROR(Size, "the number of components differs from number of dimensions"); + HADRONS_ERROR(Size, "the number of components differs from number of dimensions"); } envCreateLat(ComplexField, getName()); } diff --git a/extras/Hadrons/Modules/MScalarSUN/ShiftProbe.hpp b/extras/Hadrons/Modules/MScalarSUN/ShiftProbe.hpp index 979a340e..c7c0e9ee 100644 --- a/extras/Hadrons/Modules/MScalarSUN/ShiftProbe.hpp +++ b/extras/Hadrons/Modules/MScalarSUN/ShiftProbe.hpp @@ -134,14 +134,14 @@ void TShiftProbe::execute(void) shift = strToVec(par().shifts); if (shift.size() % 2 != 0) { - HADRON_ERROR(Size, "the number of shifts is odd"); + HADRONS_ERROR(Size, "the number of shifts is odd"); } sign = (shift.size() % 4 == 0) ? 1 : -1; for (auto &s: shift) { if (s.first >= env().getNd()) { - HADRON_ERROR(Size, "dimension to large for shift <" + HADRONS_ERROR(Size, "dimension to large for shift <" + std::to_string(s.first) + " " + std::to_string(s.second) + ">" ); } diff --git a/extras/Hadrons/Modules/MScalarSUN/TrPhi.hpp b/extras/Hadrons/Modules/MScalarSUN/TrPhi.hpp index a61c00bc..6c1d733b 100644 --- a/extras/Hadrons/Modules/MScalarSUN/TrPhi.hpp +++ b/extras/Hadrons/Modules/MScalarSUN/TrPhi.hpp @@ -119,7 +119,7 @@ void TTrPhi::setup(void) { if (par().maxPow < 2) { - HADRON_ERROR(Size, "'maxPow' should be at least equal to 2"); + HADRONS_ERROR(Size, "'maxPow' should be at least equal to 2"); } envTmpLat(Field, "phi2"); envTmpLat(Field, "buf"); diff --git a/extras/Hadrons/Modules/MScalarSUN/TwoPoint.hpp b/extras/Hadrons/Modules/MScalarSUN/TwoPoint.hpp index c31b1621..9e53553f 100644 --- a/extras/Hadrons/Modules/MScalarSUN/TwoPoint.hpp +++ b/extras/Hadrons/Modules/MScalarSUN/TwoPoint.hpp @@ -143,7 +143,7 @@ void TTwoPoint::setup(void) mom_[i] = strToVec(par().mom[i]); if (mom_[i].size() != nd - 1) { - HADRON_ERROR(Size, "momentum number of components different from " + HADRONS_ERROR(Size, "momentum number of components different from " + std::to_string(nd-1)); } } diff --git a/extras/Hadrons/Modules/MScalarSUN/Utils.hpp b/extras/Hadrons/Modules/MScalarSUN/Utils.hpp index b9e49715..37a9e137 100644 --- a/extras/Hadrons/Modules/MScalarSUN/Utils.hpp +++ b/extras/Hadrons/Modules/MScalarSUN/Utils.hpp @@ -44,7 +44,7 @@ inline void dmu(Field &out, const Field &in, const unsigned int mu, const DiffTy if (mu >= env.getNd()) { - HADRON_ERROR(Range, "Derivative direction out of range"); + HADRONS_ERROR(Range, "Derivative direction out of range"); } switch(type) { @@ -58,7 +58,7 @@ inline void dmu(Field &out, const Field &in, const unsigned int mu, const DiffTy out = 0.5*(Cshift(in, mu, 1) - Cshift(in, mu, -1)); break; default: - HADRON_ERROR(Argument, "Derivative type invalid"); + HADRONS_ERROR(Argument, "Derivative type invalid"); break; } } @@ -70,7 +70,7 @@ inline void dmuAcc(Field &out, const Field &in, const unsigned int mu, const Dif if (mu >= env.getNd()) { - HADRON_ERROR(Range, "Derivative direction out of range"); + HADRONS_ERROR(Range, "Derivative direction out of range"); } switch(type) { @@ -84,7 +84,7 @@ inline void dmuAcc(Field &out, const Field &in, const unsigned int mu, const Dif out += 0.5*(Cshift(in, mu, 1) - Cshift(in, mu, -1)); break; default: - HADRON_ERROR(Argument, "Derivative type invalid"); + HADRONS_ERROR(Argument, "Derivative type invalid"); break; } } diff --git a/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp b/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp index f559c4eb..206d44d1 100644 --- a/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp +++ b/extras/Hadrons/Modules/MSolver/RBPrecCG.hpp @@ -127,7 +127,7 @@ void TRBPrecCG::setup(void) { if (par().maxIteration == 0) { - HADRON_ERROR(Argument, "zero maximum iteration"); + HADRONS_ERROR(Argument, "zero maximum iteration"); } LOG(Message) << "setting up Schur red-black preconditioned CG for" diff --git a/extras/Hadrons/Modules/MUtilities/TestSeqConserved.hpp b/extras/Hadrons/Modules/MUtilities/TestSeqConserved.hpp index dcd1ba9a..7b1bc1db 100644 --- a/extras/Hadrons/Modules/MUtilities/TestSeqConserved.hpp +++ b/extras/Hadrons/Modules/MUtilities/TestSeqConserved.hpp @@ -123,7 +123,7 @@ void TTestSeqConserved::setup(void) auto Ls = env().getObjectLs(par().q); if (Ls != env().getObjectLs(par().action)) { - HADRON_ERROR(Size, "Ls mismatch between quark action and propagator"); + HADRONS_ERROR(Size, "Ls mismatch between quark action and propagator"); } envTmpLat(PropagatorField, "tmp"); envTmpLat(LatticeComplex, "c"); diff --git a/extras/Hadrons/VirtualMachine.cc b/extras/Hadrons/VirtualMachine.cc index dffabe29..cc197ef8 100644 --- a/extras/Hadrons/VirtualMachine.cc +++ b/extras/Hadrons/VirtualMachine.cc @@ -123,7 +123,7 @@ void VirtualMachine::pushModule(VirtualMachine::ModPt &pt) else { // output already fully registered, error - HADRON_ERROR(Definition, "object '" + out + HADRONS_ERROR(Definition, "object '" + out + "' is already produced by module '" + module_[env().getObjectModule(out)].name + "' (while pushing module '" + name + "')"); @@ -158,7 +158,7 @@ void VirtualMachine::pushModule(VirtualMachine::ModPt &pt) } else { - HADRON_ERROR(Definition, "module '" + name + "' already exists"); + HADRONS_ERROR(Definition, "module '" + name + "' already exists"); } } @@ -185,7 +185,7 @@ ModuleBase * VirtualMachine::getModule(const unsigned int address) const } else { - HADRON_ERROR(Definition, "no module with address " + std::to_string(address)); + HADRONS_ERROR(Definition, "no module with address " + std::to_string(address)); } } @@ -202,7 +202,7 @@ unsigned int VirtualMachine::getModuleAddress(const std::string name) const } else { - HADRON_ERROR(Definition, "no module with name '" + name + "'"); + HADRONS_ERROR(Definition, "no module with name '" + name + "'"); } } @@ -214,7 +214,7 @@ std::string VirtualMachine::getModuleName(const unsigned int address) const } else { - HADRON_ERROR(Definition, "no module with address " + std::to_string(address)); + HADRONS_ERROR(Definition, "no module with address " + std::to_string(address)); } } @@ -226,7 +226,7 @@ std::string VirtualMachine::getModuleType(const unsigned int address) const } else { - HADRON_ERROR(Definition, "no module with address " + std::to_string(address)); + HADRONS_ERROR(Definition, "no module with address " + std::to_string(address)); } } @@ -306,7 +306,7 @@ void VirtualMachine::makeModuleGraph(void) if (min < 0) { - HADRON_ERROR(Definition, "dependency '" + HADRONS_ERROR(Definition, "dependency '" + env().getObjectName(in) + "' (address " + std::to_string(in) + ") is not produced by any module"); diff --git a/extras/Hadrons/VirtualMachine.hpp b/extras/Hadrons/VirtualMachine.hpp index 153f8d70..ccc06d63 100644 --- a/extras/Hadrons/VirtualMachine.hpp +++ b/extras/Hadrons/VirtualMachine.hpp @@ -195,7 +195,7 @@ M * VirtualMachine::getModule(const unsigned int address) const } else { - HADRON_ERROR(Definition, "module '" + module_[address].name + HADRONS_ERROR(Definition, "module '" + module_[address].name + "' does not have type " + typeid(M).name() + "(has type: " + getModuleType(address) + ")"); } diff --git a/lib/qcd/modules/Factory.h b/lib/qcd/modules/Factory.h index 66bd627e..fafa2038 100644 --- a/lib/qcd/modules/Factory.h +++ b/lib/qcd/modules/Factory.h @@ -95,7 +95,7 @@ std::unique_ptr Factory::create(const std::string type, } catch (std::out_of_range &) { - //HADRON_ERROR("object of type '" + type + "' unknown"); + //HADRONS_ERROR("object of type '" + type + "' unknown"); std::cout << GridLogError << "Error" << std::endl; std::cout << GridLogError << obj_type() << " object of name [" << type << "] unknown" << std::endl; exit(1);