28 Material *extrapolationMaterial,
double extrapolationMaxX) {
29 Poco::Path suppliedFileName(inputFileName);
30 Poco::Path inputFilePath;
31 std::string fileExt = suppliedFileName.getExtension();
32 std::transform(fileExt.begin(), fileExt.end(), fileExt.begin(), toupper);
34 if (fileExt ==
"DAT") {
35 if (suppliedFileName.isRelative()) {
36 bool useSearchDirectories =
true;
38 if (!searchPath.empty()) {
39 inputFilePath = Poco::Path(Poco::Path(searchPath).parent(), inputFileName);
40 if (Poco::File(inputFilePath).
exists()) {
41 useSearchDirectories =
false;
44 if (useSearchDirectories) {
47 if (!foundFile.empty()) {
48 inputFilePath = Poco::Path(foundFile);
50 inputFilePath = suppliedFileName;
54 inputFilePath = suppliedFileName;
56 std::ifstream input(inputFilePath.toString(), std::ios_base::in);
59 double minX = std::numeric_limits<double>::max();
60 double maxX = std::numeric_limits<double>::lowest();
61 while (std::getline(input, line)) {
63 if (std::stringstream(line) >>
x >> alpha >>
error) {
64 minX = std::min(
x, minX);
65 maxX = std::max(
x, maxX);
74 if ((minX > 0) && (minX < std::numeric_limits<double>::max())) {
77 if ((maxX < extrapolationMaxX) && (maxX > std::numeric_limits<double>::lowest())) {
Kernel::Interpolation m_Interpolator
double getAttenuationCoefficient(const double x) const
Returns the attenuation coefficient for the supplied x value.
void setAttenuationCoefficient(const double x, const double atten)
Set the attenuation coefficient at x value.
Records the filename and the description of failure.
bool containData() const
return false if no data has been added
double value(const double &at) const
get interpolated value at location at
void addPoint(const double &xx, const double &yy)
add data point
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
double attenuationCoefficient(const double lambda) const
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
bool exists(::NeXus::File &file, const std::string &name)
Based on the current group in the file, does the named sub-entry exist?