2006-09-28 03:51:33 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
2007-01-30 08:22:05 +08:00
|
|
|
http://lammps.sandia.gov, Sandia National Laboratories
|
|
|
|
Steve Plimpton, sjplimp@sandia.gov
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
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.
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2010-01-12 09:37:48 +08:00
|
|
|
#ifndef LMP_VARIABLE_H
|
|
|
|
#define LMP_VARIABLE_H
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
#include "pointers.h"
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
namespace LAMMPS_NS {
|
|
|
|
|
|
|
|
class Variable : protected Pointers {
|
2006-09-28 03:51:33 +08:00
|
|
|
public:
|
2007-01-30 08:22:05 +08:00
|
|
|
Variable(class LAMMPS *);
|
2006-09-28 03:51:33 +08:00
|
|
|
~Variable();
|
|
|
|
void set(int, char **);
|
|
|
|
void set(char *, char *);
|
|
|
|
int next(int, char **);
|
2007-01-30 08:22:05 +08:00
|
|
|
int find(char *);
|
2008-01-03 03:24:46 +08:00
|
|
|
int equalstyle(int);
|
|
|
|
int atomstyle(int);
|
2006-09-28 03:51:33 +08:00
|
|
|
char *retrieve(char *);
|
2008-01-03 03:24:46 +08:00
|
|
|
double compute_equal(int);
|
|
|
|
void compute_atom(int, int, double *, int, int);
|
2009-12-10 05:12:49 +08:00
|
|
|
int int_between_brackets(char *&);
|
2007-02-21 08:15:29 +08:00
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
private:
|
|
|
|
int me;
|
|
|
|
int nvar; // # of defined variables
|
|
|
|
int maxvar; // max # of variables arrays can hold
|
|
|
|
char **names; // name of each variable
|
|
|
|
int *style; // style of each variable
|
|
|
|
int *num; // # of values for each variable
|
|
|
|
int *index; // next available value for each variable
|
|
|
|
char ***data; // str value of each variable's values
|
2010-04-24 04:18:24 +08:00
|
|
|
int precedence[15]; // precedence level of math operators
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2008-01-03 03:24:46 +08:00
|
|
|
struct Tree { // parse tree for atom-style variables
|
2007-02-21 08:15:29 +08:00
|
|
|
double value;
|
|
|
|
double *array;
|
2009-06-29 23:29:26 +08:00
|
|
|
int *iarray;
|
2007-02-21 08:15:29 +08:00
|
|
|
int nstride;
|
|
|
|
int type;
|
|
|
|
Tree *left,*right;
|
|
|
|
};
|
|
|
|
|
2008-10-07 22:44:33 +08:00
|
|
|
void remove(int);
|
|
|
|
void extend();
|
2006-09-28 03:51:33 +08:00
|
|
|
void copy(int, char **, char **);
|
2008-01-03 03:24:46 +08:00
|
|
|
double evaluate(char *, Tree **);
|
2007-02-21 08:15:29 +08:00
|
|
|
double eval_tree(Tree *, int);
|
|
|
|
void free_tree(Tree *);
|
2008-01-03 03:24:46 +08:00
|
|
|
int find_matching_paren(char *, int, char *&);
|
|
|
|
int math_function(char *, char *, Tree **, Tree **, int &, double *, int &);
|
|
|
|
int group_function(char *, char *, Tree **, Tree **, int &, double *, int &);
|
2009-04-29 03:46:52 +08:00
|
|
|
int region_function(char *);
|
2008-01-09 07:13:53 +08:00
|
|
|
void peratom2global(int, char *, double *, int, int,
|
|
|
|
Tree **, Tree **, int &, double *, int &);
|
2009-12-10 05:12:49 +08:00
|
|
|
int is_atom_vector(char *);
|
2008-01-03 03:24:46 +08:00
|
|
|
void atom_vector(char *, Tree **, Tree **, int &);
|
2006-09-28 03:51:33 +08:00
|
|
|
};
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
#endif
|