Ignore:
Timestamp:
07/03/20 00:32:23 (4 years ago)
Author:
Maciej Komosinski
Message:
  • separate "0" and "0s" formats (for SHAPE_BALL_AND_STICK and SHAPE_SOLIDS, respectively)
  • converting to format list (Geno::F0_FORMAT_LIST = "0,0s")
  • (optional) declaring Model as SHAPE_BALL_AND_STICK or SHAPE_SOLIDS (or SHAPE_UNKNOWN)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/genoconv.cpp

    r955 r972  
    123123/// (can be NULL if you don't need this information)
    124124
    125 GenoConverter **GenoConvManager::getPath(const SString& in, const SString& out, GenoConverter **path, int maxlen, int *mapavailable)
     125GenoConverter **GenoConvManager::getPath(const SString& in_format, const SString& out_format_list, GenoConverter **path, int maxlen, int *mapavailable)
    126126{
    127127        if (!maxlen) return 0;
     
    130130        for (; gk = (GenoConverter*)converters(i); i++)
    131131        {
    132                 if ((gk->enabled) && (gk->in_format == in))
     132                if ((gk->enabled) && (gk->in_format == in_format))
    133133                {
    134134                        *path = gk;
    135                         if (gk->out_format == out)
     135                        if (Geno::formatIsOneOf(gk->out_format, out_format_list))
    136136                        {
    137137                                if (mapavailable)
     
    142142                        {
    143143                                int mapavail;
    144                                 GenoConverter **ret = getPath(gk->out_format, out, path + 1, maxlen - 1, &mapavail);
     144                                GenoConverter **ret = getPath(gk->out_format, out_format_list, path + 1, maxlen - 1, &mapavail);
    145145                                if (ret)
    146146                                {
     
    155155}
    156156
    157 Geno GenoConvManager::convert(Geno &in, SString format, MultiMap *map, bool using_checkpoints, bool *converter_missing)
    158 {
    159         if (in.getFormat() == format) { if (converter_missing) *converter_missing = false; return in; }
     157Geno GenoConvManager::convert(Geno &in, SString format_list, MultiMap *map, bool using_checkpoints, bool *converter_missing)
     158{
     159        if (Geno::formatIsOneOf(in.getFormat(), format_list))
     160        {
     161                if (converter_missing) *converter_missing = false; return in;
     162        }
    160163        GenoConverter *path[10];
    161164        int dep;
     
    164167        int mapavail;
    165168        for (dep = 1; dep < (int)sizeof(path); dep++) //iterative deepening
    166                 if (ret = getPath(in.getFormat(), format, path, dep, &mapavail)) break;
     169                if (ret = getPath(in.getFormat(), format_list, path, dep, &mapavail)) break;
    167170        if (!ret) { if (converter_missing) *converter_missing = true; return Geno("", Geno::INVALID_FORMAT, "", "converter not found"); }
    168171        if (converter_missing) *converter_missing = false;
    169172        if (!map) mapavail = 0;
    170173        GenoConverter **t = path;
    171         SString tmp;
     174        SString tmp, out_format;
    172175        tmp = in.getGenes();
    173176        MultiMap lastmap, tmpmap;
     
    177180                GenoConverter *gk = *t;
    178181                tmp = gk->convert(tmp, mapavail ? &tmpmap : 0, using_checkpoints);
    179                 if (!tmp.len())
     182                out_format = gk->out_format;
     183                if (!tmp.length())
    180184                {
    181185                        string t = ssprintf("f%s->f%s conversion failed (%s)", gk->in_format.c_str(), gk->out_format.c_str(), gk->name);
     
    200204        if (map)
    201205                *map = lastmap;
    202         return Geno(tmp, format, in.getName(), in.getComment());
    203 }
     206        return Geno(tmp, out_format, in.getName(), in.getComment());
     207}
Note: See TracChangeset for help on using the changeset viewer.