int main(int argc, char **argv) { IndentWriter writer; Polygon<Point2D> base; base.addPoint(Point2D(1.0, 2.0)); base.addPoint(Point2D(1.0, -2.0)); base.addPoint(Point2D(-1.0, -1.0)); base.addPoint(Point2D(-2.0, 1.0)); Component prism(PolygonalPrism(base, 5.0)); writer << prism; std::cout << writer; return 0; }
void OstreamGMV3DFmt::StaticData::initialize() { if(archetypes == 0 || names == 0) { archetypes = new archetype_table; names = new archetype_name_map; // construct tet int conn_tet[4*4] = { 3, 0, 1, 2, 3, 0, 3, 1, 3, 0, 2, 3, 3, 1, 3, 2 }; stream_grid_mask<int *> tet(4,4,conn_tet); archetypes->push_back(archetype_type()); ConstructGrid0(archetypes->back(), tet); (*names)[archetypes->size() -1] = "tet"; // construct hex // 0: (0,0,0), 1: (1,0,0), 2: (1,1,0), 3: (0,1,0) // 4: (0,0,1), 5: (1,0,1), 6: (1,1,1), 7: (0,1,1) int conn_hex[5*6] = { 4, 0, 3, 2, 1, 4, 0, 1, 5, 4, 4, 0, 4, 7, 3, 4, 1, 2, 6, 5, 4, 2, 3, 7, 6, 4, 4, 5, 6, 7 }; stream_grid_mask<int *> hex(8,6,conn_hex); archetypes->push_back(archetype_type()); ConstructGrid0(archetypes->back(), hex); (*names)[archetypes->size()-1] = "phex8"; // construct prism int conn_prism[3*5+2*4] = { 3, 0, 1, 2, 3, 3, 5, 4, 4, 0, 3, 4, 1, 4, 1, 4, 5, 2, 4, 0, 2, 5, 3 }; stream_grid_mask<int *> prism(6,5,conn_prism); archetypes->push_back(archetype_type()); ConstructGrid0(archetypes->back(), prism); (*names)[archetypes->size()-1] = "prism"; // construct pyramid int conn_pyramid[1*5+4*4] = { 4, 4, 3, 2, 1, 3, 0, 1, 2, 3, 0, 2, 3, 3, 0, 3, 4, 3, 0, 4, 1 }; stream_grid_mask<int *> pyramid(5,5,conn_pyramid); archetypes->push_back(archetype_type()); ConstructGrid0(archetypes->back(), pyramid); (*names)[archetypes->size() -1] = "pyramid"; // cerr << Printer(*names) << '\n'; } }