Ignore:
Timestamp:
05/04/19 23:39:39 (6 years ago)
Author:
Maciej Komosinski
Message:

Fixed error messages, changed int to paInt (for 32/64-bit safety), changed two int variables to bool as they should be

Location:
cpp/frams/model/similarity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/similarity/simil_model.cpp

    r871 r872  
    7575        //Determines whether "fuzzy vertex degree" should be used.
    7676        //Currently "fuzzy vertex degree" is inactive.
    77         isFuzzy = 0;
     77        isFuzzy = false;
    7878        fuzzyDepth = 10;
    7979
     
    8181        wMDS = 0;
    8282        //Determines whether best matching should be saved using hungarian similarity measure.
    83         saveMatching = 0;
     83        saveMatching = false;
    8484}
    8585
     
    105105        {
    106106                logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "NULL or invalid model pointer(s)");
    107                         return 0.0;
     107                return 0.0;
    108108        }
    109109
     
    139139        if ((this->*pfMatchingFunction)() == 0)
    140140        {
    141                 logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "Matching function error");
    142                         return 0.0;
     141                logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "The matching function returned 0");
     142                return 0.0;
    143143        }
    144144
     
    151151                if (CountPartsDistance() == 0)
    152152                {
    153                         logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "CountPartDistance() error");
    154                                 return 0.0;
     153                        logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "CountPartDistance()==0");
     154                        return 0.0;
    155155                }
    156156
     
    562562                }
    563563
    564                 if (m_aDegrees[i] != NULL && (isFuzzy != 1 || (m_Neighbours[i] != NULL && m_fuzzyNeighb[i] != NULL)))
     564                if (m_aDegrees[i] != NULL && ((!isFuzzy) || (m_Neighbours[i] != NULL && m_fuzzyNeighb[i] != NULL)))
    565565                {
    566566                        // wypelnij tablice zgodnie z sensem TDN[0] - orginalny index
     
    600600                else
    601601                {
    602                         logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "Memory error");
    603                                 return 0;
     602                        logPrintf("ModelSimil", "CreatePartInfoTables", LOG_ERROR, "Not enough memory?");
     603                        return 0;
    604604                }
    605605                // utworz tablice dla pozycji 3D Parts (wielkosc tablicy: liczba Parts organizmu)
     
    931931        int i;
    932932        int(*pfDegreeFunction) (const void*, const void*) = NULL;
    933         pfDegreeFunction = (isFuzzy == 1) ? &CompareFuzzyDegrees : &CompareDegrees;
     933        pfDegreeFunction = isFuzzy ? &CompareFuzzyDegrees : &CompareDegrees;
    934934        // sortowanie obu tablic wg stopni punktów - TDN[1]
    935935        for (i = 0; i < 2; i++)
     
    943943        // sprawdzenie wartosci parametru
    944944        DB(i = sizeof(TDN);)
    945                 int degreeType = (isFuzzy == 1) ? FUZZ_DEG : DEGREE;
     945                int degreeType = isFuzzy ? FUZZ_DEG : DEGREE;
    946946
    947947        // sortowanie obu tablic m_aDegrees wedlug liczby neuronów i
     
    20792079        {
    20802080                logPrintf("ModelSimil", "EvaluateDistanceHungarian", LOG_ERROR, "NULL genotype pointer(s)");
    2081                         return 0.0;
     2081                return 0.0;
    20822082        }
    20832083        // create models of objects to compare
     
    20892089        {
    20902090                logPrintf("ModelSimil", "EvaluateDistanceHungarian", LOG_ERROR, "NULL or invalid model pointer(s)");
    2091                         return 0.0;
     2091                return 0.0;
    20922092        }
    20932093
     
    21652165                        {
    21662166                                dMinSimValue = dCurrentSim;
    2167                                 if (saveMatching == 1)
     2167                                if (saveMatching)
    21682168                                {
    21692169                                        minAssignment.clear();
     
    21742174
    21752175                dResult = dMinSimValue;
    2176                 if (saveMatching == 1)
     2176                if (saveMatching)
    21772177                        std::copy(minAssignment.begin(), minAssignment.end(), assignment);
    21782178        }
  • cpp/frams/model/similarity/simil_model.h

    r870 r872  
    7777        /// Currently selected matching algorithm. Allowed values: 0 (more exact, slower), 1 (more greedy, faster). Details in https://doi.org/10.1007/978-3-030-16692-2_8
    7878        /// @sa EvaluateDistance
    79         int matching_method;
     79        paInt matching_method;
    8080
    8181        /// Table of weights for weighted distance function.
     
    8989
    9090        //for Zfixed = 1, the "z" (vertical) coordinates are not taken into account during PCA alignment
    91         int fixedZaxis;
     91        paInt fixedZaxis;
    9292
    9393        //Controls the depth of fuzzy neighbourhood
    9494        int fuzzyDepth;
    95         int isFuzzy;
     95        bool isFuzzy;
    9696
    9797        //For wMDS = 1 weighted MDS with vertex degrees as weights is used for the alignment.
    98         int wMDS;
     98        paInt wMDS;
    9999
    100100        //For saveMatching = 1 the best matching found will be saved.
    101         int saveMatching;
     101        bool saveMatching;
    102102
    103103        /// Interface to local parameters
Note: See TracChangeset for help on using the changeset viewer.