Commit 10c4aa19 authored by gsell's avatar gsell
Browse files

Merge branch...

Merge branch '316-reading-fields-in-h5block-format-fails-if-z-dimension-is-less-than-the-number-of-cores-2' into 'master'

Resolve "reading fields in H5Block format fails if z-dimension is less than the number of cores"

Closes #316

See merge request !388
parents 0d2ccc73 0c6c722a
......@@ -101,8 +101,8 @@ void RBend3D::initialise(PartBunchBase<double, 3> *bunch, double &startField, do
fieldmap_m->getInfo(&msg);
goOnline(0.0);
double zBegin = 0.0, zEnd = 0.0, rBegin = 0.0, rEnd = 0.0;
fieldmap_m->getFieldDimensions(zBegin, zEnd, rBegin, rEnd);
double zBegin = 0.0, zEnd = 0.0;
fieldmap_m->getFieldDimensions(zBegin, zEnd);
if (length_m == 0.0) {
chordLength_m = 0.0;
......
......@@ -172,13 +172,12 @@ void RFCavity::initialise(PartBunchBase<double, 3> *bunch, double &startField, d
return;
}
double rBegin = 0.0, rEnd = 0.0;
Inform msg("RFCavity ", *gmsg);
std::stringstream errormsg;
RefPartBunch_m = bunch;
fieldmap_m = Fieldmap::getFieldmap(filename_m, fast_m);
fieldmap_m->getFieldDimensions(startField_m, endField, rBegin, rEnd);
fieldmap_m->getFieldDimensions(startField_m, endField);
if (endField <= startField_m) {
throw GeneralClassicException("RFCavity::initialise",
"The length of the field map '" + filename_m + "' is zero or negativ");
......@@ -722,8 +721,8 @@ bool RFCavity::isInside(const Vector_t &r) const {
double RFCavity::getElementLength() const {
double length = ElementBase::getElementLength();
if (length < 1e-10 && fieldmap_m != NULL) {
double start, end, tmp;
fieldmap_m->getFieldDimensions(start, end, tmp, tmp);
double start, end;
fieldmap_m->getFieldDimensions(start, end);
length = end - start;
}
......@@ -732,6 +731,13 @@ double RFCavity::getElementLength() const {
void RFCavity::getElementDimensions(double &begin,
double &end) const {
double tmp;
fieldmap_m->getFieldDimensions(begin, end, tmp, tmp);
}
\ No newline at end of file
fieldmap_m->getFieldDimensions(begin, end);
}
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c++
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
......@@ -127,8 +127,8 @@ void Solenoid::initialise(PartBunchBase<double, 3> *bunch, double &startField, d
msg << level2 << getName() << " using file ";
myFieldmap_m->getInfo(&msg);
double zBegin = 0.0, zEnd = 0.0, rBegin = 0.0, rEnd = 0.0;
myFieldmap_m->getFieldDimensions(zBegin, zEnd, rBegin, rEnd);
double zBegin = 0.0, zEnd = 0.0;
myFieldmap_m->getFieldDimensions(zBegin, zEnd);
startField_m = zBegin;
length_m = zEnd - zBegin;
......
......@@ -236,7 +236,7 @@ bool Astra1DDynamic::getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t
return false;
}
void Astra1DDynamic::getFieldDimensions(double &zBegin, double &zEnd, double &/*rBegin*/, double &/*rEnd*/) const {
void Astra1DDynamic::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zbegin_m;
zEnd = zend_m;
}
......
......@@ -8,7 +8,7 @@ class Astra1DDynamic: public Fieldmap {
public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
virtual void getFieldDimensions(double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const;
virtual void swap();
virtual void getInfo(Inform *);
......
......@@ -111,7 +111,7 @@ bool Astra1DDynamic_fast::getFieldDerivative(const Vector_t &R, Vector_t &E, Vec
return false;
}
void Astra1DDynamic_fast::getFieldDimensions(double &zBegin, double &zEnd, double &/*rBegin*/, double &/*rEnd*/) const {
void Astra1DDynamic_fast::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zbegin_m;
zEnd = zend_m;
}
......
......@@ -8,7 +8,7 @@ class Astra1DDynamic_fast: public Astra1D_fast {
public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
virtual void getFieldDimensions(double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const;
virtual void swap();
virtual void getInfo(Inform *);
......
......@@ -215,7 +215,7 @@ bool Astra1DElectroStatic::getFieldDerivative(const Vector_t &/*R*/, Vector_t &/
return false;
}
void Astra1DElectroStatic::getFieldDimensions(double &zBegin, double &zEnd, double &/*rBegin*/, double &/*rEnd*/) const {
void Astra1DElectroStatic::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zbegin_m;
zEnd = zend_m;
}
......
......@@ -7,7 +7,7 @@ class Astra1DElectroStatic: public Fieldmap {
public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
virtual void getFieldDimensions(double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const;
virtual void swap();
......
......@@ -94,7 +94,7 @@ bool Astra1DElectroStatic_fast::getFieldDerivative(const Vector_t &/*R*/, Vector
return false;
}
void Astra1DElectroStatic_fast::getFieldDimensions(double &zBegin, double &zEnd, double &/*rBegin*/, double &/*rEnd*/) const {
void Astra1DElectroStatic_fast::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zbegin_m;
zEnd = zend_m;
}
......
......@@ -7,7 +7,7 @@ class Astra1DElectroStatic_fast: public Astra1D_fast {
public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
virtual void getFieldDimensions(double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const;
virtual void swap();
......
......@@ -206,7 +206,7 @@ bool Astra1DMagnetoStatic::getFieldDerivative(const Vector_t &/*R*/, Vector_t &/
return false;
}
void Astra1DMagnetoStatic::getFieldDimensions(double &zBegin, double &zEnd, double &/*rBegin*/, double &/*rEnd*/) const {
void Astra1DMagnetoStatic::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zbegin_m;
zEnd = zend_m;
}
......
......@@ -7,7 +7,7 @@ class Astra1DMagnetoStatic: public Fieldmap {
public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
virtual void getFieldDimensions(double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const;
virtual void swap();
......
......@@ -94,7 +94,7 @@ bool Astra1DMagnetoStatic_fast::getFieldDerivative(const Vector_t &/*R*/, Vector
return false;
}
void Astra1DMagnetoStatic_fast::getFieldDimensions(double &zBegin, double &zEnd, double &/*rBegin*/, double &/*rEnd*/) const {
void Astra1DMagnetoStatic_fast::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zbegin_m;
zEnd = zend_m;
}
......
......@@ -7,7 +7,7 @@ class Astra1DMagnetoStatic_fast: public Astra1D_fast {
public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
virtual void getFieldDimensions(double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const;
virtual void swap();
......
......@@ -8,7 +8,7 @@ class Astra1D_fast: public Fieldmap {
public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const = 0;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const = 0;
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const = 0;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const = 0;
virtual void getFieldDimensions(double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const = 0;
virtual void swap() = 0;
virtual void getInfo(Inform *) = 0;
......
......@@ -11,6 +11,7 @@ set (_SRCS
StaticElectricField.cpp
StaticMagneticField.cpp
Fieldmap.cpp
FM3DH5BlockBase.cpp
FM3DH5Block.cpp
FM3DH5Block_nonscale.cpp
FM3DMagnetoStaticH5Block.cpp
......@@ -81,6 +82,7 @@ set (HDRS
FM2DElectroStatic.h
FM2DMagnetoStatic.h
FM3DDynamic.h
FM3DH5BlockBase.h
FM3DH5Block.h
FM3DH5Block_nonscale.h
FM3DMagnetoStaticH5Block.h
......
......@@ -101,12 +101,9 @@ bool FM1DDynamic::getFieldDerivative(const Vector_t &R,
return false;
}
void FM1DDynamic::getFieldDimensions(double &zBegin, double &zEnd,
double &rBegin, double &rEnd) const {
void FM1DDynamic::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zBegin_m;
zEnd = zEnd_m;
rBegin = rBegin_m;
rEnd = rEnd_m;
}
void FM1DDynamic::getFieldDimensions(double &/*xIni*/, double &/*xFinal*/,
......
......@@ -9,8 +9,7 @@ public:
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E,
Vector_t &B, const DiffDirection &dir) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd,
double &rBegin, double &rEnd) const;
virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
virtual void getFieldDimensions(double &xIni, double &xFinal,
double &yIni, double &yFinal,
double &zIni, double &zFinal) const;
......@@ -63,4 +62,12 @@ inline bool FM1DDynamic::isInside(const Vector_t &r) const
return r(2) >= zBegin_m && r(2) < zEnd_m;
}
#endif
\ No newline at end of file
#endif
// vi: set et ts=4 sw=4 sts=4:
// Local Variables:
// mode:c++
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
......@@ -117,12 +117,9 @@ bool FM1DDynamic_fast::getFieldDerivative(const Vector_t &R,
return false;
}
void FM1DDynamic_fast::getFieldDimensions(double &zBegin, double &zEnd,
double &rBegin, double &rEnd) const {
void FM1DDynamic_fast::getFieldDimensions(double &zBegin, double &zEnd) const {
zBegin = zBegin_m;
zEnd = zEnd_m;
rBegin = rBegin_m;
rEnd = rEnd_m;
}
void FM1DDynamic_fast::getFieldDimensions(double &/*xIni*/, double &/*xFinal*/,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment