Skip to content

Commit

Permalink
The great renaming of '16. Mesh->Arrangement, xiPoint-> TemplatePoint…
Browse files Browse the repository at this point in the history
…, and all derivatives thereof
  • Loading branch information
xoltar committed Sep 8, 2016
1 parent bf1ec49 commit 98a5827
Show file tree
Hide file tree
Showing 36 changed files with 544 additions and 585 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ add_executable (rivet_console
interface/file_writer.cpp
interface/file_input_reader.cpp
interface/input_manager.cpp
dcel/mesh.cpp
dcel/mesh_builder.cpp
dcel/arrangement.cpp
dcel/arrangement_builder.cpp
dcel/anchor.cpp
dcel/barcode_template.cpp
dcel/dcel.cpp
dcel/mesh_message.cpp
dcel/arrangement_message.cpp
math/map_matrix.cpp
math/multi_betti.cpp
math/simplex_tree.cpp
math/st_node.cpp
math/xi_point.cpp
math/xi_support_matrix.cpp
math/template_point.cpp
math/template_points_matrix.cpp
math/index_matrix.cpp
math/persistence_updater.cpp
numerics.cpp
Expand All @@ -62,17 +62,17 @@ add_executable(unit_tests
interface/file_writer.cpp
interface/file_input_reader.cpp
interface/input_manager.cpp
dcel/mesh.cpp
dcel/mesh_builder.cpp
dcel/arrangement.cpp
dcel/arrangement_builder.cpp
dcel/anchor.cpp
dcel/barcode_template.cpp
dcel/dcel.cpp
math/map_matrix.cpp
math/multi_betti.cpp
math/simplex_tree.cpp
math/st_node.cpp
math/xi_point.cpp
math/xi_support_matrix.cpp
math/template_point.cpp
math/template_points_matrix.cpp
math/index_matrix.cpp
math/persistence_updater.cpp
numerics.cpp
Expand Down
14 changes: 7 additions & 7 deletions RIVET.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SOURCES += main.cpp \
visualizationwindow.cpp \
dataselectdialog.cpp \
dcel/dcel.cpp \
dcel/mesh.cpp \
dcel/arrangement.cpp \
interface/control_dot.cpp \
#interface/input_manager.cpp \
interface/persistence_bar.cpp \
Expand All @@ -40,10 +40,10 @@ SOURCES += main.cpp \
interface/barcode.cpp \
dcel/barcode_template.cpp \
dcel/anchor.cpp \
dcel/mesh_message.cpp \
dcel/arrangement_message.cpp \
#math/persistence_updater.cpp \
math/xi_support_matrix.cpp \
math/xi_point.cpp \
math/template_points_matrix.cpp \
math/template_point.cpp \
interface/progressdialog.cpp \
computationthread.cpp \
interface/aboutmessagebox.cpp \
Expand All @@ -60,7 +60,7 @@ SOURCES += main.cpp \
HEADERS += visualizationwindow.h \
dataselectdialog.h \
dcel/dcel.h \
dcel/mesh.h \
dcel/arrangement.h \
interface/control_dot.h \
interface/input_manager.h \
interface/persistence_bar.h \
Expand All @@ -77,8 +77,8 @@ HEADERS += visualizationwindow.h \
dcel/barcode_template.h \
dcel/anchor.h \
math/persistence_updater.h \
math/xi_support_matrix.h \
math/xi_point.h \
math/template_points_matrix.h \
math/template_point.h \
interface/progressdialog.h \
computationthread.h \
interface/input_parameters.h \
Expand Down
18 changes: 9 additions & 9 deletions computation.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "computation.h"
#include "dcel/mesh.h"
#include "dcel/mesh_builder.h"
#include "dcel/arrangement.h"
#include "dcel/arrangement_builder.h"
#include "debug.h"
#include "math/multi_betti.h"
#include "timer.h"
Expand Down Expand Up @@ -49,9 +49,9 @@ std::unique_ptr<ComputationResult> Computation::compute_raw(ComputationInput& in
debug() << " --> xi_i computation took " << timer.elapsed() << " seconds";

//store the xi support points
mb.store_support_points(result->xi_support);
mb.store_support_points(result->template_points);

xiSupportReady(XiSupportMessage{ input.x_label, input.y_label, result->xi_support, result->homology_dimensions, input.x_exact, input.y_exact }); //signal that xi support points are ready for visualization
template_points_ready(TemplatePointsMessage{ input.x_label, input.y_label, result->template_points, result->homology_dimensions, input.x_exact, input.y_exact }); //signal that xi support points are ready for visualization
progress.advanceProgressStage(); //update progress box to stage 4

//STAGES 4 and 5: BUILD THE LINE ARRANGEMENT AND COMPUTE BARCODE TEMPLATES
Expand All @@ -62,18 +62,18 @@ std::unique_ptr<ComputationResult> Computation::compute_raw(ComputationInput& in
}

timer.restart();
MeshBuilder builder(verbosity);
auto arrangement = builder.build_arrangement(mb, input.x_exact, input.y_exact, result->xi_support, progress); ///TODO: update this -- does not need to store list of xi support points in xi_support
ArrangementBuilder builder(verbosity);
auto arrangement = builder.build_arrangement(mb, input.x_exact, input.y_exact, result->template_points, progress); ///TODO: update this -- does not need to store list of xi support points in xi_support
//NOTE: this also computes and stores barcode templates in the arrangement

debug() << " building the line arrangement and computing all barcode templates took"
<< timer.elapsed() << "milliseconds";

//send (a pointer to) the arrangement back to the VisualizationWindow
arrangementReady(arrangement);
arrangement_ready(arrangement);
//re-send xi support and other anchors
debug() << "Sending" << result->xi_support.size() << "anchors";
xiSupportReady(XiSupportMessage{ input.x_label, input.y_label, result->xi_support, result->homology_dimensions, input.x_exact, input.y_exact });
debug() << "Sending" << result->template_points.size() << "anchors";
template_points_ready(TemplatePointsMessage{ input.x_label, input.y_label, result->template_points, result->homology_dimensions, input.x_exact, input.y_exact });
arrangement->test_consistency();
result->arrangement = std::move(arrangement);
return result;
Expand Down
10 changes: 5 additions & 5 deletions computation.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "interface/input_manager.h"
#include "interface/input_parameters.h"
#include "math/simplex_tree.h"
#include "math/xi_point.h"
#include "math/template_point.h"
#include "numerics.h"

#include "boost/multi_array.hpp"
Expand Down Expand Up @@ -42,16 +42,16 @@ class ComputationInput {

struct ComputationResult {
unsigned_matrix homology_dimensions;
std::vector<xiPoint> xi_support;
std::shared_ptr<Mesh> arrangement;
std::vector<TemplatePoint> template_points;
std::shared_ptr<Arrangement> arrangement;
std::shared_ptr<SimplexTree> bifiltration;
};

class Computation {
public:
//TODO: these signals are a little strange, they should go away soon
boost::signals2::signal<void(std::shared_ptr<Mesh>)> arrangementReady;
boost::signals2::signal<void(XiSupportMessage)> xiSupportReady;
boost::signals2::signal<void(std::shared_ptr<Arrangement>)> arrangement_ready;
boost::signals2::signal<void(TemplatePointsMessage)> template_points_ready;
Computation(InputParameters& params, Progress& progress);
~Computation();

Expand Down
30 changes: 15 additions & 15 deletions computationthread.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "computationthread.h"

#include "dcel/mesh.h"
#include "dcel/mesh_message.h"
#include "dcel/arrangement.h"
#include "dcel/arrangement_message.h"
#include "dcel/serialization.h"
#include "interface/input_manager.h"
#include "interface/input_parameters.h"
#include "math/multi_betti.h"
#include "math/simplex_tree.h"
#include "math/xi_point.h"
#include "math/template_point.h"

#include "interface/console_interaction.h"

Expand All @@ -28,7 +28,7 @@
ComputationThread::ComputationThread(InputParameters& params, QObject* parent)
: QThread(parent)
, params(params)
, xi_support()
, template_points()
, x_exact()
, y_exact()
, x_label()
Expand Down Expand Up @@ -77,11 +77,11 @@ void ComputationThread::load_from_file()
assert(type == "RIVET_1");
boost::archive::binary_iarchive archive(file);

arrangement.reset(new MeshMessage());
arrangement.reset(new ArrangementMessage());
archive >> params;
archive >> message;
unpack_message_fields();
emit xiSupportReady();
emit templatePointsReady();
archive >> *arrangement;
emit arrangementReady(&*arrangement);
}
Expand All @@ -90,7 +90,7 @@ void ComputationThread::load_from_file()
void ComputationThread::unpack_message_fields()
{

xi_support = message.xi_support;
template_points = message.template_points;
std::vector<unsigned> dims(message.homology_dimensions.shape(),
message.homology_dimensions.shape() + message.homology_dimensions.num_dimensions());
assert(dims.size() == 2);
Expand Down Expand Up @@ -141,7 +141,7 @@ void ComputationThread::compute_from_file()
}
unpack_message_fields();
reading_xi = false;
emit xiSupportReady();
emit templatePointsReady();
} else {
ss << line.toStdString();
}
Expand All @@ -157,17 +157,17 @@ void ComputationThread::compute_from_file()
if (type != "RIVET_1") {
throw std::runtime_error("Unsupported file format");
}
qDebug() << "ComputationThread::compute_from_file() : checkpoint A -- xi_support.size() = " << xi_support.size();
qDebug() << "ComputationThread::compute_from_file() : checkpoint A -- template_points.size() = " << template_points.size();
boost::archive::binary_iarchive archive(input);
arrangement.reset(new MeshMessage());
arrangement.reset(new ArrangementMessage());
InputParameters p;
archive >> p;
archive >> message;
unpack_message_fields();
archive >> *arrangement;
qDebug() << "ComputationThread::compute_from_file() : checkpoint B -- xi_support.size() = " << xi_support.size();
qDebug() << "ComputationThread::compute_from_file() : checkpoint B -- template_points.size() = " << template_points.size();
}
// qDebug() << "Mesh received: " << arrangement->x_exact.size() << " x " << arrangement->y_exact.size();
// qDebug() << "Arrangement received: " << arrangement->x_exact.size() << " x " << arrangement->y_exact.size();
emit arrangementReady(&*arrangement);
return;
} else if (line.startsWith("PROGRESS ")) {
Expand All @@ -182,22 +182,22 @@ void ComputationThread::compute_from_file()
}
}

