Commit 1cd82555 authored by absingh's avatar absingh
Browse files

Fixing pvtp writer after merge from FD_solver

parent 7cd835c3
Pipeline #3068 failed with stages
in 23 minutes and 8 seconds
......@@ -135,6 +135,85 @@ template<unsigned int i, typename ele_g, bool has_attributes> std::string get_po
}
/*! \brief Get the vtp properties header appending a prefix at the end
*
* \tparam has_attributes indicate if the properties have attributes name
* \param oprp prefix
*
*/
template<unsigned int i, typename ele_g, bool has_attributes> std::string get_point_property_header_impl_new_pvtp(const std::string & oprp, const openfpm::vector<std::string> & prop_names)
{
//! vertex node output string
std::string v_out;
typedef typename boost::mpl::at<typename ele_g::value_type::value_type::type,boost::mpl::int_<i>>::type ctype;
// Check if T is a supported format
// for now we support only scalar of native type
if (std::rank<ctype>::value == 1)
{
if (std::extent<ctype>::value <= 3)
{
//Get type of the property
std::string type = getTypeNew<typename std::remove_all_extents<ctype>::type>();
// if the type is not supported skip-it
if (type.size() == 0)
{
#ifndef DISABLE_ALL_RTTI
std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " the type " << demangle(typeid(ctype).name()) << " is not supported by vtp\n";
#endif
return "";
}
// Create point data properties
v_out += " <PDataArray type=\""+type+"\" Name=\""+getAttrName<ele_g,has_attributes>::get(i,prop_names,oprp)+"\""+" NumberOfComponents=\"3\"/>\n";
//v_out += "VECTORS " + getAttrName<ele_g,has_attributes>::get(i,prop_names,oprp) + " " + type + "\n";
}
}
else
{
std::string type = getTypeNew<typename std::remove_all_extents<ctype>::type>();
// if the type is not supported return
if (type.size() == 0)
{
// We check if is a custom vtk writable object
if (is_vtk_writable<ctype>::value == true)
{
type = getTypeNew<typename vtk_type<ctype,is_custom_vtk_writable<ctype>::value>::type >();
// We check if it is a vector or scalar like type
if (vtk_dims<ctype>::value == 1) {
v_out += " <PDataArray type=\"" + type + "\" Name=\"" +
getAttrName<ele_g, has_attributes>::get(i, prop_names, oprp) + "\"/>\n";
//v_out += "SCALARS " + getAttrName<ele_g,has_attributes>::get(i,prop_names,oprp) + " " + type + "\n";
}
else{
v_out += " <PDataArray type=\""+type+"\" Name=\""+getAttrName<ele_g,has_attributes>::get(i,prop_names,oprp)+"\""+" NumberOfComponents=\"3\"/>\n";
//v_out += "VECTORS " + getAttrName<ele_g,has_attributes>::get(i,prop_names,oprp) + " " + type + "\n";
}
}
return v_out;
}
// Create point data properties
v_out += " <PDataArray type=\"" + type + "\" Name=\"" +
getAttrName<ele_g, has_attributes>::get(i, prop_names, oprp) + "\"/>\n";
//v_out += "SCALARS " + getAttrName<ele_g,has_attributes>::get(i,prop_names,oprp) + " " + type + "\n";
// Default lookup table
//v_out += "LOOKUP_TABLE default\n";
}
// return the vertex list
return v_out;
}
/*! \brief Get the vtk properties header appending a prefix at the end
*
* \tparam has_attributes indicate if the properties have attributes name
......@@ -713,6 +792,11 @@ struct meta_prop_new
}
}
static inline void get_pvtp_out(std::string & v_out, const openfpm::vector<std::string> & prop_names){
v_out += get_point_property_header_impl_new_pvtp<I::value,ele_g,has_attributes<typename ele_g::value_type::value_type>::value>("",prop_names);
}
};
//! Partial specialization for N=1 1D-Array
......@@ -808,6 +892,12 @@ struct meta_prop_new<I, ele_g,St,T[N1],is_writable>
v_out += " </DataArray>\n";
}
}
static inline void get_pvtp_out(std::string & v_out, const openfpm::vector<std::string> & prop_names){
v_out += get_point_property_header_impl_new_pvtp<I::value,ele_g,has_attributes<typename ele_g::value_type::value_type>::value>("",prop_names);
}
};
//! Partial specialization for N=2 2D-Array
......@@ -889,6 +979,12 @@ struct meta_prop_new<I, ele_g,St, T[N1][N2],is_writable>
}
}
}
static inline void get_pvtp_out(std::string & v_out, const openfpm::vector<std::string> & prop_names){
v_out += get_point_property_header_impl_new_pvtp<I::value,ele_g,has_attributes<typename ele_g::value_type::value_type>::value>("",prop_names);
}
};
......
This diff is collapsed.
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