OGS
GMSHLineLoop.cpp
Go to the documentation of this file.
1
12#include "GMSHLineLoop.h"
13
14#include <ostream>
15
16#include "GMSHLine.h"
17
18namespace FileIO
19{
20namespace GMSH
21{
22GMSHLineLoop::GMSHLineLoop(bool is_sfc) : _is_sfc(is_sfc) {}
23
25{
26 const std::size_t n_lines(_lines.size());
27 for (std::size_t k(0); k < n_lines; k++)
28 {
29 delete _lines[k];
30 }
31}
32
33void GMSHLineLoop::write(std::ostream& os, std::size_t line_offset,
34 std::size_t sfc_offset) const
35{
36 const std::size_t n_lines(_lines.size());
37 for (std::size_t k(0); k < n_lines; k++)
38 {
39 (_lines[k])->write(os, line_offset + k);
40 }
41 os << "Line Loop(" << line_offset + n_lines << ") = {";
42 for (std::size_t k(0); k < n_lines - 1; k++)
43 {
44 os << line_offset + k << ",";
45 }
46 os << line_offset + n_lines - 1 << "};\n";
47
48 if (_is_sfc)
49 {
50 // write plane surface
51 os << "Plane Surface (" << sfc_offset << ") = {"
52 << line_offset + n_lines << "};\n";
53 }
54}
55
56} // end namespace GMSH
57} // end namespace FileIO
std::vector< GMSHLine * > _lines
void write(std::ostream &os, std::size_t line_offset, std::size_t sfc_offset=0) const
GMSHLineLoop(bool is_sfc=false)