|
@@ -121,10 +121,15 @@ namespace Lemma {
|
121
|
121
|
if ( (rRepeat-rp).norm() > 1e-16 ) {
|
122
|
122
|
Dipoles.clear();
|
123
|
123
|
|
|
124
|
+ ///////////////////
|
|
125
|
+ // dipole array, this has impoved performance over directly pushing
|
|
126
|
+ std::vector< std::shared_ptr<DipoleSource> > xDipoles;
|
|
127
|
+
|
124
|
128
|
// loop over all segments
|
125
|
129
|
for (int iseg=0; iseg<NumberOfPoints-1; ++iseg) {
|
126
|
|
- InterpolateLineSegment(Points.col(iseg), Points.col(iseg+1), rp);
|
|
130
|
+ InterpolateLineSegment(Points.col(iseg), Points.col(iseg+1), rp, xDipoles);
|
127
|
131
|
}
|
|
132
|
+ Dipoles = std::move(xDipoles);
|
128
|
133
|
rRepeat = rp;
|
129
|
134
|
|
130
|
135
|
} else {
|
|
@@ -191,8 +196,8 @@ namespace Lemma {
|
191
|
196
|
}
|
192
|
197
|
|
193
|
198
|
void PolygonalWireAntenna::InterpolateLineSegment(const Vector3r &p1,
|
194
|
|
- const Vector3r &p2, const Vector3r & tp) {
|
195
|
|
-
|
|
199
|
+ const Vector3r &p2, const Vector3r & tp,
|
|
200
|
+ std::vector< std::shared_ptr<DipoleSource> > &xDipoles ) {
|
196
|
201
|
|
197
|
202
|
Vector3r phat = (p1-p2).array() / (p1-p2).norm();
|
198
|
203
|
Vector3r c = this->ClosestPointOnLine(p1, p2, tp);
|
|
@@ -203,10 +208,6 @@ namespace Lemma {
|
203
|
208
|
// unit vector
|
204
|
209
|
Vector3r cdir = (p2-p1).array() / (p2-p1).norm();
|
205
|
210
|
|
206
|
|
- ///////////////////
|
207
|
|
- // dipoles for this segment
|
208
|
|
- std::vector< std::shared_ptr<DipoleSource> > xDipoles;
|
209
|
|
-
|
210
|
211
|
// go towards p1
|
211
|
212
|
if ( ((c-p1).array().abs() > minDipoleMoment).any() ) {
|
212
|
213
|
|
|
@@ -319,8 +320,11 @@ namespace Lemma {
|
319
|
320
|
}
|
320
|
321
|
// else case 0: nearly 'perfect' fit do nothing
|
321
|
322
|
}
|
322
|
|
- Dipoles.insert(Dipoles.end(), xDipoles.begin(), xDipoles.end());
|
323
|
|
- }
|
324
|
323
|
|
|
324
|
+ //Dipoles.insert(Dipoles.end(), xDipoles.begin(), xDipoles.end());
|
|
325
|
+ //Dipoles = xDipoles;
|
|
326
|
+ //xDipoles.clear();
|
|
327
|
+
|
|
328
|
+ }
|
325
|
329
|
|
326
|
330
|
}
|