//###################################################################### //# generate trellis representation of FSM as an SVG file //###################################################################### void fsm::print_trellis( std::string filename ,int number_stages) { std::ofstream trellis_fname (filename.c_str()); if (!trellis_fname) {std::cout << "file not found " << std::endl ; exit(-1);} const int TRELLIS_Y_OFFSET = 30; const int TRELLIS_X_OFFSET = 20; const int STAGE_LABEL_Y_OFFSET = 25; const int STAGE_LABEL_X_OFFSET = 20; const int STATE_LABEL_Y_OFFSET = 30; const int STATE_LABEL_X_OFFSET = 5; const int STAGE_STATE_OFFSETS = 10; // std::cout << "################## BEGIN SVG TRELLIS PIC #####################" << std::endl; trellis_fname << "" << std::endl; for(unsigned int stage_num = 0;stage_num < number_stages;stage_num ++){ // draw states for (unsigned int state_num = 0;state_num < d_S ; state_num ++ ) { trellis_fname << "" << std::endl; //draw branches if(stage_num != number_stages-1){ for(unsigned int branch_num = 0;branch_num < d_I; branch_num++){ trellis_fname << "" << std::endl; } } } } // label the stages trellis_fname << "" << std::endl; for(unsigned int stage_num = 0;stage_num < number_stages ;stage_num ++){ trellis_fname << "" << std::endl; trellis_fname << stage_num << std::endl; trellis_fname << "" << std::endl; } trellis_fname << "" << std::endl; // label the states trellis_fname << "" << std::endl; for(unsigned int state_num = 0;state_num < d_S ; state_num ++){ trellis_fname << "" << std::endl; trellis_fname << state_num << std::endl; trellis_fname << "" << std::endl; } trellis_fname << "" << std::endl; trellis_fname << "" << std::endl; // std::cout << "################## END SVG TRELLIS PIC ##################### " << std::endl; trellis_fname.close(); }