Commit e4b8c9be authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

Merge branch 'feature/refactor-particles' into develop

parents 0658c2d3 c842e987
Pipeline #77435 passed with stages
in 9 minutes and 40 seconds
......@@ -169,7 +169,7 @@ list(APPEND TURTLE_LIBS "${OpenMP_CXX_LIB_NAMES}")
#####################################################################################
## Extra flags
set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} $ENV{TURTLE_COMPILATION_FLAGS} -Wall -g -Wfatal-errors -fopenmp")
set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} $ENV{TURTLE_COMPILATION_FLAGS} -Wall -g -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_FLAGS}")
#####################################################################################
......@@ -271,6 +271,7 @@ set(cpp_for_lib
${PROJECT_SOURCE_DIR}/cpp/full_code/Gauss_field_test.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/symmetrize_test.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/field_output_test.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/test_tracer_set.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/get_rfields.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/write_rpressure.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/bandpass_stats.cpp
......@@ -286,24 +287,29 @@ set(cpp_for_lib
${PROJECT_SOURCE_DIR}/cpp/fftw_tools.cpp
${PROJECT_SOURCE_DIR}/cpp/vorticity_equation.cpp
${PROJECT_SOURCE_DIR}/cpp/field_binary_IO.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n1.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n2.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n3.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n4.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n5.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n6.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n7.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n8.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n9.cpp
${PROJECT_SOURCE_DIR}/cpp/spline_n10.cpp
${PROJECT_SOURCE_DIR}/cpp/Lagrange_polys.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n1.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n2.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n3.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n4.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n5.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n6.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n7.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n8.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n9.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n10.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/Lagrange_polys.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/field_tinterpolator.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/particle_set.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/rhs/tracer_rhs.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/rhs/tracer_with_collision_counter_rhs.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/particle_solver.cpp
${PROJECT_SOURCE_DIR}/cpp/scope_timer.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/test_interpolation.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEparticles.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEcomplex_particles.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVE_Stokes_particles.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEp_extra_sampling.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_inner_computer.cpp
${PROJECT_SOURCE_DIR}/cpp/particles/inner/particles_inner_computer.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/ornstein_uhlenbeck_process.cpp
${PROJECT_SOURCE_DIR}/cpp/full_code/ou_vorticity_equation.cpp)
......@@ -321,6 +327,7 @@ set(hpp_for_lib
${PROJECT_SOURCE_DIR}/cpp/full_code/write_filtered_test.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/symmetrize_test.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/field_output_test.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/test_tracer_set.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/get_rfields.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/write_rpressure.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/bandpass_stats.hpp
......@@ -336,43 +343,51 @@ set(hpp_for_lib
${PROJECT_SOURCE_DIR}/cpp/fftw_tools.hpp
${PROJECT_SOURCE_DIR}/cpp/vorticity_equation.hpp
${PROJECT_SOURCE_DIR}/cpp/field_binary_IO.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n1.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n2.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n3.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n4.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n5.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n6.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n7.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n8.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n9.hpp
${PROJECT_SOURCE_DIR}/cpp/spline_n10.hpp
${PROJECT_SOURCE_DIR}/cpp/Lagrange_polys.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n1.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n2.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n3.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n4.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n5.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n6.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n7.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n8.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n9.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/spline_n10.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/Lagrange_polys.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/abstract_particle_set.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/particle_set.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/field_tinterpolator.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particle_rhs.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/rhs/tracer_rhs.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/rhs/tracer_with_collision_counter_rhs.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particle_solver.hpp
${PROJECT_SOURCE_DIR}/cpp/scope_timer.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/test_interpolation.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEparticles.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEcomplex_particles.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVE_Stokes_particles.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEp_extra_sampling.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_inner_computer.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_inner_computer_2nd_order.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_inner_computer_empty.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/inner/particles_inner_computer.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/inner/particles_inner_computer_2nd_order.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/inner/particles_inner_computer_empty.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particles_input.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particles_output.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particles_system.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particles_system_with_p2p.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/alltoall_exchanger.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/lock_free_bool_array.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p_computer_empty.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p_computer.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p_ghost_collision_base.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p_ghost_collisions.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p_cylinder_collisions.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p_distr_mpi.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p_tree.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p/p2p_computer_empty.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p/p2p_computer.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p/p2p_ghost_collision_base.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p/p2p_ghost_collisions.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p/p2p_cylinder_collisions.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p/p2p_distr_mpi.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/p2p/p2p_tree.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_adams_bashforth.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_distr_mpi.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_field_computer.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_generic_interp.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/particles_field_computer.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/interpolation/particles_generic_interp.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_input_hdf5.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_output_hdf5.hpp
${PROJECT_SOURCE_DIR}/cpp/particles/particles_output_mpiio.hpp
......@@ -391,7 +406,6 @@ set(hpp_for_lib
${PROJECT_SOURCE_DIR}/cpp/bfps_timer.hpp
${PROJECT_SOURCE_DIR}/cpp/omputils.hpp
${PROJECT_SOURCE_DIR}/cpp/shared_array.hpp
${PROJECT_SOURCE_DIR}/cpp/spline.hpp
${PROJECT_SOURCE_DIR}/cpp/spectrum_function.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/ornstein_uhlenbeck_process.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/ou_vorticity_equation.hpp
......@@ -455,6 +469,11 @@ if (BUILD_TESTING)
NAME test_Parseval
COMMAND turtle.test_Parseval
WORKING_DIRECTORY ${TEST_OUTPUT_DIRECTORY})
### basic particle functionality
add_test(
NAME test_tracer_set
COMMAND turtle TEST test_tracer_set -n 32 --np 2 --ntpp 2 --simname tracer_set_testsim
WORKING_DIRECTORY ${TEST_OUTPUT_DIRECTORY})
### compare DNS output to stored results
add_test(
NAME test_NSVEparticles
......
......@@ -108,7 +108,7 @@ The list is a work in progress, please contact us
(Cristian.Lalescu@ds.mpg.de) if the procedure fails at any step of the
process.
*Note*: the HDF5 library may require MPI standard v1, we haven't tested
*Note*: the HDF5 1.8x library may require MPI standard v1, we haven't tested
this in detail. Some default OpenMPI3 installations will not work.
Detailed full installation instructions:
......@@ -140,6 +140,10 @@ Detailed full installation instructions:
folders, hence the options of specifying the details.
See also lines 143 through 160 of `CMakeLists.txt`.
*If using openmpi* you may need to recompile it with the
`--enable-mpi1-compatibility` flag, in order for HDF5 to compile and
link (step 4).
2.
Make directory PREFIX on a local fast partition.
......@@ -228,6 +232,8 @@ Detailed full installation instructions:
`CMAKE_PREFIX_PATH`.
This ensures that the required `TurTLEConfig.cmake` file is accessible for
future use by the package.
Alternatively you may set the `TurTLE_DIR` environment variable to
include the location instead.
10.
Using TurTLE from an external project.
......
......@@ -366,6 +366,9 @@ class TEST(_code):
parser_ornstein_uhlenbeck_test = subparsers.add_parser(
'ornstein_uhlenbeck_test',
help = 'test ornstein uhlenbeck process')
parser_test_tracer_set = subparsers.add_parser(
'test_tracer_set',
help = 'basic test of tracer set solver')
for parser in ['Gauss_field_test',
'filter_test',
......@@ -374,7 +377,8 @@ class TEST(_code):
'symmetrize_test',
'field_output_test',
'test_interpolation',
'ornstein_uhlenbeck_test']:
'ornstein_uhlenbeck_test',
'test_tracer_set']:
eval('self.simulation_parser_arguments(parser_' + parser + ')')
eval('self.job_parser_arguments(parser_' + parser + ')')
eval('self.parameters_to_parser_arguments(parser_' + parser + ')')
......@@ -406,6 +410,12 @@ class TEST(_code):
if not os.path.exists(os.path.join(self.work_dir, self.simname + '.h5')):
self.write_par(
particle_ic = particle_initial_condition)
if self.dns_type == 'test_tracer_set':
ofile = h5py.File(os.path.join(self.work_dir, 'test_particle_sample.h5'), 'w')
ofile.create_group('tracers0')
ofile.create_group('tracers0/position')
ofile.create_group('tracers0/velocity')
ofile.close()
if self.dns_type == 'test_interpolation':
if type(particle_initial_condition) == type(None):
pbase_shape = (self.parameters['nparticles'],)
......
......@@ -426,11 +426,11 @@ class _code(_base):
stderr = open(err_file + '_' + suffix, 'w'),
env = custom_env)
except subprocess.CalledProcessError:
print('!!!!!!!!!!!! PROBLEM: code failed to run, output follows:')
print('!!!! TurTLE-generated executable failed to run, output follows:')
print(open(out_file + '_' + suffix, 'r').read())
print('!!!!!!!!!!!! PROBLEM: and here is the error log:')
print('!!!! TurTLE-generated executable failed to run, error log follows:')
print(open(err_file + '_' + suffix, 'r').read())
raise SystemExit('TurTLE-generated executable failed to run, see above for details.')
os.chdir(current_dir)
return None
def write_IBMLoadLeveler_file_single_job(
......
......@@ -49,8 +49,21 @@ constexpr unsigned int ndim(
(fc == THREExTHREE) ? 5 : 3));
}
class abstract_field_layout
{
public:
virtual ~abstract_field_layout(){}
virtual MPI_Comm getMPIComm() const = 0;
virtual int getMPIRank() const = 0;
virtual hsize_t getSize(int component) const = 0;
virtual hsize_t getSubSize(int component) const = 0;
virtual hsize_t getStart(int component) const = 0;
};
template <field_components fc>
class field_layout
class field_layout: public abstract_field_layout
{
public:
/* description */
......@@ -73,6 +86,30 @@ class field_layout
const hsize_t *STARTS,
const MPI_Comm COMM_TO_USE);
~field_layout(){}
MPI_Comm getMPIComm() const
{
return this->comm;
}
int getMPIRank() const
{
return this->myrank;
}
hsize_t getSize(int component) const
{
assert(component >= 0 && component < int(ndim(fc)));
return this->sizes[component];
}
hsize_t getSubSize(int component) const
{
assert(component >= 0 && component < int(ndim(fc)));
return this->subsizes[component];
}
hsize_t getStart(int component) const
{
assert(component >= 0 && component < int(ndim(fc)));
return this->starts[component];
}
};
#endif//FIELD_LAYOUT_HPP
......
......@@ -26,11 +26,11 @@
#include <string>
#include <cmath>
#include "NSVE_Stokes_particles.hpp"
#include "full_code/NSVE_Stokes_particles.hpp"
#include "scope_timer.hpp"
#include "particles/particles_sampling.hpp"
#include "particles/p2p_ghost_collisions.hpp"
#include "particles/particles_inner_computer_2nd_order.hpp"
#include "particles/p2p/p2p_ghost_collisions.hpp"
#include "particles/inner/particles_inner_computer_2nd_order.hpp"
template <typename rnumber>
int NSVE_Stokes_particles<rnumber>::initialize(void)
......
......@@ -26,11 +26,11 @@
#include <string>
#include <cmath>
#include "NSVEcomplex_particles.hpp"
#include "full_code/NSVEcomplex_particles.hpp"
#include "scope_timer.hpp"
#include "particles/particles_sampling.hpp"
#include "particles/p2p_computer.hpp"
#include "particles/particles_inner_computer.hpp"
#include "particles/p2p/p2p_computer.hpp"
#include "particles/inner/particles_inner_computer.hpp"
template <typename rnumber>
int NSVEcomplex_particles<rnumber>::initialize(void)
......
/******************************************************************************
* *
* Copyright 2019 Max Planck Institute for Dynamics and Self-Organization *
* *
* This file is part of bfps. *
* *
* bfps is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, either version 3 of the License, *
* or (at your option) any later version. *
* *
* bfps is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with bfps. If not, see <http://www.gnu.org/licenses/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
******************************************************************************/
#include <string>
#include <cmath>
#include <random>
#include "test_tracer_set.hpp"
#include "particles/rhs/tracer_rhs.hpp"
#include "particles/rhs/tracer_with_collision_counter_rhs.hpp"
#include "particles/interpolation/particle_set.hpp"
#include "particles/particle_solver.hpp"
#include "particles/particles_input_random.hpp"
#include "scope_timer.hpp"
template <typename rnumber>
int test_tracer_set<rnumber>::initialize(void)
{
TIMEZONE("test_tracer_set::initialize");
this->read_parameters();
return EXIT_SUCCESS;
}
template <typename rnumber>
int test_tracer_set<rnumber>::finalize(void)
{
TIMEZONE("test_tracer_set::finalize");
return EXIT_SUCCESS;
}
template <typename rnumber>
int test_tracer_set<rnumber>::read_parameters()
{
TIMEZONE("test_tracer_set::read_parameters");
this->test::read_parameters();
return EXIT_SUCCESS;
}
template <typename rnumber>
int test_tracer_set<rnumber>::do_work(void)
{
TIMEZONE("test_tracer_set::do_work");
const int nparticles = 1001;
// allocate
field<rnumber, FFTW, THREE> *vec_field = new field<rnumber, FFTW, THREE>(
this->nx, this->ny, this->nz,
this->comm,
FFTW_ESTIMATE);
kspace<FFTW, SMOOTH> *kk = new kspace<FFTW, SMOOTH>(
vec_field->clayout,
this->dkx, this->dky, this->dkz);
// initialize field
vec_field->real_space_representation = false;
make_gaussian_random_field(
kk,
vec_field,
1 // rseed
);
vec_field->ift();
field_tinterpolator<rnumber, FFTW, THREE, NONE> *fti = new field_tinterpolator<rnumber, FFTW, THREE, NONE>();
tracer_with_collision_counter_rhs<rnumber, FFTW, NONE> *trhs = new tracer_with_collision_counter_rhs<rnumber, FFTW, NONE>();
particle_set<3, 2, 1> pset(
vec_field->rlayout,
this->dkx,
this->dky,
this->dkz,
0.5);
// initialize particles
particles_input_random<long long int, double, 3> bla(
this->comm,
nparticles,
1,
pset.getSpatialLowLimitZ(),
pset.getSpatialUpLimitZ());
pset.init(bla);
// initialize particle output object
particles_output_hdf5<long long int, double, 3> *particle_output_writer = new particles_output_hdf5<
long long int, double, 3>(
MPI_COMM_WORLD,
"tracers0",
pset.getTotalNumberOfParticles(),
0);
particles_output_sampling_hdf5<long long int, double, 3> *particle_sample_writer = new particles_output_sampling_hdf5<
long long int, double, 3>(
MPI_COMM_WORLD,
pset.getTotalNumberOfParticles(),
"test_particle_sample.h5",
"tracers0",
"position/0");
fti->set_field(vec_field);
trhs->setVelocity(fti);
particle_solver psolver(pset, 0);
particle_output_writer->open_file("test_particle_checkpoint.h5");
psolver.template writeCheckpoint<3>(particle_output_writer);
pset.writeSample(
vec_field,
particle_sample_writer,
"tracers0",
"velocity",
psolver.getIteration());
pset.writeStateTriplet(
0,
particle_sample_writer,
"tracers0",
"position",
psolver.getIteration());
psolver.Euler(0.001, *trhs);
psolver.setIteration(1);
psolver.template writeCheckpoint<3>(particle_output_writer);
pset.writeSample(
vec_field,
particle_sample_writer,
"tracers0",
"velocity",
psolver.getIteration());
pset.writeStateTriplet(
0,
particle_sample_writer,
"tracers0",
"position",
psolver.getIteration());
particle_output_writer->close_file();
// deallocate
delete particle_sample_writer;
delete particle_output_writer;
delete trhs;
delete fti;
delete kk;
delete vec_field;
return EXIT_SUCCESS;
}
template class test_tracer_set<float>;
template class test_tracer_set<double>;
/**********************************************************************
* *
* Copyright 2017 Max Planck Institute *
* for Dynamics and Self-Organization *
* *
* This file is part of TurTLE. *
* *
* TurTLE is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, either version 3 of the License, *
* or (at your option) any later version. *
* *
* TurTLE is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with TurTLE. If not, see <http://www.gnu.org/licenses/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
**********************************************************************/
#ifndef TEST_TRACER_SET_HPP
#define TEST_TRACER_SET_HPP
#include <cstdlib>
#include "base.hpp"
#include "kspace.hpp"
#include "field.hpp"
#include "full_code/test.hpp"
/** \brief A class for testing basic `particle_set` functionality.
*/
template <typename rnumber>
class test_tracer_set: public test
{
public:
test_tracer_set(
const MPI_Comm COMMUNICATOR,
const std::string &simulation_name):
test(
COMMUNICATOR,
simulation_name){}
~test_tracer_set(){}
int initialize(void);
int do_work(void);
int finalize(void);
int read_parameters(void);
};
#endif//TEST_TRACER_SET_HPP
/******************************************************************************
* *
* Copyright 2020 Max Planck Institute for Dynamics and Self-Organization *
* *
* This file is part of TurTLE. *
* *
* TurTLE is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, either version 3 of the License, *
* or (at your option) any later version. *
* *
* TurTLE is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with TurTLE. If not, see <http://www.gnu.org/licenses/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
******************************************************************************/
#ifndef ABSTRACT_PARTICLE_RHS_HPP
#define ABSTRACT_PARTICLE_RHS_HPP
#include "particles/interpolation/abstract_particle_set.hpp"
// children of this class must provide a method to compute the rhs for a given particle set
class abstract_particle_rhs
{
protected:
using particle_rnumber = abstract_particle_set::particle_rnumber;
public:
// destructor
virtual ~abstract_particle_rhs(){}
// important bit
virtual int operator()(
double t,
abstract_particle_set &pset,
particle_rnumber *result) const = 0;
// for post-timestep actions such as
// normalization of orientation vector
virtual int imposeModelConstraints(
abstract_particle_set &pset) const = 0;
};
#endif//ABSTRACT_PARTICLE_RHS_HPP
......@@ -40,6 +40,7 @@ public:
virtual std::unique_ptr<real_number[]> getMyParticles() = 0;
virtual std::unique_ptr<partsize_t[]> getMyParticlesIndexes() = 0;
virtual std::vector<std::unique_ptr<real_number[]>> getMyRhs() = 0;
virtual std::vector<hsize_t> getParticleFileLayout() = 0;
};
......
......@@ -193,7 +193,7 @@ public:
size_buffers_send = nb_particles;
buffer_indexes_send.reset(new std::pair<partsize_t,partsize_t>[size_buffers_send]);
buffer_particles_positions_send.reset(new real_number[size_buffers_send*size_particle_positions]);