apply clang-format

This commit is contained in:
Axel Kohlmeyer
2021-12-21 13:20:25 -05:00
parent c780768e91
commit 364d0be28c
4 changed files with 109 additions and 105 deletions

View File

@ -29,7 +29,9 @@ DumpStyle(netcdf,DumpNetCDF);
#include "dump_custom.h" #include "dump_custom.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace NetCDFUnits {enum Quantity : int;} // forward declaration namespace NetCDFUnits {
enum Quantity : int;
} // namespace NetCDFUnits
const int NC_FIELD_NAME_MAX = 100; const int NC_FIELD_NAME_MAX = 100;
const int DUMP_NC_MAX_DIMS = 100; const int DUMP_NC_MAX_DIMS = 100;
@ -43,11 +45,11 @@ class DumpNetCDF : public DumpCustom {
private: private:
// per-atoms quantities (positions, velocities, etc.) // per-atoms quantities (positions, velocities, etc.)
struct nc_perat_t { struct nc_perat_t {
int dims; // number of dimensions int dims; // number of dimensions
int field[DUMP_NC_MAX_DIMS]; // field indices corresponding to the dim. int field[DUMP_NC_MAX_DIMS]; // field indices corresponding to the dim.
char name[NC_FIELD_NAME_MAX]; // field name char name[NC_FIELD_NAME_MAX]; // field name
int var; // NetCDF variable int var; // NetCDF variable
NetCDFUnits::Quantity quantity; // type of the quantity NetCDFUnits::Quantity quantity; // type of the quantity
bool constant; // is this property per file (not per frame) bool constant; // is this property per file (not per frame)
int ndumped; // number of enties written for this prop. int ndumped; // number of enties written for this prop.
@ -64,8 +66,8 @@ class DumpNetCDF : public DumpCustom {
int *thermovar; // NetCDF variables for thermo output int *thermovar; // NetCDF variables for thermo output
int type_nc_real; // netcdf type to use for real variables: float or double int type_nc_real; // netcdf type to use for real variables: float or double
bool thermo; // write thermo output to netcdf file bool thermo; // write thermo output to netcdf file
bigint n_buffer; // size of buffer bigint n_buffer; // size of buffer
bigint *int_buffer; // buffer for passing data to netcdf bigint *int_buffer; // buffer for passing data to netcdf

View File

@ -29,7 +29,9 @@ DumpStyle(netcdf/mpiio,DumpNetCDFMPIIO);
#include "dump_custom.h" #include "dump_custom.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace NetCDFUnits {enum Quantity : int;} // forward declaration namespace NetCDFUnits {
enum Quantity : int;
} // namespace NetCDFUnits
const int NC_MPIIO_FIELD_NAME_MAX = 100; const int NC_MPIIO_FIELD_NAME_MAX = 100;
const int DUMP_NC_MPIIO_MAX_DIMS = 100; const int DUMP_NC_MPIIO_MAX_DIMS = 100;
@ -63,8 +65,8 @@ class DumpNetCDFMPIIO : public DumpCustom {
int *thermovar; // NetCDF variables for thermo output int *thermovar; // NetCDF variables for thermo output
int type_nc_real; // netcdf type to use for real variables: float or double int type_nc_real; // netcdf type to use for real variables: float or double
bool thermo; // write thermo output to netcdf file bool thermo; // write thermo output to netcdf file
bigint n_buffer; // size of buffer bigint n_buffer; // size of buffer
bigint *int_buffer; // buffer for passing data to netcdf bigint *int_buffer; // buffer for passing data to netcdf

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -24,7 +23,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
std::string NetCDFUnits::get_unit_for(const char* unit_style, Quantity quantity, Error* error) { std::string NetCDFUnits::get_unit_for(const char *unit_style, Quantity quantity, Error *error)
{
if (!strcmp(unit_style, "lj")) { if (!strcmp(unit_style, "lj")) {
if (quantity == Quantity::UNKNOWN) { if (quantity == Quantity::UNKNOWN) {
return ""; return "";
@ -33,108 +33,108 @@ std::string NetCDFUnits::get_unit_for(const char* unit_style, Quantity quantity,
} }
} else if (!strcmp(unit_style, "real")) { } else if (!strcmp(unit_style, "real")) {
switch (quantity) { switch (quantity) {
case Quantity::UNKNOWN: case Quantity::UNKNOWN:
return ""; return "";
case Quantity::TIME: case Quantity::TIME:
return "femtosecond"; return "femtosecond";
case Quantity::DISTANCE: case Quantity::DISTANCE:
return "angstrom"; return "angstrom";
case Quantity::VELOCITY: case Quantity::VELOCITY:
return "angstrom/femtosecond"; return "angstrom/femtosecond";
case Quantity::FORCE: case Quantity::FORCE:
return "(Kcal/mol)/angstrom)"; return "(Kcal/mol)/angstrom)";
case Quantity::DIPOLE_MOMENT: case Quantity::DIPOLE_MOMENT:
return "e * angstrom"; return "e * angstrom";
} }
} else if (!strcmp(unit_style, "metal")) { } else if (!strcmp(unit_style, "metal")) {
switch (quantity) { switch (quantity) {
case Quantity::UNKNOWN: case Quantity::UNKNOWN:
return ""; return "";
case Quantity::TIME: case Quantity::TIME:
return "picosecond"; return "picosecond";
case Quantity::DISTANCE: case Quantity::DISTANCE:
return "angstrom"; return "angstrom";
case Quantity::VELOCITY: case Quantity::VELOCITY:
return "angstrom/picosecond"; return "angstrom/picosecond";
case Quantity::FORCE: case Quantity::FORCE:
return "eV/angstrom"; return "eV/angstrom";
case Quantity::DIPOLE_MOMENT: case Quantity::DIPOLE_MOMENT:
return "e * angstrom"; return "e * angstrom";
} }
} else if (!strcmp(unit_style, "si")) { } else if (!strcmp(unit_style, "si")) {
switch (quantity) { switch (quantity) {
case Quantity::UNKNOWN: case Quantity::UNKNOWN:
return ""; return "";
case Quantity::TIME: case Quantity::TIME:
return "second"; return "second";
case Quantity::DISTANCE: case Quantity::DISTANCE:
return "meter"; return "meter";
case Quantity::VELOCITY: case Quantity::VELOCITY:
return "meter/second"; return "meter/second";
case Quantity::FORCE: case Quantity::FORCE:
return "Newton"; return "Newton";
case Quantity::DIPOLE_MOMENT: case Quantity::DIPOLE_MOMENT:
return "Coulomb * meter"; return "Coulomb * meter";
} }
} else if (!strcmp(unit_style, "cgs")) { } else if (!strcmp(unit_style, "cgs")) {
switch (quantity) { switch (quantity) {
case Quantity::UNKNOWN: case Quantity::UNKNOWN:
return ""; return "";
case Quantity::TIME: case Quantity::TIME:
return "second"; return "second";
case Quantity::DISTANCE: case Quantity::DISTANCE:
return "centimeter"; return "centimeter";
case Quantity::VELOCITY: case Quantity::VELOCITY:
return "centimeter/second"; return "centimeter/second";
case Quantity::FORCE: case Quantity::FORCE:
return "dynes"; return "dynes";
case Quantity::DIPOLE_MOMENT: case Quantity::DIPOLE_MOMENT:
return "statcoul * cm"; return "statcoul * cm";
} }
} else if (!strcmp(unit_style, "electron")) { } else if (!strcmp(unit_style, "electron")) {
switch (quantity) { switch (quantity) {
case Quantity::UNKNOWN: case Quantity::UNKNOWN:
return ""; return "";
case Quantity::TIME: case Quantity::TIME:
return "femtoseconds"; return "femtoseconds";
case Quantity::DISTANCE: case Quantity::DISTANCE:
return "Bohr"; return "Bohr";
case Quantity::VELOCITY: case Quantity::VELOCITY:
return "Bohr/atomic time units"; return "Bohr/atomic time units";
case Quantity::FORCE: case Quantity::FORCE:
return "Hartree/Bohr"; return "Hartree/Bohr";
case Quantity::DIPOLE_MOMENT: case Quantity::DIPOLE_MOMENT:
return "Debye"; return "Debye";
} }
} else if (!strcmp(unit_style, "micro")) { } else if (!strcmp(unit_style, "micro")) {
switch (quantity) { switch (quantity) {
case Quantity::UNKNOWN: case Quantity::UNKNOWN:
return ""; return "";
case Quantity::TIME: case Quantity::TIME:
return "microseconds"; return "microseconds";
case Quantity::DISTANCE: case Quantity::DISTANCE:
return "micrometers"; return "micrometers";
case Quantity::VELOCITY: case Quantity::VELOCITY:
return "micrometers/microsecond"; return "micrometers/microsecond";
case Quantity::FORCE: case Quantity::FORCE:
return "picogram * micrometer/microsecond^2"; return "picogram * micrometer/microsecond^2";
case Quantity::DIPOLE_MOMENT: case Quantity::DIPOLE_MOMENT:
return "picocoulomb * micrometer"; return "picocoulomb * micrometer";
} }
} else if (!strcmp(unit_style, "nano")) { } else if (!strcmp(unit_style, "nano")) {
switch (quantity) { switch (quantity) {
case Quantity::UNKNOWN: case Quantity::UNKNOWN:
return ""; return "";
case Quantity::TIME: case Quantity::TIME:
return "nanoseconds"; return "nanoseconds";
case Quantity::DISTANCE: case Quantity::DISTANCE:
return "nanometers"; return "nanometers";
case Quantity::VELOCITY: case Quantity::VELOCITY:
return "nanometers/nanosecond"; return "nanometers/nanosecond";
case Quantity::FORCE: case Quantity::FORCE:
return "attogram * nanometer/nanosecond^2"; return "attogram * nanometer/nanosecond^2";
case Quantity::DIPOLE_MOMENT: case Quantity::DIPOLE_MOMENT:
return "e * nanometer"; return "e * nanometer";
} }
} }

View File

@ -26,21 +26,21 @@ namespace LAMMPS_NS {
class Error; class Error;
namespace NetCDFUnits { namespace NetCDFUnits {
// type of quantity for per-atom values (used to get the unit) // type of quantity for per-atom values (used to get the unit)
enum Quantity : int { enum Quantity : int {
UNKNOWN = 0, UNKNOWN = 0,
TIME, TIME,
DISTANCE, DISTANCE,
VELOCITY, VELOCITY,
FORCE, FORCE,
DIPOLE_MOMENT, DIPOLE_MOMENT,
}; };
// get the name of the unit for the given `quantity` in the given LAMMPS // get the name of the unit for the given `quantity` in the given LAMMPS
// `unit_style` any error will be reported through `error` // `unit_style` any error will be reported through `error`
std::string get_unit_for(const char* unit_style, Quantity quantity, Error* error); std::string get_unit_for(const char *unit_style, Quantity quantity, Error *error);
} } // namespace NetCDFUnits
} } // namespace LAMMPS_NS
#endif #endif
#endif #endif