mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-02 01:30:34 -06:00
almost done. creates file but crashes after finished
This commit is contained in:
@@ -8,7 +8,7 @@ return {
|
||||
Seedpoints = "C:/Users/eolsson/Documents/openspace/data/2012/seeds",
|
||||
TracingVar = "b",
|
||||
OutputFolder = "C:/Users/eolsson/Documents/openspace/data/2012/test1Output",
|
||||
OutputType = "Json",
|
||||
OutputType = "Osfls",
|
||||
ExtraVars = {rho, p}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <modules/volume/rawvolumewriter.h>
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <ghoul/fmt.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
@@ -57,7 +58,7 @@ namespace {
|
||||
// The folder to write the files to
|
||||
std::filesystem::path outputFolder [[codegen::directory()]];
|
||||
|
||||
enum class ConversionType {
|
||||
enum class [[codegen::map(openspace::KameleonVolumeToFieldlinesTask::conversionType)]] ConversionType {
|
||||
Json,
|
||||
Osfls
|
||||
};
|
||||
@@ -78,14 +79,20 @@ documentation::Documentation KameleonVolumeToFieldlinesTask::documentation() {
|
||||
KameleonVolumeToFieldlinesTask::KameleonVolumeToFieldlinesTask(
|
||||
const ghoul::Dictionary& dictionary)
|
||||
{
|
||||
SpiceManager::ref().loadKernel(absPath("${ASSETS}/spice/naif0012.tls").string());
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
_inputPath = p.input;
|
||||
_seedpointsPath = p.seedpoints;
|
||||
_manualTimeOffset = p.manualTimeOffset.value_or(_manualTimeOffset);
|
||||
_outputFolder = p.outputFolder;
|
||||
if (&_outputFolder.string().back() != "/") {
|
||||
_outputFolder += "/";
|
||||
}
|
||||
|
||||
switch (p.outputType) {
|
||||
_outputType = codegen::map<openspace::KameleonVolumeToFieldlinesTask::conversionType>(p.outputType);
|
||||
|
||||
/* switch (p.outputType) {
|
||||
case Parameters::ConversionType::Json:
|
||||
break;
|
||||
_outputType = conversionType::Json;
|
||||
@@ -94,9 +101,9 @@ KameleonVolumeToFieldlinesTask::KameleonVolumeToFieldlinesTask(
|
||||
break;
|
||||
default:
|
||||
LERROR("outputType must be either json or osfls");
|
||||
}
|
||||
}*/
|
||||
|
||||
_tracingVar= p.tracingVar;
|
||||
_tracingVar = p.tracingVar;
|
||||
|
||||
//_tracingVar = p.tracingVar.value_or(_tractingVar);
|
||||
if (p.extraVars.has_value()) {
|
||||
@@ -122,6 +129,11 @@ KameleonVolumeToFieldlinesTask::KameleonVolumeToFieldlinesTask(
|
||||
|
||||
}
|
||||
|
||||
KameleonVolumeToFieldlinesTask::~KameleonVolumeToFieldlinesTask() {
|
||||
SpiceManager::ref().unloadKernel(absPath("${ASSETS}/spice/naif0012.tls").string());
|
||||
|
||||
}
|
||||
|
||||
std::string KameleonVolumeToFieldlinesTask::description() {
|
||||
return fmt::format(
|
||||
"Extract fieldline data from cdf file {} and seedpoint file {}. "
|
||||
@@ -165,7 +177,7 @@ void KameleonVolumeToFieldlinesTask::perform(
|
||||
timeStr.replace(13, 1, "-");
|
||||
timeStr.replace(16, 1, "-");
|
||||
timeStr.replace(19, 1, "-");
|
||||
std::string fileName = timeStr + "json";
|
||||
std::string fileName = timeStr;
|
||||
newState.saveStateToJson(_outputFolder.string() + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,17 +34,18 @@
|
||||
namespace openspace {
|
||||
class KameleonVolumeToFieldlinesTask : public Task {
|
||||
public:
|
||||
enum class conversionType {
|
||||
Json,
|
||||
Osfls
|
||||
};
|
||||
KameleonVolumeToFieldlinesTask(const ghoul::Dictionary& dictionary);
|
||||
~KameleonVolumeToFieldlinesTask();
|
||||
|
||||
std::string description() override;
|
||||
void perform(const Task::ProgressCallback& progressCallback) override;
|
||||
static documentation::Documentation documentation();
|
||||
|
||||
private:
|
||||
enum class conversionType {
|
||||
Json,
|
||||
Osfls
|
||||
};
|
||||
std::string _tracingVar;
|
||||
std::vector<std::string> _extraVars;
|
||||
std::filesystem::path _inputPath;
|
||||
|
||||
Reference in New Issue
Block a user