mirror of https://github.com/CGAL/cgal
parent
9cbf8fa23c
commit
fc7f67269f
|
|
@ -975,7 +975,7 @@ update_mesh(const Moves_vector& moves,
|
||||||
FT size = std::get<2>(*it);
|
FT size = std::get<2>(*it);
|
||||||
|
|
||||||
#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
|
#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
|
||||||
std::cout << "Moving #" << it - moves.begin()
|
std::cerr << "Moving #" << it - moves.begin()
|
||||||
<< " addr: " << &*v
|
<< " addr: " << &*v
|
||||||
<< " pt: " << tr_.point(v)
|
<< " pt: " << tr_.point(v)
|
||||||
<< " move: " << move << std::endl;
|
<< " move: " << move << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,56 @@
|
||||||
#include <CGAL/use.h>
|
#include <CGAL/use.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
static constexpr bool verbose =
|
||||||
|
#if CGAL_MESH_3_VERBOSE
|
||||||
|
true;
|
||||||
|
#else
|
||||||
|
false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
std::stringstream cerr_output;
|
||||||
|
|
||||||
template <typename K, typename Concurrency_tag = CGAL::Sequential_tag>
|
template <typename K, typename Concurrency_tag = CGAL::Sequential_tag>
|
||||||
struct Polyhedron_with_features_tester : public Tester<K>
|
struct Polyhedron_with_features_tester : public Tester<K>
|
||||||
{
|
{
|
||||||
|
std::streambuf* old_cerr_buf;
|
||||||
|
std::string tag_name;
|
||||||
|
|
||||||
|
Polyhedron_with_features_tester(std::string tag_name)
|
||||||
|
: old_cerr_buf(std::cerr.rdbuf(verbose ? cerr_output.rdbuf() : std::cerr.rdbuf()))
|
||||||
|
, tag_name(tag_name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
~Polyhedron_with_features_tester()
|
||||||
|
{
|
||||||
|
std::cerr.rdbuf(old_cerr_buf);
|
||||||
|
if(verbose) {
|
||||||
|
const auto output = cerr_output.str();
|
||||||
|
const auto str_size= output.size();
|
||||||
|
const auto str_begin = output.data();
|
||||||
|
const auto str_end = str_begin + str_size;
|
||||||
|
constexpr auto nb = static_cast<decltype(str_size)>(10000);
|
||||||
|
auto pos1 = str_begin + (std::min)(nb, str_size);
|
||||||
|
assert(pos1 <= str_end);
|
||||||
|
const auto pos2 = str_end - (std::min)(nb, str_size);
|
||||||
|
assert(pos2 >= str_begin);
|
||||||
|
if(pos2 <= pos1) {
|
||||||
|
pos1 = str_end;
|
||||||
|
}
|
||||||
|
std::cerr << "NOW THE FIRST AND LAST 10k CHARACTERS OF THE CERR OUTPUT:\n";
|
||||||
|
std::cerr << "-----\n" << std::string(str_begin, pos1) << "\n-----\n";
|
||||||
|
if(pos1 != str_end) {
|
||||||
|
std::cerr << "[...]\n-----\n" << std::string(pos2, str_end) << "\n-----\n";
|
||||||
|
}
|
||||||
|
const auto file_name = std::string("test_meshing_verbose-") + tag_name + ".txt";
|
||||||
|
std::ofstream file_output(file_name);
|
||||||
|
file_output << output;
|
||||||
|
std::cerr << "Full log is output to " << file_name << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
void operator()() const
|
void operator()() const
|
||||||
{
|
{
|
||||||
typedef CGAL::Mesh_3::Robust_intersection_traits_3<K> Gt;
|
typedef CGAL::Mesh_3::Robust_intersection_traits_3<K> Gt;
|
||||||
|
|
@ -107,14 +153,17 @@ struct Polyhedron_with_features_tester : public Tester<K>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Polyhedron_with_features_tester<K_e_i> test_epic;
|
{
|
||||||
std::cerr << "Mesh generation from a polyhedron with edges:\n";
|
std::cerr << "Mesh generation from a polyhedron with edges:\n";
|
||||||
test_epic();
|
Polyhedron_with_features_tester<K_e_i> test_epic("sequential");
|
||||||
|
test_epic();
|
||||||
|
}
|
||||||
#ifdef CGAL_LINKED_WITH_TBB
|
#ifdef CGAL_LINKED_WITH_TBB
|
||||||
Polyhedron_with_features_tester<K_e_i, CGAL::Parallel_tag> test_epic_p;
|
{
|
||||||
std::cerr << "Parallel mesh generation from a polyhedron with edges:\n";
|
std::cerr << "Parallel mesh generation from a polyhedron with edges:\n";
|
||||||
test_epic_p();
|
Polyhedron_with_features_tester<K_e_i, CGAL::Parallel_tag> test_epic_p("parallel");
|
||||||
|
test_epic_p();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
|
|
@ -170,6 +171,10 @@ int main(int argc, char** argv)
|
||||||
std::cout << vd.number_of_faces() << " faces" << std::endl;
|
std::cout << vd.number_of_faces() << " faces" << std::endl;
|
||||||
std::cout << "dimension = " << vd.dual().dimension() << std::endl;
|
std::cout << "dimension = " << vd.dual().dimension() << std::endl;
|
||||||
|
|
||||||
|
// redirect std::cout to cout_output
|
||||||
|
std::stringstream cout_output;
|
||||||
|
std::streambuf* old_cout_buf = std::cout.rdbuf(cout_output.rdbuf());
|
||||||
|
|
||||||
VD::Vertex_iterator vit = vd.vertices_begin(), vend = vd.vertices_end();
|
VD::Vertex_iterator vit = vd.vertices_begin(), vend = vd.vertices_end();
|
||||||
for(; vit!=vend; ++vit)
|
for(; vit!=vend; ++vit)
|
||||||
{
|
{
|
||||||
|
|
@ -197,5 +202,29 @@ int main(int argc, char** argv)
|
||||||
CGAL_USE(opposite_h);
|
CGAL_USE(opposite_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now restore std::cout and display the output
|
||||||
|
std::cout.rdbuf(old_cout_buf);
|
||||||
|
const auto output = cout_output.str();
|
||||||
|
const auto str_size = output.size();
|
||||||
|
const auto str_begin = output.data();
|
||||||
|
const auto str_end = str_begin + str_size;
|
||||||
|
constexpr auto nb = static_cast<decltype(str_size)>(10000);
|
||||||
|
auto pos1 = str_begin + (std::min)(nb, str_size);
|
||||||
|
assert(pos1 <= str_end);
|
||||||
|
const auto pos2 = str_end - (std::min)(nb, str_size);
|
||||||
|
assert(pos2 >= str_begin);
|
||||||
|
if (pos2 <= pos1) {
|
||||||
|
pos1 = str_end;
|
||||||
|
}
|
||||||
|
std::cout << "NOW THE FIRST AND LAST 10k CHARACTERS OF THE COUT OUTPUT:\n";
|
||||||
|
std::cout << "-----\n" << std::string(str_begin, pos1) << "\n-----\n";
|
||||||
|
if (pos1 != str_end) {
|
||||||
|
std::cout << "[...]\n-----\n" << std::string(pos2, str_end) << "\n-----\n";
|
||||||
|
}
|
||||||
|
const auto file_name = "vda_tos2_test_output.txt";
|
||||||
|
std::ofstream file_output(file_name);
|
||||||
|
file_output << output;
|
||||||
|
std::cout << "Full log is output to " << file_name << "\n";
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue