PeTar
N-body code for collisional gravitational systems
|
Go to the documentation of this file.
6 #include "Hermite/hermite_particle.h"
12 typedef H4::ParticleH4<PtclHard>
PtclH4;
39 const PS::S32* _n_member_in_group,
43 ptcl_bk.resizeNoInitialize(_n_ptcl);
44 for (
int i=0; i<_n_ptcl; i++)
ptcl_bk[i] = _ptcl_local[i];
50 if (_ptcl_artifical!=NULL) {
51 n_arti = _n_group*_n_artificial;
65 std::FILE*
fp = std::fopen(_fname,
"w");
67 std::cerr<<
"Error: filename "<<_fname<<
" cannot be open!\n";
81 fwrite(ptcl_st_dat,
sizeof(
PS::F64),4,
fp);
96 std::FILE*
fp = std::fopen(_fname,
"r");
98 std::cerr<<
"Error: filename "<<_fname<<
" cannot be open!\n";
105 std::cerr<<
"Error: Data reading fails! requiring data number is 2, only obtain "<<rcount<<
".\n";
111 std::cerr<<
"Error: Data reading fails! requiring data number is 1, only obtain "<<rcount<<
".\n";
115 std::cerr<<
"Error: particle number "<<
n_ptcl<<
" <=0 !\n";
122 rcount = fread(ptcl_st_dat,
sizeof(
PS::F64),4,
fp);
124 std::cerr<<
"Error: Data reading fails! requiring data number is 3, only obtain "<<rcount<<
".\n";
136 std::cerr<<
"Error: Data reading fails! requiring data number is 2, only obtain "<<rcount<<
".\n";
142 std::cerr<<
"Error: Data reading fails! requiring data number is "<<
n_group<<
", only obtain "<<rcount<<
".\n";
146 std::cerr<<
"Error: artificial particle number "<<
n_arti<<
" <0 !\n";
150 std::cerr<<
"Error: group number "<<
n_group<<
" <0 !\n";
173 void initial(
const int _nthread,
const int _rank=0) {
192 std::string point(
".");
193 std::string fname_prefix = filename + point + std::to_string(
mpi_rank) + point;
194 for (
int i=0; i<
size; i++) {
195 std::time_t tnow = std::time(
nullptr);
196 std::string fname = fname_prefix + std::to_string(i) + point + std::to_string(
dump_number++) + point + std::to_string(tnow);
199 std::cerr<<
"Dump file: "<<fname.c_str()<<std::endl;
205 const PS::S32 ith = PS::Comm::getThreadNum();
206 std::string point(
".");
207 std::time_t tnow = std::time(
nullptr);
209 std::string fname = filename + point + std::to_string(
mpi_rank) + point + std::to_string(ith) + point + std::to_string(
dump_number++) + point + std::to_string(tnow);
212 std::cerr<<
"Thread: "<<ith<<
" Dump file: "<<fname.c_str()<<std::endl;
225 #define DATADUMP(expr) hard_dump.dumpThread(expr)
227 #define DATADUMP(expr)
231 #define ASSERT(expr) \
233 std::cerr<<"Assertion! "<<__FILE__<<":"<<__LINE__<<": ("<<#expr<<") fail!"<<std::endl; \
234 DATADUMP("hard_dump"); \
int dump_number
Definition: hard_assert.hpp:168
Definition: soft_ptcl.hpp:26
PS::ReallocatableArray< PtclH4 > ptcl_bk
Definition: hard_assert.hpp:20
Definition: hard_assert.hpp:10
int32_t S32
Definition: pikg_vector.hpp:24
void dumpThread(const char *filename)
Definition: hard_assert.hpp:204
fp
Definition: galpy_pot_movie.py:131
void dumpAll(const char *filename)
Definition: hard_assert.hpp:191
static PS::F64 mean_mass_inv
Definition: ptcl.hpp:45
Definition: hard_assert.hpp:164
~HardDumpList()
Definition: hard_assert.hpp:187
double F64
Definition: pikg_vector.hpp:17
PS::S32 n_arti
Definition: hard_assert.hpp:16
void dumpOneCluster(const char *_fname)
Dumping one cluster data for debuging.
Definition: hard_assert.hpp:64
HardDump & operator[](const int i)
Definition: hard_assert.hpp:216
void readOneCluster(const char *_fname)
reading one cluster data for debuging
Definition: hard_assert.hpp:95
static PS::F64 r_search_min
Definition: ptcl.hpp:43
int mpi_rank
Definition: hard_assert.hpp:167
bool backup_flag
Definition: hard_assert.hpp:21
void initial(const int _nthread, const int _rank=0)
Definition: hard_assert.hpp:173
HardDump * hard_dump
Definition: hard_assert.hpp:169
int size
Definition: hard_assert.hpp:166
void backup(PtclH4 *_ptcl_local, const PS::S32 _n_ptcl, FPSoft *_ptcl_artifical, const PS::S32 _n_group, const PS::S32 *_n_member_in_group, const PS::F64 _time_offset, const PS::F64 _time_end, const PS::S32 _n_artificial)
backup one hard cluster data
Definition: hard_assert.hpp:35
PS::F64 time_end
Definition: hard_assert.hpp:14
void clear()
Definition: hard_assert.hpp:179
HardDump()
Definition: hard_assert.hpp:23
PS::S32 n_group
Definition: hard_assert.hpp:17
H4::ParticleH4< PtclHard > PtclH4
Definition: hard_assert.hpp:12
PS::ReallocatableArray< FPSoft > ptcl_arti_bk
Definition: hard_assert.hpp:19
HardDumpList()
Definition: hard_assert.hpp:171
static PS::F64 search_factor
Definition: ptcl.hpp:42
static PS::F64 r_group_crit_ratio
Definition: ptcl.hpp:44
PS::ReallocatableArray< PS::S32 > n_member_in_group
Definition: hard_assert.hpp:18
PS::F64 time_offset
Definition: hard_assert.hpp:13
PS::S32 n_ptcl
Definition: hard_assert.hpp:15