qDebug() << "Mesh was not delivered";
qDebug() << "Arrangement was not delivered";

} //end run()

//TODO: this doesn't really belong here, look for a better place.
//NOTE this is a copy of a function in the console
//It has to be here because we get duplicate symbol errors when we use binary_oarchive in a different compilation
//unit in addition to this one.
void write_boost_file(QString file_name, InputParameters const& params, XiSupportMessage const& message, MeshMessage const& mesh)
void write_boost_file(QString file_name, InputParameters const& params, TemplatePointsMessage const& message, ArrangementMessage const& arrangement)
{
std::ofstream file(file_name.toStdString(), std::ios::binary);
if (!file.is_open()) {
throw std::runtime_error("Could not open " + file_name.toStdString() + " for writing");
}
file << "RIVET_1\n";
boost::archive::binary_oarchive oarchive(file);
oarchive& params& message& mesh;
oarchive& params& message& arrangement;
file.flush();
}
18 changes: 9 additions & 9 deletions computationthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
//forward declarations
class InputManager;
struct InputParameters;
class Mesh;
class Arrangement;

#include "dcel/barcode_template.h"
#include "math/simplex_tree.h"
#include "math/xi_point.h"
#include "math/template_point.h"

#include <QObject>
#include <QThread>
Expand All @@ -18,7 +18,7 @@ typedef boost::multiprecision::cpp_rational exact;
#include "boost/multi_array.hpp"
typedef boost::multi_array<unsigned, 2> unsigned_matrix;

