Commit 5dfcba90 authored by incardon's avatar incardon

Improving documentation and fixing small bug for unsupported array in paraview

parent 4a5f8a2a
......@@ -16,7 +16,7 @@ parallel (
catch (IOException e)
{
ntry--
sleep(5000)
sleep(50)
}
}
......@@ -49,7 +49,7 @@ parallel (
catch (IOException e)
{
ntry--
sleep(5000)
sleep(50)
}
}
......@@ -80,7 +80,7 @@ parallel (
catch (IOException e)
{
ntry--
sleep(5000)
sleep(50)
}
}
......
......@@ -3,7 +3,7 @@
AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_INIT(OpenFPM_io, 0.8.0, BUG-REPORT-ADDRESS)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/main.cpp])
......@@ -79,6 +79,64 @@ else
fi
###### Check for se-class1
AC_MSG_CHECKING(whether to build with security enhancement class1)
se_class1=no
AC_ARG_ENABLE(se-class1,
AC_HELP_STRING(
[--enable-se-class1],
[enable security enhancement class1]
),
se_class1="$enableval"
)
AC_MSG_RESULT($se_class1)
if test x"$se_class1" = x"yes"; then
AC_DEFINE([SE_CLASS1],[],[Security enhancement class 1])
fi
###### Check for se-class 2
AC_MSG_CHECKING(whether to build with security enhancement class 2)
se_class2=no
AC_ARG_ENABLE(se-class2,
AC_HELP_STRING(
[--enable-se-class2],
[enable security enhancement class 2]
),
se_class2="$enableval"
)
AC_MSG_RESULT($se_class2)
if test x"$se_class2" = x"yes"; then
AC_DEFINE([SE_CLASS2],[],[Security enhancement class 2])
fi
###### Check for se-class 3
AC_MSG_CHECKING(whether to build with security enhancement class 3)
se_class3=no
AC_ARG_ENABLE(se-class3,
AC_HELP_STRING(
[--enable-se-class3],
[enable security enhancement class 3]
),
se_class3="$enableval"
)
AC_MSG_RESULT($se_class3)
if test x"$se_class3" = x"yes"; then
AC_DEFINE([SE_CLASS3],[],[Security enhancement class 3])
fi
###### Checking for compiler flags -fext-numeric-literals
AC_LANG_PUSH([C++])
......
......@@ -50,16 +50,16 @@ void create_prop(std::string * str)
template<typename G>
struct vertex_prop
{
// Properties counter
//! Properties counter
int cnt = 0;
// vertex properties
//! vertex properties
std::string & v_prop;
// Attribute names
//! Attribute names
std::string * attributes_names;
// Number of attributes name defined into the vertex
//! Number of attributes name defined into the vertex
int n_attr = 0;
/*! \brief Constructor
......@@ -67,11 +67,9 @@ struct vertex_prop
* Create a vertex properties list
*
* \param v_prop std::string that is filled with the graph properties in the GraphML format
* \param stub SFINAE, it basically check if G has properties names defined, if yes this
* constructor is selected over the other one
* \param a_name array with the names of the properties
*
*/
vertex_prop(std::string & v_prop, typename G::V_type::attributes & a_name)
:v_prop(v_prop),attributes_names(a_name.name)
{
......@@ -84,7 +82,6 @@ struct vertex_prop
* Create a vertex properties list
*
* \param v_prop std::string that is filled with the graph properties in the GraphML format
* \param n_prop number of properties
*
*/
vertex_prop(std::string & v_prop)
......@@ -100,7 +97,11 @@ struct vertex_prop
create_prop<typename G::V_type>(attributes_names);
};
//! It call the functor for each member
/*! It call the functor for each member
*
* \param t each member
*
*/
template<typename T>
void operator()(T& t)
{
......@@ -143,19 +144,19 @@ struct vertex_prop
template<typename G>
struct vertex_node
{
// Vertex object container
//! Vertex object container
const typename G::V_container & vo;
// Properties counter
//! Properties counter
int cnt = 0;
// vertex node string
//! vertex node string
std::string & v_node;
// Attribute names
//! Attribute names
std::string * attributes_names;
// Number of attributes name defined into the vertex
//! Number of attributes name defined into the vertex
int n_attr = 0;
/*! \brief Constructor
......@@ -164,7 +165,7 @@ struct vertex_node
*
* \param v_node std::string that is filled with the graph node definition in the GraphML format
* \param n_obj object container to access its properties for example encapc<...>
* \param stub SFINAE, it basically check if G has properties names defined, if yes this
* \param a_name stub SFINAE, it basically check if G has properties names defined, if yes this
* constructor is selected over the other one
*
*/
......@@ -227,7 +228,7 @@ struct vertex_node
/*! \brief Create a new node
*
* Create a new node
* \param v_c id of the node
*
*/
void new_node(size_t v_c)
......@@ -250,7 +251,11 @@ struct vertex_node
v_node += "</node>\n";
}
//! It call the functor for each member
/*! \brief It call the functor for each member
*
* \param t each member
*
*/
template<typename T>
void operator()(T& t)
{
......@@ -288,16 +293,16 @@ struct vertex_node
template<typename G>
struct edge_prop
{
// Properties counter
//! Properties counter
int cnt = 0;
// edge properties
//! edge properties
std::string & e_prop;
// Attribute names
//! Attribute names
std::string * attributes_names;
// Number of attributes name defined into the vertex
//! Number of attributes name defined into the vertex
int n_attr = 0;
/*! \brief Constructor
......@@ -305,7 +310,7 @@ struct edge_prop
* Create an edge properties list
*
* \param e_prop std::string that is filled with the graph properties in the GraphML format
* \param stub SFINAE, it basically check if G::E_type has properties names defined, if yes this
* \param a_name stub SFINAE, it basically check if G::E_type has properties names defined, if yes this
* constructor is selected over the other one
*
*/
......@@ -321,7 +326,6 @@ struct edge_prop
* Create an edge properties list
*
* \param e_prop std::string that is filled with the graph properties in the GraphML format
* \param n_prop number of properties
*
*/
edge_prop(std::string & e_prop)
......@@ -337,7 +341,11 @@ struct edge_prop
create_prop<typename G::E_type>(attributes_names);
};
//! It call the functor for each member
/*! \brief It call the functor for each member
*
* \param t each member
*
*/
template<typename T>
void operator()(T& t)
{
......@@ -381,7 +389,7 @@ struct edge_node
//! Properties counter
int cnt = 0;
// edge node string
//! edge node string
std::string & e_node;
//! Attribute names
......@@ -430,7 +438,9 @@ struct edge_node
/*! \brief Create a new node
*
* \param vc node number
* \param v_c node number
* \param s source node id
* \param d destination node id
*
*/
void new_node(size_t v_c, size_t s, size_t d)
......@@ -453,7 +463,11 @@ struct edge_node
e_node += "</edge>\n";
}
//! It call the functor for each member
/*! It call the functor for each member
*
* \param t each member
*
*/
template<typename T>
void operator()(T& t)
{
......@@ -488,6 +502,7 @@ struct edge_node
template <typename Graph>
class GraphMLWriter
{
//! Graph to write
Graph & g;
/*! \brief It get the vertex properties list
......@@ -499,7 +514,6 @@ class GraphMLWriter
* \return a string that define the vertex properties in graphML format
*
*/
std::string get_vertex_properties_list()
{
//! vertex property output string
......@@ -522,7 +536,6 @@ class GraphMLWriter
* \return a string that define the edge properties in graphML format
*
*/
std::string get_edge_properties_list()
{
//! edge property output string
......@@ -538,6 +551,11 @@ class GraphMLWriter
return e_out;
}
/*! \brief Get the string containing the set of vertices
*
* \return the set of vertices as string
*
*/
std::string get_vertex_list()
{
// node counter
......@@ -575,6 +593,11 @@ class GraphMLWriter
return v_out;
}
/*! \brief return the edge list as a string
*
* \return the edge list as string
*
*/
std::string get_edge_list()
{
// node counter
......@@ -632,7 +655,6 @@ public:
* \param name of the graph
*
*/
bool write(std::string file, std::string graph_name="Graph")
{
// Header for the GraphML
......
......@@ -1115,7 +1115,7 @@ public:
*
* \param file path where to write
* \param name of the graph
* \param file_type specify if it is a VTK BINARY or ASCII file [default = ASCII]
* \param ft specify if it is a VTK BINARY or ASCII file [default = ASCII]
*
*/
......
......@@ -1088,7 +1088,7 @@ public:
*
* \param file path where to write
* \param name of the graph
* \param file_type specify if it is a VTK BINARY or ASCII file [default = ASCII]
* \param ft specify if it is a VTK BINARY or ASCII file [default = ASCII]
*
*/
......
......@@ -295,7 +295,7 @@ public:
*
* \param file path where to write
* \param name of the graph
* \param file_type specify if it is a VTK BINARY or ASCII file [default = ASCII]
* \param ft specify if it is a VTK BINARY or ASCII file [default = ASCII]
*
*/
......
......@@ -22,10 +22,11 @@
template <typename Grid>
struct cell_grid
{
// vector of fused grids
//! vector of fused grids
openfpm::vector<const Grid *> grids;
// combination
//! combination
//! (used to calculate the grid shift from the starting point of the cell)
comb<Grid::dims> cmb;
cell_grid() {}
......@@ -35,11 +36,13 @@ struct cell_grid
:cmb(cmb)
{}
//! copy contructor
cell_grid(const cell_grid<Grid> & cg)
{
this->operator=(cg);
}
//! copy constructor
cell_grid(cell_grid<Grid> && cg)
{
this->operator=(cg);
......@@ -76,27 +79,45 @@ struct cell_grid
}
};
/*! \brief convert a staggered element into a string for vtk write
*
* \tparam Grid type of the grid
* \tparam St space type
*
*/
template <typename Grid, typename St>
class ele_g_st
{
public:
//! grid type
typedef Grid value_type;
//! constructor
ele_g_st(){};
ele_g_st(const Point<Grid::dims,St> & offset, const Point<Grid::dims,St> & spacing, const Box<Grid::dims,St> & dom)
/*! \brief convert a staggered grid property into a string
*
* \param offset shift of the staggered element
* \param spacing of the grid
* \param Part of the grid that is real domain
*
*/
ele_g_st(const Point<Grid::dims,St> & offset,
const Point<Grid::dims,St> & spacing,
const Box<Grid::dims,St> & dom)
:offset(offset),spacing(spacing),dom(dom)
{}
//! output string
std::string dataset;
//! fused grids
openfpm::vector<cell_grid<Grid>> g;
//! offset where it start
//! offset where it start the grid
Point<Grid::dims,St> offset;
// spacing of the grid
//! spacing of the grid
Point<Grid::dims,St> spacing;
// Part of the grid that is real domain
//! Part of the grid that is real domain
Box<Grid::dims,size_t> dom;
//! Copy constructor
......@@ -113,7 +134,9 @@ public:
/*! \brief Copy the object
*
* \patam ele ele_g_st to copy
* \param ele ele_g_st to copy
*
* \return itself
*
*/
ele_g_st<Grid,St> & operator=(const ele_g_st & ele)
......@@ -129,7 +152,9 @@ public:
/*! \brief Copy the object
*
* \patam ele ele_g_st to copy
* \param ele ele_g_st to copy
*
* \return itself
*
*/
ele_g_st<Grid,St> & operator=(ele_g_st && ele)
......@@ -221,6 +246,8 @@ class VTKWriter<pair,VECTOR_ST_GRIDS>
}
/*! \brief Create the VTK point definition
*
* \return the list of points
*
*/
std::string get_point_list()
......@@ -273,9 +300,11 @@ class VTKWriter<pair,VECTOR_ST_GRIDS>
return v_out.str();
}
/* \brief Get the properties components
/* \brief It generate a name for the property cell component
*
* \param k component in the cell
*
* \return the components printed
* \return property name
*
*/
std::string get_prop_components(size_t k)
......@@ -304,6 +333,8 @@ class VTKWriter<pair,VECTOR_ST_GRIDS>
* \param k component
* \param prop property name
*
* \return the property output string for the grid
*
*/
std::string get_properties_output(size_t k, std::string prop_name)
{
......@@ -462,6 +493,8 @@ class VTKWriter<pair,VECTOR_ST_GRIDS>
}
/*! \brief Create the VTK vertex definition
*
* \return the string with the vertices as string
*
*/
std::string get_vertex_list()
......@@ -515,7 +548,8 @@ class VTKWriter<pair,VECTOR_ST_GRIDS>
* fuse them, otherwise create a new combination and grid
*
* \param id sub-domain id
* \param location in the cell of the grid
* \param g grid to output
* \param cmb position of the grid
*
* \return a valid slot, if does not exist it append the grid at the end with the new combination
*
......@@ -555,9 +589,15 @@ public:
* \param offset grid offset
* \param spacing spacing of the grid
* \param dom part of the spacethat is the domain
* \param cmb position of the grid
*
*/
void add(size_t i, const typename pair::first & g, const Point<pair::first::dims,typename pair::second> & offset, const Point<pair::first::dims,typename pair::second> & spacing, const Box<pair::first::dims,typename pair::second> & dom, const comb<pair::first::dims> & cmb)
void add(size_t i,
const typename pair::first & g,
const Point<pair::first::dims,typename pair::second> & offset,
const Point<pair::first::dims,typename pair::second> & spacing,
const Box<pair::first::dims,typename pair::second> & dom,
const comb<pair::first::dims> & cmb)
{
//! Increase the size
if (i >= vg.size())
......@@ -577,11 +617,15 @@ public:
*
* \param file path where to write
* \param g_name of the set of grids
* \param file_type specify if it is a VTK BINARY or ASCII file [default = ASCII]
* \param ft specify if it is a VTK BINARY or ASCII file [default = ASCII]
*
* \return true if the file is succeful written
*
*/
template<int prp = -1> bool write(std::string file, std::string g_name = "grids" , file_type ft = file_type::ASCII)
template<int prp = -1> bool write(std::string file,
std::string g_name = "grids",
file_type ft = file_type::ASCII)
{
// Header for the vtk
std::string vtk_header;
......
......@@ -62,18 +62,21 @@ template<unsigned int i, typename ele_g, bool has_attributes> std::string get_po
// for now we support only scalar of native type
if (std::rank<ctype>::value == 1)
{
//Get type of the property
std::string type = getType<typename std::remove_all_extents<ctype>::type>();
// if the type is not supported skip-it
if (type.size() == 0)
if (std::extent<ctype>::value <= 3)
{
std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " the type " << demangle(typeid(ctype).name()) << " is not supported by vtk\n";
return "";
}
//Get type of the property
std::string type = getType<typename std::remove_all_extents<ctype>::type>();
// Create point data properties
v_out += "VECTORS " + getAttrName<ele_g,has_attributes>::get(i,oprp) + " " + type + "\n";
// if the type is not supported skip-it
if (type.size() == 0)
{
std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " the type " << demangle(typeid(ctype).name()) << " is not supported by vtk\n";
return "";
}
// Create point data properties
v_out += "VECTORS " + getAttrName<ele_g,has_attributes>::get(i,oprp) + " " + type + "\n";
}
}
else
{
......
......@@ -8,11 +8,13 @@
#ifndef OPENFPM_IO_SRC_VTKWRITER_POINT_SET_HPP_
#define OPENFPM_IO_SRC_VTKWRITER_POINT_SET_HPP_
#include <cstddef>
#include <boost/mpl/pair.hpp>
#include "VTKWriter_grids_util.hpp"
#include "is_vtk_writable.hpp"
#include <string>
/*! \brief Store the couple of vector position and properties
/*! \brief Store a reference to the vector position
*
* \tparam Vps Type of vector that store the position of the particles
*
......@@ -22,19 +24,23 @@ class ele_vps
{
public:
//! type of vector that store the particle position
typedef Vps value_type;
//! particle position vector
const Vps & g;
//! ghost marker
size_t mark;
//! constructor
ele_vps(const Vps & g, size_t mark)
:g(g),mark(mark)
{}
};
/*! \brief Store the couple of vector position and properties
/*! \brief Store a reference to the vector properties
*
* \tparam Vpp Type of vector that store the property of the particles
*
......@@ -44,12 +50,17 @@ class ele_vpp
{
public:
//! type of vector that store the particle properties
typedef Vpp value_type;
//! Reference to the particle properties
const Vpp & g;
//! ghost marker
size_t mark;
//! constructor
ele_vpp(const Vpp & vpp, size_t mark)
:g(vpp),mark(mark)
{}
......@@ -67,19 +78,19 @@ public:
*
*
*/
template<typename ele_v, typename St>
struct prop_out_v
{
// property output string
//! property output string
std::string & v_out;
// vector that we are processing
//! vector that we are processing
const openfpm::vector_std< ele_v > & vv;
/*! \brief constructor
*
* \param v_out string to fill with the vertex properties
* \param vv vector we are processing
*
*/
prop_out_v(std::string & v_out, const openfpm::vector_std< ele_v > & vv)
......@@ -138,8 +149,9 @@ struct prop_out_v
template <typename pair>
class VTKWriter<pair,VECTOR_POINTS>
{
//! Vector of couple, position and properties
//! Vector of position
openfpm::vector< ele_vps<typename pair::first >> vps;
//! Vector of properties
openfpm::vector< ele_vpp<typename pair::second>> vpp;
/*! \brief Get the total number of points
......@@ -166,7 +178,6 @@ class VTKWriter<pair,VECTOR_POINTS>
* \return a string that define the vertex properties in graphML format
*
*/
std::string get_vertex_properties_list()
{
//! vertex property output string
......@@ -266,7 +277,6 @@ class VTKWriter<pair,VECTOR_POINTS>
* \return a string with the point data header for VTK format
*
*/
std::string get_point_data_header()
{
std::string v_out;
......@@ -290,7 +300,7 @@ public:
*
* \param vps vector of positions
* \param vpp vector of properties
* \param mark, additional information that divide the dataset into 2
* \param mark additional information that divide the dataset into 2
* (in general is used to mark real from ghost information)
*
*/
......@@ -308,11 +318,10 @@ public:
* \tparam prp_out which properties to output [default = -1 (all)]
*
* \param file path where to write
* \param name name of the dataset
* \param file_type specify if it is a VTK BINARY or ASCII file [default = ASCII]
* \param f_name name of the dataset
* \param ft specify if it is a VTK BINARY or ASCII file [default = ASCII]
*
*/
template<int prp = -1> bool write(std::string file, std::string f_name = "points" , file_type ft = file_type::ASCII)
{
// Header for the vtk
......
......@@ -361,7 +361,7 @@ public:
*
* \param file path where to write
* \param name of the graph
* \param file_type specify if it is a VTK BINARY or ASCII file [default = ASCII]
* \param ft specify if it is a VTK BINARY or ASCII file [default = ASCII]
*
*/
......
#include "config.h"
#undef VERSION
#include <iostream>
#define BOOST_DISABLE_ASSERTS
......
......@@ -34,12 +34,19 @@ static inline bool compare(std::string file1, std::string file2)
return false;
}
//! RGB color struct
struct RGB
{
//! Red
float R;
//! Green
float G;
//! Blue
float B;
//! Return the color as string
std::string toString()
{
return std::to_string(R) + " " + std::to_string(G) + " " + std::to_string(B);
......
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