mirror of https://github.com/CGAL/cgal
fix output_to_vtu() when Subdomain_index is int
This commit is contained in:
parent
0a8ca42680
commit
3ab0737d4f
|
|
@ -268,12 +268,16 @@ write_attributes(std::ostream& os,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum VTU_ATTRIBUTE_TYPE{
|
enum VTU_ATTRIBUTE_TYPE{
|
||||||
DOUBLE=0,
|
INTEGER = 0,
|
||||||
|
DOUBLE,
|
||||||
UNIT_8,
|
UNIT_8,
|
||||||
SIZE_TYPE
|
SIZE_TYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::variant<const std::vector<double>*, const std::vector<uint8_t>*, const std::vector<std::size_t>* > Vtu_attributes;
|
typedef std::variant<const std::vector<int>*,
|
||||||
|
const std::vector<double>*,
|
||||||
|
const std::vector<uint8_t>*,
|
||||||
|
const std::vector<std::size_t>* > Vtu_attributes;
|
||||||
|
|
||||||
template <class C3T3>
|
template <class C3T3>
|
||||||
void output_to_vtu_with_attributes(std::ostream& os,
|
void output_to_vtu_with_attributes(std::ostream& os,
|
||||||
|
|
@ -284,6 +288,7 @@ void output_to_vtu_with_attributes(std::ostream& os,
|
||||||
//CGAL_assertion(attributes.size() == attribute_types.size());
|
//CGAL_assertion(attributes.size() == attribute_types.size());
|
||||||
typedef typename C3T3::Triangulation Tr;
|
typedef typename C3T3::Triangulation Tr;
|
||||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||||
|
|
||||||
const Tr& tr = c3t3.triangulation();
|
const Tr& tr = c3t3.triangulation();
|
||||||
std::map<Vertex_handle, std::size_t> V;
|
std::map<Vertex_handle, std::size_t> V;
|
||||||
//write header
|
//write header
|
||||||
|
|
@ -316,9 +321,12 @@ void output_to_vtu_with_attributes(std::ostream& os,
|
||||||
{
|
{
|
||||||
switch(attributes[i].second.index()){
|
switch(attributes[i].second.index()){
|
||||||
case 0:
|
case 0:
|
||||||
write_attribute_tag(os,attributes[i].first, *std::get<const std::vector<double>* >(attributes[i].second), binary,offset);
|
write_attribute_tag(os, attributes[i].first, *std::get<const std::vector<int>* >(attributes[i].second), binary, offset);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
write_attribute_tag(os,attributes[i].first, *std::get<const std::vector<double>* >(attributes[i].second), binary,offset);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
write_attribute_tag(os,attributes[i].first, *std::get<const std::vector<uint8_t>* >(attributes[i].second), binary,offset);
|
write_attribute_tag(os,attributes[i].first, *std::get<const std::vector<uint8_t>* >(attributes[i].second), binary,offset);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -336,9 +344,12 @@ void output_to_vtu_with_attributes(std::ostream& os,
|
||||||
for(std::size_t i = 0; i< attributes.size(); ++i) {
|
for(std::size_t i = 0; i< attributes.size(); ++i) {
|
||||||
switch(attributes[i].second.index()){
|
switch(attributes[i].second.index()){
|
||||||
case 0:
|
case 0:
|
||||||
write_attributes(os, *std::get<const std::vector<double>* >(attributes[i].second));
|
write_attributes(os, *std::get<const std::vector<int>* >(attributes[i].second));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
write_attributes(os, *std::get<const std::vector<double>* >(attributes[i].second));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
write_attributes(os, *std::get<const std::vector<uint8_t>* >(attributes[i].second));
|
write_attributes(os, *std::get<const std::vector<uint8_t>* >(attributes[i].second));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -371,14 +382,13 @@ void output_to_vtu(std::ostream& os,
|
||||||
const C3T3& c3t3,
|
const C3T3& c3t3,
|
||||||
Mode mode = BINARY)
|
Mode mode = BINARY)
|
||||||
{
|
{
|
||||||
typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
|
typedef typename C3T3::Cell_handle Cell_handle;
|
||||||
std::vector<double> mids;
|
typedef typename C3T3::Subdomain_index Subdomain_index;
|
||||||
for( Cell_iterator cit = c3t3.cells_in_complex_begin() ;
|
|
||||||
cit != c3t3.cells_in_complex_end() ;
|
std::vector<Subdomain_index> mids;
|
||||||
++cit )
|
for( Cell_handle c : c3t3.cells_in_complex())
|
||||||
{
|
{
|
||||||
double v = cit->subdomain_index();
|
mids.push_back(c->subdomain_index());
|
||||||
mids.push_back(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<const char*, internal::Vtu_attributes > > atts;
|
std::vector<std::pair<const char*, internal::Vtu_attributes > > atts;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue