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

HADRONS_ERROR

This commit is contained in:
Michael Marshall 2019-11-18 10:27:35 +00:00
parent 2d6f4e0c09
commit 7bf42b9c0e
2 changed files with 17 additions and 7 deletions

View File

@ -171,14 +171,20 @@ public:
// Construct this operator given a gauge field and the number of dimensions it should act on // Construct this operator given a gauge field and the number of dimensions it should act on
Laplacian3D( GaugeField& gf, int dimSpatial = Tdir ) : nd{dimSpatial} Laplacian3D( GaugeField& gf, int dimSpatial = Tdir ) : nd{dimSpatial}
{ {
assert(dimSpatial>=1); if (dimSpatial<1)
{
HADRONS_ERROR(Range,"Must be at least one spatial dimension");
}
for (int mu = 0 ; mu < nd ; mu++) for (int mu = 0 ; mu < nd ; mu++)
U.push_back(PeekIndex<LorentzIndex>(gf,mu)); U.push_back(PeekIndex<LorentzIndex>(gf,mu));
} }
// Apply this operator to "in", return result in "out" // Apply this operator to "in", return result in "out"
void operator()(const Field& in, Field& out) { void operator()(const Field& in, Field& out) {
assert( nd <= in.Grid()->Nd() ); if (nd > in.Grid()->Nd())
{
HADRONS_ERROR(Range,"nd too large");
}
conformable( in, out ); conformable( in, out );
out = ( ( Real ) ( 2 * nd ) ) * in; out = ( ( Real ) ( 2 * nd ) ) * in;
Field tmp_(in.Grid()); Field tmp_(in.Grid());
@ -191,11 +197,11 @@ public:
} }
} }
void OpDiag (const Field &in, Field &out) { assert(0); }; void OpDiag (const Field &in, Field &out) { HADRONS_ERROR(Definition, "OpDiag() undefined"); };
void OpDir (const Field &in, Field &out,int dir,int disp) { assert(0); }; void OpDir (const Field &in, Field &out,int dir,int disp) { HADRONS_ERROR(Definition, "OpDir() undefined"); };
void Op (const Field &in, Field &out) { assert(0); }; void Op (const Field &in, Field &out) { HADRONS_ERROR(Definition, "Op() undefined"); };
void AdjOp (const Field &in, Field &out) { assert(0); }; void AdjOp (const Field &in, Field &out) { HADRONS_ERROR(Definition, "AdjOp() undefined"); };
void HermOpAndNorm(const Field &in, Field &out,RealD &n1,RealD &n2) { assert(0); }; void HermOpAndNorm(const Field &in, Field &out,RealD &n1,RealD &n2) { HADRONS_ERROR(Definition, "HermOpAndNorm() undefined"); };
void HermOp(const Field &in, Field &out) { operator()(in,out); }; void HermOp(const Field &in, Field &out) { operator()(in,out); };
}; };

View File

@ -128,9 +128,13 @@ public:
const typename ET::Dimensions & NewDimensions{tensor.dimensions()}; const typename ET::Dimensions & NewDimensions{tensor.dimensions()};
for (int i = 0; i < NumIndices_; i++) for (int i = 0; i < NumIndices_; i++)
if(OldDimensions[i] && OldDimensions[i] != NewDimensions[i]) if(OldDimensions[i] && OldDimensions[i] != NewDimensions[i])
{
HADRONS_ERROR(Size,"NamedTensor::read dimension size"); HADRONS_ERROR(Size,"NamedTensor::read dimension size");
}
if (bValidate && !ValidateIndexNames(OldIndexNames)) if (bValidate && !ValidateIndexNames(OldIndexNames))
{
HADRONS_ERROR(Definition,"NamedTensor::read dimension name"); HADRONS_ERROR(Definition,"NamedTensor::read dimension name");
}
} }
template<typename Reader> void read(Reader &r, bool bValidate = true) { read(r, bValidate, Name_); } template<typename Reader> void read(Reader &r, bool bValidate = true) { read(r, bValidate, Name_); }