Skip to content

Commit 2de3ccd

Browse files
author
Martin D. Weinberg
committed
Fix time varying centering; evaluate() should use (0, 0, 0) as origin
1 parent 86337c3 commit 2de3ccd

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

expui/BasisFactory.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ namespace BasisClasses
215215
//! Evaluate fields at a point, and provide field lables
216216
virtual std::tuple<std::vector<double>, std::vector<std::string>>
217217
evaluate(double x, double y, double z)
218-
{ return {getFields(x, y, z), getFieldLabels(coordinates)}; }
218+
{ return {getFields(x, y, z, true), getFieldLabels(coordinates)}; }
219219

220220
//! Retrieve the coefficients
221221
virtual CoefClasses::CoefStrPtr getCoefficients()

expui/BasisFactory.cc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,21 @@ namespace BasisClasses
254254
auto fields = getFieldLabels(coordinates);
255255
for (auto s : fields) ret[s].resize(times.size());
256256

257-
// Apply centering
258-
if (not origin) {
259-
x -= coefctr(0);
260-
y -= coefctr(1);
261-
z -= coefctr(2);
262-
}
263-
264257
// Make the return dictionary of arrays
265258
for (int i=0; i<times.size(); i++) {
266259
// Load the coefficients for the current time
267260
set_coefs(coefs->getCoefStruct(times[i]));
268261

262+
double xc = x, yc = y, zc = z;
263+
// Apply centering
264+
if (not origin) {
265+
xc -= coefctr(0);
266+
yc -= coefctr(1);
267+
zc -= coefctr(2);
268+
}
269+
269270
// The field evaluation
270-
auto v = crt_eval(x, y, z);
271+
auto v = crt_eval(xc, yc, zc);
271272

272273
// Pack the fields into the dictionary
273274
for (int j=0; j<fields.size(); j++) ret[fields[j]][i] = v[j];

0 commit comments

Comments
 (0)