7#include <boost/regex.hpp>
11 std::string indent(indentwidth,
' ');
12 std::string indent2(indentwidth + 8,
' ');
15 std::cout << indent <<
"ellipse, \n"
16 << indent2 <<
"w: " <<
width_m <<
", \n"
17 << indent2 <<
"h: " <<
height_m <<
", \n"
18 << indent2 <<
"origin: " << origin[0] <<
", " << origin[1] <<
",\n"
19 << indent2 <<
"angle: " << angle <<
"\n"
20 << indent2 << std::setw(14) <<
trafo_m(0, 0) << std::setw(14) <<
trafo_m(0, 1) << std::setw(14) <<
trafo_m(0, 2) <<
"\n"
21 << indent2 << std::setw(14) <<
trafo_m(1, 0) << std::setw(14) <<
trafo_m(1, 1) << std::setw(14) <<
trafo_m(1, 2) <<
"\n"
22 << indent2 << std::setw(14) <<
trafo_m(2, 0) << std::setw(14) <<
trafo_m(2, 1) << std::setw(14) <<
trafo_m(2, 2)
27 const unsigned int N = 101;
29 const unsigned int colwidth = out.precision() + 8;
32 for (
unsigned int i = 0; i < N; ++ i, phi += dp) {
36 std::pow(
width_m * 0.5 * tan(phi), 2))),
38 pt[1] = pt[0] * tan(phi);
41 out << std::setw(colwidth) << pt[0]
42 << std::setw(colwidth) << pt[1]
48 item->writeGnuplot(out);
55 bfuncs.emplace_back(this->
clone());
59 std::shared_ptr<Ellipse> elps(
new Ellipse);
66 elps->divisor_m.emplace_back(item->clone());
69 return std::static_pointer_cast<Base>(elps);
78 const double &M11 = e_xp[0];
79 const double &M12 = e_yp[0];
80 const double &M21 = e_xp[1];
81 const double &M22 = e_yp[1];
84 double halfwidth = 0.5 * (M11 *
width_m * cos(t) +
86 llc[0] = center[0] - std::abs(halfwidth);
87 urc[0] = center[0] + std::abs(halfwidth);
91 double halfheight = 0.5 * (M21 *
width_m * cos(t) +
94 llc[1] = center[1] - std::abs(halfheight);
95 urc[1] = center[1] + std::abs(halfheight);
100 item->computeBoundingBox();
105 if (!
bb_m.isInside(R))
return false;
108 if (4 * (std::pow(X[0] /
width_m, 2) + std::pow(X[1] /
height_m, 2)) <= 1) {
111 if (item->isInside(R))
return false;
123 double width, height;
127 }
catch (std::runtime_error &e) {
128 std::cout << e.what() << std::endl;
137 std::cout <<
"Ellipse: a negative width provided '"
138 << arguments.
get(0) <<
" = " << elps->
width_m <<
"'"
143 std::cout <<
"Ellipse: a negative height provided '"
144 << arguments.
get(1) <<
" = " << elps->
height_m <<
"'"
ippl::Vector< T, Dim > Vector_t
PartBunch< T, Dim >::ConstIterator end(PartBunch< T, Dim > const &bunch)
constexpr double two_pi
The value of.
double parseMathExpression(const std::string &str)
std::string::iterator iterator
std::vector< std::shared_ptr< Base > > divisor_m
AffineTransformation trafo_m
std::string get(unsigned int i) const
unsigned int getLengthConsumed() const
virtual void computeBoundingBox()
virtual void print(int indentwidth)
virtual bool isInside(const Vector_t< double, 3 > &R) const
virtual std::shared_ptr< Base > clone() const
virtual void writeGnuplot(std::ofstream &out) const
virtual void apply(std::vector< std::shared_ptr< Base > > &bfuncs)
static bool parse_detail(iterator &it, const iterator &end, Function *fun)