Loading [MathJax]/extensions/tex2jax.js
PeTar
N-body code for collisional gravitational systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hard_ptcl.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ptcl.hpp"
4 
5 class PtclHard: public Ptcl{
6 public:
9 
10  PtclHard(): Ptcl(), id_cluster(-1), adr_org(-1) {}
11 
12  template<class Tptcl>
13  PtclHard(const Tptcl& _p, const PS::F64 _r_search, const PS::F64 _mass_bk, const PS::S64 _id, const PS::S64 _status, const ChangeOver& _co, const PS::S32 _id_cluster, const PS::S32 _adr_org):
14  Ptcl(_p, _r_search, _mass_bk, _id, _status, _co), id_cluster(_id_cluster), adr_org(_adr_org) {}
15 
16  template<class Tptcl>
17  PtclHard(const Tptcl &_p, const PS::S32 _id_cluster, const PS::S32 _adr_org):
18  Ptcl(_p), id_cluster(_id_cluster), adr_org(_adr_org) {}
19 
20  template<class Tptcl>
21  PtclHard(const Tptcl &_p) {
22  Ptcl::DataCopy(_p);
23  id_cluster = _p.id_cluster;
24  adr_org = _p.adr_org;
25  }
26 
27  // notice datacopy ignore id_cluster and adr_org
28  template<class Tptcl>
29  void DataCopy(const Tptcl& _p) {
30  Ptcl::DataCopy(_p);
31  }
32 
33  template<class Tptcl>
34  PtclHard& operator = (const Tptcl& _p) {
35  Ptcl::DataCopy(_p);
36  id_cluster = _p.id_cluster;
37  adr_org = _p.adr_org;
38  return *this;
39  }
40 
41  void setTidalTensorID(const PS::S32 _id) {
42 #ifdef HARD_DEBUG
43  assert(_id>0);
44 #endif
46  }
47 
50  }
51 
52  // calculate reseach based on potential and velocity
65  void calcRSearch(const PS::F64 _Gm, const PS::F64 _pot, const PS::F64vec& _vel_cm, const PS::F64 _dt_tree) {
66  PS::F64vec vrel = Ptcl::vel-_vel_cm;
67  PS::F64 v2rel = vrel*vrel;
68  PS::F64 r0 = _pot>0? _Gm/_pot : PS::LARGE_FLOAT;
69  PS::F64 q = 2.0*_pot/v2rel;
70  if (q>1.0) r0 /= (q-1.0);
71 
73  PS::F64 v = std::sqrt(v2);
75  }
76 
77  void dump(FILE *_fout) {
78  fwrite(this, sizeof(*this),1,_fout);
79  }
80 
81  void read(FILE *_fin) {
82  size_t rcount = fread(this, sizeof(*this),1,_fin);
83  if (rcount<1) {
84  std::cerr<<"Error: Data reading fails! requiring data number is 1, only obtain "<<rcount<<".\n";
85  abort();
86  }
87  }
88  void print(std::ostream & _fout) const{
89  Ptcl::print(_fout);
90  std::cerr<<" id_cluster="<<id_cluster
91  <<" adr_org="<<adr_org;
92  }
93 
94 };
Ptcl::DataCopy
void DataCopy(const Tptcl &_p)
Definition: ptcl.hpp:58
hard.hpp
PtclHard::PtclHard
PtclHard(const Tptcl &_p)
Definition: hard_ptcl.hpp:21
HardManager::ap_manager
ArtificialParticleManager ap_manager
Definition: hard.hpp:33
HardIntegrator
hard integrator
Definition: hard.hpp:159
IOParams::value
Type value
Definition: io.hpp:43
HardDump::ptcl_bk
PS::ReallocatableArray< PtclH4 > ptcl_bk
Definition: hard_assert.hpp:20
BSEManager::getBSEOutputFilenameSuffix
static std::string getBSEOutputFilenameSuffix()
Definition: bse_interface.h:1178
HardDump
Definition: hard_assert.hpp:10
IOParamsBSE
IO parameters manager for BSE based code.
Definition: bse_interface.h:619
PIKG::S32
int32_t S32
Definition: pikg_vector.hpp:24
IOParamsBSE::idum
IOParams< long long int > idum
Definition: bse_interface.h:659
soft_ptcl.hpp
HardIntegrator::printInterruptBinaryInfo
void printInterruptBinaryInfo(std::ostream &_fout) const
print interrupt binary information
Definition: hard.hpp:1144
PIKG::F64vec
Vector3< F64 > F64vec
Definition: pikg_vector.hpp:167
IOParamsContainer::readAscii
void readAscii(FILE *_fin)
Definition: io.hpp:112
IOParamsBSE::input_par_store
IOParamsContainer input_par_store
Definition: bse_interface.h:621
HardManager::readBinary
void readBinary(FILE *_fin, int _version=0)
read class data to file with binary format
Definition: hard.hpp:95
HardIntegrator::driftClusterCMRecordGroupCMDataAndWriteBack
void driftClusterCMRecordGroupCMDataAndWriteBack(const PS::F64 _time_end)
drift c.m. particle of the cluster record group c.m. in group_data and write back data to original pa...
Definition: hard.hpp:835
HardManager::energy_error_max
PS::F64 energy_error_max
Definition: hard.hpp:28
HardManager
Hard integrator parameter manager.
Definition: hard.hpp:26
PIKG::F64
double F64
Definition: pikg_vector.hpp:17
HardManager::h4_manager
H4::HermiteManager< HermiteInteraction > h4_manager
Definition: hard.hpp:34
BSEManager::getBSEName
static std::string getBSEName()
Definition: bse_interface.h:1198
PtclH4
H4::ParticleH4< PtclHard > PtclH4
Definition: hard.hpp:23
Ptcl
Particle class.
Definition: ptcl.hpp:36
PIKG::S64
int64_t S64
Definition: pikg_vector.hpp:23
ParticleBase::vel
PS::F64vec vel
Definition: particle_base.hpp:25
ptcl.hpp
HardDump::readOneCluster
void readOneCluster(const char *_fname)
reading one cluster data for debuging
Definition: hard_assert.hpp:95
io.hpp
Ptcl::r_search_min
static PS::F64 r_search_min
Definition: ptcl.hpp:43
PtclHard::operator=
PtclHard & operator=(const Tptcl &_p)
Definition: hard_ptcl.hpp:34
ArtificialParticleManager::getTidalTensorParticleN
PS::S32 getTidalTensorParticleN() const
get artificial particle total number
Definition: artificial_particles.hpp:432
PtclHard
Definition: hard_ptcl.hpp:5
ArtificialParticleInformation::getStatus
PS::F64 getStatus() const
get status
Definition: artificial_particles.hpp:135
PtclHard::PtclHard
PtclHard(const Tptcl &_p, const PS::F64 _r_search, const PS::F64 _mass_bk, const PS::S64 _id, const PS::S64 _status, const ChangeOver &_co, const PS::S32 _id_cluster, const PS::S32 _adr_org)
Definition: hard_ptcl.hpp:13
HardManager::ar_manager
AR::TimeTransformedSymplecticManager< ARInteraction > ar_manager
Definition: hard.hpp:35
PIKG::min
T min(const Vector3< T > &v)
Definition: pikg_vector.hpp:150
ArtificialParticleManager::getArtificialParticleN
PS::S32 getArtificialParticleN() const
get artificial particle total number
Definition: artificial_particles.hpp:427
PtclHard::PtclHard
PtclHard(const Tptcl &_p, const PS::S32 _id_cluster, const PS::S32 _adr_org)
Definition: hard_ptcl.hpp:17
Ptcl::r_search
PS::F64 r_search
Definition: ptcl.hpp:38
cluster_list.hpp
PtclHard::getTidalTensorID
PS::S32 getTidalTensorID() const
Definition: hard_ptcl.hpp:48
SystemHard
Hard system.
Definition: hard.hpp:1190
ChangeOver
Changeover function class.
Definition: changeover.hpp:7
PtclHard::calcRSearch
void calcRSearch(const PS::F64 _Gm, const PS::F64 _pot, const PS::F64vec &_vel_cm, const PS::F64 _dt_tree)
Definition: hard_ptcl.hpp:65
Ptcl::changeover
ChangeOver changeover
Definition: ptcl.hpp:41
PtclHard::dump
void dump(FILE *_fout)
Definition: hard_ptcl.hpp:77
SystemHard::findGroupsAndCreateArtificialParticlesOneCluster
void findGroupsAndCreateArtificialParticlesOneCluster(const PS::S32 _i_cluster, Tptcl *_ptcl_in_cluster, const PS::S32 _n_ptcl, PS::ReallocatableArray< Tptcl > &_ptcl_artificial, PS::ReallocatableArray< COMM::BinaryTree< PtclH4, COMM::Binary >> &_binary_table, PS::S32 &_n_groups, PS::ReallocatableArray< GroupIndexInfo > &_n_member_in_group, PS::ReallocatableArray< PS::S32 > &_changeover_update_list, SearchGroupCandidate< Tptcl > &_groups, const PS::F64 _dt_tree)
generate artificial particles,
Definition: hard.hpp:2495
PtclHard::id_cluster
PS::S32 id_cluster
Definition: hard_ptcl.hpp:7
WRITE_PRECISION
const int WRITE_PRECISION
Definition: bse_test.cxx:11
HardIntegrator::initial
void initial(PtclH4 *_ptcl, const PS::S32 _n_ptcl, Tsoft *_ptcl_artificial, const PS::S32 _n_group, const PS::S32 *_n_member_in_group, HardManager *_manager, const PS::F64 _time_origin)
initial integration
Definition: hard.hpp:231
HardDump::time_end
PS::F64 time_end
Definition: hard_assert.hpp:14
PtclHard::setTidalTensorID
void setTidalTensorID(const PS::S32 _id)
Definition: hard_ptcl.hpp:41
PtclHard::print
void print(std::ostream &_fout) const
Definition: hard_ptcl.hpp:88
PIKG::max
T max(const Vector3< T > &v)
Definition: pikg_vector.hpp:143
PtclHard::adr_org
PS::S32 adr_org
Definition: hard_ptcl.hpp:8
ArtificialParticleManager::getTidalTensorParticles
Tptcl * getTidalTensorParticles(Tptcl *_ptcl_list)
get tidal tensor particle list address from a artificial particle array
Definition: artificial_particles.hpp:395
hard_assert.hpp
HardManager::checkParams
bool checkParams()
check paramters
Definition: hard.hpp:68
GroupDataDeliver::artificial
ArtificialParticleInformation artificial
Definition: ptcl.hpp:18
static_variables.hpp
SearchGroupCandidate
Definition: search_group_candidate.hpp:9
HardDump::n_group
PS::S32 n_group
Definition: hard_assert.hpp:17
SystemHard::manager
HardManager * manager
Definition: hard.hpp:1221
PtclHard::read
void read(FILE *_fin)
Definition: hard_ptcl.hpp:81
PtclHard::PtclHard
PtclHard()
Definition: hard_ptcl.hpp:10
HardDump::ptcl_arti_bk
PS::ReallocatableArray< FPSoft > ptcl_arti_bk
Definition: hard_assert.hpp:19
HardManager::setDtRange
void setDtRange(const PS::F64 _dt_max, const PS::S32 _dt_min_index)
set time step range
Definition: hard.hpp:61
BSEManager::getSSEOutputFilenameSuffix
static std::string getSSEOutputFilenameSuffix()
Definition: bse_interface.h:1168
Ptcl::search_factor
static PS::F64 search_factor
Definition: ptcl.hpp:42
HardIntegrator::integrateToTime
AR::InterruptBinary< PtclHard > & integrateToTime(const PS::F64 _time_end)
Integrate system to time.
Definition: hard.hpp:577
Ptcl::group_data
GroupDataDeliver group_data
Definition: ptcl.hpp:40
HardDump::n_member_in_group
PS::ReallocatableArray< PS::S32 > n_member_in_group
Definition: hard_assert.hpp:18
PtclHard::DataCopy
void DataCopy(const Tptcl &_p)
Definition: hard_ptcl.hpp:29
ArtificialParticleInformation::setStatus
void setStatus(const PS::F64 _status)
set status
Definition: artificial_particles.hpp:127
HardDump::time_offset
PS::F64 time_offset
Definition: hard_assert.hpp:13
HardManager::print
void print(std::ostream &_fout) const
print parameters
Definition: hard.hpp:108
SearchGroupCandidate::searchAndMerge
void searchAndMerge(Tptcl *_ptcl_in_cluster, const PS::S32 _n_ptcl)
Definition: search_group_candidate.hpp:224
main
int main(int argc, char **argv)
Definition: hard_debug.cxx:16
Ptcl::print
void print(std::ostream &_fout) const
Definition: ptcl.hpp:72
HardDump::n_ptcl
PS::S32 n_ptcl
Definition: hard_assert.hpp:15