From e7050a7aede342c854cd4076c7d8f8e455e81271 Mon Sep 17 00:00:00 2001 From: Michael Marshall <43034299+mmphys@users.noreply.github.com> Date: Fri, 19 Jul 2019 11:58:56 +0100 Subject: [PATCH] Support gamma structure names that have trailing white space --- Hadrons/Modules/MContraction/Baryon.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Hadrons/Modules/MContraction/Baryon.hpp b/Hadrons/Modules/MContraction/Baryon.hpp index c717f4a5..52508864 100644 --- a/Hadrons/Modules/MContraction/Baryon.hpp +++ b/Hadrons/Modules/MContraction/Baryon.hpp @@ -120,9 +120,20 @@ void TBaryon::setup(void) // Translate the full string naming the desired gamma structure into the one we need to use const std::string gamma{ par().gamma }; int iGamma = 0; - std::cout << "Gamma input " << gamma << std::endl; - while( gamma.compare( Gamma::name[iGamma] ) ) - assert( ++iGamma < Gamma::nGamma && "Invalid gamma structure specified" ); + do + { + const char * pGammaName = Gamma::name[iGamma]; + int iLen = 0; + while( pGammaName[iLen] && pGammaName[iLen] != ' ' ) + iLen++; + if( !gamma.compare( 0, gamma.size(), pGammaName, iLen ) ) + break; + } + while( ++iGamma < Gamma::nGamma ); + if( iGamma >= Gamma::nGamma ) { + LOG(Message) << "Unrecognised gamma structure \"" << gamma << "\"" << std::endl; + assert( 0 && "Invalid gamma structure specified" ); + } switch( iGamma ) { case Gamma::Algebra::GammaX: std::cout << "using interpolator C gamma_X" << std::endl;