NAMD
Classes | Macros | Enumerations | Functions
ParseOptions.h File Reference
#include "common.h"
#include "Vector.h"

Go to the source code of this file.

Classes

class  ParseOptions
 
class  ParseOptions::DataElement
 

Macros

#define PARSE_FLOAT   (BigReal *) NULL
 
#define PARSE_BIGREAL   (BigReal *) NULL
 
#define PARSE_VECTOR   (Vector *) NULL
 
#define PARSE_INT   (int *) NULL
 
#define PARSE_BOOL   (int *) NULL
 
#define PARSE_STRING   (char *) NULL
 
#define PARSE_ANYTHING   (StringList **) NULL
 
#define PARSE_MULTIPLES   (StringList **) NULL, TRUE
 

Enumerations

enum  Range {
  FREE_RANGE, POSITIVE, NOT_NEGATIVE, NEGATIVE,
  NOT_POSITIVE
}
 
enum  Units {
  N_UNIT, N_FSEC, N_NSEC, N_SEC,
  N_MIN, N_HOUR, N_ANGSTROM, N_NANOMETER,
  N_METER, N_KCAL, N_KJOULE, N_EV,
  N_KELVIN, N_UNITS_UNDEFINED
}
 

Functions

BigReal convert (Units to, Units from)
 

Macro Definition Documentation

#define PARSE_ANYTHING   (StringList **) NULL

Definition at line 39 of file ParseOptions.h.

#define PARSE_BIGREAL   (BigReal *) NULL

Definition at line 34 of file ParseOptions.h.

#define PARSE_BOOL   (int *) NULL

Definition at line 37 of file ParseOptions.h.

#define PARSE_FLOAT   (BigReal *) NULL

Definition at line 33 of file ParseOptions.h.

#define PARSE_INT   (int *) NULL

Definition at line 36 of file ParseOptions.h.

#define PARSE_MULTIPLES   (StringList **) NULL, TRUE

Definition at line 40 of file ParseOptions.h.

#define PARSE_STRING   (char *) NULL

Definition at line 38 of file ParseOptions.h.

#define PARSE_VECTOR   (Vector *) NULL

Definition at line 35 of file ParseOptions.h.

Enumeration Type Documentation

enum Range
Enumerator
FREE_RANGE 
POSITIVE 
NOT_NEGATIVE 
NEGATIVE 
NOT_POSITIVE 

Definition at line 26 of file ParseOptions.h.

enum Units
Enumerator
N_UNIT 
N_FSEC 
N_NSEC 
N_SEC 
N_MIN 
N_HOUR 
N_ANGSTROM 
N_NANOMETER 
N_METER 
N_KCAL 
N_KJOULE 
N_EV 
N_KELVIN 
N_UNITS_UNDEFINED 

Definition at line 28 of file ParseOptions.h.

Function Documentation

BigReal convert ( Units  to,
Units  from 
)

Definition at line 89 of file ParseOptions.C.

References N_ANGSTROM, N_EV, N_FSEC, N_HOUR, N_KCAL, N_KELVIN, N_KJOULE, N_METER, N_MIN, N_NANOMETER, N_NSEC, N_SEC, and N_UNIT.

90 {
91 // cout << "Converting from " << string(from) << " to " << string(to) << std::endl;
92 // cout << scaling_factors[from] << " <--> " << scaling_factors[to] << std::endl;
93  if (from == N_UNIT && to == N_UNIT) { return 1.0; }
94  if ((from == N_NSEC || from == N_FSEC || from == N_SEC || from == N_MIN ||
95  from == N_HOUR) &&
96  (to == N_NSEC || to == N_FSEC || to == N_SEC || to == N_MIN ||
97  to == N_HOUR)) {
98  return scaling_factors[from]/scaling_factors[to];
99  }
100  if ((from == N_METER || from == N_NANOMETER || from == N_ANGSTROM) &&
101  (to == N_METER || to == N_NANOMETER || to == N_ANGSTROM)) {
102  return scaling_factors[from]/scaling_factors[to];
103  }
104  if ((from == N_KCAL || from == N_KJOULE || from == N_EV) &&
105  (to == N_KCAL || to == N_KJOULE || to == N_EV)) {
106  return scaling_factors[from]/scaling_factors[to];
107  }
108  if (from == N_KELVIN && to == N_KELVIN) {
109  return scaling_factors[from]/scaling_factors[to];
110  }
111  return 0.0;
112 }
static BigReal scaling_factors[N_UNITS_UNDEFINED+1]
Definition: ParseOptions.C:82