71 istream& is = ips.
is();
88 node.get_values (ips);
95 xmin[k] = std::numeric_limits<T>::max();
96 xmax[k] = std::numeric_limits<T>::min();
98 for (
size_t i = 0, n = node.size(); i < n; ++i) {
100 xmin[k] = std::min (node[i][k], xmin[k]);
101 xmax[k] = std::max (node[i][k], xmax[k]);
106 if (fabs(xmax[k] - xmin[k]) < std::numeric_limits<T>::epsilon())
120 if (mark ==
"VERTICES") {
128 if (mark ==
"POLYGONS" || mark ==
"LINES" || mark ==
"CELLS")
break;
129 }
while (is >> ws >> mark);
130 bool have_vtk_cell_type =
false;
131 string mesh_fmt = mark;
134 else if (mesh_fmt ==
"CELLS") { hdr.
map_dimension = 0; have_vtk_cell_type =
true; }
135 else error_macro (
"geo: unexpected `" << mesh_fmt <<
"' in vtk input."
136 <<
" Expect LINES, POLYGONS or CELLS.");
141 mark = skip_optional_line (is);
143 std::vector<size_type> cell_trash (ncs);
144 std::vector<size_type> vtk_cell_type (ne);
150 for (
size_type ics = 0; ics < ncs; ics++) {
151 is >> cell_trash [ics];
154 if (have_vtk_cell_type) {
156 check_macro (mark ==
"CELL_TYPES",
"geo: unexpected `" << mark <<
"' in vtk input."
157 <<
" Expect CELL_TYPES.");
160 check_macro (ne == ne2,
"geo: unexpected CELL_TYPES size=`" << ne2 <<
"' , expect size="<<ne);
162 is >> vtk_cell_type [ie];
165 for (
size_type ie = 0, ics = 0; ie < ne; ie++) {
168 size_type variant = (!have_vtk_cell_type) ?
171 elt[ie].reset (variant, hdr.
order);
172 for (
size_type iloc = 0 ; iloc < nloc; iloc++, ics++) {
173 elt[ie][iloc] = cell_trash [ics];
183 for (
size_t count_key = 0; mark ==
"OFFSETS" || mark ==
"CONNECTIVITY"; ++count_key) {
184 if (mark ==
"OFFSETS") {
193 prec_offset = offset;
196 for (
size_type ics = 0; ics < ncs; ics++) {
197 is >> cell_trash [ics];
200 if (count_key == 1)
break;
202 mark = skip_optional_line (is);
204 for (
size_type ie = 0, ics = 0; ie < ne; ie++) {
206 elt[ie].reset (variant, hdr.
order);
208 for (
size_type iloc = 0 ; iloc < nloc; iloc++, ics++) {
209 check_macro (ics < ncs,
"unexpected ics="<<ics<<
" out of range [0:"<<ncs<<
"[");
210 elt[ie][iloc] = cell_trash [ics];
222 std::array<disarray_t, reference_element::max_variant> tmp_geo_element;
229 std::array<size_type, 4> counter;
234 tmp_geo_element [variant] [ige] = elt[ie];
241 omega.build_from_data (hdr, node, tmp_geo_element,
true);
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
bool scatch(std::istream &in, const std::string &ch, bool full_match=true)
scatch: see the rheostream page for the full documentation