OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
DiscParticle.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef DISC_PARTICLE_H
12 #define DISC_PARTICLE_H
13 
14 // include files
15 #include "Utility/DiscConfig.h"
16 #include "Utility/IpplInfo.h"
17 #include "Utility/PAssert.h"
18 #include "Message/Communicate.h"
19 #include "Message/Message.h"
20 #include "Message/Tags.h"
21 
22 #include <vector>
23 #include <iostream>
24 #include <cstdio>
25 
26 // forward declarations
27 template<class T> class IpplParticleBase;
28 template<class T> class ParticleAttrib;
29 
30 class DiscParticle {
31 
32 public:
33  // an enumeration used to indicate whether the file is for reading (INPUT)
34  // or writing (OUTPUT), or for appending (APPEND)
35  enum DPMode1 { INPUT, OUTPUT, APPEND };
36 
37  // an enumeration used to indicate whether we should read/write just a
38  // single attribute, or the whole set of particle attributes
39  enum DPMode2 { ALL, ATTRIB };
40 
41 public:
42  // Constructor: make a DiscParticle for reading or writing.
43  // fname = name of file (without extensions)
44  // config = name of configuration file
45  // I/O mode (INPUT, OUTPUT, or APPEND)
46  // typestr = string describing the 'type' of the Particles to be written
47  // (this is ignored if the data is being read). The string can
48  // be anything the user prefers.
49  DiscParticle(const char *fname, const char *config, int iomode,
50  const char *typestr = 0);
51 
52  // Constructor: same as above, but without a config file specified. The
53  // default config file entry that will be used is "* .", which means, for
54  // each SMP machine, assume the directory to put data files in is "."
55  DiscParticle(const char *fname, int iomode, const char * = 0);
56 
57  // Destructor.
58  ~DiscParticle();
59 
60  //
61  // accessor functions
62  //
63 
64  // Query for whether everything is OK so far.
65  bool get_OK() const { return ConfigOK; }
66 
67  // Query for the number of records in the file. If all attributes in a
68  // Particle object are being written out, this is the number of sets of
69  // attribute collections; if only single attributes are being written out,
70  // this is the number of attributes which were written.
71  unsigned int get_NumRecords() const { return RecordList.size(); }
72 
73  // Query for the mode of the Nth record, which can be either ALL (meaning
74  // an entire IpplParticleBase's list of attributes was written out), or
75  // ATTRIB (meaning only one specific attribute was written out).
76  int get_DataMode(unsigned int record=0) const {
77  return (RecordList[record]->attributes > 0 ? ALL : ATTRIB);
78  }
79 
80  // Query for how this DiscParticle is operationg, either INPUT, OUTPUT, or
81  // APPEND.
82  int get_IOMode() const { return IOMode; }
83 
84  // Query for how many individual particles are stored in the Nth record,
85  // for just the local filesets
86  unsigned int get_NumLocalParticles(unsigned int record=0) const;
87 
88  // Query for how many individual particles are stored in the Nth record,
89  // for the entire particle object (sum of all local particle counts)
90  unsigned int get_NumGlobalParticles(unsigned int record=0) const {
91  return RecordList[record]->globalparticles;
92  }
93 
94  // Query for the number of attributes in the Nth record
95  unsigned int get_NumAttributes(unsigned int record=0) const {
96  return (get_DataMode(record)==ALL ? RecordList[record]->attributes : 1);
97  }
98 
99  // Query for the number of bytes/elem in the Mth attribute in the Nth record
100  unsigned int get_ElemByteSize(unsigned int record=0,
101  unsigned int attrib=0) const {
102  return RecordList[record]->bytesize[attrib];
103  }
104 
105  // Query for the user-specified type string
106  const char *get_TypeString() const { return TypeString.c_str(); }
107 
108  // Query for the DiscType string for the Mth attribute in the Nth record.
109  // If there not one available, return 0.
110  const char *get_DiscType(unsigned int record=0,
111  unsigned int attrib=0) const;
112 
113  //
114  // read methods
115  //
116  // read the specifed record in the file into the given IpplParticleBase or
117  // ParticleAttrib object.
118  // If the method is to read all the IpplParticleBase, this will delete all the
119  // existing particles in the given object, create new ones and store the
120  // values, and then do an update. If an attribute is being read, this
121  // will only work if the number of particles in the attribute already
122  // matches the number in the file.
123 
124  // a templated read for IpplParticleBase objects. This should only be called
125  // if the object was opened with iomode == INPUT
126  // pbase = IpplParticleBase object to read into
127  // record = which record to read. DiscParticle does not keep a 'current
128  // file position' pointer, instead you explicitly request which
129  // record you wish to read.
130  // Return success of operation.
131  //mwerks template<class T>
132  //mwerks bool read(IpplParticleBase<T> &pbase, unsigned int record=0);
134  // a templated read for IpplParticleBase objects. This should only be called
135  // if the object was opened with iomode == INPUT, datamode == ALL.
136  // pbase = IpplParticleBase object to read into
137  // record = which record to read. DiscParticle does not keep a 'current
138  // file position' pointer, instead you explicitly request which
139  // record you wish to read.
140  // Return success of operation.
141  template<class T>
142  bool read(IpplParticleBase<T> &pbase, unsigned int record) {
143 
144  // re-read the meta file since it might have changed
145  ConfigOK = read_meta();
146 
147  // do some sanity checking first
148  if (!ConfigOK) {
149  ERRORMSG("Bad config or meta file in DiscParticle::read." << endl);
150  return false;
151  } else if (IOMode != INPUT) {
152  ERRORMSG("Trying to read for DiscParticle created for output." << endl);
153  return false;
154  } else if (record >= get_NumRecords()) {
155  ERRORMSG("Illegal record number in DiscParticle::read." << endl);
156  return false;
157  } else if (get_DataMode(record) != ALL) {
158  ERRORMSG("Record " << record << " does not contain information for an ");
159  ERRORMSG("entire IpplParticleBase." << endl);
160  return false;
161  } else if (get_NumAttributes(record) != pbase.numAttributes()) {
162  ERRORMSG("Record " << record <<" has a different number of attributes ");
163  ERRORMSG("than in the given IpplParticleBase." << endl);
164  return false;
165  }
166 
167 // ada: incDiscReads is not found INCIPPLSTAT(incDiscReads);
168 
169  // make sure all the attribute sizes match
170  for (unsigned int ca=0; ca < get_NumAttributes(record); ++ca) {
171  if (get_ElemByteSize(record, ca)!=pbase.getAttribute(ca).elementSize()) {
172  ERRORMSG("Mismatched data type size for attribute " << ca << " in ");
173  ERRORMSG("DiscParticle::read." << endl);
174  return false;
175  }
176  }
177 
178  // since we're reading in data for the entire IpplParticleBase, delete all the
179  // existing particles, and do an update, before reading in new particles
180  pbase.destroy(pbase.getLocalNum(), 0);
181  pbase.update();
182 
183  // if we're on a box0 node, read in the data for the attributes
184  if ((unsigned int) Ippl::myNode() == Config->getSMPBox0()) {
185 
186  // loop over all the files on this Box0 node
187  for (unsigned int sf=0; sf < Config->getNumFiles(); ++sf) {
188 
189  // only need to process this file if there are particles in the file
190  int localnum = RecordList[record]->localparticles[sf];
191  if (localnum > 0) {
192 
193  // open the data file
194  std::string filename = Config->getFilename(sf) + ".data";
195  FILE *datafile = open_file(filename, std::string("r"));
196 
197  // if the file is available, read it
198  if (datafile != 0) {
199  // read the data for each attribute into a buffer, then put
200  // these buffers in a message.
201  Message *msg = new Message;
202  msg->put(localnum);
203 
204  // read in the data for all the attributes
205  for (unsigned int a=0; a < get_NumAttributes(record); ++a) {
206  // read the data
207  void *buf = read_data(datafile, a, record, sf);
208  PAssert(buf);
209 
210  // put it in the Message
211  msg->setCopy(false).setDelete(true);
212  msg->putmsg(buf, get_ElemByteSize(record, a), localnum);
213  }
214 
215  // create new particles, by getting them from the message
216  pbase.getMessageAndCreate(*msg);
217 
218  // we're done with the message now
219  delete msg;
220  }
221  }
222  }
223  }
224 
225  // at the end, do an update to get everything where it is supposed to be
226  pbase.update();
227  return true;
228  }
229 
230  // a templated read for ParticleAttrib objects. This should only be
231  // called if the object was opened with iomode == INPUT
232  // pattr = ParticleAttrib object to read into
233  // record = which record to read. DiscParticle does not keep a 'current
234  // file position' pointer, instead you explicitly request which
235  // record you wish to read.
236  // Return success of operation.
237  //mwerks template<class T>
238  //mwerks bool read(ParticleAttrib<T> &pattr, unsigned int record=0);
240  // a templated read for ParticleAttrib objects. This should only be called
241  // if the object was opened with iomode == INPUT, datamode == ATTRIB. When
242  // reading just a single attribute, the particles simply replace the existing
243  // particles in the attribute.
244  // pbase = ParticleAttrib object to read into
245  // record = which record to read. DiscParticle does not keep a 'current
246  // file position' pointer, instead you explicitly request which
247  // record you wish to read.
248  // Return success of operation.
249  template<class T>
250  bool read(ParticleAttrib<T> &pattr, unsigned int record) {
251 
252  // re-read the meta file since it might have changed
253  ConfigOK = read_meta();
254 
255  // do some sanity checking first
256  if (!ConfigOK) {
257  ERRORMSG("Bad config or meta file in DiscParticle::read." << endl);
258  return false;
259  } else if (IOMode != INPUT) {
260  ERRORMSG("Trying to read for a DiscParticle created for output."<<endl);
261  return false;
262  } else if (record >= get_NumRecords()) {
263  ERRORMSG("Illegal record number in DiscParticle::read." << endl);
264  return false;
265  } else if (get_DataMode(record) != ATTRIB) {
266  ERRORMSG("Record " << record << " does not contain information for a ");
267  ERRORMSG("single ParticleAttrib." << endl);
268  return false;
269  } else if (get_ElemByteSize(record, 0) != pattr.elementSize()) {
270  ERRORMSG("Mismatched attribute data type size in ");
271  ERRORMSG("DiscParticle::read." << endl);
272  return false;
273  }
274 
275  pattr.destroy(pattr.size(), 0);
276 
277  // if we're on a box0 node, read in the data for the attributes
278  if ((unsigned int) Ippl::myNode() == Config->getSMPBox0()) {
279 
280  // loop over all the files on this Box0 node
281  for (unsigned int sf=0; sf < Config->getNumFiles(); ++sf) {
282 
283  // only need to process this file if there are particles in the file
284  int localnum = RecordList[record]->localparticles[sf];
285  if (localnum > 0) {
286 
287  // open the data file
288  std::string filename = Config->getFilename(sf) + ".data";
289  FILE *datafile = open_file(filename, std::string("r"));
290 
291  // if the file is available, read it
292  if (datafile != 0) {
293  // read the data for each attribute into a buffer, then put
294  // these buffers in a message.
295  Message *msg = new Message;
296 
297  // read in the data for the attribute
298  void *buf = read_data(datafile, 0, record, sf);
299  PAssert(buf);
300 
301  // put it in the Message
302  msg->setCopy(false).setDelete(true);
303  msg->putmsg(buf, get_ElemByteSize(record, 0), localnum);
304 
305  // create new particles, by getting them from the message
306  pattr.getMessage(*msg, localnum);
307 
308  // we're done with the message now
309  delete msg;
310  }
311  }
312  }
313  }
314 
315  return true;
316  }
317 
318  //
319  // write methods
320  //
321  // write the data from the given IpplParticleBase or ParticleAttrib into the
322  // file. Data is appended as a new record.
323 
324  // a templated write for IpplParticleBase objects. All attributes in the
325  // IpplParticleBase are written as a single record. This should only be
326  // called if the object was opened with iomode == OUTPUT or APPEND.
327  // pbase = IpplParticleBase object to read from.
328  // Return success of operation.
329  //mwerks template<class T>
330  //mwerks bool write(IpplParticleBase<T> &pbase);
332  // a templated write for IpplParticleBase objects. All attributes in the
333  // IpplParticleBase are written as a single record. This should only be
334  // called if the object was opened with iomode == OUTPUT or APPEND.
335  // pbase = IpplParticleBase object to read into
336  // Return success of operation.
337  template<class T>
338  bool write(IpplParticleBase<T> &pbase) {
339 
340  // generate a tag to use for communication
342 
343  // if the file already has some records, re-read the meta file in case it
344  // has changed. If we do not have any record info, and we've opened
345  // for OUTPUT, we do NOT read any possible meta file since we want to start
346  // a new file.
347  if (get_NumRecords() > 0 || IOMode == APPEND)
348  ConfigOK = read_meta();
349 
350  // do some sanity checking first
351  if (!ConfigOK) {
352  ERRORMSG("Bad config or meta file in DiscParticle::write." << endl);
353  return false;
354  } else if (IOMode == INPUT) {
355  ERRORMSG("Trying to write for a DiscParticle created for input."<<endl);
356  return false;
357  }
358 
359  // create a new record entry, and set it to the proper values
360  RecordInfo *info = new RecordInfo;
361  info->attributes = pbase.numAttributes();
362  info->globalparticles = pbase.getTotalNum();
363  for (int a=0; a < info->attributes; ++a) {
364  info->bytesize.push_back(pbase.getAttribute(a).elementSize());
365  info->disctypes.push_back(pbase.getAttribute(a).typeString());
366  }
367 
368  // Create a message with our local particles, which will then be used
369  // to write out the data
370  Message *msg = new Message;
371  pbase.putMessage(*msg, pbase.getLocalNum(), 0);
372 
373  // on Box0 nodes, first write out your own particles, then write out
374  // all the other node's particles
375  if ((unsigned int) Ippl::myNode() == Config->getSMPBox0()) {
376  // create the data file, if it does not yet exist; otherwise, open
377  // it for append
378  std::string openmode = "a";
379  if (get_NumRecords() == 0)
380  openmode = "w";
381  std::string filename = Config->getFilename(0) + ".data";
382  FILE *datafile = open_file(filename, openmode);
383  if (datafile == 0) {
384  delete info;
385  delete msg;
386  return false;
387  }
388 
389  // create a vector of Messages, which will hold the info to be written
390  // out. We do not write until we have all the messages from the
391  // different nodes writing to the Box0 file.
392  std::vector<Message *> msgvec;
393  msgvec.push_back(msg);
394 
395  // write out our local attribute data, saving where we started to write
396  // determine how many other SMP nodes we expect to receive data from
397  int notreceived = (Config->getNumSMPNodes() - 1);
398  for (unsigned int s=0; s < Config->getNumOtherSMP(); ++s)
399  notreceived += Config->getNumSMPNodes(Config->getOtherSMP(s));
400 
401  // now wait for messages from all the other nodes with their particle
402  // data, and save the messages
403  while (notreceived > 0) {
404  // receive the message
405  int any_node = COMM_ANY_NODE;
406  Message *recmsg = Ippl::Comm->receive_block(any_node, tag);
407  PAssert(recmsg);
408  notreceived--;
409 
410  // get the number of particles and save the info
411  // write the info out to disk
412  msgvec.push_back(recmsg);
413  }
414 
415  // we have all the messages, so write the data to disk. This will
416  // delete all the messages and save the offset information, as well as
417  // the particle count.
418  if (!write_data(datafile, msgvec, info)) {
419  delete info;
420  return false;
421  }
422 
423  // done writing; close the file and save the particle count
424  fclose(datafile);
425 
426  } else {
427  // just send out the message with our local particles now
428  Ippl::Comm->send(msg, Config->getSMPBox0(), tag);
429 
430  // and save extra necessary info into RecordInfo struct
431  info->localparticles.push_back(0);
432  info->offset.push_back(std::vector<Offset_t>());
433  }
434 
435  // add this new record information to our list
436  RecordList.push_back(info);
437 
438  // rewrite the meta file, if we're on a box0 node
439  if ((unsigned int) Ippl::myNode() == Config->getSMPBox0()) {
440  if (!write_meta())
441  return false;
442  }
443 
444  // to be safe, do a barrier here, since some nodes could have had very
445  // little to do
446  Ippl::Comm->barrier();
447 
448  // return success
449  return true;
450  }
451 
452  // a templated write for ParticleAttrib objects. The single attribute
453  // data is written as a single record. This should only be
454  // called if the object was opened with iomode == OUTPUT or APPEND.
455  // pattr = ParticleAttrib object to read from.
456  // Return success of operation.
457  //mwerks template<class T>
458  //mwerks bool write(ParticleAttrib<T> &pattr);
460  // a templated write for ParticleAttrib objects. This should only be
461  // called if the object was opened with iomode == OUTPUT or APPEND.
462  // pattr = ParticleAttrib object to read from
463  // Return success of operation.
464  template<class T>
465  bool write(ParticleAttrib<T> &pattr) {
466 
467  // generate a tag to use for communication
469 
470  // if the file already has some records, re-read the meta file in case it
471  // has changed. If we do not have any record info, and we've opened
472  // for OUTPUT, we do NOT ready any possible meta file since we want to
473  // start a new file
474  if (get_NumRecords() > 0 || IOMode == APPEND)
475  ConfigOK = read_meta();
476 
477  // do some sanity checking first
478  if (!ConfigOK) {
479  ERRORMSG("Bad config or meta file in DiscParticle::write." << endl);
480  return false;
481  } else if (IOMode == INPUT) {
482  ERRORMSG("Trying to write for a DiscParticle created for input."<<endl);
483  return false;
484  }
485 
486  // create a new record entry, and set it to the proper values
487  RecordInfo *info = new RecordInfo;
488  info->attributes = 0;
489  info->globalparticles = 0;
490  info->bytesize.push_back(pattr.elementSize());
491  info->disctypes.push_back(pattr.typeString());
492 
493  // Create a message with our local particles, which will then be used
494  // to write out the data
495  Message *msg = new Message;
496  msg->put(pattr.size());
497  pattr.putMessage(*msg, pattr.size(), 0);
498 
499  // on Box0 nodes, first write out your own particles, then write out
500  // all the other node's particles
501  if ((unsigned int) Ippl::myNode() == Config->getSMPBox0()) {
502  // create the data file, if it does not yet exist; otherwise, open
503  // it for append
504  std::string openmode = "a";
505  if (get_NumRecords() == 0)
506  openmode = "w";
507  std::string filename = Config->getFilename(0) + ".data";
508  FILE *datafile = open_file(filename, openmode);
509  if (datafile == 0) {
510  delete info;
511  delete msg;
512  return false;
513  }
514 
515  // create a vector of Messages, which will hold the info to be written
516  // out. We do not write until we have all the messages from the
517  // different nodes writing to the Box0 file.
518  std::vector<Message *> msgvec;
519  msgvec.push_back(msg);
520 
521  // write out our local attribute data, saving where we started to write
522  // determine how many other SMP nodes we expect to receive data from
523  int notreceived = (Config->getNumSMPNodes() - 1);
524  for (unsigned int s=0; s < Config->getNumOtherSMP(); ++s)
525  notreceived += Config->getNumSMPNodes(Config->getOtherSMP(s));
526 
527  // now wait for messages from all the other nodes with their particle
528  // data, and save the messages
529  while (notreceived > 0) {
530  // receive the message
531  int any_node = COMM_ANY_NODE;
532  Message *recmsg = Ippl::Comm->receive_block(any_node, tag);
533  PAssert(recmsg);
534  notreceived--;
535 
536  // get the number of particles and save the info
537  // write the info out to disk
538  msgvec.push_back(recmsg);
539  }
540 
541  // we have all the messages, so write the data to disk. This will
542  // delete all the messages and save the offset information, as well as
543  // the particle count.
544  if (!write_data(datafile, msgvec, info)) {
545  delete info;
546  return false;
547  }
548 
549  // done writing; close the file and save the particle count
550  fclose(datafile);
551 
552  } else {
553  // just send out the message with our local particles now
554  Ippl::Comm->send(msg, Config->getSMPBox0(), tag);
555 
556  // and save extra necessary info into RecordInfo struct
557  info->localparticles.push_back(0);
558  info->offset.push_back(std::vector<Offset_t>());
559  }
560 
561  // add this new record information to our list
562  RecordList.push_back(info);
563 
564  // rewrite the meta file, if we're on a box0 node
565  if ((unsigned int) Ippl::myNode() == Config->getSMPBox0()) {
566  if (!write_meta())
567  return false;
568  }
569 
570  // to be safe, do a barrier here, since some nodes could have had very
571  // little to do
572  Ippl::Comm->barrier();
573 
574  // return success
575  return true;
576  }
577 
578  //
579  // console printing methods
580  //
581 
582  // print out debugging info to the given stream
583  void printDebug(std::ostream&);
584  void printDebug();
585 
586 private:
587  // a typedef used to select the data type for file offsets
588  typedef long Offset_t;
589 
590  // the configuration file mechanism
592  bool ConfigOK;
593 
594  // I/O mode (INPUT or OUTPUT)
595  int IOMode;
596 
597  // the base name for the output file, and the descriptive type string
598  std::string BaseFile;
599  std::string TypeString;
600 
601  // a simple struct which stores information about each record, for each
602  // file set
603  struct RecordInfo {
604  // a typedef used to select the data type for file offsets
605  typedef long Offset_t;
606 
607  int attributes; // number of attributes; 0 == just writing
608  // one attribute, > 0 == writing a whole
609  // IpplParticleBase's worth of particles
610  int globalparticles; // total number of particles in whole system
611  std::vector<int> localparticles; // number of particles in this fileset's files
612  std::vector<int> bytesize; // how many bytes/attrib elem in each attrib
613  std::vector<std::vector<Offset_t> > offset; // starting offset for attrib in .data
614  std::vector<std::string> disctypes; // attribute types determined by DiscType
616  };
617 
618  // the list of information for each record
619  std::vector<RecordInfo *> RecordList;
620 
621  // this keeps track of where in the .data file writing is occuring
623 
624  //
625  // functions used to build/query information about the processors, etc.
626  //
627 
628  // perform initialization based on the constuctor arguments
629  void initialize(const char *base, const char *config,
630  const char *typestr, int iomode);
631 
632  // open a file in the given mode. If an error occurs, print a message (but
633  // only if the last argument is true).
634  // fnm = complete name of file (can include a path)
635  // mode = open method ("r" == read, "rw" == read/write, etc.
636  FILE *open_file(const std::string& fnm, const std::string& mode,
637  bool reporterr = true);
638 
639  //
640  // read/write functions for individual components
641  //
642 
643  // read or write .meta data file information. Return success.
644  bool read_meta();
645  bool write_meta();
646 
647  // read the data for the Nth attribute of record R, in the Fth fileset,
648  // and return the newly allocated buffer (or 0 if an error occurs).
649  void *read_data(FILE *outputData, unsigned int attrib,
650  unsigned int record, unsigned int fileset);
651 
652  // write the data for a block of particles to the given file. The
653  // data is just appended to the end. Return success of write.
654  bool write_data(FILE *outputData, std::vector<Message *> &, RecordInfo *);
655 
656  //
657  // don't allow copy or assign ... this are declared but never defined,
658  // if something tries to use them it will generate a missing symbol error
659  //
660 
663 };
664 
665 #endif // DISC_PARTICLE_H
666 
667 /***************************************************************************
668  * $RCSfile: DiscParticle.h,v $ $Author: adelmann $
669  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
670  * IPPL_VERSION_ID: $Id: DiscParticle.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
671  ***************************************************************************/
const int COMM_ANY_NODE
Definition: Communicate.h:40
#define FB_TAG_CYCLE
Definition: Tags.h:62
#define FB_WRITE_TAG
Definition: Tags.h:60
std::complex< double > a
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
#define ERRORMSG(msg)
Definition: IpplInfo.h:350
#define PAssert(c)
Definition: PAssert.h:102
bool info
Info flag.
Definition: Options.cpp:28
size_t size(void) const
virtual size_t putMessage(Message &, size_t, size_t)
virtual void destroy(size_t M, size_t I, bool optDestroy=true)
virtual size_t getMessage(Message &, size_t)
size_t getMessageAndCreate(Message &)
size_t getTotalNum() const
ParticleAttribBase & getAttribute(attrib_container_t::size_type N)
size_t putMessage(Message &, size_t, size_t)
virtual void update()
attrib_container_t::size_type numAttributes() const
size_t getLocalNum() const
void destroy(size_t, size_t, bool=false)
bool send(Message *, int node, int tag, bool delmsg=true)
Message * receive_block(int &node, int &tag)
void barrier(void)
Message & setDelete(const bool c)
Definition: Message.h:331
Message & put(const T &val)
Definition: Message.h:406
Message & putmsg(void *, int, int=0)
Message & setCopy(const bool c)
Definition: Message.h:319
int next_tag(int t, int s=1000)
Definition: TagMaker.h:39
const std::string & typeString() const
unsigned int elementSize() const
const std::string & getFilename(unsigned int fn) const
Definition: DiscConfig.h:125
unsigned int getOtherSMP(unsigned int sn) const
Definition: DiscConfig.h:139
unsigned int getSMPBox0() const
Definition: DiscConfig.h:113
unsigned int getNumOtherSMP() const
Definition: DiscConfig.h:133
unsigned int getNumSMPNodes() const
Definition: DiscConfig.h:101
unsigned int getNumFiles() const
Definition: DiscConfig.h:119
bool write(ParticleAttrib< T > &pattr)
Definition: DiscParticle.h:465
int get_IOMode() const
Definition: DiscParticle.h:82
std::vector< RecordInfo * > RecordList
Definition: DiscParticle.h:619
unsigned int get_NumLocalParticles(unsigned int record=0) const
int get_DataMode(unsigned int record=0) const
Definition: DiscParticle.h:76
DiscParticle(const char *fname, const char *config, int iomode, const char *typestr=0)
std::string TypeString
Definition: DiscParticle.h:599
unsigned int get_NumRecords() const
Definition: DiscParticle.h:71
DiscParticle & operator=(const DiscParticle &)
bool read(IpplParticleBase< T > &pbase, unsigned int record)
Definition: DiscParticle.h:142
Offset_t CurrentOffset
Definition: DiscParticle.h:622
std::string BaseFile
Definition: DiscParticle.h:598
bool read(ParticleAttrib< T > &pattr, unsigned int record)
Definition: DiscParticle.h:250
bool write_data(FILE *outputData, std::vector< Message * > &, RecordInfo *)
const char * get_TypeString() const
Definition: DiscParticle.h:106
unsigned int get_ElemByteSize(unsigned int record=0, unsigned int attrib=0) const
Definition: DiscParticle.h:100
unsigned int get_NumAttributes(unsigned int record=0) const
Definition: DiscParticle.h:95
FILE * open_file(const std::string &fnm, const std::string &mode, bool reporterr=true)
unsigned int get_NumGlobalParticles(unsigned int record=0) const
Definition: DiscParticle.h:90
DiscParticle(const DiscParticle &)
void * read_data(FILE *outputData, unsigned int attrib, unsigned int record, unsigned int fileset)
bool write(IpplParticleBase< T > &pbase)
Definition: DiscParticle.h:338
const char * get_DiscType(unsigned int record=0, unsigned int attrib=0) const
bool get_OK() const
Definition: DiscParticle.h:65
DiscConfig * Config
Definition: DiscParticle.h:591
void initialize(const char *base, const char *config, const char *typestr, int iomode)
std::vector< std::string > disctypes
Definition: DiscParticle.h:614
std::vector< int > bytesize
Definition: DiscParticle.h:612
std::vector< std::vector< Offset_t > > offset
Definition: DiscParticle.h:613
std::vector< int > localparticles
Definition: DiscParticle.h:611
static int myNode()
Definition: IpplInfo.cpp:691
static Communicate * Comm
Definition: IpplInfo.h:84