forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11403 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
15a48a27b5
commit
19252df8ad
|
@ -162,6 +162,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||||
tag_enable = 1;
|
tag_enable = 1;
|
||||||
map_style = map_user = 0;
|
map_style = map_user = 0;
|
||||||
map_tag_max = 0;
|
map_tag_max = 0;
|
||||||
|
map_maxarray = 0;
|
||||||
map_nhash = 0;
|
map_nhash = 0;
|
||||||
|
|
||||||
max_same = 0;
|
max_same = 0;
|
||||||
|
@ -1848,7 +1849,7 @@ bigint Atom::memory_usage()
|
||||||
|
|
||||||
bytes += max_same*sizeof(int);
|
bytes += max_same*sizeof(int);
|
||||||
if (map_style == 1)
|
if (map_style == 1)
|
||||||
bytes += memory->usage(map_array,max_array);
|
bytes += memory->usage(map_array,map_maxarray);
|
||||||
else if (map_style == 2) {
|
else if (map_style == 2) {
|
||||||
bytes += map_nbucket*sizeof(int);
|
bytes += map_nbucket*sizeof(int);
|
||||||
bytes += map_nhash*sizeof(HashElem);
|
bytes += map_nhash*sizeof(HashElem);
|
||||||
|
|
|
@ -241,9 +241,10 @@ class Atom : protected Pointers {
|
||||||
|
|
||||||
// global to local ID mapping
|
// global to local ID mapping
|
||||||
|
|
||||||
int *map_array; // direct map of length map_tag_max + 1
|
int *map_array; // direct map via array that holds map_tag_max
|
||||||
|
int map_maxarray; // allocated size of map_array (1 larger than this)
|
||||||
|
|
||||||
struct HashElem {
|
struct HashElem { // hashed map
|
||||||
tagint global; // key to search on = global ID
|
tagint global; // key to search on = global ID
|
||||||
int local; // value associated with key = local index
|
int local; // value associated with key = local index
|
||||||
int next; // next entry in this bucket, -1 if last
|
int next; // next entry in this bucket, -1 if last
|
||||||
|
@ -255,8 +256,6 @@ class Atom : protected Pointers {
|
||||||
int *map_bucket; // ptr to 1st entry in each bucket
|
int *map_bucket; // ptr to 1st entry in each bucket
|
||||||
HashElem *map_hash; // hash table
|
HashElem *map_hash; // hash table
|
||||||
|
|
||||||
int max_array; // allocated size of map_array (+1)
|
|
||||||
int max_nhash; // allocated size of hash table
|
|
||||||
int max_same; // allocated size of sametag
|
int max_same; // allocated size of sametag
|
||||||
|
|
||||||
// spatial sorting of atoms
|
// spatial sorting of atoms
|
||||||
|
|
|
@ -60,7 +60,7 @@ void Atom::map_init()
|
||||||
|
|
||||||
int recreate = 0;
|
int recreate = 0;
|
||||||
if (map_style != map_style_old) recreate = 1;
|
if (map_style != map_style_old) recreate = 1;
|
||||||
else if (map_style == 1 && map_tag_max > max_array) recreate = 1;
|
else if (map_style == 1 && map_tag_max > map_maxarray) recreate = 1;
|
||||||
else if (map_style == 2 && nlocal+nghost > map_nhash) recreate = 1;
|
else if (map_style == 2 && nlocal+nghost > map_nhash) recreate = 1;
|
||||||
|
|
||||||
// if not recreating:
|
// if not recreating:
|
||||||
|
@ -84,8 +84,8 @@ void Atom::map_init()
|
||||||
map_delete();
|
map_delete();
|
||||||
|
|
||||||
if (map_style == 1) {
|
if (map_style == 1) {
|
||||||
max_array = map_tag_max;
|
map_maxarray = map_tag_max;
|
||||||
memory->create(map_array,max_array+1,"atom:map_array");
|
memory->create(map_array,map_maxarray+1,"atom:map_array");
|
||||||
for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1;
|
for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue