37 #ifndef Foam_SVGTools_H 38 #define Foam_SVGTools_H 55 typedef std::pair<const char*, string>
entryType;
70 const std::initializer_list<entryType>& styles = {},
71 const std::initializer_list<entryType>& elems = {}
80 void addAttr(
const char*
key,
const Type& value)
94 os <<
"<" << ele.key_;
96 for (
const auto&
e : ele.elems_)
98 os <<
" " <<
e.first <<
"=" <<
e.second;
102 for (
const auto&
s : ele.styles_)
104 os <<
s.first <<
":" <<
s.second.c_str() <<
";";
131 const std::initializer_list<entryType>& styles = {},
132 const word anchor =
"middle",
133 const std::initializer_list<entryType>& elems = {}
136 element(
"text", styles, elems),
144 entryType(
"font-family",
"Arial, Helvetica, sans-serif")
152 os << static_cast<const element&>(t);
154 os << t.text_.c_str();
177 const std::initializer_list<entryType>& styles = {},
178 const std::initializer_list<entryType>& elems = {}
193 os << static_cast<const element&>(l);
209 header(
const label width,
const label height)
217 os <<
"<svg viewBox=\"0 0 " <<
h.width_ <<
' ' <<
h.height_ <<
"\"" 218 <<
" xmlns=\"http://www.w3.org/2000/svg\"" 219 <<
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"" 220 <<
" xmlns:bx=\"https://www.boxy-svg.com/bx\">";
227 const char*
end =
"</svg>";
friend Ostream & operator<<(Ostream &os, const text &t)
DynamicList< entryType > elems_
line(const label x1, const label y1, const label x2, const label y2, const std::initializer_list< entryType > &styles={}, const std::initializer_list< entryType > &elems={})
element(const word &key, const std::initializer_list< entryType > &styles={}, const std::initializer_list< entryType > &elems={})
PointRef end() const noexcept
The end (second) point.
void addAttr(const char *key, const Type &value)
Foam::string str() const
Get the string. As Foam::string instead of std::string (may change in future)
text(const string text, const label left, const label top, const std::initializer_list< entryType > &styles={}, const word anchor="middle", const std::initializer_list< entryType > &elems={})
const dimensionedScalar e
Elementary charge.
Ostream & operator<<(Ostream &os, const element &e)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
auto key(const Type &t) -> std::enable_if_t< std::is_enum_v< Type >, std::underlying_type_t< Type > >
dimensionedScalar y1(const dimensionedScalar &ds)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
std::pair< const char *, string > entryType
OBJstream os(runTime.globalPath()/outputName)
friend Ostream & operator<<(Ostream &os, const element &ele)
void push_back(const T &val)
Copy append an element to the end of this list.
void addAttrStr(const char *key, const string &str)
const dimensionedScalar h
Planck constant.
DynamicList< entryType > styles_
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
friend Ostream & operator<<(Ostream &os, const line &l)