mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Fixing more includes and forward declarations (#3876)
This commit is contained in:
@@ -25,9 +25,14 @@
|
||||
#include <modules/multiresvolume/rendering/errorhistogrammanager.h>
|
||||
|
||||
#include <modules/multiresvolume/rendering/tsp.h>
|
||||
#include <openspace/util/histogram.h>
|
||||
#include <openspace/util/progressbar.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/format.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -44,9 +49,9 @@ bool ErrorHistogramManager::buildHistograms(int numBins) {
|
||||
_maxBin = 1.f; // Should be calculated from tsp file as (maxValue - minValue)
|
||||
|
||||
unsigned int numOtLevels = _tsp->numOTLevels();
|
||||
unsigned int numOtLeaves = static_cast<unsigned int>(pow(8, numOtLevels - 1));
|
||||
unsigned int numOtLeaves = static_cast<unsigned int>(std::pow(8, numOtLevels - 1));
|
||||
unsigned int numBstLeaves = static_cast<unsigned int>(
|
||||
pow(2, _tsp->numBSTLevels() - 1)
|
||||
std::pow(2, _tsp->numBSTLevels() - 1)
|
||||
);
|
||||
|
||||
_numInnerNodes = _tsp->numTotalNodes() - numOtLeaves * numBstLeaves;
|
||||
@@ -58,7 +63,7 @@ bool ErrorHistogramManager::buildHistograms(int numBins) {
|
||||
|
||||
// All TSP Leaves
|
||||
int numOtNodes = _tsp->numOTNodes();
|
||||
int otOffset = static_cast<int>((pow(8, numOtLevels - 1) - 1) / 7);
|
||||
int otOffset = static_cast<int>((std::pow(8, numOtLevels - 1) - 1) / 7);
|
||||
|
||||
int numBstNodes = _tsp->numBSTNodes();
|
||||
int bstOffset = numBstNodes / 2;
|
||||
@@ -123,7 +128,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset,
|
||||
ancestorVoxels = it->second;
|
||||
}
|
||||
|
||||
float voxelScale = static_cast<float>(pow(2.f, octreeLevel));
|
||||
float voxelScale = static_cast<float>(std::pow(2.f, octreeLevel));
|
||||
float invVoxelScale = 1.f / voxelScale;
|
||||
|
||||
// Calculate leaf offset in ancestor sized voxels
|
||||
@@ -162,7 +167,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset,
|
||||
octreeLastOnly &= octreeChild == 7;
|
||||
octreeNode = parentOffset(octreeNode, 8);
|
||||
|
||||
int childSize = static_cast<int>(pow(2, octreeLevel) * brickDim);
|
||||
int childSize = static_cast<int>(std::pow(2, octreeLevel) * brickDim);
|
||||
leafOffset.x += (octreeChild % 2) * childSize;
|
||||
leafOffset.y += ((octreeChild / 2) % 2) * childSize;
|
||||
leafOffset.z += (octreeChild / 4) * childSize;
|
||||
@@ -181,7 +186,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset,
|
||||
}
|
||||
|
||||
bool ErrorHistogramManager::loadFromFile(const std::filesystem::path& filename) {
|
||||
std::ifstream file(filename, std::ios::in | std::ios::binary);
|
||||
std::ifstream file = std::ifstream(filename, std::ios::in | std::ios::binary);
|
||||
if (!file.is_open()) {
|
||||
return false;
|
||||
}
|
||||
@@ -206,13 +211,12 @@ bool ErrorHistogramManager::loadFromFile(const std::filesystem::path& filename)
|
||||
|
||||
delete[] histogramData;
|
||||
// No need to deallocate histogram data, since histograms take ownership.
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ErrorHistogramManager::saveToFile(const std::filesystem::path& filename) {
|
||||
std::ofstream file(filename, std::ios::out | std::ios::binary);
|
||||
std::ofstream file = std::ofstream(filename, std::ios::out | std::ios::binary);
|
||||
if (!file.is_open()) {
|
||||
return false;
|
||||
}
|
||||
@@ -233,7 +237,6 @@ bool ErrorHistogramManager::saveToFile(const std::filesystem::path& filename) {
|
||||
file.write(reinterpret_cast<char*>(histogramData), sizeof(float) * nFloats);
|
||||
delete[] histogramData;
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -302,14 +305,14 @@ int ErrorHistogramManager::parentOffset(int offset, int base) const {
|
||||
return -1;
|
||||
}
|
||||
const int depth = static_cast<int>(
|
||||
floor(log1p(((base - 1) * offset)) / log(base))
|
||||
std::floor(std::log1p(((base - 1) * offset)) / std::log(base))
|
||||
);
|
||||
const int firstInLevel = static_cast<int>((pow(base, depth) - 1) / (base - 1));
|
||||
const int firstInLevel = static_cast<int>((std::pow(base, depth) - 1) / (base - 1));
|
||||
const int inLevelOffset = offset - firstInLevel;
|
||||
|
||||
const int parentDepth = depth - 1;
|
||||
const int firstInParentLevel = static_cast<int>(
|
||||
(pow(base, parentDepth) - 1) / (base - 1)
|
||||
(std::pow(base, parentDepth) - 1) / (base - 1)
|
||||
);
|
||||
const int parentInLevelOffset = inLevelOffset / base;
|
||||
|
||||
@@ -339,14 +342,14 @@ unsigned int ErrorHistogramManager::brickToInnerNodeIndex(unsigned int brickInde
|
||||
const unsigned int numBstLevels = _tsp->numBSTLevels();
|
||||
|
||||
const unsigned int numInnerBstNodes = static_cast<int>(
|
||||
(pow(2, numBstLevels - 1) - 1) * numOtNodes
|
||||
(std::pow(2, numBstLevels - 1) - 1) * numOtNodes
|
||||
);
|
||||
if (brickIndex < numInnerBstNodes) {
|
||||
return brickIndex;
|
||||
}
|
||||
|
||||
const unsigned int numOtLeaves = static_cast<unsigned int>(
|
||||
pow(8, _tsp->numOTLevels() - 1)
|
||||
std::pow(8, _tsp->numOTLevels() - 1)
|
||||
);
|
||||
const unsigned int numOtInnerNodes = (numOtNodes - numOtLeaves);
|
||||
|
||||
@@ -375,14 +378,14 @@ unsigned int ErrorHistogramManager::innerNodeToBrickIndex(
|
||||
const unsigned int numBstLevels = _tsp->numBSTLevels();
|
||||
|
||||
const unsigned int numInnerBstNodes = static_cast<unsigned int>(
|
||||
(pow(2, numBstLevels - 1) - 1) * numOtNodes
|
||||
(std::pow(2, numBstLevels - 1) - 1) * numOtNodes
|
||||
);
|
||||
if (innerNodeIndex < numInnerBstNodes) {
|
||||
return innerNodeIndex;
|
||||
}
|
||||
|
||||
const unsigned int numOtLeaves = static_cast<unsigned int>(
|
||||
pow(8, _tsp->numOTLevels() - 1)
|
||||
std::pow(8, _tsp->numOTLevels() - 1)
|
||||
);
|
||||
const unsigned int numOtInnerNodes = (numOtNodes - numOtLeaves);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user