mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 11:29:55 -05:00
debris performanslogging, fixed spherical coords and asset clean-up
This commit is contained in:
+1
-1
Submodule apps/OpenSpace/ext/sgct updated: 8d672fd0a7...2c774af032
+38
@@ -0,0 +1,38 @@
|
||||
-- This asset requires OpenSpace to be built with the OPENSPACE_MODULE_VOLUME enabled
|
||||
|
||||
-- Before using this asset,
|
||||
-- the volume data itself needs to be generated,
|
||||
-- using the task 'data/tasks/volume/debristasks/generate_debris_volume.task'
|
||||
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
|
||||
|
||||
local maxApogee = 2 * 10946320;
|
||||
|
||||
local volume = {
|
||||
Identifier = "DebrisVolume - Cartesian",
|
||||
Parent = transforms.EarthInertial.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTimeVaryingVolume",
|
||||
SourceDirectory = asset.localResource("generatedCartesian"),
|
||||
TransferFunction = asset.localResource("transferfunction.txt"),
|
||||
StepSize = 0.01,
|
||||
MinValue = 0,
|
||||
MaxValue = 1,
|
||||
GridType = "Cartesian",
|
||||
SecondsBefore = 50*365*24*60*60,
|
||||
SecondsAfter = 50*365*24*60*60
|
||||
},
|
||||
GUI = {
|
||||
Path = "/Volumes"
|
||||
},
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
Scale = maxApogee -- do not multiply this. That will not show real representation.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local objects = { volume }
|
||||
assetHelper.registerSceneGraphNodes(asset, objects)
|
||||
+1
-1
@@ -19,7 +19,7 @@ local volume = {
|
||||
StepSize = 0.01,
|
||||
MinValue = 0,
|
||||
MaxValue = 1,
|
||||
GridType = "Cartesian",
|
||||
GridType = "Spherical",
|
||||
SecondsBefore = 50*365*24*60*60,
|
||||
SecondsAfter = 50*365*24*60*60
|
||||
},
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
return {Dimensions={2.800000E1,2.800000E1,2.800000E1},GridType="Spherical",LowerDomainBound={0,0,0},MaxValue=9.730000E2,MinValue=0,Time="2018-05-04T00:00:00.000",UpperDomainBound={1.000000E0,3.141593E0,6.283185E0}}
|
||||
BIN
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
--asset.request('./debris/debris_asat')
|
||||
asset.request('./debris/debris_asat')
|
||||
asset.request('./debris/debris_breezem')
|
||||
--asset.request('./debris/debris_fengyun')
|
||||
--asset.request('./debris/debris_iridium33')
|
||||
--asset.request('./debris/debris_kosmos2251')
|
||||
asset.request('./debris/debris_fengyun')
|
||||
asset.request('./debris/debris_iridium33')
|
||||
asset.request('./debris/debris_kosmos2251')
|
||||
|
||||
asset.request('./satellites_debris_old')
|
||||
--asset.request('./satellites_debris_old')
|
||||
@@ -3,7 +3,7 @@ return {{
|
||||
Dimensions = {32, 32, 32},
|
||||
LowerDomainBound = {-0.5, -0.5, -0.5},
|
||||
UpperDomainBound = {0.5, 0.5, 0.5},
|
||||
InputPath = "D:/OpenSpace/sync/url/satellite_tle_data_DebrisAll/files/allDebrisInOneTLE.txt",
|
||||
InputPath = "${SYNC}/url/satellite_tle_data_DebrisAll/files/allDebrisInOneTLE.txt",
|
||||
StartTime = "2018-05-04T00:00:00",
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAll/singleDebris.rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAll/singleDebris.dictionary"
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
return {{
|
||||
Type = "GenerateDebrisVolumeTask",
|
||||
Dimensions = {32, 32, 32},
|
||||
LowerDomainBound = {-0.5, -0.5, -0.5},
|
||||
UpperDomainBound = {0.5, 0.5, 0.5},
|
||||
InputPath = "D:/OpenSpace/sync/url/satellite_tle_data_BreezeMBreakup(18391204735368316775)/files/2012-044.txt",
|
||||
InputPath1 = "D:/OpenSpace/sync/url/satellite_tle_data_FengyunDebris(17139759358359376863)/files/1999-025.txt",
|
||||
InputPath2 = "D:/OpenSpace/sync/url/satellite_tle_data_IndianASATtestDebris(10018654073589624780)/files/2019-006.txt",
|
||||
InputPath3 = "D:/OpenSpace/sync/url/satellite_tle_data_Iridium33Debris(10708435089634408069)/files/iridium-33-debris.txt",
|
||||
InputPath4 = "D:/OpenSpace/sync/url/satellite_tle_data_Kosmos2251Debris(14362705017065532804)/files/cosmos-2251-debris.txt",
|
||||
|
||||
StartTime = "2018-05-04T00:00:00",
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAllInOne/debris.rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAllInOne/debris.dictionary"
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
return {{
|
||||
Type = "GenerateDebrisVolumeTask",
|
||||
Dimensions = {32, 32, 32},
|
||||
LowerDomainBound = {-0.5, -0.5, -0.5},
|
||||
UpperDomainBound = {0.5, 0.5, 0.5},
|
||||
InputPath = "${SYNC}/url/satellite_tle_data_DebrisAll/files/allDebrisInOneTLE.txt",
|
||||
StartTime = "2018-05-04T00:00:00",
|
||||
TimeStep = "25",
|
||||
EndTime = "2018-05-04T00:01:00",
|
||||
GridType = "Cartesian",
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedCartesian/singleDebris.rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedCartesian/singleDebris.dictionary"
|
||||
}}
|
||||
@@ -1,15 +1,15 @@
|
||||
return {{
|
||||
Type = "GenerateDebrisVolumeTask",
|
||||
Dimensions = {28, 28, 28},
|
||||
Dimensions = {64, 64, 64},
|
||||
LowerDomainBound = {0, 0, 0},
|
||||
UpperDomainBound = {1, math.pi, 2 * math.pi},
|
||||
InputPath = "${SYNC}/url/satellite_tle_data_DebrisAll/files/allDebrisInOneTLE.txt",
|
||||
StartTime = "2018-05-04T00:00:00",
|
||||
TimeStep = "1",
|
||||
EndTime = "2018-05-04T00:00:00",
|
||||
TimeStep = "25",
|
||||
EndTime = "2018-05-04T00:01:00",
|
||||
GridType = "Spherical",
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.dictionary"
|
||||
}}
|
||||
|
||||
-- C:\Users\Jonathan\Documents\exjobb\OpenSpace\sync\url\satellite_tle_data_BreezeMBreakup(18391204735368316775)\files
|
||||
-- C:\Users\Jonathan\Documents\exjobb\OpenSpace\sync\url\satellite_tle_data_BreezeMBreakup(18391204735368316775)\files
|
||||
|
||||
+1
-1
Submodule ext/ghoul updated: 9045871f1e...5600165bb3
@@ -53,6 +53,7 @@ public:
|
||||
const std::vector<SceneGraphNode*>& sceneNodes);
|
||||
|
||||
void outputLogs();
|
||||
void debrisLog();
|
||||
|
||||
void writeData(std::ofstream& out, const std::vector<float>& data);
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ void SpaceModule::internalInitialize(const ghoul::Dictionary&) {
|
||||
fTranslation->registerClass<HorizonsTranslation>("HorizonsTranslation");
|
||||
|
||||
auto fTasks = FactoryManager::ref().factory<Task>();
|
||||
ghoul_assert(fTask, "No task factory existed");
|
||||
ghoul_assert(fTasks, "No task factory existed");
|
||||
fTasks->registerClass<volume::GenerateDebrisVolumeTask>("GenerateDebrisVolumeTask");
|
||||
|
||||
auto fRotation = FactoryManager::ref().factory<Rotation>();
|
||||
|
||||
@@ -379,9 +379,13 @@ std::vector<KeplerParameters> readTLEFile(const std::string& filename){
|
||||
|
||||
glm::dvec3 cartesianToSphericalCoord(glm::dvec3 position){
|
||||
glm::dvec3 sphericalPosition;
|
||||
//sphericalPosition.x = pow(pow(position.x,2)+pow(position.y,2)+pow(position.z,2) , 0.5); //abs(position.x + position.y + position.z); // r
|
||||
//sphericalPosition.y = atan(position.y/position.x); // theta
|
||||
//sphericalPosition.z = atan(pow(pow(position.x,2)+pow(position.y,2),0.5)/position.z); // abs(position.x + position.y) // p
|
||||
|
||||
sphericalPosition.x = pow(pow(position.x,2)+pow(position.y,2)+pow(position.z,2) , 0.5); //abs(position.x + position.y + position.z); // r
|
||||
sphericalPosition.y = atan(position.y/position.x); // theta
|
||||
sphericalPosition.z = atan(pow(pow(position.x,2)+pow(position.y,2),0.5)/position.z); // abs(position.x + position.y) // p
|
||||
sphericalPosition.y = acos(position.z/sphericalPosition.x); // theta
|
||||
sphericalPosition.z = atan(position.y/position.x); // abs(position.x + position.y) // p
|
||||
return sphericalPosition;
|
||||
}
|
||||
|
||||
@@ -405,6 +409,8 @@ std::vector<glm::dvec3> getPositionBuffer(std::vector<KeplerParameters> tleData,
|
||||
glm::dvec3 position = keplerTranslator.debrisPos(timeInSeconds);
|
||||
if( gridType == "Spherical"){
|
||||
position = cartesianToSphericalCoord(position);
|
||||
//LINFO(fmt::format("pos: {} ", position));
|
||||
|
||||
}
|
||||
positionBuffer.push_back(position);
|
||||
|
||||
@@ -451,7 +457,7 @@ int getIndexFromPosition(glm::dvec3 position, glm::uvec3 dim, float maxApogee, s
|
||||
// epsilon is to make sure that for example if newPosition.x/maxApogee = 1,
|
||||
// then the index for that dimension will not exceed the range of the grid.
|
||||
float epsilon = static_cast<float>(0.000000001);
|
||||
if(gridType == "Cartesian" || gridType == "Spherical"){
|
||||
if(gridType == "Cartesian"){ //|| gridType == "Spherical"){
|
||||
glm::dvec3 newPosition = glm::dvec3(position.x + maxApogee
|
||||
,position.y + maxApogee
|
||||
,position.z + maxApogee);
|
||||
@@ -463,15 +469,25 @@ int getIndexFromPosition(glm::dvec3 position, glm::uvec3 dim, float maxApogee, s
|
||||
|
||||
return coordinateIndex.z * (dim.x * dim.y) + coordinateIndex.y * dim.x + coordinateIndex.x;
|
||||
}
|
||||
//else if(gridType == "Spherical"){
|
||||
else if(gridType == "Spherical"){
|
||||
glm::dvec3 newPosition = glm::dvec3(position.x + maxApogee
|
||||
,position.y + maxApogee
|
||||
,position.z + maxApogee);
|
||||
|
||||
glm::uvec3 coordinateIndex = glm::uvec3(static_cast<int>(newPosition.x * dim.x / (2 * (maxApogee + epsilon)))
|
||||
,static_cast<int>(newPosition.y * dim.y / (2 * (maxApogee + epsilon)))
|
||||
,static_cast<int>(newPosition.z * dim.z / (2 * (maxApogee + epsilon))));
|
||||
|
||||
// }
|
||||
return coordinateIndex.z * (dim.x * dim.y) + coordinateIndex.y * dim.x + coordinateIndex.x;
|
||||
}
|
||||
}
|
||||
|
||||
int* mapDensityToVoxels(int* densityArray, std::vector<glm::dvec3> positions, glm::uvec3 dim, float maxApogee, std::string gridType) {
|
||||
|
||||
for(const glm::dvec3& position : positions) {
|
||||
//LINFO(fmt::format("pos: {} ", position));
|
||||
int index = getIndexFromPosition(position, dim, maxApogee, gridType);
|
||||
//LINFO(fmt::format("index: {} ", index));
|
||||
++densityArray[index];
|
||||
}
|
||||
|
||||
@@ -577,7 +593,12 @@ void GenerateDebrisVolumeTask::perform(const Task::ProgressCallback& progressCal
|
||||
|
||||
int *densityArrayp = new int[size]();
|
||||
//densityArrayp = mapDensityToVoxels(densityArrayp, generatedPositions, _dimensions, maxApogee);
|
||||
densityArrayp = mapDensityToVoxels(densityArrayp, startPositionBuffer, _dimensions, _maxApogee, _gridType);
|
||||
//densityArrayp = mapDensityToVoxels(densityArrayp, startPositionBuffer, _dimensions, _maxApogee, _gridType);
|
||||
std::vector<glm::dvec3> testBuffer;
|
||||
testBuffer.push_back(glm::dvec3(0,0,0));
|
||||
testBuffer.push_back(glm::dvec3(100,100,100));
|
||||
|
||||
densityArrayp = mapDensityToVoxels(densityArrayp, testBuffer, _dimensions, _maxApogee, _gridType);
|
||||
|
||||
// create object rawVolume
|
||||
volume::RawVolume<float> rawVolume(_dimensions);
|
||||
|
||||
@@ -210,6 +210,7 @@ void PerformanceManager::outputLogs() {
|
||||
PerformanceLayout* layout = performanceData();
|
||||
const size_t writeStart = (PerformanceLayout::NumberValues - 1) - _currentTick;
|
||||
|
||||
|
||||
// Log function performance
|
||||
for (int16_t n = 0; n < layout->nFunctionEntries; n++) {
|
||||
const PerformanceLayout::FunctionPerformanceLayout& function =
|
||||
@@ -255,6 +256,40 @@ void PerformanceManager::outputLogs() {
|
||||
}
|
||||
}
|
||||
|
||||
void PerformanceManager::debrisLog() {
|
||||
PerformanceLayout* layout = performanceData();
|
||||
const size_t writeStart = (PerformanceLayout::NumberValues - 1) - _currentTick;
|
||||
|
||||
//for (int16_t n = 0; n < layout->nScaleGraphEntries; n++) {
|
||||
for (int16_t n = 7; n < 12; n++) {
|
||||
//lol fult
|
||||
const PerformanceLayout::SceneGraphPerformanceLayout node =
|
||||
layout->sceneGraphEntries[n];
|
||||
|
||||
// Open file
|
||||
std::string filename = formatLogName(node.name);
|
||||
|
||||
std::ofstream out = std::ofstream(
|
||||
absPath(std::move(filename)),
|
||||
std::ofstream::out | std::ofstream::app
|
||||
);
|
||||
|
||||
// Comma separate data
|
||||
for (size_t i = writeStart; i < PerformanceLayout::NumberValues; i++) {
|
||||
const std::vector<float> data = {
|
||||
node.renderTime[i],
|
||||
node.updateRenderable[i],
|
||||
node.updateRotation[i],
|
||||
node.updateScaling[i],
|
||||
node.updateTranslation[i]
|
||||
};
|
||||
writeData(out, data);
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PerformanceManager::writeData(std::ofstream& out, const std::vector<float>& data) {
|
||||
for (size_t i = 0; i < data.size() - 1; i++) {
|
||||
out << data[i] << ",";
|
||||
@@ -450,7 +485,8 @@ void PerformanceManager::storeScenePerformanceMeasurements(
|
||||
_performanceMemory->releaseLock();
|
||||
|
||||
if (_loggingEnabled && _currentTick == PerformanceLayout::NumberValues - 1) {
|
||||
outputLogs();
|
||||
//outputLogs();
|
||||
debrisLog();
|
||||
}
|
||||
|
||||
tick();
|
||||
|
||||
Reference in New Issue
Block a user