Permalink
Browse files

Format

  • Loading branch information...
xoltar committed Oct 28, 2016
1 parent 9e553aa commit 9be93936f9d20f1852994c10acde7c0d5fe87368
View
@@ -95,15 +95,15 @@ void write_boost_file(InputParameters const& params, TemplatePointsMessage const
file.flush();
}
void print_betti(TemplatePointsMessage const &message, std::ostream &ostream) {
void print_betti(TemplatePointsMessage const& message, std::ostream& ostream)
{
assert(message.homology_dimensions.dimensionality == 2);
auto shape = message.homology_dimensions.shape();
auto dims = &message.homology_dimensions;
auto data = message.homology_dimensions.data();
for(int row = 0; row < shape[0]; row++) {
for(int col = 0; col < shape[1]; col++) {
for (int row = 0; row < shape[0]; row++) {
for (int col = 0; col < shape[1]; col++) {
unsigned dim = data[row * shape[0] + col];
ostream << dim << '\t';
ostream << dim << '\t';
}
ostream << std::endl;
}
@@ -159,33 +159,33 @@ int main(int argc, char* argv[])
});
computation.arrangement_ready.connect([&arrangement_message, &params, binary](std::shared_ptr<Arrangement> arrangement) {
//TODO: add a flag to re-enable this code?
// arrangement_message = new ArrangementMessage(*arrangement);
// //TODO: this should become a system test with a known dataset
// //Note we no longer write the arrangement to stdout, it goes to a file at the end
// //of the run. This message just announces the absolute path of the file.
// //The viewer should capture the file name from the stdout stream, and
// //then wait for the console program to finish before attempting to read the file.
// std::stringstream ss(std::ios_base::binary | std::ios_base::out | std::ios_base::in);
// {
// boost::archive::binary_oarchive archive(ss);
// archive << *arrangement_message;
// }
// std::clog << "Testing deserialization locally..." << std::endl;
// std::string original = ss.str();
// ArrangementMessage test;
// {
// boost::archive::binary_iarchive inarch(ss);
// inarch >> test;
// std::clog << "Deserialized!";
// }
// if (!(*arrangement_message == test)) {
// throw std::runtime_error("Original and deserialized don't match!");
// }
// Arrangement reconstituted = arrangement_message->to_arrangement();
// ArrangementMessage round_trip(reconstituted);
// if (!(round_trip == *arrangement_message)) {
// throw std::runtime_error("Original and reconstituted don't match!");
// }
// arrangement_message = new ArrangementMessage(*arrangement);
// //TODO: this should become a system test with a known dataset
// //Note we no longer write the arrangement to stdout, it goes to a file at the end
// //of the run. This message just announces the absolute path of the file.
// //The viewer should capture the file name from the stdout stream, and
// //then wait for the console program to finish before attempting to read the file.
// std::stringstream ss(std::ios_base::binary | std::ios_base::out | std::ios_base::in);
// {
// boost::archive::binary_oarchive archive(ss);
// archive << *arrangement_message;
// }
// std::clog << "Testing deserialization locally..." << std::endl;
// std::string original = ss.str();
// ArrangementMessage test;
// {
// boost::archive::binary_iarchive inarch(ss);
// inarch >> test;
// std::clog << "Deserialized!";
// }
// if (!(*arrangement_message == test)) {
// throw std::runtime_error("Original and deserialized don't match!");
// }
// Arrangement reconstituted = arrangement_message->to_arrangement();
// ArrangementMessage round_trip(reconstituted);
// if (!(round_trip == *arrangement_message)) {
// throw std::runtime_error("Original and reconstituted don't match!");
// }
if (binary) {
std::cout << "ARRANGEMENT: " << params.outputFile << std::endl;
} else {
@@ -204,20 +204,20 @@ int main(int argc, char* argv[])
std::cout.flush();
}
//TODO: Add a flag to re-enable this code?
// std::stringstream ss;
// {
// std::cerr << "Local deserialization test" << std::endl;
// boost::archive::text_oarchive out(ss);
// out << message;
// }
// {
// boost::archive::text_iarchive in(ss);
// TemplatePointsMessage result;
// in >> result;
// if (!(message == result)) {
// throw std::runtime_error("Original TemplatePointsMessage and reconstituted don't match!");
// }
// }
// std::stringstream ss;
// {
// std::cerr << "Local deserialization test" << std::endl;
// boost::archive::text_oarchive out(ss);
// out << message;
// }
// {
// boost::archive::text_iarchive in(ss);
// TemplatePointsMessage result;
// in >> result;
// if (!(message == result)) {
// throw std::runtime_error("Original TemplatePointsMessage and reconstituted don't match!");
// }
// }
if (betti_only) {
print_betti(message, std::cout);
//TODO: this seems a little abrupt...
View
@@ -17,9 +17,9 @@ class MultiBetti;
class PersistenceUpdater;
class Vertex;
#include "math/template_point.h"
#include "anchor.h"
#include "interface/progress.h"
#include "math/template_point.h"
#include "numerics.h"
#include "pointer_comparator.h"
#include <set>
@@ -58,7 +58,7 @@ class Arrangement {
friend class PersistenceUpdater;
friend class ArrangementBuilder;
friend class ArrangementMessage;
friend Arrangement to_arrangement(ArrangementMessage const &msg);
friend Arrangement to_arrangement(ArrangementMessage const& msg);
public:
Arrangement(); //For serialization
@@ -4,8 +4,8 @@
#include "dcel/arrangement_builder.h"
#include "dcel/anchor.h"
#include "dcel/dcel.h"
#include "dcel/arrangement.h"
#include "dcel/dcel.h"
#include "debug.h"
#include "timer.h"
#include <boost/graph/adjacency_list.hpp>
@@ -5,9 +5,9 @@
#ifndef RIVET_CONSOLE_MESH_MESSAGE_H
#define RIVET_CONSOLE_MESH_MESSAGE_H
#include "dcel/anchor.h"
#include "dcel/arrangement.h"
#include "dcel/barcode_template.h"
#include "dcel/dcel.h"
#include "dcel/arrangement.h"
#include "type_tag.h"
#include <boost/optional.hpp>
#include <boost/serialization/split_member.hpp>
View
@@ -8,9 +8,9 @@
#define FILEWRITER_H
#include "dcel/arrangement.h"
#include "math/template_point.h"
#include "input_manager.h"
#include "input_parameters.h"
#include "math/template_point.h"
#include <fstream>
@@ -5,8 +5,8 @@
#ifndef RIVET_CONSOLE_SERIALIZATION_TESTS_H_H
#define RIVET_CONSOLE_SERIALIZATION_TESTS_H_H
#include "dcel/anchor.h"
#include "dcel/dcel.h"
#include "dcel/arrangement.h"
#include "dcel/dcel.h"
#include "dcel/serialization.h"
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
View
@@ -1,8 +1,8 @@
#include "visualizationwindow.h"
#include "ui_visualizationwindow.h"
#include "dcel/barcode_template.h"
#include "dcel/arrangement_message.h"
#include "dcel/barcode_template.h"
#include "interface/barcode.h"
#include "interface/config_parameters.h"
#include "interface/file_writer.h"

0 comments on commit 9be9393

Please sign in to comment.