8 #include <boost/spirit/include/qi.hpp> 10 #include <boost/bind.hpp> 12 #include "../MeshGenerator.hpp" 19 namespace qi = boost::spirit::qi;
20 namespace spirit = boost::spirit;
22 template <
typename Iterator>
26 tetmesh_grammar::base_type(content),
27 generator_(_generator) {
29 content = node_section_header >> *node >> element_section_header >> *element;
31 node_section_header = spirit::lit(
"Vertices") >> qi::int_;
33 node = qi::double_[
boost::bind(&MeshGenerator::add_vertex_component, &generator_, ::_1)] >>
34 qi::double_[
boost::bind(&MeshGenerator::add_vertex_component, &generator_, ::_1)] >>
35 qi::double_[
boost::bind(&MeshGenerator::add_vertex_component, &generator_, ::_1)] >>
38 element_section_header = spirit::lit(
"Tetrahedra") >>
39 qi::int_[
boost::bind(&MeshGenerator::set_num_cells, &generator_, ::_1)];
41 element = qi::int_[
boost::bind(&MeshGenerator::add_cell_vertex, &generator_, ::_1)] >>
42 qi::int_[
boost::bind(&MeshGenerator::add_cell_vertex, &generator_, ::_1)] >>
43 qi::int_[
boost::bind(&MeshGenerator::add_cell_vertex, &generator_, ::_1)] >>
44 qi::int_[
boost::bind(&MeshGenerator::add_cell_vertex, &generator_, ::_1)];
49 qi::rule<Iterator, qi::space_type> node_section_header, element_section_header, node, element, content;
bool bind(osg::GeometryPtr &_geo, Mesh &_mesh)