Files
lammps/src/irregular.h
Axel Kohlmeyer 1f17e8ebbb remove need for static class member variables in Dump and Irregular
The dump and irregular classes were using qsort() from the C-library
for sorting lists through custom comparison functions, which required
access to additional data, which was passed via static class variables,
i.e. globals. This collides with having multiple LAMMPS instances in
the same address space.

the calls to qsort() are replaced with a custom merge sort, which passes
a void pointer to the comparison functions, which can contain any kind
of desired information, e.g. a class handle or a list
2017-06-14 23:10:53 -04:00

97 lines
3.4 KiB
C++

/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
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.
------------------------------------------------------------------------- */
#ifndef LMP_IRREGULAR_H
#define LMP_IRREGULAR_H
#include "pointers.h"
namespace LAMMPS_NS {
class Irregular : protected Pointers {
public:
Irregular(class LAMMPS *);
~Irregular();
void migrate_atoms(int sortflag = 0, int preassign = 0,
int *procassign = NULL);
int migrate_check();
int create_data(int, int *, int sortflag = 0);
void exchange_data(char *, int, char *);
void destroy_data();
bigint memory_usage();
private:
int me,nprocs;
int triclinic;
int map_style;
int maxsend,maxrecv; // size of buf send/recv in # of doubles
double *buf_send,*buf_recv; // bufs used in migrate_atoms
int maxdbuf; // size of double buf in bytes
double *dbuf; // double buf for largest single atom send
int maxbuf; // size of char buf in bytes
char *buf; // char buf for largest single data send
int *mproclist,*msizes; // persistent vectors in migrate_atoms
int maxlocal; // allocated size of mproclist and msizes
int *work1,*work2; // work vectors
// plan params for irregular communication of atoms or datums
// no params refer to atoms/data copied to self
int nsend_proc; // # of messages to send
int nrecv_proc; // # of messages to recv
int sendmax_proc; // # of doubles/datums in largest send message
int *proc_send; // list of procs to send to
int *num_send; // # of atoms/datums to send to each proc
int *index_send; // list of which atoms/datums to send to each proc
int *proc_recv; // list of procs to recv from
MPI_Request *request; // MPI requests for posted recvs
MPI_Status *status; // MPI statuses for WaitAll
// extra plan params plan for irregular communication of atoms
// no params refer to atoms copied to self
int *length_send; // # of doubles to send to each proc
int *length_recv; // # of doubles to recv from each proc
int *offset_send; // where each atom starts in send buffer
// extra plan params plan for irregular communication of datums
// 2 self params refer to data copied to self
int *num_recv; // # of datums to recv from each proc
int num_self; // # of datums to copy to self
int *index_self; // list of which datums to copy to self
// private methods
int create_atom(int, int *, int *, int);
void exchange_atom(double *, int *, double *);
void destroy_atom();
int binary(double, int, double *);
void grow_send(int,int); // reallocate send buffer
void grow_recv(int); // free/allocate recv buffer
};
}
#endif
/* ERROR/WARNING messages:
*/