43 |
|
#include "applications/staticProps/SpatialStatistics.hpp" |
44 |
|
#include "io/DumpReader.hpp" |
45 |
|
#include "primitives/Molecule.hpp" |
46 |
+ |
#ifdef _MSC_VER |
47 |
+ |
#define isnan(x) _isnan((x)) |
48 |
+ |
#define isinf(x) (!_finite(x) && !_isnan(x)) |
49 |
+ |
#endif |
50 |
|
|
51 |
|
namespace OpenMD { |
52 |
|
|
224 |
|
assert(int(bin) < nBins_); |
225 |
|
int n = dat->accumulator[bin]->count(); |
226 |
|
if (n == 0) return; |
223 |
– |
|
224 |
– |
RealType r; |
225 |
– |
Vector3d v; |
227 |
|
|
228 |
|
if( dat->dataType == odtReal ) { |
229 |
+ |
RealType r; |
230 |
|
dynamic_cast<Accumulator*>(dat->accumulator[bin])->getAverage(r); |
231 |
|
if (isinf(r) || isnan(r) ) { |
232 |
|
sprintf( painCave.errMsg, |
233 |
|
"SpatialStatistics detected a numerical error writing:\n" |
234 |
< |
"\t%s for bin %d", |
234 |
> |
"\t%s for bin %u", |
235 |
|
dat->title.c_str(), bin); |
236 |
|
painCave.isFatal = 1; |
237 |
|
simError(); |
240 |
|
os << "\t" << r; |
241 |
|
|
242 |
|
} else if ( dat->dataType == odtVector3 ) { |
243 |
+ |
Vector3d v; |
244 |
|
dynamic_cast<VectorAccumulator*>(dat->accumulator[bin])->getAverage(v); |
245 |
|
if (isinf(v[0]) || isnan(v[0]) || |
246 |
|
isinf(v[1]) || isnan(v[1]) || |
247 |
|
isinf(v[2]) || isnan(v[2]) ) { |
248 |
|
sprintf( painCave.errMsg, |
249 |
|
"SpatialStatistics detected a numerical error writing:\n" |
250 |
< |
"\t%s for bin %d", |
250 |
> |
"\t%s for bin %u", |
251 |
|
dat->title.c_str(), bin); |
252 |
|
painCave.isFatal = 1; |
253 |
|
simError(); |
263 |
|
int n = dat->accumulator[bin]->count(); |
264 |
|
if (n == 0) return; |
265 |
|
|
263 |
– |
RealType r; |
264 |
– |
Vector3d v; |
265 |
– |
|
266 |
|
if( dat->dataType == odtReal ) { |
267 |
+ |
RealType r; |
268 |
|
dynamic_cast<Accumulator*>(dat->accumulator[bin])->getStdDev(r); |
269 |
|
if (isinf(r) || isnan(r) ) { |
270 |
|
sprintf( painCave.errMsg, |
271 |
|
"SpatialStatistics detected a numerical error writing:\n" |
272 |
< |
"\tstandard deviation of %s for bin %d", |
272 |
> |
"\tstandard deviation of %s for bin %u", |
273 |
|
dat->title.c_str(), bin); |
274 |
|
painCave.isFatal = 1; |
275 |
|
simError(); |
278 |
|
os << "\t" << r; |
279 |
|
|
280 |
|
} else if ( dat->dataType == odtVector3 ) { |
281 |
+ |
Vector3d v; |
282 |
|
dynamic_cast<VectorAccumulator*>(dat->accumulator[bin])->getStdDev(v); |
283 |
|
if (isinf(v[0]) || isnan(v[0]) || |
284 |
|
isinf(v[1]) || isnan(v[1]) || |
285 |
|
isinf(v[2]) || isnan(v[2]) ) { |
286 |
|
sprintf( painCave.errMsg, |
287 |
|
"SpatialStatistics detected a numerical error writing:\n" |
288 |
< |
"\tstandard deviation of %s for bin %d", |
288 |
> |
"\tstandard deviation of %s for bin %u", |
289 |
|
dat->title.c_str(), bin); |
290 |
|
painCave.isFatal = 1; |
291 |
|
simError(); |
351 |
|
|
352 |
|
ShellStatistics::ShellStatistics(SimInfo* info, const string& filename, |
353 |
|
const string& sele, int nbins) : |
354 |
< |
SpatialStatistics(info, filename, sele, nbins){ |
354 |
> |
SpatialStatistics(info, filename, sele, nbins), coordinateOrigin_(V3Zero) { |
355 |
|
|
354 |
– |
coordinateOrigin_ = V3Zero; |
356 |
|
binWidth_ = 1.0; |
357 |
< |
|
357 |
> |
|
358 |
|
r_ = new OutputData; |
359 |
|
r_->units = "Angstroms"; |
360 |
|
r_->title = "R"; |