Renamed the medit output function

This commit is contained in:
Mael Rouxel-Labbé 2018-06-05 18:14:40 +02:00
parent 573f4cf1eb
commit cdda597e4e
15 changed files with 41 additions and 49 deletions

View File

@ -3,7 +3,7 @@ namespace CGAL {
/// \ingroup PkgMesh_3IOFunctions
///
/// \brief Outputs a mesh complex to the medit (`.mesh`) file format.
/// See \cgalCite{frey:inria-00069921} for a detailed presentation of this file format.
/// See \cgalCite{frey:inria-00069921} for a comprehensive description of this file format.
///
/// \param os the output stream
/// \param c3t3 the mesh complex

View File

@ -879,10 +879,7 @@ void
output_to_medit(std::ostream& os,
const C3T3& c3t3,
bool rebind = false,
bool show_patches = false,
typename boost::enable_if_c<
boost::is_same<typename C3T3::Triangulation::Periodic_tag,
Tag_false>::value>::type* = NULL)
bool show_patches = false)
{
if ( rebind )
{

View File

@ -25,12 +25,15 @@
#include <CGAL/license/Mesh_3.h>
#include <CGAL/disable_warnings.h>
#include <string>
#include <CGAL/Mesh_3/io_signature.h>
#include <CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h>
#include <CGAL/IO/File_medit.h>
#include <CGAL/is_streamable.h>
#include <boost/type_traits/is_same.hpp>
#include <fstream>
#include <string>
namespace CGAL {
@ -50,14 +53,9 @@ struct Dump_c3t3 {
{
std::clog<<"======dump c3t3===== to: " << prefix << std::endl;
std::ofstream medit_file((prefix+".mesh").c_str());
// This medit function is meant to be used with Mesh_3 only
if(boost::is_same<typename C3t3::Triangulation::Periodic_tag, Tag_false>::value)
{
medit_file.precision(17);
CGAL::output_to_medit(medit_file, c3t3, false, true);
medit_file.close();
}
medit_file.precision(17);
CGAL::output_to_medit(medit_file, c3t3, false /*rebind*/, true /*show_patches*/);
medit_file.close();
std::string bin_filename = prefix;
bin_filename += ".binary.cgal";

View File

@ -3,7 +3,7 @@ namespace CGAL {
/// \ingroup PkgPeriodic_3_mesh_3IOFunctions
///
/// \brief Outputs a periodic mesh to the medit (`.mesh`) file format.
/// See \cgalCite{frey:inria-00069921} for a detailed presentation of this file format.
/// See \cgalCite{frey:inria-00069921} for a comprehensive description of this file format.
///
/// \param os the output stream
/// \param c3t3 the mesh complex
@ -16,11 +16,11 @@ namespace CGAL {
/// using the label of each adjacent cell.
///
template <class C3T3>
void output_to_medit(std::ostream& os,
const C3T3& c3t3,
int occurrence_count = 8,
bool distinguish_copies = true,
bool rebind = false,
bool show_patches = false);
void output_periodic_mesh_to_medit(std::ostream& os,
const C3T3& c3t3,
int occurrence_count = 8,
bool distinguish_copies = true,
bool rebind = false,
bool show_patches = false);
} // namespace CGAL

View File

@ -103,7 +103,7 @@ Many classes and functions used by this package are defined within the package
and \ref PkgMesh_3Parameters.
## Input/Output Functions ##
- \link PkgPeriodic_3_mesh_3IOFunctions `CGAL::output_to_medit()` \endlink
- \link PkgPeriodic_3_mesh_3IOFunctions `CGAL::output_periodic_mesh_to_medit()` \endlink
*/

View File

@ -459,7 +459,7 @@ This section presents various use cases of the periodic mesh generator.
\subsection Periodic_3_mesh_3SubMultipleCopies Outputting Multiple Copies of a Periodic Mesh
Generated meshes can be output to the `.mesh` file format, which can be read
with `medit`. The function \link PkgPeriodic_3_mesh_3IOFunctions `CGAL::output_to_medit()` \endlink
with `medit`. The function \link PkgPeriodic_3_mesh_3IOFunctions `CGAL::output_periodic_mesh_to_medit()` \endlink
takes a stream, a mesh complex, and - optionally - the number of periodic copies that should be drawn,
making it easier to observe the periodicity of the result.
\cgalFigureRef{Periodic_3_mesh_3Periodic_copies} illustrates the different output

View File

@ -89,9 +89,9 @@ int main(int argc, char** argv)
// Output
std::ofstream medit_file("output_multi_domain.mesh");
CGAL::output_to_medit<C3t3>(medit_file, c3t3, number_of_copies_in_output,
false /*do not associate different colors to each copy*/,
false /*do not rebind*/, true /*show patches*/);
CGAL::output_periodic_mesh_to_medit<C3t3>(medit_file, c3t3, number_of_copies_in_output,
false /*do not associate different colors to each copy*/,
false /*do not rebind*/, true /*show patches*/);
std::cout << "EXIT SUCCESS" << std::endl;
return 0;

View File

@ -68,7 +68,7 @@ int main(int argc, char** argv)
C3t3 c3t3 = CGAL::make_periodic_3_mesh_3<C3t3>(domain, criteria);
std::ofstream medit_file("output_implicit_shape.mesh");
CGAL::output_to_medit(medit_file, c3t3, number_of_copies_in_output);
CGAL::output_periodic_mesh_to_medit(medit_file, c3t3, number_of_copies_in_output);
std::cout << "EXIT SUCCESS" << std::endl;
return 0;

View File

@ -110,13 +110,13 @@ int main(int argc, char** argv)
C3t3 c3t3 = CGAL::make_periodic_3_mesh_3<C3t3>(domain, criteria, no_features(),
no_exude(), no_perturb());
std::ofstream medit_file("output_implicit_shape_without_protection.mesh");
CGAL::output_to_medit(medit_file, c3t3, number_of_copies_in_output);
CGAL::output_periodic_mesh_to_medit(medit_file, c3t3, number_of_copies_in_output);
// Mesh generation WITH feature preservation (and no optimizers)
C3t3 c3t3_bis = CGAL::make_periodic_3_mesh_3<C3t3>(domain, criteria, features(),
no_exude(), no_perturb());
std::ofstream medit_file_bis("output_implicit_shape_with_protection.mesh");
CGAL::output_to_medit(medit_file_bis, c3t3_bis, number_of_copies_in_output);
CGAL::output_periodic_mesh_to_medit(medit_file_bis, c3t3_bis, number_of_copies_in_output);
std::cout << "EXIT SUCCESS" << std::endl;
return 0;

View File

@ -76,7 +76,7 @@ int main(int argc, char** argv)
exude(sliver_bound=10, time_limit=0));
std::ofstream medit_file("output_implicit_shape_optimized.mesh");
CGAL::output_to_medit(medit_file, c3t3);
CGAL::output_periodic_mesh_to_medit(medit_file, c3t3);
// Below, the mesh generation and the optimizations are done in several calls
C3t3 c3t3_bis = CGAL::make_periodic_3_mesh_3<C3t3>(domain, criteria,
@ -84,7 +84,7 @@ int main(int argc, char** argv)
no_perturb(), no_exude());
std::ofstream medit_file_bis("output_implicit_shape_non-optimized.mesh");
CGAL::output_to_medit(medit_file_bis, c3t3_bis);
CGAL::output_periodic_mesh_to_medit(medit_file_bis, c3t3_bis);
// Now, call each optimizer with its global function
CGAL::odt_optimize_periodic_3_mesh_3(c3t3_bis, domain, convergence=0.03, freeze_bound=0.02, time_limit=30);
@ -93,7 +93,7 @@ int main(int argc, char** argv)
CGAL::exude_periodic_3_mesh_3(c3t3_bis, sliver_bound=10, time_limit=0);
std::ofstream medit_file_ter("output_implicit_shape_two_steps.mesh");
CGAL::output_to_medit(medit_file_ter, c3t3_bis, number_of_copies_in_output);
CGAL::output_periodic_mesh_to_medit(medit_file_ter, c3t3_bis, number_of_copies_in_output);
std::cout << "EXIT SUCCESS" << std::endl;
return 0;

View File

@ -78,7 +78,7 @@ int main(int argc, char** argv)
// Output
std::ofstream medit_file("output_implicit_with_subdomains.mesh");
CGAL::output_to_medit(medit_file, c3t3, number_of_copies_in_output);
CGAL::output_periodic_mesh_to_medit(medit_file, c3t3, number_of_copies_in_output);
std::cout << "EXIT SUCCESS" << std::endl;
return 0;

View File

@ -353,15 +353,12 @@ void output_to_medit(std::ostream& os,
* each adjacent cell.
*/
template <class C3T3>
void output_to_medit(std::ostream& os,
const C3T3& c3t3,
const int occurrence_count = 8,
const bool distinguish_copies = true,
bool rebind = false,
bool show_patches = false,
typename boost::enable_if_c<
boost::is_same<typename C3T3::Triangulation::Periodic_tag,
Tag_true>::value>::type* = NULL)
void output_periodic_mesh_to_medit(std::ostream& os,
const C3T3& c3t3,
const int occurrence_count = 8,
const bool distinguish_copies = true,
bool rebind = false,
bool show_patches = false)
{
if(rebind)
{

View File

@ -244,7 +244,7 @@ int main()
// Output
std::ofstream medit_file(file_name.c_str());
CGAL::output_to_medit(medit_file, c3t3);
CGAL::output_periodic_mesh_to_medit(medit_file, c3t3);
}
std::cout << "EXIT SUCCESS" << std::endl;

View File

@ -2,8 +2,8 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_mesh_3/IO/File_medit.h>
#include <CGAL/make_periodic_3_mesh_3.h>
#include <CGAL/Periodic_3_mesh_3/IO/File_medit.h>
#include <CGAL/Periodic_3_mesh_triangulation_3.h>
#include <CGAL/Periodic_3_wrapper.h>
@ -97,7 +97,7 @@ void test_protected_sphere()
// Output
std::ofstream medit_file_bis("protected_sphere.mesh");
CGAL::output_to_medit(medit_file_bis, c3t3_bis);
CGAL::output_periodic_mesh_to_medit(medit_file_bis, c3t3_bis);
}
////////////////////////////////////////////////////////////////////////////////
@ -162,7 +162,7 @@ void test_protected_squary_cylinder()
// Output
std::ofstream medit_file_bis("squary_cylinder.mesh");
CGAL::output_to_medit(medit_file_bis, c3t3_bis);
CGAL::output_periodic_mesh_to_medit(medit_file_bis, c3t3_bis);
}
////////////////////////////////////////////////////////////////////////////////
@ -275,7 +275,7 @@ void test_protected_squary_cylinder_2()
// Output
std::ofstream medit_file_bis("squary_cylinder_2.mesh");
CGAL::output_to_medit(medit_file_bis, c3t3_bis);
CGAL::output_periodic_mesh_to_medit(medit_file_bis, c3t3_bis);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -305,7 +305,7 @@ int main(int, char**)
oss_2 << iter->first << "__" << it->first << "__" << *i << ".mesh";
std::string output_filename = oss_2.str();
std::ofstream medit_file( output_filename.data() );
CGAL::output_to_medit(medit_file, c3t3, *i);
CGAL::output_periodic_mesh_to_medit(medit_file, c3t3, *i);
medit_file.close();
std::cout << ", " << *i << "-copy Saved" << std::flush;