GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
//1// main.cpp2// Bistellar3//4// Created by Alexander Thumm on 07.10.11.5// Copyright 2011 -. All rights reserved.6//78#include <iostream>9#include <sstream>10#include <string>11#include "types.h"12#include "movable_complex.h"13#include "face.h"14#include "util.h"15#include "randomize_complex.h"16#include "reduce_complex.h"1718int main (int argc, const char * argv[])19{20std::istream & in = std::cin;2122while (true)23{24std::string line;25std::getline(in, line);26std::stringstream sstream(line);2728std::string command;29sstream >> command;3031if (command.compare("randomize") == 0)32{33MovableComplex complex;34sstream >> complex;3536std::vector< unsigned int > allowedMoves;37for (unsigned int i = 0; i < complex.dimension()+1; i++)38allowedMoves.push_back(i);3940unsigned int rounds = 50;4142std::string nextToken;43while (sstream >> nextToken)44{45std::stringstream token(nextToken);4647if (token.str().compare(0,12,"allowedMoves") == 0)48{49token.ignore(token.str().length(),'=');50std::vector< unsigned int > newAllowedMoves;51list_read(token, newAllowedMoves);52allowedMoves = newAllowedMoves;53}54else if (token.str().compare(0,6,"rounds") == 0)55{56token.ignore(token.str().length(),'=');57token >> rounds;58}59}6061randomize_complex(complex, allowedMoves, rounds);6263std::cout << "resulting complex is " << complex << std::endl;64}65else if (command.compare("reduce") == 0)66{67MovableComplex complex;68sstream >> complex;6970unsigned int rounds = 10000;71int heating = 0;72int relaxation = 4;7374std::string nextToken;75while (sstream >> nextToken)76{77std::stringstream token(nextToken);7879if (token.str().compare(0,6,"rounds") == 0)80{81token.ignore(token.str().length(),'=');82token >> rounds;83}84else if (token.str().compare(0,7,"heating") == 0)85{86token.ignore(token.str().length(),'=');87token >> heating;88}89else if (token.str().compare(0,9,"relaxation") == 0)90{91token.ignore(token.str().length(),'=');92token >> relaxation;93}94}9596reduce_complex(complex, rounds, heating, relaxation);9798std::cout << "resulting complex is " << complex << " with " << complex.f(0) << " vertices" << std::endl;99}100else if (command.compare("quit") == 0)101{102break;103}104else105{106std::cout << "possible commands are:" << std::endl;107std::cout << "- \"reduce %c with %o\", where %c is a complex given as facet list and %o are options." << std::endl;108std::cout << "\texample: \"reduce [[1,2],[2,3],[3,4],[4,1]] with rounds=10, heating=0 and relaxation=4\"" << std::endl;109std::cout << "- \"randomize %c with %o\", where %c is a complex given as facet list and %o are options." << std::endl;110std::cout << "\texample: \"randomize [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] with rounds=10 and allowedMoves=[0,1]\"" << std::endl;111std::cout << "- \"quit\"" << std::endl;112}113}114115return 0;116}117118119120