replace some numeric constants in Atom and AtomVec classes with enumerators
This commit is contained in:
@ -44,15 +44,15 @@ void Atom::map_init(int check)
|
||||
int recreate = 0;
|
||||
if (check) recreate = map_style_set();
|
||||
|
||||
if (map_style == 1 && map_tag_max > map_maxarray) recreate = 1;
|
||||
else if (map_style == 2 && nlocal+nghost > map_nhash) recreate = 1;
|
||||
if (map_style == MAP_ARRAY && map_tag_max > map_maxarray) recreate = 1;
|
||||
else if (map_style == MAP_HASH && nlocal+nghost > map_nhash) recreate = 1;
|
||||
|
||||
// if not recreating:
|
||||
// for array, initialize current map_tag_max values
|
||||
// for hash, set all buckets to empty, put all entries in free list
|
||||
|
||||
if (!recreate) {
|
||||
if (map_style == 1) {
|
||||
if (map_style == MAP_ARRAY) {
|
||||
for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1;
|
||||
} else {
|
||||
for (int i = 0; i < map_nbucket; i++) map_bucket[i] = -1;
|
||||
@ -67,7 +67,7 @@ void Atom::map_init(int check)
|
||||
} else {
|
||||
map_delete();
|
||||
|
||||
if (map_style == 1) {
|
||||
if (map_style == MAP_ARRAY) {
|
||||
map_maxarray = map_tag_max;
|
||||
memory->create(map_array,map_maxarray+1,"atom:map_array");
|
||||
for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1;
|
||||
@ -114,7 +114,7 @@ void Atom::map_init(int check)
|
||||
|
||||
void Atom::map_clear()
|
||||
{
|
||||
if (map_style == 1) {
|
||||
if (map_style == MAP_ARRAY) {
|
||||
int nall = nlocal + nghost;
|
||||
for (int i = 0; i < nall; i++) {
|
||||
sametag[i] = -1;
|
||||
@ -169,7 +169,7 @@ void Atom::map_set()
|
||||
{
|
||||
int nall = nlocal + nghost;
|
||||
|
||||
if (map_style == 1) {
|
||||
if (map_style == MAP_ARRAY) {
|
||||
|
||||
// possible reallocation of sametag must come before loop over atoms
|
||||
// since loop sets sametag
|
||||
@ -247,7 +247,7 @@ void Atom::map_set()
|
||||
|
||||
void Atom::map_one(tagint global, int local)
|
||||
{
|
||||
if (map_style == 1) map_array[global] = local;
|
||||
if (map_style == MAP_ARRAY) map_array[global] = local;
|
||||
else {
|
||||
// search for key
|
||||
// if found it, just overwrite local value with index
|
||||
@ -305,9 +305,12 @@ int Atom::map_style_set()
|
||||
// else use array
|
||||
|
||||
int map_style_old = map_style;
|
||||
if (map_user == 1 || map_user == 2) map_style = map_user;
|
||||
else if (map_tag_max > 1000000 && !lmp->kokkos) map_style = 2;
|
||||
else map_style = 1;
|
||||
if (map_user == MAP_ARRAY || map_user == MAP_HASH) {
|
||||
map_style = map_user;
|
||||
} else { // map_user == MAP_YES
|
||||
if (map_tag_max > 1000000 && !lmp->kokkos) map_style = MAP_HASH;
|
||||
else map_style = MAP_ARRAY;
|
||||
}
|
||||
|
||||
// recreate = 1 if must create new map b/c map_style changed
|
||||
|
||||
@ -326,7 +329,7 @@ void Atom::map_delete()
|
||||
sametag = NULL;
|
||||
max_same = 0;
|
||||
|
||||
if (map_style == 1) {
|
||||
if (map_style == MAP_ARRAY) {
|
||||
memory->destroy(map_array);
|
||||
map_array = NULL;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user