move json.hpp class to thirdparty folder and add wrapper for use with LAMMPS
This commit is contained in:
12
src/info.cpp
12
src/info.cpp
@ -34,6 +34,7 @@
|
||||
#include "group.h"
|
||||
#include "improper.h"
|
||||
#include "input.h"
|
||||
#include "json.h"
|
||||
#include "lmpfftsettings.h"
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
@ -291,6 +292,7 @@ void Info::command(int narg, char **arg)
|
||||
utils::print(out,"\nCompiler: {} with {}\nC++ standard: {}\n",
|
||||
platform::compiler_info(),platform::openmp_standard(),platform::cxx_standard());
|
||||
fputs(get_fmt_info().c_str(), out);
|
||||
fputs(get_json_info().c_str(), out);
|
||||
|
||||
fputs("\nActive compile time flags:\n\n",out);
|
||||
if (has_gzip_support()) fputs("-DLAMMPS_GZIP\n",out);
|
||||
@ -1320,6 +1322,16 @@ std::string Info::get_fmt_info()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
std::string Info::get_json_info()
|
||||
{
|
||||
return fmt::format("Embedded JSON class version: {}.{}.{}\n",
|
||||
NLOHMANN_JSON_VERSION_MAJOR,
|
||||
NLOHMANN_JSON_VERSION_MINOR,
|
||||
NLOHMANN_JSON_VERSION_PATCH);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Info::get_memory_info(double *meminfo)
|
||||
{
|
||||
double bytes = 0;
|
||||
|
||||
@ -50,6 +50,7 @@ class Info : public Command {
|
||||
const std::string &);
|
||||
static std::string get_fft_info();
|
||||
static std::string get_fmt_info();
|
||||
static std::string get_json_info();
|
||||
static bool has_gpu_device();
|
||||
static std::string get_gpu_device_info();
|
||||
static std::string get_accelerator_info(const std::string &pkg = "");
|
||||
|
||||
25
src/json.h
Normal file
25
src/json.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
LAMMPS development team: developers@lammps.org
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_JSON_H
|
||||
#define LMP_JSON_H
|
||||
|
||||
// wrapper around including the JSON parsing and writing class
|
||||
// Do NOT include in any header file
|
||||
|
||||
#include "../third_party/nlohmann/json.hpp"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using json = ::nlohmann_lmp::json;
|
||||
}
|
||||
#endif
|
||||
@ -1456,6 +1456,7 @@ void LAMMPS::print_config(FILE *fp)
|
||||
platform::compiler_info(),platform::openmp_standard(),
|
||||
platform::cxx_standard());
|
||||
fputs(Info::get_fmt_info().c_str(),fp);
|
||||
fputs(Info::get_json_info().c_str(),fp);
|
||||
|
||||
int major,minor;
|
||||
std::string infobuf = platform::mpi_info(major,minor);
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#include "input.h"
|
||||
#include "library.h"
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "json.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <mpi.h>
|
||||
@ -32,7 +32,6 @@
|
||||
#include <mdi.h>
|
||||
#endif
|
||||
|
||||
using json = nlohmann_lmp::json;
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
// for convenience
|
||||
|
||||
1
third_party/README
vendored
Normal file
1
third_party/README
vendored
Normal file
@ -0,0 +1 @@
|
||||
This folder contains copies of third-party software
|
||||
@ -12,15 +12,16 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "lmptype.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
#include "json.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using ::testing::Eq;
|
||||
using json = ::nlohmann_lmp::json;
|
||||
|
||||
#define STRINGIFY(val) XSTR(val)
|
||||
#define XSTR(val) #val
|
||||
|
||||
Reference in New Issue
Block a user