"Fossies" - the Fresh Open Source Software Archive

Member "gama-2.05/bin/gama-local.cpp" (10 May 2019, 21052 Bytes) of package /linux/privat/gama-2.05.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "gama-local.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.04_vs_2.05.

    1 /* GNU Gama C++ library
    2    Copyright (C) 1999, 2002, 2003, 2010, 2011, 2012, 2014, 2018
    3                  Ales Cepek <cepek@gnu.org>
    4 
    5    This file is part of the GNU Gama C++ library.
    6 
    7    This library is free software; you can redistribute it and/or modify
    8    it under the terms of the GNU General Public License as published by
    9    the Free Software Foundation; either version 3, or (at your option)
   10    any later version.
   11 
   12    This program is distributed in the hope that it will be useful,
   13    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15    GNU General Public License for more details.
   16 
   17    You should have received a copy of the GNU General Public License
   18    along with this program; if not, write to the Free Software Foundation,
   19    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
   20 
   21 #ifdef   GNU_GAMA_LOCAL_SQLITE_READER
   22 #include <gnu_gama/local/sqlitereader.h>
   23 #endif
   24 
   25 #include <gnu_gama/outstream.h>
   26 
   27 #include <cstring>
   28 #include <gnu_gama/version.h>
   29 #include <gnu_gama/intfloat.h>
   30 #include <gnu_gama/xml/localnetworkoctave.h>
   31 #include <gnu_gama/xml/localnetworkxml.h>
   32 #include <gnu_gama/xml/gkfparser.h>
   33 
   34 #include <gnu_gama/local/language.h>
   35 #include <gnu_gama/local/gamadata.h>
   36 #include <gnu_gama/local/network.h>
   37 #include <gnu_gama/local/acord/acord2.h>
   38 #include <gnu_gama/local/acord/acord.h>
   39 #include <gnu_gama/local/acord/acordstatistics.h>
   40 #include <gnu_gama/local/svg.h>
   41 #include <gnu_gama/local/html.h>
   42 
   43 #include <gnu_gama/local/results/text/approximate_coordinates.h>
   44 #include <gnu_gama/local/results/text/network_description.h>
   45 #include <gnu_gama/local/results/text/general_parameters.h>
   46 #include <gnu_gama/local/results/text/fixed_points.h>
   47 #include <gnu_gama/local/results/text/adjusted_observations.h>
   48 #include <gnu_gama/local/results/text/adjusted_unknowns.h>
   49 #include <gnu_gama/local/results/text/outlying_abs_terms.h>
   50 #include <gnu_gama/local/results/text/reduced_observations.h>
   51 #include <gnu_gama/local/results/text/reduced_observations_to_ellipsoid.h>
   52 #include <gnu_gama/local/results/text/residuals_observations.h>
   53 #include <gnu_gama/local/results/text/error_ellipses.h>
   54 #include <gnu_gama/local/test_linearization_visitor.h>
   55 #include <gnu_gama/local/xmlerror.h>
   56 
   57 namespace {
   58 int help()
   59 {
   60   using namespace std;
   61   using namespace GNU_gama::local;
   62 
   63   cerr << "\n"
   64        << "Adjustment of local geodetic network"
   65        << "        version: "<< GNU_gama::GNU_gama_version()
   66        << " / " << GNU_gama::GNU_gama_compiler() << "\n"
   67        << "************************************\n"
   68        << "http://www.gnu.org/software/gama/\n\n";
   69 
   70   cerr <<
   71     "Usage: gama-local  input.xml  [options]\n"
   72 
   73 #ifdef   GNU_GAMA_LOCAL_SQLITE_READER
   74     "       gama-local  input.xml  --sqlitedb sqlite.db"
   75             "  --configuration name  [options]\n"
   76     "       gama-local  --sqlitedb sqlite.db  --configuration name  [options]\n"
   77     "       gama-local  --sqlitedb sqlite.db"
   78             "  --readonly-configuration name  [options]\n"
   79 #endif
   80 
   81     "\nOptions:\n\n"
   82 
   83     "--algorithm  gso | svd | cholesky | envelope\n"
   84     "--language   en | ca | cz | du | es | fi | fr | hu | ru | ua | zh\n"
   85     "--encoding   utf-8 | iso-8859-2 | iso-8859-2-flat | cp-1250 | cp-1251\n"
   86     "--angles     400 | 360\n"
   87     "--latitude   <latitude>\n"
   88     "--ellipsoid  <ellipsoid name>\n"
   89     "--text       adjustment_results.txt\n"
   90     "--html       adjustment_results.html\n"
   91     "--xml        adjustment_results.xml\n"
   92     "--octave     adjustment_results.m\n"
   93     "--svg        network_configuration.svg\n"
   94     "--cov-band   covariance matrix of adjusted parameters in XML output\n"
   95     "             n  = -1  for full covariance matrix (implicit value)\n"
   96     "             n >=  0  covariances are computed only for bandwidth n\n"
   97     "--iterations maximum number of iterations allowed in the linearized\n"
   98     "             least squares algorithm (implicit value is 5)\n"
   99 //  "--updated-xml input data with free coordinates updated after adjustment\n"
  100 //  "             and rejected observations removed\n"
  101     "--version\n"
  102     "--help\n\n";
  103 
  104 //  "--obs        observation_equations.txt (obsolete format)\n"
  105 
  106   return 1;
  107 }
  108 
  109 GNU_gama::local::XMLerror xmlerr;
  110 
  111 }  // unnamed namespace
  112 
  113 
  114 
  115 int main(int argc, char **argv)
  116   try {
  117 
  118     if (argc == 1) return help();
  119 
  120     using namespace std;
  121     using namespace GNU_gama::local;
  122 
  123     const char* c;
  124     const char* argv_1 = 0;           // xml input or sqlite db name
  125     const char* argv_algo = 0;
  126     const char* argv_lang = 0;
  127     const char* argv_enc  = 0;
  128     const char* argv_angles = 0;
  129     const char* argv_ellipsoid = 0;
  130     const char* argv_latitude = 0;
  131     const char* argv_txtout = 0;
  132     const char* argv_htmlout = 0;
  133     const char* argv_xmlout = 0;
  134     const char* argv_octaveout = 0;
  135     const char* argv_svgout = 0;
  136     const char* argv_obsout = 0;
  137     const char* argv_covband = 0;
  138     const char* argv_iterations = 0;
  139     const char* argv_updated_xml = 0;
  140 
  141 #ifdef GNU_GAMA_LOCAL_SQLITE_READER
  142     const char* argv_confname = 0;
  143     const char* argv_readonly = 0;
  144     const char* argv_sqlitedb = 0;
  145 #endif
  146 
  147 
  148     for (int i=1; i<argc; i++)
  149       {
  150         c = argv[i];
  151         if (*c != '-')    // **** one or two parameters (file names) ****
  152           {
  153             if (!argv_1) {
  154               argv_1 = c;
  155               continue;
  156             }
  157             return help();
  158           }
  159 
  160         // ****  options  ****
  161 
  162         if(*c && *c == '-') c++;
  163         if(*c && *c == '-') c++;
  164         string name = string(c);
  165         c = argv[++i];
  166 
  167         if      (name == "help"      ) return help();
  168         else if (name == "version"   )
  169                 return GNU_gama::version("gama-local", "Ales Cepek et al.");
  170         else if ( i   ==  argc       ) return help();
  171         else if (name == "algorithm" ) argv_algo = c;
  172         else if (name == "language"  ) argv_lang = c;
  173         else if (name == "encoding"  ) argv_enc  = c;
  174         else if (name == "angles"    ) argv_angles = c;
  175         else if (name == "ellipsoid" ) argv_ellipsoid = c;
  176         else if (name == "latitude"  ) argv_latitude = c;
  177         else if (name == "text"      ) argv_txtout = c;
  178         else if (name == "html"      ) argv_htmlout = c;
  179         else if (name == "xml"       ) argv_xmlout = c;
  180         else if (name == "octave"    ) argv_octaveout = c;
  181         else if (name == "svg"       ) argv_svgout = c;
  182         else if (name == "obs"       ) argv_obsout = c;
  183         else if (name == "cov-band"  ) argv_covband = c;
  184         else if (name == "iterations") argv_iterations = c;
  185         else if (name == "updated-xml") argv_updated_xml = c;
  186 #ifdef GNU_GAMA_LOCAL_SQLITE_READER
  187         else if (name == "sqlitedb")               argv_sqlitedb = c;
  188         else if (name == "configuration")          argv_confname = c;
  189         else if (name == "readonly-configuration") argv_readonly = c;
  190 #endif
  191         else
  192           return help();
  193       }
  194 
  195     // implicit output
  196     if (!argv_txtout && !argv_htmlout && !argv_xmlout) argv_xmlout = "-";
  197 
  198     if (argv_xmlout) xmlerr.setXmlOutput(argv_xmlout);
  199 
  200 #ifdef GNU_GAMA_LOCAL_SQLITE_READER
  201     if (argv_confname && argv_readonly) return help();
  202     if (!argv_1 && !argv_sqlitedb) return help();
  203 #endif
  204 
  205     if (!argv_lang)
  206       set_gama_language(en);
  207     else
  208       {
  209         if      (!strcmp("en", argv_lang)) set_gama_language(en);
  210         else if (!strcmp("ca", argv_lang)) set_gama_language(ca);
  211         else if (!strcmp("cs", argv_lang)) set_gama_language(cz);
  212         else if (!strcmp("cz", argv_lang)) set_gama_language(cz);
  213         else if (!strcmp("du", argv_lang)) set_gama_language(du);
  214         else if (!strcmp("du", argv_lang)) set_gama_language(du);
  215         else if (!strcmp("es", argv_lang)) set_gama_language(es);
  216         else if (!strcmp("fr", argv_lang)) set_gama_language(fr);
  217         else if (!strcmp("fi", argv_lang)) set_gama_language(fi);
  218         else if (!strcmp("hu", argv_lang)) set_gama_language(hu);
  219         else if (!strcmp("ru", argv_lang)) set_gama_language(ru);
  220         else if (!strcmp("ua", argv_lang)) set_gama_language(ua);
  221         else if (!strcmp("zh", argv_lang)) set_gama_language(zh);
  222         else return help();
  223       }
  224 
  225     ostream* output = 0;
  226 
  227     ofstream fcout;
  228     if (argv_txtout)
  229       {
  230         if (!strcmp(argv_txtout, "-"))
  231           {
  232             output = &std::cout;
  233           }
  234         else
  235           {
  236             fcout.open(argv_txtout);
  237             output = &fcout;
  238           }
  239       }
  240 
  241     GNU_gama::OutStream cout(output);
  242 
  243     if (argv_enc)
  244       {
  245         using namespace GNU_gama;
  246 
  247         if (!strcmp("utf-8", argv_enc))
  248           cout.set_encoding(OutStream::utf_8);
  249         else if (!strcmp("iso-8859-2", argv_enc))
  250           cout.set_encoding(OutStream::iso_8859_2);
  251         else if (!strcmp("iso-8859-2-flat", argv_enc))
  252           cout.set_encoding(OutStream::iso_8859_2_flat);
  253         else if (!strcmp("cp-1250", argv_enc))
  254           cout.set_encoding(OutStream::cp_1250);
  255         else if (!strcmp("cp-1251", argv_enc))
  256           cout.set_encoding(OutStream::cp_1251);
  257         else
  258           return help();
  259       }
  260 
  261     if (argv_algo)
  262       {
  263         const std::string algorithm = argv_algo;
  264         if (algorithm != "gso"      &&
  265             algorithm != "svd"      &&
  266             algorithm != "cholesky" &&
  267             algorithm != "envelope" ) return help();
  268       }
  269 
  270     LocalNetwork* IS = new LocalNetwork;
  271 
  272 #ifdef GNU_GAMA_LOCAL_SQLITE_READER
  273     if (argv_sqlitedb)
  274       {
  275         GNU_gama::local::sqlite_db::SqliteReader reader(argv_sqlitedb);
  276 
  277         const char* conf = argv_confname;
  278         if (argv_readonly) conf = argv_readonly;
  279         reader.retrieve(IS, conf);
  280       }
  281     else
  282 #endif
  283       {
  284         ifstream soubor(argv_1);
  285         GKFparser gkf(*IS);
  286         try
  287           {
  288             char c;
  289             int  n, konec = 0;
  290             string radek;
  291             do
  292               {
  293                 radek = "";
  294                 n     = 0;
  295                 while (soubor.get(c))
  296                   {
  297                     radek += c;
  298                     n++;
  299                     if (c == '\n') break;
  300                   }
  301                 if (!soubor) konec = 1;
  302 
  303                 gkf.xml_parse(radek.c_str(), n, konec);
  304               }
  305             while (!konec);
  306           }
  307         catch (const GNU_gama::local::ParserException& v) {
  308           if (xmlerr.isValid())
  309             {
  310               xmlerr.setDescription(T_GaMa_exception_2a);
  311               std::string t, s = v.what();
  312               for (std::string::iterator i=s.begin(), e=s.end(); i!=e; ++i)
  313                 {
  314                   if      (*i == '<') t += "\"";
  315                   else if (*i == '>') t += "\"";
  316                   else                t += *i;
  317                 }
  318               xmlerr.setDescription(t);
  319               xmlerr.setLineNumber (v.line);
  320               //xmlerr.setDescription(T_GaMa_exception_2b);
  321               return xmlerr.write_xml("gamaLocalParserError");
  322             }
  323 
  324           cerr << "\n" << T_GaMa_exception_2a << "\n\n"
  325                << T_GaMa_exception_2b << v.line << " : " << v.what() << endl;
  326           return 3;
  327         }
  328         catch (const GNU_gama::local::Exception& v) {
  329           if (xmlerr.isValid())
  330             {
  331               xmlerr.setDescription(T_GaMa_exception_2a);
  332               xmlerr.setDescription(v.what());
  333               return xmlerr.write_xml("gamaLocalException");
  334             }
  335 
  336           cerr << "\n" <<T_GaMa_exception_2a << "\n"
  337                << "\n***** " << v.what() << "\n\n";
  338           return 2;
  339         }
  340         catch (...)
  341           {
  342             cerr << "\n" << T_GaMa_exception_2a << "\n\n";
  343             throw;
  344           }
  345       }
  346 
  347     if (argv_algo)
  348       {
  349         IS->set_algorithm(argv_algo);
  350       }
  351 
  352     if (!IS->has_algorithm()) IS->set_algorithm();
  353 
  354     if (argv_angles)
  355       {
  356         if (!strcmp("400", argv_angles))
  357           IS->set_gons();
  358         else if (!strcmp("360", argv_angles))
  359           IS->set_degrees();
  360         else
  361           return help();
  362       }
  363 
  364     if (argv_covband)
  365       {
  366         std::istringstream istr(argv_covband);
  367         int band = -1;
  368         if (!(istr >> band) || band < -1) return help();
  369         char c;
  370         if (istr >> c) return help();
  371 
  372         IS->set_adj_covband(band);
  373       }
  374 
  375     if (argv_iterations)
  376       {
  377         std::istringstream istr(argv_iterations);
  378         int iter = IS->max_linearization_iterations();
  379         if (!(istr >> iter) || iter < 0) return help();
  380         char c;
  381         if (istr >> c) return help();
  382 
  383         IS->set_max_linearization_iterations(iter);
  384       }
  385 
  386     if (argv_latitude)
  387       {
  388         double latitude;
  389         if (!GNU_gama::deg2gon(argv_latitude, latitude))
  390           {
  391             if (!GNU_gama::IsFloat(string(argv_latitude)))
  392               return help();
  393 
  394             latitude = atof(argv_latitude);
  395           }
  396 
  397         IS->set_latitude(latitude * M_PI/200);
  398       }
  399 
  400 
  401     if (argv_ellipsoid)
  402       {
  403         using namespace GNU_gama;
  404 
  405         gama_ellipsoid gama_el = ellipsoid(argv_ellipsoid);
  406         if  (gama_el == ellipsoid_unknown) return help();
  407 
  408         IS->set_ellipsoid(argv_ellipsoid);
  409       }
  410 
  411 
  412     {
  413       cout << T_GaMa_Adjustment_of_geodetic_network << "        "
  414            << T_GaMa_version << GNU_gama::GNU_gama_version()
  415            << "-" << IS->algorithm()
  416            << " / " << GNU_gama::GNU_gama_compiler() << "\n"
  417            << underline(T_GaMa_Adjustment_of_geodetic_network, '*') << "\n"
  418            << "http://www.gnu.org/software/gama/\n\n\n";
  419     }
  420 
  421     if (IS->PD.empty())
  422       throw GNU_gama::local::Exception(T_GaMa_No_points_available);
  423 
  424     if (IS->OD.clusters.empty())
  425       throw GNU_gama::local::Exception(T_GaMa_No_observations_available);
  426 
  427     try
  428       {
  429         // if (!GaMaConsistent(IS->PD))
  430         //   {
  431         //      cout << T_GaMa_inconsistent_coordinates_and_angles << "\n\n\n";
  432         //   }
  433         IS->remove_inconsistency();
  434 
  435         AcordStatistics stats(IS->PD, IS->OD);
  436 
  437         Acord2 acord2(IS->PD, IS->OD);
  438         acord2.execute();
  439 
  440         Acord acord(IS->PD, IS->OD);
  441         acord.execute();
  442 
  443         ReducedObservationsText(IS,&(acord.RO), cout);
  444 
  445         if (IS->correction_to_ellipsoid())
  446           {
  447             using namespace GNU_gama;
  448             gama_ellipsoid elnum = ellipsoid(IS->ellipsoid().c_str());
  449             Ellipsoid el;
  450             GNU_gama::set(&el, elnum);
  451             ReduceToEllipsoid reduce_to_el(IS->PD, IS->OD, el, IS->latitude());
  452             reduce_to_el.execute();
  453             ReducedObservationsToEllipsoidText(IS, reduce_to_el.getMap(), cout);
  454           }
  455 
  456         stats.execute();
  457         ApproximateCoordinates(&stats, cout);
  458 
  459 
  460       }
  461     catch(GNU_gama::local::Exception e)
  462       {
  463         if (xmlerr.isValid())
  464           {
  465             xmlerr.setDescription(e.what());
  466             return xmlerr.write_xml("gamaLocalException");
  467           }
  468 
  469         cerr << e.what() << endl;
  470         return 1;
  471       }
  472     catch(...)
  473       {
  474         if (xmlerr.isValid())
  475           {
  476             xmlerr.setDescription("Gama / Acord: "
  477                                   "approximate coordinates failed");
  478             return xmlerr.write_xml("gamaLocalApproximateCoordinates");
  479           }
  480 
  481         cerr << "Gama / Acord: approximate coordinates failed\n\n";
  482         return 1;
  483       }
  484 
  485 
  486     if (IS->sum_points() == 0 || IS->sum_unknowns() == 0)
  487       {
  488         throw GNU_gama::local::Exception(T_GaMa_No_network_points_defined);
  489       }
  490     else
  491       {
  492         if (IS->huge_abs_terms())
  493           {
  494             OutlyingAbsoluteTerms(IS, cout);
  495             IS->remove_huge_abs_terms();
  496             cout << T_GaMa_Observatios_with_outlying_absolute_terms_removed
  497                  << "\n\n\n";
  498           }
  499 
  500         if (!IS->connected_network())
  501           cout  << T_GaMa_network_not_connected << "\n\n\n";
  502 
  503         bool network_can_be_adjusted;
  504         {
  505           std::ostringstream tmp_out;
  506           if (!(network_can_be_adjusted = GeneralParameters(IS, tmp_out)))
  507             {
  508               NetworkDescription(IS->description, cout);
  509               cout << tmp_out.str();
  510             }
  511         }
  512 
  513         if (network_can_be_adjusted)
  514           {
  515             IS->clear_linearization_iterations();
  516             while (IS->next_linearization_iterations() &&
  517                    TestLinearization(IS))
  518               {
  519                 IS->increment_linearization_iterations();
  520                 IS->refine_approx();
  521               }
  522 
  523             if (IS->linearization_iterations() > 0)
  524               {
  525                 cout << T_GaMa_Approximate_coordinates_replaced << "\n"
  526                      << underline(T_GaMa_Approximate_coordinates_replaced,'*')
  527                      << "\n\n"
  528                      << T_GaMa_Number_of_linearization_iterations
  529                      << IS->linearization_iterations() << "\n\n";
  530               }
  531 
  532             if (!TestLinearization(IS, cout)) cout << "\n";
  533 
  534             NetworkDescription   (IS->description, cout);
  535             GeneralParameters    (IS, cout);
  536             FixedPoints          (IS, cout);
  537             AdjustedUnknowns     (IS, cout);
  538             ErrorEllipses        (IS, cout);
  539             AdjustedObservations (IS, cout);
  540             ResidualsObservations(IS, cout);
  541           }
  542 
  543         if (argv_svgout)
  544           {
  545             GamaLocalSVG svg(IS);
  546             if (!strcmp(argv_svgout, "-"))
  547               {
  548                 svg.draw(std::cout);
  549               }
  550             else
  551               {
  552                 ofstream file(argv_svgout);
  553                 svg.draw(file);
  554               }
  555           }
  556 
  557         if (argv_obsout)
  558           {
  559             ofstream opr(argv_obsout);
  560             IS->project_equations(opr);
  561           }
  562 
  563         if (argv_htmlout)
  564           {
  565             GNU_gama::local::GamaLocalHTML html(IS);
  566             html.exec();
  567 
  568             if (!strcmp(argv_htmlout, "-"))
  569               {
  570                 html.html(std::cout);
  571               }
  572             else
  573               {
  574                 ofstream file(argv_htmlout);
  575                 html.html(file);
  576               }
  577           }
  578 
  579         if (argv_xmlout)
  580           {
  581             IS->set_gons();
  582 
  583             GNU_gama::LocalNetworkXML xml(IS);
  584 
  585             if (!strcmp(argv_xmlout, "-"))
  586               {
  587                 xml.write(std::cout);
  588               }
  589             else
  590               {
  591                 ofstream file(argv_xmlout);
  592                 xml.write(file);
  593               }
  594           }
  595 
  596         if (argv_octaveout)
  597           {
  598             IS->set_gons();
  599 
  600             GNU_gama::LocalNetworkOctave octave(IS);
  601 
  602             if (!strcmp(argv_octaveout, "-"))
  603               {
  604                 octave.write(std::cout);
  605               }
  606             else
  607               {
  608                 ofstream file(argv_octaveout);
  609                 octave.write(file);
  610               }
  611           }
  612 
  613         if (network_can_be_adjusted && argv_updated_xml)
  614           {
  615             std::string xml = IS->updated_xml();
  616 
  617             if (!strcmp(argv_updated_xml, "-"))
  618               {
  619                 std::cout << xml;
  620               }
  621             else
  622               {
  623                 ofstream file(argv_updated_xml);
  624                 file << xml;
  625               }
  626           }
  627       }
  628 
  629     delete IS;
  630     return 0;
  631 
  632   }
  633 #ifdef GNU_GAMA_LOCAL_SQLITE_READER
  634   catch(const GNU_gama::Exception::sqlitexc& gamalite)
  635     {
  636       if (xmlerr.isValid())
  637         {
  638           xmlerr.setDescription(gamalite.what());
  639           return xmlerr.write_xml("gamaLocalSqlite");
  640         }
  641 
  642       std::cout << "\n" << "****** " << gamalite.what() << "\n\n";
  643       return 1;
  644     }
  645 #endif
  646   catch(const GNU_gama::Exception::adjustment& choldec)
  647     {
  648       using namespace GNU_gama::local;
  649 
  650       if (xmlerr.isValid())
  651         {
  652           xmlerr.setDescription(T_GaMa_solution_ended_with_error);
  653           xmlerr.setDescription(choldec.str);
  654           return xmlerr.write_xml("gamaLocalAdjustment");
  655         }
  656 
  657       std::cout << "\n" << T_GaMa_solution_ended_with_error << "\n\n"
  658                 << "****** " << choldec.str << "\n\n";
  659       return 1;
  660     }
  661   catch (const GNU_gama::local::Exception& V)
  662     {
  663       using namespace GNU_gama::local;
  664 
  665       if (xmlerr.isValid())
  666         {
  667           xmlerr.setDescription(T_GaMa_solution_ended_with_error);
  668           xmlerr.setDescription(V.what());
  669           return xmlerr.write_xml("gamaLocalException");
  670         }
  671 
  672       std::cout << "\n" << T_GaMa_solution_ended_with_error << "\n\n"
  673                 << "****** " << V.what() << "\n\n";
  674       return 1;
  675     }
  676   catch (std::exception& stde) {
  677     if (xmlerr.isValid())
  678       {
  679         xmlerr.setDescription(stde.what());
  680         return xmlerr.write_xml("gamaLocalStdException");
  681       }
  682 
  683     std::cout << "\n" << stde.what() << "\n\n";
  684   }
  685   catch(...) {
  686     using namespace GNU_gama::local;
  687 
  688     if (xmlerr.isValid())
  689       {
  690         return xmlerr.write_xml("gamaLocalUnknownException");
  691       }
  692 
  693     std::cout << "\n" << T_GaMa_internal_program_error << "\n\n";
  694     return 1;
  695   }