mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-03 10:58:34 -06:00
Merge branch 'feature/iSWA' of github.com:OpenSpace/OpenSpace-Development into feature/iSWA
This commit is contained in:
@@ -46,6 +46,9 @@ DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary)
|
||||
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
|
||||
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
|
||||
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
|
||||
//FOR TESTING
|
||||
,_numOfBenchmarks(0)
|
||||
,_avgBenchmarkTime(0.0f)
|
||||
{
|
||||
addProperty(_dataOptions);
|
||||
addProperty(_useLog);
|
||||
|
||||
@@ -102,6 +102,10 @@ protected:
|
||||
std::string _dataBuffer;
|
||||
glm::size3_t _textureDimensions;
|
||||
|
||||
//FOR TESTING
|
||||
int _numOfBenchmarks;
|
||||
double _avgBenchmarkTime;
|
||||
|
||||
private:
|
||||
bool readyToRender() const override;
|
||||
bool downloadTextureResource(double timestamp = Time::ref().currentTime()) override;
|
||||
|
||||
@@ -153,7 +153,26 @@ std::vector<float*> DataPlane::textureData(){
|
||||
}
|
||||
}
|
||||
// _textureDimensions = _dataProcessor->dimensions();
|
||||
return _dataProcessor->processData(_dataBuffer, _dataOptions, _textureDimensions);
|
||||
|
||||
// FOR TESTING
|
||||
// ===========
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
// ===========
|
||||
std::vector<float*> d = _dataProcessor->processData(_dataBuffer, _dataOptions, _textureDimensions);
|
||||
|
||||
// FOR TESTING
|
||||
// ===========
|
||||
end = std::chrono::system_clock::now();
|
||||
_numOfBenchmarks++;
|
||||
std::chrono::duration<double> elapsed_seconds = end-start;
|
||||
_avgBenchmarkTime = ( (_avgBenchmarkTime * (_numOfBenchmarks-1)) + elapsed_seconds.count() ) / _numOfBenchmarks;
|
||||
std::cout << " processData() " << name() << std::endl;
|
||||
std::cout << "avg elapsed time: " << _avgBenchmarkTime << "s\n";
|
||||
std::cout << "num Benchmarks: " << _numOfBenchmarks << "\n";
|
||||
// ===========
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
}// namespace openspace
|
||||
@@ -99,21 +99,24 @@ void DataProcessorText::addDataValues(std::string data, properties::SelectionPro
|
||||
std::vector<float> values;
|
||||
float value;
|
||||
|
||||
int first, last, option, lineSize;
|
||||
|
||||
|
||||
while(getline(memorystream, line)){
|
||||
if(line.find("#") == 0) continue;
|
||||
|
||||
values = std::vector<float>();
|
||||
std::stringstream ss(line);
|
||||
copy(
|
||||
std::istream_iterator<float> (ss),
|
||||
std::next( std::istream_iterator<float> (ss), 3 ), //+3 because options x, y and z in the file
|
||||
std::istream_iterator<float> (),
|
||||
back_inserter(values)
|
||||
);
|
||||
|
||||
if(values.size() <= 0) continue;
|
||||
if(values.size() <= 0) continue;
|
||||
|
||||
for(int i=0; i<numOptions; i++){
|
||||
value = values[i+3];
|
||||
value = values[i];
|
||||
|
||||
optionValues[i].push_back(value);
|
||||
_min[i] = std::min(_min[i], value);
|
||||
@@ -140,6 +143,8 @@ std::vector<float*> DataProcessorText::processData(std::string data, properties:
|
||||
std::vector<float> values;
|
||||
float value;
|
||||
|
||||
int first, last, option, lineSize;
|
||||
|
||||
std::vector<float*> dataOptions(numOptions, nullptr);
|
||||
for(int option : selectedOptions){
|
||||
dataOptions[option] = new float[dimensions.x*dimensions.y]{0.0f};
|
||||
@@ -149,20 +154,47 @@ std::vector<float*> DataProcessorText::processData(std::string data, properties:
|
||||
while(getline(memorystream, line)){
|
||||
if(line.find("#") == 0) continue;
|
||||
|
||||
values = std::vector<float>();
|
||||
|
||||
int first = 0;
|
||||
int last = 0;
|
||||
int option = -3;
|
||||
int lineSize = line.size();
|
||||
// ----------- OLD METHODS ------------------------
|
||||
// values = std::vector<float>();
|
||||
// std::stringstream ss(line);
|
||||
// float v;
|
||||
// while(ss >> v){
|
||||
// values.push_back(v);
|
||||
// }
|
||||
|
||||
// copy(
|
||||
// std::istream_iterator<float> (ss),
|
||||
// std::istream_iterator<float> (),
|
||||
// back_inserter(values)
|
||||
// );
|
||||
|
||||
// copy(
|
||||
// std::next( std::istream_iterator<float> (ss), 3 ), //+3 because options x, y and z in the file
|
||||
// std::istream_iterator<float> (),
|
||||
// back_inserter(values)
|
||||
// );
|
||||
|
||||
// for(int option : selectedOptions){
|
||||
// value = values[option];
|
||||
// //value = values[option+3]; //+3 because options x, y and z in the file
|
||||
// dataOptions[option][numValues] = processDataPoint(value, option);
|
||||
// }
|
||||
// ----------- OLD METHODS ------------------------
|
||||
|
||||
first = 0;
|
||||
last = 0;
|
||||
option = -3;
|
||||
lineSize = line.size();
|
||||
|
||||
while(last < lineSize){
|
||||
|
||||
first = line.find_first_not_of(" \t", last);
|
||||
last = line.find_first_of(" \t", first);
|
||||
last = (last > 0)? last : lineSize;
|
||||
|
||||
if(option >= 0){
|
||||
last = (last > 0)? last : lineSize;
|
||||
// boost::spirit::qi::parse(&line[first], &line[last], boost::spirit::qi::double_, value);
|
||||
// boost::spirit::qi::parse(&line[first], &line[last], boost::spirit::qi::float_, value);
|
||||
value = std::stof(line.substr(first, last));
|
||||
|
||||
if(std::find(selectedOptions.begin(), selectedOptions.end(), option) != selectedOptions.end())
|
||||
|
||||
Reference in New Issue
Block a user