//TODO:[GK] Obey parameters
-//TODO:[GK] Flip y-axis?
template <>
void GridOut::write_xfig (
const Triangulation<2>& tria,
// The following text was copied
// from an existing XFig file.
- out << "#FIG 3.2\nLandscape\nCenter\nInches" << '\n'
- << "A4\n100.00\nSingle" << '\n'
+ out << "#FIG 3.2\nLandscape\nCenter\nInches" << std::endl
+ << "A4\n100.00\nSingle" << std::endl
// Background is transparent
- << "-3" << '\n'
- << "# generated by deal.II GridOut class" << '\n'
- << "# reduce first number to scale up image" << '\n'
- << "1200 2" << '\n';
+ << "-3" << std::endl
+ << "# generated by deal.II GridOut class" << std::endl
+ << "# reduce first number to scale up image" << std::endl
+ << "1200 2" << std::endl;
+ // Write custom palette
+ //grey
+ unsigned int colno = 32;
+ out << "0 " << colno++ << " #ff0000" << std::endl;
+ out << "0 " << colno++ << " #ff8000" << std::endl;
+ out << "0 " << colno++ << " #ffd000" << std::endl;
+ out << "0 " << colno++ << " #ffff00" << std::endl;
+ out << "0 " << colno++ << " #c0ff00" << std::endl;
+ out << "0 " << colno++ << " #80ff00" << std::endl;
+ out << "0 " << colno++ << " #00f000" << std::endl;
+ out << "0 " << colno++ << " #00f0c0" << std::endl;
+ out << "0 " << colno++ << " #00f0ff" << std::endl;
+ out << "0 " << colno++ << " #00c0ff" << std::endl;
+ out << "0 " << colno++ << " #0080ff" << std::endl;
+ out << "0 " << colno++ << " #0040ff" << std::endl;
+ out << "0 " << colno++ << " #0000c0" << std::endl;
+ out << "0 " << colno++ << " #5000ff" << std::endl;
+ out << "0 " << colno++ << " #8000ff" << std::endl;
+ out << "0 " << colno++ << " #b000ff" << std::endl;
+ out << "0 " << colno++ << " #ff00ff" << std::endl;
+ out << "0 " << colno++ << " #ff80ff" << std::endl;
+ // grey
+ for (unsigned int i=0;i<8;++i)
+ out << "0 " << colno++ << " #" << std::hex << 32*i+31 << 32*i+31 << 32*i+31 << std::dec << std::endl;
+ // green
+ for (unsigned int i=1;i<16;++i)
+ out << "0 " << colno++ << " #00" << std::hex << 16*i+15 << std::dec << "00" << std::endl;
+ // yellow
+ for (unsigned int i=1;i<16;++i)
+ out << "0 " << colno++ << " #" << std::hex << 16*i+15 << 16*i+15 << std::dec << "00" << std::endl;
+ // red
+ for (unsigned int i=1;i<16;++i)
+ out << "0 " << colno++ << " #" << std::hex << 16*i+15 << std::dec << "0000" << std::endl;
+ // purple
+ for (unsigned int i=1;i<16;++i)
+ out << "0 " << colno++ << " #" << std::hex << 16*i+15 << "00" << 16*i+15 << std::dec << std::endl;
+ // blue
+ for (unsigned int i=1;i<16;++i)
+ out << "0 " << colno++ << " #0000" << std::hex << 16*i+15 << std::dec << std::endl;
+ // cyan
+ for (unsigned int i=1;i<16;++i)
+ out << "0 " << colno++ << " #00" << std::hex << 16*i+15 << 16*i+15 << std::dec << std::endl;
// We write all cells and cells on
// coarser levels are behind cells
// with black line
<< " 0 ";
// Fill color
- if (xfig_flags.level_color)
- out << cell->level() + 8;
- else
- out << cell->material_id() + 1;
+ switch(xfig_flags.color_by)
+ {
+//TODO[GK]: Simplify after deprecation period is over
+ case GridOutFlags::XFig::material_id:
+ if (xfig_flags.level_color)
+ out << cell->level() + 32;
+ else
+ out << cell->material_id() + 32;
+ break;
+ case GridOutFlags::XFig::level_number:
+ out << cell->level() + 8;
+ break;
+ case GridOutFlags::XFig::subdomain_id:
+ out << cell->subdomain_id() + 32;
+ break;
+ case GridOutFlags::XFig::level_subdomain_id:
+ out << cell->level_subdomain_id() + 32;
+ break;
+ }
+
// Depth, unused, fill
out << ' '
<< (xfig_flags.level_depth
// some style parameters
<< " 0 0 -1 0 0 "
// number of points
- << nv+1 << '\n';
+ << nv+1 << std::endl;
// For each point, write scaled
// and shifted coordinates
{
int val = (int)(1200 * xfig_flags.scaling(d) *
(p(d)-xfig_flags.offset(d)));
- out << '\t' << val;
+ out << '\t' << ((d==0) ? val : -val);
}
- out << '\n';
+ out << std::endl;
}
// Now write boundary edges
static const unsigned int face_reorder[4]={2,1,3,0};
// some style parameters
<< " 0 0 -1 0 0 "
// number of points
- << nvf << '\n';
+ << nvf << std::endl;
// For each point, write scaled
// and shifted coordinates
{
int val = (int)(1200 * xfig_flags.scaling(d) *
(p(d)-xfig_flags.offset(d)));
- out << '\t' << val;
+ out << '\t' << ((d==0) ? val : -val);
}
- out << '\n';
+ out << std::endl;
}
}
}