26 std::ifstream in(filename.c_str());
29 ERR(
"FEFLOWGeoInterface::readFEFLOWFile(): Could not open file {:s}.",
34 unsigned dimension = 0;
35 std::vector<GeoLib::Point*> points;
36 std::vector<GeoLib::Polyline*> lines;
38 bool isXZplane =
false;
40 std::string line_string;
41 std::stringstream line_stream;
44 std::getline(in, line_string);
47 if (line_string.find(
"CLASS") != std::string::npos)
49 std::getline(in, line_string);
50 line_stream.str(line_string);
53 for (
int i = 0; i < 3; i++)
57 line_stream >> dimension;
62 else if (line_string ==
"GRAVITY")
64 std::getline(in, line_string);
65 line_stream.str(line_string);
67 line_stream >> vec[0] >> vec[1] >> vec[2];
68 if (vec[0] == 0.0 && vec[1] == -1.0 && vec[2] == 0.0)
77 else if (line_string ==
"SUPERMESH")
85 if (isXZplane && !points.empty())
87 for (
auto* pt : points)
93 std::string project_name(
97 geo_objects.
addPointVec(std::move(points), project_name,
108 const std::string& tag,
110 std::vector<GeoLib::Point*>& points)
113 nodesEle.firstChildElement(QString::fromStdString(tag));
118 QString str_pt_list1 = xmlEle.text();
119 std::istringstream ss(str_pt_list1.toStdString());
120 std::string line_str;
123 std::getline(ss, line_str);
124 boost::trim_right(line_str);
125 if (line_str.empty())
129 std::istringstream line_ss(line_str);
130 std::size_t pt_id = 0;
131 std::array<double, 3> pt_xyz;
133 for (
int i = 0; i < dim; i++)
135 line_ss >> pt_xyz[i];
143 std::vector<GeoLib::Point*>& points,
144 std::vector<GeoLib::Polyline*>& lines)
147 std::ostringstream oss;
148 std::string line_string;
151 std::getline(in, line_string);
153 oss << line_string <<
"\n";
154 if (line_string.find(
"</supermesh>") != std::string::npos)
159 const QString strXML(oss.str().c_str());
163 if (!doc.setContent(strXML))
165 ERR(
"FEFLOWGeoInterface::readSuperMesh(): Illegal XML format error");
170 QDomElement docElem = doc.documentElement();
172 QDomElement nodesEle = docElem.firstChildElement(
"nodes");
173 if (nodesEle.isNull())
179 const QString str = nodesEle.attribute(
"count");
180 const long n_points = str.toLong();
181 points.resize(n_points);
183 readPoints(nodesEle,
"fixed", dimension, points);
184 readPoints(nodesEle,
"linear", dimension, points);
185 readPoints(nodesEle,
"parabolic", dimension, points);
189 QDomElement polygonsEle = docElem.firstChildElement(
"polygons");
190 if (polygonsEle.isNull())
196 QDomNode child = polygonsEle.firstChild();
197 while (!child.isNull())
199 if (child.nodeName() !=
"polygon")
201 child = child.nextSibling();
204 QDomElement xmlEle = child.firstChildElement(
"nodes");
209 const QString str = xmlEle.attribute(
"count");
210 const std::size_t n_points = str.toLong();
211 QString str_ptId_list = xmlEle.text().simplified();
214 lines.push_back(line);
215 std::istringstream ss(str_ptId_list.toStdString());
216 for (std::size_t i = 0; i < n_points; i++)
220 line->addPoint(pt_id - 1);
222 line->addPoint(line->getPointID(0));
224 child = child.nextSibling();