GraviDy  1.0
Gravitational Dynamics N-body integrator
Hermite4MPI.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016
3  *
4  * Cristián Maureira-Fredes <cmaureirafredes@gmail.com>
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * 3. The name of the author may not be used to endorse or promote
20  * products derived from this software without specific prior written
21  * permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
24  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
27  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
31  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  */
36 #ifndef HERMITE4MPI_HPP
37 #define HERMITE4MPI_HPP
38 #include "../Hermite4.hpp"
39 
40 #define MPI_NUM_SLAVES 600
41 
52 class Hermite4MPI : public Hermite4 {
53  public:
55  int rank, int nproc);
56  ~Hermite4MPI();
57 
58  int rank;
59  int nproc;
60  int tag;
61  MPI_Status status;
62  MPI_Datatype f_type;
63  MPI_Op f_op;
64 
65  unsigned int chunk_size;
66  unsigned int chunk_begin;
67  unsigned int chunk_end;
69 
70  void alloc_slaves_memory(int rank);
71  void force_calculation(Predictor pi, Predictor pj, Forces &fi);
72  void init_acc_jrk();
73  void update_acc_jrk(unsigned int nact);
74  void predicted_pos_vel(double ITIME);
75  void correction_pos_vel(double ITIME, unsigned int nact);
76  void integration();
77 };
78 
79 #endif
Class in charge of all the logging system in the code.
Definition: Logger.hpp:60
Class which implements on the MPI the structure of the Hermite4 scheme.
Definition: Hermite4MPI.hpp:52
Logger * logger
Logger object reference.
Definition: Hermite4.hpp:56
Hermite4MPI(NbodySystem *ns, Logger *logger, NbodyUtils *nu, int rank, int nproc)
Constructor that uses its parent one.
Definition: Hermite4MPI.cpp:42
void integration()
Integration virtual method to be implemented.
Definition: Hermite4MPI_integration.cpp:38
This structure contains the predicted information of a particle in some moment of the integration...
Definition: common.hpp:192
Class in charge of the general aspects of the N-body integrator.
Definition: NbodySystem.hpp:51
unsigned int chunk_end
Definition: Hermite4MPI.hpp:67
void predicted_pos_vel(double ITIME)
Method that predict all the particles to the current integration time.
Definition: Hermite4MPI.cpp:217
unsigned int chunk_size
Definition: Hermite4MPI.hpp:65
int nproc
Definition: Hermite4MPI.hpp:59
int rank
Definition: Hermite4MPI.hpp:58
void alloc_slaves_memory(int rank)
Method in charge of allocating the memory and initializing the data for all the data structures in al...
Definition: Hermite4MPI.cpp:82
unsigned int chunk_begin
Definition: Hermite4MPI.hpp:66
MPI_Status status
Definition: Hermite4MPI.hpp:61
void correction_pos_vel(double ITIME, unsigned int nact)
Method that correct the positions and velocities of the particles at the end of every integration ste...
Definition: Hermite4MPI.cpp:248
General class that define the structure to be follow by any implementation of the integrator (CPU...
Definition: Hermite4.hpp:48
MPI_Op f_op
Definition: Hermite4MPI.hpp:63
int tag
Definition: Hermite4MPI.hpp:60
MPI_Datatype f_type
Definition: Hermite4MPI.hpp:62
void update_acc_jrk(unsigned int nact)
Method that call the force_calculation method for every and particles interaction of the ones...
Definition: Hermite4MPI.cpp:167
~Hermite4MPI()
Destructor that free memory of two tmp arrays.
Definition: Hermite4MPI.cpp:71
Forces * tmp_f
Definition: Hermite4MPI.hpp:68
void init_acc_jrk()
Method that initializes the acceleration and it first derivative.
Definition: Hermite4MPI.cpp:147
Class in charge of the different properties of the system.
Definition: NbodyUtils.hpp:49
This structure contains the information of the Forces of a particle in some moment of the integration...
Definition: common.hpp:207
void force_calculation(Predictor pi, Predictor pj, Forces &fi)
Method that calculate the gravitational interaction between two particles.
Definition: Hermite4MPI.cpp:115
NbodySystem * ns
NbodySystem object reference.
Definition: Hermite4.hpp:54
NbodyUtils * nu
NbodyUtils object reference.
Definition: Hermite4.hpp:58