Changeset 14345


Ignore:
Timestamp:
02/13/13 10:17:00 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added min option, easier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/wrappers/ExpSimplify/ExpSimplify.cpp

    r14344 r14345  
    1414        _pprintLine_("      - tol:  tolerance (maximal euclidean distance allowed between the new line and a vertex)");
    1515        _pprintLine_("      Additional options:");
    16         _pprintLine_("      - 'remove1': remove singleton from exp file (default is true)");
    17         _pprintLine_("      - 'remove2': remove pairs from exp file (default is true)");
     16        _pprintLine_("      - 'min': minimum number of vertices to save contours in exp file (default is 3)");
    1817        _pprintLine_("");
    1918        _pprintLine_("   Example:");
     
    9796        char*    expfile  = NULL;
    9897        double   tolerance;
    99         bool     remove1,remove2,save;
    10098        Options *options      = NULL;
     99        int      minimumvertices;
    101100
    102101        /*output*/
     
    131130
    132131        /*Process options*/
    133         options->Get(&remove1,"remove1",true);
    134         options->Get(&remove2,"remove2",true);
     132        options->Get(&minimumvertices,"min",3);
     133        if(minimumvertices<1) _error_("'min' (minimum number of verties) should be a positive integer");
    135134
    136135        /*Read old contours and allocate new contours*/
     
    181180
    182181                /*Do we save new profile?*/
    183                 save = true;
    184                 if(newnods==0){
    185                         save = false;
    186                 }
    187                 else if(remove1 && newnods==1){
    188                         save = false;
    189                 }
    190                 else if(remove2 && newnods==2){
    191                         save = false;
    192                 }
    193                 if(save){
    194                         printf("   New     number of vertices in contour #%i: %i\n",counter+1,newnods);
     182                if(newnods>=minimumvertices){
     183                        printf("   Final   number of vertices in contour #%i: %i\n",counter+1,newnods);
    195184                        newcontour       = xNew<Contour<double> >(1);
    196185                        newcontour->nods = newnods;
     
    211200                }
    212201                else{
    213                         printf("   New     number of vertices in contour #%i: %i (not saved)\n",counter+1,newnods);
     202                        printf("   Final   number of vertices in contour #%i: %i (not saved)\n",counter+1,newnods);
    214203                }
    215204
     
    217206                xDelete<bool>(flags);
    218207        }
     208        printf("   Initial number of contours: %i\n",oldcontours->Size());
     209        printf("   Final   number of contours: %i\n",newcontours->Size());
    219210
    220211        /*Write data: */
Note: See TracChangeset for help on using the changeset viewer.