1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-09 21:50:45 +01:00

Namespace

This commit is contained in:
paboyle 2018-01-14 22:40:29 +00:00
parent 5d3b574325
commit a60f6d353e

View File

@ -27,57 +27,54 @@
See the full license in the file "LICENSE" in the top level distribution See the full license in the file "LICENSE" in the top level distribution
directory directory
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* END LEGAL */
#ifndef SCALAR_ACTION_H #ifndef SCALAR_ACTION_H
#define SCALAR_ACTION_H #define SCALAR_ACTION_H
namespace Grid { NAMESPACE_BEGIN(Grid);
// FIXME drop the QCD namespace everywhere here
template <class Impl> template <class Impl>
class ScalarAction : public QCD::Action<typename Impl::Field> { class ScalarAction : public QCD::Action<typename Impl::Field> {
public: public:
INHERIT_FIELD_TYPES(Impl); INHERIT_FIELD_TYPES(Impl);
private: private:
RealD mass_square; RealD mass_square;
RealD lambda; RealD lambda;
public: public:
ScalarAction(RealD ms, RealD l) : mass_square(ms), lambda(l) {} ScalarAction(RealD ms, RealD l) : mass_square(ms), lambda(l) {}
virtual std::string LogParameters() { virtual std::string LogParameters() {
std::stringstream sstream; std::stringstream sstream;
sstream << GridLogMessage << "[ScalarAction] lambda : " << lambda << std::endl; sstream << GridLogMessage << "[ScalarAction] lambda : " << lambda << std::endl;
sstream << GridLogMessage << "[ScalarAction] mass_square : " << mass_square << std::endl; sstream << GridLogMessage << "[ScalarAction] mass_square : " << mass_square << std::endl;
return sstream.str(); return sstream.str();
} }
virtual std::string action_name() {return "ScalarAction";} virtual std::string action_name() {return "ScalarAction";}
virtual void refresh(const Field &U, GridParallelRNG &pRNG) {} // noop as no pseudoferms virtual void refresh(const Field &U, GridParallelRNG &pRNG) {} // noop as no pseudoferms
virtual RealD S(const Field &p) { virtual RealD S(const Field &p) {
return (mass_square * 0.5 + QCD::Nd) * ScalarObs<Impl>::sumphisquared(p) + return (mass_square * 0.5 + QCD::Nd) * ScalarObs<Impl>::sumphisquared(p) +
(lambda / 24.) * ScalarObs<Impl>::sumphifourth(p) + (lambda / 24.) * ScalarObs<Impl>::sumphifourth(p) +
ScalarObs<Impl>::sumphider(p); ScalarObs<Impl>::sumphider(p);
}; };
virtual void deriv(const Field &p, virtual void deriv(const Field &p,
Field &force) { Field &force) {
Field tmp(p._grid); Field tmp(p._grid);
Field p2(p._grid); Field p2(p._grid);
ScalarObs<Impl>::phisquared(p2, p); ScalarObs<Impl>::phisquared(p2, p);
tmp = -(Cshift(p, 0, -1) + Cshift(p, 0, 1)); tmp = -(Cshift(p, 0, -1) + Cshift(p, 0, 1));
for (int mu = 1; mu < QCD::Nd; mu++) tmp -= Cshift(p, mu, -1) + Cshift(p, mu, 1); for (int mu = 1; mu < QCD::Nd; mu++) tmp -= Cshift(p, mu, -1) + Cshift(p, mu, 1);
force =+(mass_square + 2. * QCD::Nd) * p + (lambda / 6.) * p2 * p + tmp; force =+(mass_square + 2. * QCD::Nd) * p + (lambda / 6.) * p2 * p + tmp;
} }
}; };
NAMESPACE_END(Grid);
} // namespace Grid
#endif // SCALAR_ACTION_H #endif // SCALAR_ACTION_H