PeTar
N-body code for collisional gravitational systems
|
Go to the documentation of this file.
11 #ifdef SAVE_NEIGHBOR_ID_IN_FORCE_KERNEL
20 #ifdef SAVE_NEIGHBOR_ID_IN_FORCE_KERNEL
21 id_ngb[0] = id_ngb[1] = id_ngb[2] = id_ngb[3] = 0;
34 #ifdef EXTERNAL_POT_IN_PTCL
37 #ifdef SAVE_NEIGHBOR_ID_IN_FORCE_KERNEL
78 #ifdef EXTERNAL_POT_IN_PTCL
91 #ifdef SAVE_NEIGHBOR_ID_IN_FORCE_KERNEL
92 for (
int k=0; k<4; k++) id_ngb[k] = force.id_ngb[k];
105 fprintf(
fp,
"%26.17e %26.17e %26.17e %26.17e %26.17e ",
106 this->acc.x, this->acc.y, this->acc.z,
107 this->pot_tot, this->pot_soft);
108 #ifdef EXTERNAL_POT_IN_PTCL
109 fprintf(
fp,
"%26.17e ",this->pot_ext);
111 fprintf(
fp,
"%lld\n",this->n_ngb);
116 #ifdef EXTERNAL_POT_IN_PTCL
117 fwrite(&(this->acc),
sizeof(
PS::F64), 7,
fp);
119 fwrite(&(this->acc),
sizeof(
PS::F64), 6,
fp);
125 PS::S64 rcount=fscanf(
fp,
"%lf %lf %lf %lf %lf ",
126 &this->acc.x, &this->acc.y, &this->acc.z,
127 &this->pot_tot, &this->pot_soft);
129 std::cerr<<
"Error: FPSoft Data reading fails! requiring data number is 6, only obtain "<<rcount<<
".\n";
130 std::cerr<<
"Check your input data, whether the consistent features (interrupt mode and external mode) are used in configuring petar and the data generation\n";
133 #ifdef EXTERNAL_POT_IN_PTCL
134 rcount=fscanf(
fp,
"%lf ", &this->pot_ext);
136 std::cerr<<
"Error: FPSoft Data reading fails! requiring data number is 1, only obtain "<<rcount<<
".\n";
137 std::cerr<<
"Check your input data, whether the consistent features (interrupt mode and external mode) are used in configuring petar and the data generation\n";
141 rcount=fscanf(
fp,
"%lld\n", &this->n_ngb);
143 std::cerr<<
"Error: FPSoft Data reading fails! requiring data number is 1, only obtain "<<rcount<<
".\n";
144 std::cerr<<
"Check your input data, whether the consistent features (interrupt mode and external mode) are used in configuring petar and the data generation\n";
151 #ifdef EXTERNAL_POT_IN_PTCL
152 size_t rcount = fread(&(this->acc),
sizeof(
PS::F64), 7,
fp);
154 std::cerr<<
"Error: Data reading fails! requiring data number is 7, only obtain "<<rcount<<
".\n";
155 std::cerr<<
"Check your input data, whether the consistent features (interrupt mode and external mode) are used in configuring petar and the data generation\n";
159 size_t rcount = fread(&(this->acc),
sizeof(
PS::F64), 6,
fp);
161 std::cerr<<
"Error: Data reading fails! requiring data number is 6, only obtain "<<rcount<<
".\n";
162 std::cerr<<
"Check your input data, whether the consistent features (interrupt mode and external mode) are used in configuring petar and the data generation\n";
173 #ifdef EXTERNAL_POT_IN_PTCL
174 <<
" pot_ext= "<<pot_ext
186 _fout<<std::setw(_width)<<
"acc_soft.x"
187 <<std::setw(_width)<<
"acc_soft.y"
188 <<std::setw(_width)<<
"acc_soft.z"
189 <<std::setw(_width)<<
"pot_tot"
190 <<std::setw(_width)<<
"pot_soft"
191 #ifdef EXTERNAL_POT_IN_PTCL
192 <<std::setw(_width)<<
"pot_ext"
194 <<std::setw(_width)<<
"n_b";
204 int counter = _counter;
207 _fout<<std::setw(_offset)<<
" "<<counter<<
"-"<<counter+2<<
". acc_soft.[x/y/z]: 3D soft (long-range) acceleration (0.0)\n";
209 _fout<<std::setw(_offset)<<
" "<<counter<<
". pot_tot: total potential (0.0)\n";
211 _fout<<std::setw(_offset)<<
" "<<counter<<
". pot_soft: soft potential (0.0)\n";
213 #ifdef EXTERNAL_POT_IN_PTCL
214 _fout<<std::setw(_offset)<<
" "<<counter<<
". pot_ext: external potential (0.0)\n";
217 _fout<<std::setw(_offset)<<
" "<<counter<<
". n_b: number of neighbors (0)\n";
228 _fout<<std::setw(_width)<<
acc.x
229 <<std::setw(_width)<<
acc.y
230 <<std::setw(_width)<<
acc.z
233 #ifdef EXTERNAL_POT_IN_PTCL
234 <<std::setw(_width)<<pot_ext
236 <<std::setw(_width)<<
n_ngb;
245 template <
class Tpcm>
248 _fout<<std::setw(_width)<<
acc.x
249 <<std::setw(_width)<<
acc.y
250 <<std::setw(_width)<<
acc.z
253 #ifdef EXTERNAL_POT_IN_PTCL
254 <<std::setw(_width)<<pot_ext
256 <<std::setw(_width)<<
n_ngb;
264 #ifdef EXTERNAL_POT_IN_PTCL
287 if (
fp.group_data.artificial.isArtificial() && !
fp.group_data.artificial.isCM() &&
fp.mass>0 )
type = 0;
296 void print(std::ostream & fout=std::cout)
const {
338 r_in =
fp.changeover.getRin();
339 r_out =
fp.changeover.getRout();
360 void print(std::ostream & fout=std::cout)
const {
PS::S32 adr_org
Definition: soft_ptcl.hpp:326
Definition: soft_ptcl.hpp:271
void printColumn(std::ostream &_fout, const int _width=20)
print data of class members using column style
Definition: soft_ptcl.hpp:226
Definition: soft_ptcl.hpp:26
void DataCopy(const Tptcl &_p)
Definition: ptcl.hpp:58
void copyFromForce(const ForceSoft &force)
Definition: soft_ptcl.hpp:84
void writeAscii(FILE *fp) const
Definition: soft_ptcl.hpp:103
void clear()
gravitational constant
Definition: soft_ptcl.hpp:16
PS::F64 mass
Definition: soft_ptcl.hpp:314
int32_t S32
Definition: pikg_vector.hpp:24
void readAscii(FILE *fp)
Definition: soft_ptcl.hpp:123
PS::F64vec getPos() const
Definition: soft_ptcl.hpp:346
fp
Definition: galpy_pot_movie.py:131
void writeBinary(FILE *fp) const
Definition: soft_ptcl.hpp:114
Definition: soft_ptcl.hpp:4
Vector3< F64 > F64vec
Definition: pikg_vector.hpp:167
PS::S32 rank_org
Definition: soft_ptcl.hpp:276
PS::F64 r_out
Definition: soft_ptcl.hpp:321
PS::F64vec pos
Definition: soft_ptcl.hpp:274
static int printTitleWithMeaning(std::ostream &_fout, const int _counter=0, const int _offset=0)
print column title with meaning (each line for one column)
Definition: ptcl.hpp:99
PS::F64vec getPos() const
Definition: soft_ptcl.hpp:283
static void printColumnTitle(std::ostream &_fout, const int _width=20)
print titles of class members using column style
Definition: soft_ptcl.hpp:184
group data delivery, used for two purpose
Definition: ptcl.hpp:17
PS::S64 n_ngb
Definition: soft_ptcl.hpp:40
PS::F64 getRSearch() const
Definition: soft_ptcl.hpp:302
void readBinary(FILE *fp)
Definition: soft_ptcl.hpp:149
PS::F64 pot_tot
Definition: soft_ptcl.hpp:32
PS::F64 getRSearch() const
Definition: soft_ptcl.hpp:97
double F64
Definition: pikg_vector.hpp:17
PS::F64 pot
soft acceleration (c.m.: averaged force from orbital particles; tensor: c.m. is substracted)
Definition: soft_ptcl.hpp:7
void clear()
Definition: soft_ptcl.hpp:368
PS::S64 getId() const
Definition: soft_ptcl.hpp:355
PS::S64 id
Definition: soft_ptcl.hpp:273
void copyFromFP(const FPSoft &fp)
Definition: soft_ptcl.hpp:284
void writeBinary(FILE *_fout) const
write class data with BINARY format
Definition: ptcl.hpp:158
PS::S32 type
Definition: soft_ptcl.hpp:277
static void printColumnTitle(std::ostream &_fout, const int _width=20)
print titles of class members using column style
Definition: ptcl.hpp:85
PS::F64vec pos
Definition: particle_base.hpp:24
Particle class.
Definition: ptcl.hpp:36
int64_t S64
Definition: pikg_vector.hpp:23
PS::F64vec vel
Definition: particle_base.hpp:25
const PS::F64 SAFTY_FACTOR_FOR_SEARCH
Definition: ptcl.hpp:8
static PS::F64 r_out
Definition: soft_ptcl.hpp:282
PS::F64vec acc
Definition: soft_ptcl.hpp:28
PS::F64 getCharge() const
Definition: soft_ptcl.hpp:348
PS::F64vec getVel() const
Get velocity (required for ARC::chain)
Definition: soft_ptcl.hpp:57
PS::F64 r_search
Definition: soft_ptcl.hpp:275
PS::F64vec getPos() const
Get position (required for ARC::chain)
Definition: soft_ptcl.hpp:50
PS::F64 r_in
Definition: soft_ptcl.hpp:320
PS::F64 getRSearch() const
Definition: soft_ptcl.hpp:349
PS::S32 rank_org
Definition: soft_ptcl.hpp:325
PS::F64 r_search
Definition: ptcl.hpp:38
void writeAscii(FILE *_fout) const
write class data with ASCII format
Definition: ptcl.hpp:142
Definition: soft_ptcl.hpp:311
FPSoft(const Tptcl &p, const PS::S32 rank_, const PS::S32 adr_)
Definition: soft_ptcl.hpp:71
void print(std::ostream &fout=std::cout) const
Definition: soft_ptcl.hpp:360
PS::F64 r_scale_next
Definition: soft_ptcl.hpp:323
void clearForce()
clear force
Definition: soft_ptcl.hpp:260
void printColumn(std::ostream &_fout, const int _width=20)
print data of class members using column style
Definition: ptcl.hpp:116
PS::S32 adr
Definition: soft_ptcl.hpp:42
PS::F64 pot_soft
Definition: soft_ptcl.hpp:33
void printColumnWithOffset(Tpcm &_pcm, std::ostream &_fout, const int _width=20)
print data of class members with pos and vel offset using column style
Definition: ptcl.hpp:131
static int printTitleWithMeaning(std::ostream &_fout, const int _counter=0, const int _offset=0)
print column title with meaning (each line for one column)
Definition: soft_ptcl.hpp:203
PS::F64vec pos
Definition: soft_ptcl.hpp:315
PS::S64 id
Definition: soft_ptcl.hpp:313
static PS::F64 eps
Definition: soft_ptcl.hpp:281
FPSoft()
Definition: soft_ptcl.hpp:45
PS::F64vec vel
Definition: soft_ptcl.hpp:316
void readAscii(FILE *_fin)
read class data with ASCII format
Definition: ptcl.hpp:168
void printColumnWithOffset(Tpcm &_pcm, std::ostream &_fout, const int _width=20)
print data of class members with pos and vel offset using column style
Definition: soft_ptcl.hpp:246
void print(std::ostream &fout)
Definition: soft_ptcl.hpp:168
GroupDataDeliver group_data
Definition: soft_ptcl.hpp:324
PS::S32 rank_org
Definition: soft_ptcl.hpp:41
PS::F64vec acc
Definition: soft_ptcl.hpp:6
void setPos(const PS::F64vec &pos_new)
Definition: soft_ptcl.hpp:347
PS::S64 n_ngb
full potential
Definition: soft_ptcl.hpp:14
void readBinary(FILE *_fin)
read class data with BINARY format
Definition: ptcl.hpp:194
static PS::F64 grav_const
neighbor number+1
Definition: soft_ptcl.hpp:15
PS::F64 r_search
Definition: soft_ptcl.hpp:322
void print(std::ostream &_fout) const
Definition: ptcl.hpp:72
void copyFromFP(const FPSoft &fp)
Definition: soft_ptcl.hpp:330
void print(std::ostream &fout=std::cout) const
Definition: soft_ptcl.hpp:296