12#ifndef BEMBEL_SRC_GEOMETRY_GEOMETRYIGS_HPP_
13#define BEMBEL_SRC_GEOMETRY_GEOMETRYIGS_HPP_
30 std::cerr <<
"File " <<
file_name <<
" doesn't exist!";
37 std::cerr <<
"Format of the file not supported! I assume that character 72 "
38 "denotes the section";
42 while (
row[72] !=
'D') {
44 assert(!file.eof() &&
"End of file should not be found here!");
48 while (
row[72] !=
'P') {
49 std::stringstream
iss;
56 assert(
info1[0] == 128 &&
"Entry type must be NURBS surface!");
68 assert(!file.eof() &&
"End of file should not be found here!");
72 std::vector<Patch>
out;
76 std::stringstream
iss;
78 std::vector<double>
data;
86 while (std::getline(
iss,
word,
',')) {
99 const int N1 = 1 +
K1 -
M1;
100 const int N2 = 1 +
K2 -
M2;
101 const int A =
N1 + 2 *
M1;
102 const int B =
N2 + 2 *
M2;
103 const int C = (1 +
K1) * (1 +
K2);
111 data.begin() +
A +
B + 2);
113 const int M =
K2 + 1;
114 const int N =
K1 + 1;
159 const std::vector<std::string>&
section,
161 std::ofstream file(
file_name, std::ios::app);
163 const int index = std::distance(
section.begin(),
it);
164 file << std::left << std::setw(72) << *
it <<
section_char << std::right
165 << std::setw(7) << index + 1 <<
"\n";
182 const std::vector<std::string>&
section,
184 std::ofstream file(
file_name, std::ios::app);
187 file << std::left << std::setw(64) << *
it
188 << std::right << std::setw(8) <<
patch_idx <<
"P"
189 << std::right << std::setw(7) <<
last_line <<
"\n";
207 std::vector<std::string>
out;
210 std::string
line =
"";
237 std::vector<std::string>
section(4);
239 section[1] =
"IGES obtained from Bembel.";
240 section[2] =
"See <http://www.bembel.eu>";
254 std::ostringstream
stm;
255 stm << std::setprecision(precision) <<
d;
266 std::vector<std::string>
out(24);
267 std::time_t
now = std::time(
nullptr);
283 out[5] =
"writeIGSFile";
295 out[11] =
"Nurbs from Bembel";
309 out[18] =
"0.000001";
313 out[20] =
"Maximilian Nolte";
315 out[21] =
"CEM - TU Darmstadt";
344 fid << std::setw(8) <<
"128"
354 << std::setw(7) << (
i + 1) * 2 - 1<<
"\n";
356 fid << std::setw(8) <<
"128"
361 << std::setw(8) <<
" "
362 << std::setw(8) <<
" "
363 << std::setw(8) <<
" "
366 << std::setw(7) << (
i + 1) * 2 <<
"\n";
386 const int precision) {
391 "We can not handle internal knots");
393 "We can not handle internal knots");
400 const std::array<double, 2>
span_x = {0, 1};
401 const std::array<double, 2>
span_y = {0, 1};
413 for (
auto i = 0;
i <
size; ++
i) {
453 for (
auto i = 0;
i <
size; ++
i) {
482 const int precision = 6) {
522 std::ofstream file(
file_name, std::ios::app);
523 file << std::left << std::setw(72) <<
last_section.str()
525 << std::right << std::setw(7) << 1 <<
"\n";
void init_Patch(const std::vector< Eigen::Matrix< double, -1, -1 > > &xyzw, const std::vector< double > &x_knots, const std::vector< double > &y_knots)
init
int writeDirectory(std::string file_name, std::vector< int > start_idx, std::vector< int > number_of_lines)
Write the IGES Directory section into the given file.
std::vector< std::string > writePatchData(const Patch &patch, const int precision)
This Function writes the patch from Bembel into a vector which can be written into an IGES file.
int writeParameterSection(std::string file_name, const std::vector< std::string > §ion, const int patch_idx, const int start_count)
This function writes a the parameter section of the IGES file.
void writeIGSHeader(std::string file_name)
Write the IGES header into the given file.
void writeSection(std::string file_name, const std::vector< std::string > §ion, const char section_char)
This function writes a given section to the specified file.
std::vector< std::string > makeSection(std::vector< std::string > data, const int linewidth=72)
Transform a vector of Data in a vector of lines with a specific length.
std::vector< Patch > LoadGeometryFileIGS(const std::string &file_name) noexcept
loads geometry from IGES file. Note that the direction of the normals must be consistent.
void writeIGSFile(const std::vector< Patch > &geometry, std::string file_name, const int precision=6)
Writes Geometry into an IGES file format.
int writeGlobalSection(std::string file_name)
Write the IGES Global section into the given file.
Routines for the evalutation of pointwise errors.
std::string double_to_string(double d, const int precision)
Convert a double to a string with given precision.
constexpr int getFunctionSpaceOutputDimension()