#include "dcel/mesh_message.h"
#include "dcel/arrangement_message.h"
#include <vector>

class ComputationThread : public QThread {
Expand All @@ -34,8 +34,8 @@ class ComputationThread : public QThread {
void compute();

//TODO: these really ought to be delivered via signal rather than read by other classes
XiSupportMessage message;
std::vector<xiPoint> xi_support;
TemplatePointsMessage message;
std::vector<TemplatePoint> template_points;
std::vector<exact> x_exact;
std::vector<exact> y_exact;
unsigned_matrix hom_dims;
Expand All @@ -46,16 +46,16 @@ class ComputationThread : public QThread {
void advanceProgressStage();
void setProgressMaximum(unsigned max);
void setCurrentProgress(unsigned current);
void xiSupportReady();
void arrangementReady(MeshMessage* arrangement);
void templatePointsReady();
void arrangementReady(ArrangementMessage* arrangement);

protected:
void run() Q_DECL_OVERRIDE;

private:
InputParameters& params;

std::shared_ptr<MeshMessage> arrangement;
std::shared_ptr<ArrangementMessage> arrangement;

void compute_from_file();
void unpack_message_fields();
Expand All @@ -64,5 +64,5 @@ class ComputationThread : public QThread {
};

//TODO: Move this somewhere. See comments on implementation for details.
void write_boost_file(QString file_name, InputParameters const& params, XiSupportMessage const& message, MeshMessage const& mesh);
void write_boost_file(QString file_name, InputParameters const& params, TemplatePointsMessage const& message, ArrangementMessage const& arrangement);
#endif // COMPUTATIONTHREAD_H
Loading

0 comments on commit 98a5827

Please sign in to comment.