38     void save_header( 
const GeoModel3D& geomodel, std::ostream& out )
    40         out << 
"solid " << geomodel.name() << 
EOL;
    43     void save_footer( 
const GeoModel3D& geomodel, std::ostream& out )
    45         out << 
"endsolid" << geomodel.name() << 
EOL;
    49         const GeoModel3D& geomodel,
    53         out << 
"facet normal " << geomodel.mesh.polygons.normal( triangle_id )
    57     void begin_triangle( std::ostream& out )
    59         out << 
"outer loop" << 
EOL;
    62     void end_triangle( std::ostream& out )
    64         out << 
"endloop" << 
EOL;
    67     void save_triangle_vertex(
    68         const GeoModel3D& geomodel,
    70         index_t local_vertex_id,
    74             << geomodel.mesh.vertices.vertex(
    75                 geomodel.mesh.polygons.vertex(
    76                     ElementLocalVertex( triangle_id, local_vertex_id ) ) )
    81         const GeoModel3D& geomodel,
    85         save_normal( geomodel, triangle_id, out );
    86         begin_triangle( out );
    87         for( 
auto vertex : range( 3 ) ) {
    88             save_triangle_vertex( geomodel, triangle_id, vertex, out );
    93     void save_triangles( 
const GeoModel3D& geomodel, std::ostream& out )
    95         for( 
auto triangle : range( geomodel.mesh.polygons.nb_triangle() ) ) {
    96             save_triangle( geomodel, triangle, out );
   100     void check_stl_validity( 
const GeoModel3D& geomodel )
   102         if( geomodel.mesh.polygons.nb() != geomodel.mesh.polygons.nb_triangle() ) {
   103             throw RINGMeshException( 
"I/O",
   104                 "Geological model save in STL format support only triangles" );
   119     class STLIOHandler final: 
public GeoModelIOHandler< 3 > {
   121         void load( 
const std::string& filename, GeoModel3D& geomodel ) 
final   125             throw RINGMeshException( 
"I/O",
   126                 "Geological model loading of a from STL mesh not yet implemented" );
   130             const GeoModel3D& geomodel,
   131             const std::string& filename ) 
final   133             check_stl_validity( geomodel );
   134             std::ofstream out( filename.c_str() );
   136             save_header( geomodel, out );
   137             save_triangles( geomodel, out );
   138             save_footer( geomodel, out );
 void ringmesh_unused(const T &)