Commit d4b71c57 authored by incardon's avatar incardon

Fixed VTKWriter

parent 417942d4
This diff is collapsed.
......@@ -8,9 +8,10 @@
#ifndef GRAPHMLWRITER_UNIT_TESTS_HPP_
#define GRAPHMLWRITER_UNIT_TESTS_HPP_
#define GS_SIZE 128
#define GS_SIZE 8
#include "GraphMLWriter.hpp"
#include "VTKWriter.hpp"
#include "Graph/CartesianGraphFactory.hpp"
BOOST_AUTO_TEST_SUITE( graphml_writer_test )
......@@ -29,12 +30,6 @@ struct ne_cp
typedef typename memory_traits_inte<type>::type memory_int;
typedef typename memory_traits_lin<type>::type memory_lin;
//! define attributes names
struct attributes
{
static const std::string name[];
};
//! The data
type data;
......@@ -44,25 +39,52 @@ struct ne_cp
static const unsigned int y = 1;
//! z property id in boost::fusion::vector
static const unsigned int z = 2;
//! float_num property id in boost::fusion::vector
static const unsigned int float_num = 3;
//! double_num property id in boost::fusion::vector
static const unsigned int double_num = 4;
static const unsigned int double_num = 3;
//! long_num property id in boost::fusion::vector
static const unsigned int long_num = 5;
static const unsigned int long_num = 4;
//! integer property id in boost::fusion::vector
static const unsigned int integer = 6;
static const unsigned int integer = 5;
//! string property id in boost::fusion::vector
static const unsigned int string = 7;
static const unsigned int string = 6;
//! total number of properties boost::fusion::vector
static const unsigned int max_prop = 8;
static const unsigned int max_prop = 7;
//! define attributes names
struct attributes
{
static const std::string name[max_prop];
};
//! type of the spatial information
typedef float s_type;
};
// Initialize the attributes strings array
const std::string ne_cp::attributes::name[] = {"x","y","z","float_num","double_num","long_num","integer","string"};
const std::string ne_cp::attributes::name[] = {"x","y","z","double_num","long_num","integer","string"};
BOOST_AUTO_TEST_CASE( graphml_writer_use)
{
Graph_CSR<ne_cp,ne_cp> g_csr2;
// Add 4 vertex and connect
struct ne_cp n1;
g_csr2.addVertex(n1);
g_csr2.addVertex(n1);
g_csr2.addVertex(n1);
g_csr2.addVertex(n1);
g_csr2.addEdge(0,1);
g_csr2.addEdge(2,1);
g_csr2.addEdge(3,1);
g_csr2.addEdge(2,0);
g_csr2.addEdge(3,2);
VTKWriter<Graph_CSR<ne_cp,ne_cp>> gv2(g_csr2);
gv2.write("test_graph2.vtk");
//! Create a graph
CartesianGraphFactory<3,Graph_CSR<ne_cp,ne_cp>> g_factory;
......@@ -76,11 +98,17 @@ BOOST_AUTO_TEST_CASE( graphml_writer_use)
// Box
Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
Graph_CSR<ne_cp,ne_cp> g_csr = g_factory.construct<5,float,2>(sz,box);
Graph_CSR<ne_cp,ne_cp> g_csr = g_factory.construct<5,float,2,ne_cp::x,ne_cp::y,ne_cp::z>(sz,box);
GraphMLWriter<Graph_CSR<ne_cp,ne_cp>> gw(g_csr);
// std::cout << std::is_class<ne_cp::attributes>;
gw.write("test_graph.gml");
VTKWriter<Graph_CSR<ne_cp,ne_cp>> gv(g_csr);
gv.write("test_graph.vtk");
}
BOOST_AUTO_TEST_SUITE_END()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment