Commit 4b22443b authored by Richard Berger's avatar Richard Berger
Browse files

Add feature category to is_available function

This allows checking if the LAMMPS binary/library was compiled with PNG, JPEG,
FFMPEG, GZIP, or exceptions support.

Usage:
```
is_available(feature,gzip)
is_available(feature,png)
is_available(feature,jpeg)
is_available(feature,ffmpeg)
is_available(feature,exceptions)
```
parent dd34feb2
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
@@ -925,6 +925,18 @@ bool Info::is_available(const char *category, const char *name)
        delete[] name_w_suffix;
      }
    }
  } else if (strcmp(category,"feature") == 0) {
    if (strcmp(name,"gzip") == 0) {
      return has_gzip_support();
    } else if (strcmp(name,"png") == 0) {
      return has_png_support();
    } else if (strcmp(name,"jpeg") == 0) {
      return has_jpeg_support();
    } else if (strcmp(name,"ffmpeg") == 0) {
      return has_ffmpeg_support();
    } else if (strcmp(name,"exceptions") == 0) {
      return has_exceptions();
    }
  } else error->all(FLERR,"Unknown category for info is_available()");

  return match ? true : false;
@@ -1027,3 +1039,43 @@ static void print_columns(FILE* fp, vector<string> & styles)
    }
  }
}

bool Info::has_gzip_support() const {
#ifdef LAMMPS_GZIP
  return true;
#else
  return false;
#endif
}

bool Info::has_png_support() const {
#ifdef LAMMPS_PNG
  return true;
#else
  return false;
#endif
}

bool Info::has_jpeg_support() const {
#ifdef LAMMPS_JPEG
  return true;
#else
  return false;
#endif
}

bool Info::has_ffmpeg_support() const {
#ifdef LAMMPS_FFMPEG
  return true;
#else
  return false;
#endif
}

bool Info::has_exceptions() const {
#ifdef LAMMPS_EXCEPTIONS
  return true;
#else
  return false;
#endif
}
+6 −0
Original line number Diff line number Diff line
@@ -33,6 +33,12 @@ class Info : protected Pointers {
  bool is_defined(const char *, const char *);
  bool is_available(const char *, const char *);

  bool has_gzip_support() const;
  bool has_png_support() const;
  bool has_jpeg_support() const;
  bool has_ffmpeg_support() const;
  bool has_exceptions() const;

private:
  void available_styles(FILE * out, int flags);