Use mmap instead of read - it's a lot faster here.
Also clean up construction of STRONG_TYPEDEF so that it can be
packed properly in structs (this explains all the () -> {}) changes
here.
This commit is contained in:
@@ -84,10 +84,10 @@ int SourceContainer::LoadRasterSource(const std::string &path_string,
|
||||
std::size_t nrows,
|
||||
std::size_t ncols)
|
||||
{
|
||||
const auto _xmin = static_cast<int>(util::toFixed(util::FloatLongitude(xmin)));
|
||||
const auto _xmax = static_cast<int>(util::toFixed(util::FloatLongitude(xmax)));
|
||||
const auto _ymin = static_cast<int>(util::toFixed(util::FloatLatitude(ymin)));
|
||||
const auto _ymax = static_cast<int>(util::toFixed(util::FloatLatitude(ymax)));
|
||||
const auto _xmin = static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{xmin}));
|
||||
const auto _xmax = static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{xmax}));
|
||||
const auto _ymin = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymin}));
|
||||
const auto _ymax = static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{ymax}));
|
||||
|
||||
const auto itr = LoadedSourcePaths.find(path_string);
|
||||
if (itr != LoadedSourcePaths.end())
|
||||
@@ -135,8 +135,8 @@ RasterDatum SourceContainer::GetRasterDataFromSource(unsigned int source_id, dou
|
||||
BOOST_ASSERT(lon > -180);
|
||||
|
||||
const auto &found = LoadedSources[source_id];
|
||||
return found.GetRasterData(static_cast<int>(util::toFixed(util::FloatLongitude(lon))),
|
||||
static_cast<int>(util::toFixed(util::FloatLatitude(lat))));
|
||||
return found.GetRasterData(static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})),
|
||||
static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat})));
|
||||
}
|
||||
|
||||
// External function for looking up interpolated data from a specified source
|
||||
@@ -154,8 +154,8 @@ SourceContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l
|
||||
BOOST_ASSERT(lon > -180);
|
||||
|
||||
const auto &found = LoadedSources[source_id];
|
||||
return found.GetRasterInterpolate(static_cast<int>(util::toFixed(util::FloatLongitude(lon))),
|
||||
static_cast<int>(util::toFixed(util::FloatLatitude(lat))));
|
||||
return found.GetRasterInterpolate(static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})),
|
||||
static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat})));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user