11#ifndef DISC_PARTICLE_H
12#define DISC_PARTICLE_H
49 DiscParticle(
const char *fname,
const char *config,
int iomode,
50 const char *typestr = 0);
55 DiscParticle(
const char *fname,
int iomode,
const char * = 0);
101 unsigned int attrib=0)
const {
111 unsigned int attrib=0)
const;
149 ERRORMSG(
"Bad config or meta file in DiscParticle::read." <<
endl);
152 ERRORMSG(
"Trying to read for DiscParticle created for output." <<
endl);
155 ERRORMSG(
"Illegal record number in DiscParticle::read." <<
endl);
158 ERRORMSG(
"Record " << record <<
" does not contain information for an ");
162 ERRORMSG(
"Record " << record <<
" has a different number of attributes ");
163 ERRORMSG(
"than in the given IpplParticleBase." <<
endl);
172 ERRORMSG(
"Mismatched data type size for attribute " << ca <<
" in ");
190 int localnum =
RecordList[record]->localparticles[sf];
195 FILE *datafile =
open_file(filename, std::string(
"r"));
207 void *buf =
read_data(datafile,
a, record, sf);
257 ERRORMSG(
"Bad config or meta file in DiscParticle::read." <<
endl);
260 ERRORMSG(
"Trying to read for a DiscParticle created for output."<<
endl);
263 ERRORMSG(
"Illegal record number in DiscParticle::read." <<
endl);
266 ERRORMSG(
"Record " << record <<
" does not contain information for a ");
270 ERRORMSG(
"Mismatched attribute data type size in ");
284 int localnum =
RecordList[record]->localparticles[sf];
289 FILE *datafile =
open_file(filename, std::string(
"r"));
298 void *buf =
read_data(datafile, 0, record, sf);
352 ERRORMSG(
"Bad config or meta file in DiscParticle::write." <<
endl);
355 ERRORMSG(
"Trying to write for a DiscParticle created for input."<<
endl);
363 for (
int a=0;
a <
info->attributes; ++
a) {
378 std::string openmode =
"a";
382 FILE *datafile =
open_file(filename, openmode);
392 std::vector<Message *> msgvec;
393 msgvec.push_back(msg);
403 while (notreceived > 0) {
412 msgvec.push_back(recmsg);
431 info->localparticles.push_back(0);
432 info->offset.push_back(std::vector<Offset_t>());
479 ERRORMSG(
"Bad config or meta file in DiscParticle::write." <<
endl);
482 ERRORMSG(
"Trying to write for a DiscParticle created for input."<<
endl);
488 info->attributes = 0;
489 info->globalparticles = 0;
504 std::string openmode =
"a";
508 FILE *datafile =
open_file(filename, openmode);
518 std::vector<Message *> msgvec;
519 msgvec.push_back(msg);
529 while (notreceived > 0) {
538 msgvec.push_back(recmsg);
557 info->localparticles.push_back(0);
558 info->offset.push_back(std::vector<Offset_t>());
613 std::vector<std::vector<Offset_t> >
offset;
629 void initialize(
const char *base,
const char *config,
630 const char *typestr,
int iomode);
636 FILE *
open_file(
const std::string& fnm,
const std::string& mode,
637 bool reporterr =
true);
649 void *
read_data(FILE *outputData,
unsigned int attrib,
650 unsigned int record,
unsigned int fileset);
Inform & endl(Inform &inf)
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
size_t putMessage(Message &, size_t, size_t)
ParticleAttribBase & getAttribute(attrib_container_t::size_type N)
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)
Message & putmsg(void *, int, int=0)
Message & setCopy(const bool c)
Message & put(const T &val)
Message & setDelete(const bool c)
int next_tag(int t, int s=1000)
const std::string & typeString() const
unsigned int elementSize() const
unsigned int getOtherSMP(unsigned int sn) const
unsigned int getSMPBox0() const
unsigned int getNumOtherSMP() const
unsigned int getNumSMPNodes() const
const std::string & getFilename(unsigned int fn) const
unsigned int getNumFiles() const
bool write(ParticleAttrib< T > &pattr)
std::vector< RecordInfo * > RecordList
unsigned int get_NumLocalParticles(unsigned int record=0) const
DiscParticle & operator=(const DiscParticle &)
int get_DataMode(unsigned int record=0) const
DiscParticle(const char *fname, const char *config, int iomode, const char *typestr=0)
unsigned int get_NumRecords() const
bool read(IpplParticleBase< T > &pbase, unsigned int record)
bool read(ParticleAttrib< T > &pattr, unsigned int record)
bool write_data(FILE *outputData, std::vector< Message * > &, RecordInfo *)
unsigned int get_ElemByteSize(unsigned int record=0, unsigned int attrib=0) const
unsigned int get_NumAttributes(unsigned int record=0) const
FILE * open_file(const std::string &fnm, const std::string &mode, bool reporterr=true)
unsigned int get_NumGlobalParticles(unsigned int record=0) const
DiscParticle(const DiscParticle &)
void * read_data(FILE *outputData, unsigned int attrib, unsigned int record, unsigned int fileset)
bool write(IpplParticleBase< T > &pbase)
const char * get_TypeString() const
const char * get_DiscType(unsigned int record=0, unsigned int attrib=0) const
void initialize(const char *base, const char *config, const char *typestr, int iomode)
std::vector< std::string > disctypes
std::vector< int > bytesize
std::vector< std::vector< Offset_t > > offset
std::vector< int > localparticles
static Communicate * Comm